Hi,
I have a instant scracth lotto script that is not working correctly. The problem is it's allowing a player to play more times that allowed(1 time per day). I have defined a variable in a file named var.php to the following:
$plays = "1";
Here is the bit of code in ticket.php, which I think is the problem as to why it's not working correctly.
<?PHP
require ("vars.php");
// This produces the ticket
if ($go == ""){
if ($email == ""){
print ("<form action=ticket.php method=post>\n");
print ("<table border=0 cellpadding=0 cellspacing=0 background=bg.gif>\n");
print ("<tr>\n");
print ("<td><font face=verdana,arial size=2>Instant Lotto<P><font size=1>Please enter your email address:<br></td>\n");
print ("</td></tr><tr><td><input type=text name=email size=30><br><input type=submit name=submit value=\" Play Your Instant Ticket Now \"></td></tr>\n");
print ("</table></form>\n");
}
if ($email <> ""){
$okplay = 0;
$playstoday = 0;
$Link = mysql_connect ($host, $user, $pass);
$query = "select * from ticket where email = '$email' and dayt = '$dayt'";
$result = mysql_db_query ($DBName, $query, $Link);
while ($row = mysql_fetch_array($result)){
$playstoday = $playstoday + 1;
}
if ($playstoday < $plays){
$okplay = 1;
} else {
print ("Sorry, please come back tommorow to play again");
}
[/COLOR]
If anyone could suggest how to correct this it would be much appreciated!