Here's my code:
But when I use it, even if votedtoday = 0 it will still say they have already voted.PHP Code:<style type="text/css">
<!--
.b {
font-weight: bold;
}
.red {
color: #F00;
}
-->
</style>
<form action="" method="post">
<table width="310" height="32" border="0">
<tr>
<td width="137">Login Name:</td>
<td width="264"><input type="text" name="username"></td>
</tr>
</table>
<p class="red"><span class="b">This is NOT your character's name </span>
</p>
<p class="red"><input type="submit" value="Vote" name="vote"></p>
<?php
$user = mysql_real_escape_string($_POST['username']);
$ucheck = mysql_query("SELECT * FROM `accounts` WHERE `name`='".$user."'") or die(mysql_error());
$votecheck = mysql_query("SELECT * FROM `accounts` WHERE `name` = '".$user."' && `votedtoday` != 1") or die(mysql_error());
$alreadyvoted = mysql_num_rows($votecheck);
if(isset($_POST['vote'])){
if(mysql_num_rows($ucheck) >= 1){
if(alreadyvoted >= 1) {
mysql_query("UPDATE `accounts` SET `paypalNX` = paypalNX + 10000 WHERE `name` = '".$user."'") or die(mysql_error());
mysql_query("UPDATE `accounts` SET `votedtoday` = 1 WHERE `name` ='".$user."'") or die(mysql_error());
echo "Successfully added 10k NX to your account, if you are currently logged in, relog. You will now be redirected.";
echo"
<META HTTP-EQUIV=\"refresh\" CONTENT=\"1;URL=http://www.gtop100.com/in.php?site=39688\">
";
}
else{
echo "You have already voted today, come back tomorrow!";
}
}
else{
echo "Username does not exist.";
}
}
?>
</form>
Please help.




Reply With Quote