0byt3m1n1-V2
Path:
/
home
/
bangtoey
/
domains
/
bangtoey.go.th
/
public_html
/
[
Home
]
File: vote.php
<?php require_once('admin/Connections/conndb.php'); mysql_select_db($database_conndb, $conndb); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-874" /> <title>Vote Poll</title> <link href="styles.css" rel="stylesheet" type="text/css" /> </head> <body> <?php //echo ' v = '.$_POST[v]; //echo ' / v= '.$_GET[v]; $idp=$_GET[idp]; $v=$_GET[v]; $ip=getIP(); if($idp=="" || $v==""){ ?> <div align="center" class="styles5">¡ÃسÒàÅ×Í¡ËÑÇ¢éÍâËǵ</div> <?php } else{ $getip="select * from vote_log where id_poll=".$idp." and ip='".$ip."'"; $resip=mysql_query($getip,$conndb) or die(mysql_error()); if(mysql_num_rows($resip)!=0){ ?> <div class="styles3" align="center">¢ÍÍÀѤسä´éâËǵËÑÇ¢é͹ÕéáÅéÇ</div> <?php } else{ $now=date("Y-m-d H:i:s"); $ins="insert into vote_log (id_poll,id_v,ip,created) values ('".$idp."','".$v."','".$ip."','".$now."')"; mysql_query($ins,$conndb) or die(mysql_error()); $upd="update vote set point=point+1,updated='".$now."' where id_poll='".$idp."' and id_v='".$v."' "; mysql_query($upd,$conndb) or die(mysql_error()); $getpoll="select * from poll where id_poll=".$idp; $respp=mysql_query($getpoll,$conndb); $datpp=mysql_fetch_array($respp); } ?> <div class="styles5">ÊÃØ»¼Å¡ÒÃâËǵ ËÑÇ¢éÍ <?php echo stripslashes($datpp[p_title]);?></div> <?php $sum_vote="select sum(point) as spoint from vote where id_poll=".$idp; $res_vote=mysql_query($sum_vote,$conndb) or die(mysql_error()); $datv=mysql_fetch_array($res_vote); $sum=$datv[spoint]; //echo '<br> sum = '.$sum; ?><table width="400" border="0" cellpadding="2" cellspacing="1" class="styles1"> <?php $data="select * from vote where id_poll=".$idp; $result=mysql_query($data,$conndb) or die(mysql_error()); while($f=mysql_fetch_array($result)){ $percent=($f[point]*100)/$sum; $per1=round($percent); ?> <tr> <td width="188" align="left"><?php echo $f[vtitle];?></td> <td width="156" align="left"> <table width="<?php echo $per1;?>" border="0" cellspacing="0" cellpadding="2"> <tr> <td height="15" bgcolor="#0066CC"></td> </tr> </table> </td> <td width="40" align="right"><?php echo $per1;?> %</td> </tr> <?php } ?> </table> <?php } function getIP(){ if (getenv(HTTP_CLIENT_IP)) { $ip = getenv(HTTP_CLIENT_IP); } else if (getenv(HTTP_X_FORWARDED_FOR)) { $ip = getenv(HTTP_X_FORWARDED_FOR); } else { $ip = getenv(REMOTE_ADDR); } return $ip; } ?> </body> </html>
©
2018.