北京站
荣获中国电子商务行业百强品牌
咨询电话:400-606-5558
2014-08-30
用ajax来,判断每个投票的ip地址是否一样!不一样的才能投,限制每个ip的投票数!追问我需要具体的程序代码
用php制作一个网页来实现简易网上投票系统
2014-08-30
<?phpheader("Content-type: text/html; charset=utf-8");$link = mysql_connect( 'localhost', 'root', '') or die('Could not connect to mysql server' );mysql_select_db('tpxt',$link) or die('Could not select database');if (isset($_POST['submit'])) {$sql = "SELECT `id` FROM `table` WHERE `uid` = ".$_POST['uid'];$result = mysql_query($sql);if ($result && mysql_num_rows($result)) {$sql = "UPDATE `table` SET `vote`=`vote`+1 WHERE `uid` = ".$_POST['uid'];mysql_query($sql);}else{$sql = "INSERT INTO `table`(uid,vote) VALUES('".$_POST['uid']."','1')";mysql_query($sql);}echo "<script>alert('Ok 投票成功!');</script>";echo "<script>window.location.reload();</script>";exit();}else{$sql = "SELECT `vote` FROM `table` WHERE `uid` = 3";$result = mysql_query($sql);if ($result && mysql_num_rows($result)) {$t3 = mysql_fetch_assoc($result);}else{$t3['vote'] = 0; }$sql = "SELECT `vote` FROM `table` WHERE `uid` = 4";$result = mysql_query($sql);if ($result && mysql_num_rows($result)) {$t4 = mysql_fetch_assoc($result);}else{$t4['vote'] = 0; }$sql = "SELECT `vote` FROM `table` WHERE `uid` = 5";$result = mysql_query($sql);if ($result && mysql_num_rows($result)) {$t5 = mysql_fetch_assoc($result);}else{$t5['vote'] = 0; }$sql = "SELECT `vote` FROM `table` WHERE `uid` = 6";$result = mysql_query($sql);if ($result && mysql_num_rows($result)) {$t6 = mysql_fetch_assoc($result);}else{$t6['vote'] = 0; }$sql = "SELECT `vote` FROM `table` WHERE `uid` = 7";$result = mysql_query($sql);if ($result && mysql_num_rows($result)) {$t7 = mysql_fetch_assoc($result);}else{$t7['vote'] = 0; }$count = $t3['vote']+$t4['vote']+$t5['vote']+$t6['vote']+$t7['vote'];$t3_b = $t3['vote']/$count;$t4_b = $t4['vote']/$count;$t5_b = $t5['vote']/$count;$t6_b = $t6['vote']/$count;$t7_b = $t7['vote']/$count;}?>本回答被提问者采纳
黑客技术可以入侵别人...
我想找个黑客修改网络...
找一个黑客黑进数据库...
请问黑客可以进入微信...
巨推公司旗下营销品牌
八年营销品牌,服务上万企业
微信咨询获取详细资料