View file mch-db_dv3.1/dl/ocen.php

File size: 1.3Kb
<?php
if(!$_GET["gls"]) {
      echo '<hr> 
	        <small>Оценка файла:</small><br />
	        <small>[<a href="ocen.php?gls=1&fl='.$file.'&nm='.$name.'&br='.$br.'">1</a>|<a href="ocen.php?gls=2&fl='.$file.'&nm='.$name.'&br='.$br.'">2</a>|<a href="ocen.php?gls=3&fl='.$file.'&nm='.$name.'&br='.$br.'">3</a>|<a href="ocen.php?gls=4&fl='.$file.'&nm='.$name.'&br='.$br.'">4</a>|<a href="ocen.php?gls=5&fl='.$file.'&nm='.$name.'&br='.$br.'">5</a>]</small>';
		 $uzhe = @file_get_contents('./gs/gs.'.md5($name).'.gs');
		 $new = explode("\n",$uzhe);
		 $p2 = sizeof($new);
         $bb = array_sum($new)/$p2;
		   echo '<br /><small>Проголосовали: '.($p2-1).' человек
		         <br />
		                      Текущая оценка: '.round($bb,1).' баллов</small>';
    } elseif($_GET["gls"]) {
	@$gs = $_GET["gls"];
	@$fl = $_GET["fl"];
	@$nm = $_GET["nm"];
	@$br = $_GET["br"];
	   switch($gs) {
	   case 1: $rs = 1;break;
	   case 2: $rs = 2;break;
	   case 3: $rs = 3;break;
	   case 4: $rs = 4;break;
	   case 5: $rs = 5;break;
         default: $rs = 0;	   
	   }
	    if($fp = @fopen('./gs/gs.'.md5($nm).'.gs',"a+")) {
	       @fputs($fp,$rs."\n");
		   @fclose($fp);
		    }
			 echo '<small>Ваш голос учтен.</small>';
			 exit();
	}
?>