PHP $HTTP _cookie_vars Instance Polling data restrictions

Source: Internet
Author: User

if ($http _cookie_vars["vote"]) {
echo "<script>alert (' You have already voted, please do not repeat the vote '); History.back ();</script>";
Exit
}
$vcount =$_post["Vcount"];
$lld =$_post["Jump"];
$tys =$_post["Tys"];
if (! $vcount) {
echo "<script>alert (' you have not selected any voting item '); History.back ();</script>";
Exit
}
$db = @mysql_connect ("localhost", "root", "root") or Die ("Database Tutorial Connection Failed");
mysql_select_db ("vote", $db);
if ($vcount && $lld) {
if ($tys = = "1") {
$sql = "Update vote set vcount=vcount+1 where id= $vcount";
$result =mysql_query ($sql, $db);
Setcookie ("vote", "vote", Time () +3600);
echo "<script>alert (' Vote for success! '); location.href= ' vote.php?id= $lld ';</script> ';
}
else {
for ($i =0; $i <sizeof ($vcount); $i + +) {
$sql 1= "Update vote set vcount=vcount+1 where id= $vcount [$i]";
$result 1=mysql_query ($sql 1, $db);
}
Setcookie ("vote", "vote", Time () +3600);
echo "<script>alert (' Vote for success! '); location.href= ' vote.php?id= $lld ';</script> ';
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.