0 && $valore > 0){
//attenzione: uso Y-m-d H:i:s anche x log. Cosi non faccio conti
$adesso=date('Y-m-d H:i:s');
$relPath="log/";
$path=realpath($relPath).DIRECTORY_SEPARATOR;
$fileLog = $path.'sondaggio_'.$id.'.log';
$opz = 'opz'.$valore;
$giaVisto = false;
if($fp = fopen($fileLog,"r")){
while(!feof($fp) && !$giaVisto){
$line = trim(fgets($fp));
$linea = explode(" ",$line);
$data = $linea[0].' '.$linea[1];//fncFmtDate($linea[0].' '.$linea[1],'Y-m-d H:i:s');
$diff = (strtotime($adesso)-strtotime($data))/60;
$ip = $linea[2];
if($ip==$_SERVER['REMOTE_ADDR'] && $diff < 1){
$giaVisto = true;
}
}
fclose($fp);
}
else{
$giaVisto = false;
}
if(!$giaVisto){
if($fp = fopen($fileLog,"a")){
$line = $adesso.' '.$_SERVER['REMOTE_ADDR'].' '.$valore;
fwrite($fp,$line."\r\n");
fclose($fp);
$sql = "update ".$tabella." set numRisposte=numRisposte + 1,".$opz."=".$opz." + 1 where id='".$id."'";
@mssql_query($sql,$Conn) or die('Query non eseguita: '.@mssql_get_last_message().'
'.$sql);
}
}
}
if($id > 0){
$vettBars=array('qblu.gif','qverde.gif','qrosso1.gif','qrosa.gif');
if(sizeof($vettBars) < $nrOpzioni) die('$vettBars deve avere almeno '.$nrOpzioni.' elementi');
$sql = "select * from $tabella where id='$id'";
$res=@mssql_query($sql,$Conn);
if($res && $row = mssql_fetch_array($res,1)){
//myParseArray($row);
?>
Risultati Sondaggio
0){
$perc = round((intval('0'.@$row['opz'.$i]) / $partecipanti) * 1000)/10;
}
else{
$perc = 0;
}
?>
|
%
|
Partecipanti:
|