im using this code posted somewhere on this section,.
<?php
mysql_connect("localhost", "root", "password");
mysql_select_db("webcodez");
?>
<form action="<?=$_SERVER['PHP_SELF'];?>" method="post">
<input type="submit" name="submit" value="dai to4ka" class="bt_register" />
</form>
<?php
$id = (int)$_GET['id'];
if($_POST['submit']=='dai to4ka')
{
$timeout=10; //60*60*24 seconds = 1 day
$time=time();
$out=$time-$timeout;
$ip=$_SERVER['REMOTE_ADDR'];
$check_double=mysql_query("SELECT * FROM ips WHERE ip='$ip' AND time>$out")or die(mysql_error());
if(mysql_num_rows($check_double)>0){
echo "one time pls ";
}
else{
echo "success";
$vote=mysql_query("INSERT INTO ips(ip,time) VALUES('$ip','$time')");
//$query = mysql_query(" UPDATE `tz_members` SET point = point + 1 WHERE id = $id;") or die(mysql_error());
}
}
It works fine, but i want to add a STATUS: ON / OFF
if the status is ON then the user can vote..
otherwise, if status is OFF, the user can't vote at all + error message saying "Voting is off, you can't vote at this moment"
btw, changing of status can only be access by the admin side..
Thank you so much..


Sign In
Create Account

Back to top









