I have written this script for a win button to place on a website. It works in IE, but not in firefox. Anyone know why?
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Velocity Competitions - Win Button</title>
</head>
<body>
<?php
include "index.htm";
$ip = $_SERVER["REMOTE_ADDR"];
if (file_exists("Win Button Records" . $ip . ".txt"))
{
$i = fopen($ip . ".txt", "r+");
$lastPlay = fread($i, 1000);
fclose($i);
$currTime = date("U");
$diff = $currTime-$lastPlay;
}
else
{
$diff = 1000000;
}
if ($diff<172800)
{
echo "<script language=\"javascript\">alert(\"Sorry, you cannot play because you have already played in the past 48 hours. Please wait for 48 hours between playing.\")</script>";
}
else
{
play1();
}
function play1()
{
$code = date("YnjG");
$winmsg = "<script language=\"javascript\">alert(\"Congratulations! You have won free entry to any competition where the prize is non-cash. Your special code is " . $code . ". To redeem simply E-mail your code along with the name of your prize to winbutton@velocitycompetitions.co.uk and we will E-mail you back with details on how to claim your prize. You will not be able to play again for 48 hours.\")</script>";
$userno = rand(1,20);
$winno = rand(1,20);
if ($userno!=$winno)
{
play2();
}
else
{
mail("winbutton@velocitycompetitions.co.uk", "Win Button", " CODE: " . $code . "\n\nPRIZE: Free entry to non-cash comp");
echo $winmsg;
}
}
function play2()
{
$code = date("YnjG");
$winmsg = "<script language=\"javascript\">alert(\"Congratulations! You have won a free 1 day token. Your special code is " . $code . ". To redeem simply E-mail your code along with the name of your prize to winbutton@velocitycompetitions.co.uk and we will E-mail you back with details on how to claim your prize. You will not be able to play again for 48 hours.\")</script>";
$userno = rand(1,100);
$winno = rand(1,100);
if ($userno!=$winno)
{
play3();
}
else
{
mail("winbutton@velocitycompetitions.co.uk", "Win Button", " CODE: " . $code . "\n\nPRIZE: Free 1 day token");
echo $winmsg;
}
}
function play3()
{
$code = date("YnjG");
$winmsg = "<script language=\"javascript\">alert(\"Congratulations! You have won a free 3 day token. Your special code is " . $code . ". To redeem simply E-mail your code along with the name of your prize to winbutton@velocitycompetitions.co.uk and we will E-mail you back with details on how to claim your prize. You will not be able to play again for 48 hours.\")</script>";
$userno = rand(1,1000);
$winno = rand(1,1000);
if ($userno!=$winno)
{
play4();
}
else
{
mail("winbutton@velocitycompetitions.co.uk", "Win Button", " CODE: " . $code . "\n\nPRIZE: Free 3 day token");
echo $winmsg;
}
}
function play4()
{
$code = date("YnjG");
$winmsg = "<script language=\"javascript\">alert(\"Congratulations! You have won a free week token. Your special code is " . $code . ". To redeem simply E-mail your code along with the name of your prize to winbutton@velocitycompetitions.co.uk and we will E-mail you back with details on how to claim your prize. You will not be able to play again for 48 hours.\")</script>";
$userno = rand(1,10000);
$winno = rand(1,10000);
if ($userno!=$winno)
{
play5();
}
else
{
mail("winbutton@velocitycompetitions.co.uk", "Win Button", " CODE: " . $code . "\n\nPRIZE: Free week token");
echo $winmsg;
}
}
function play5()
{
$code = date("YnjG");
$winmsg = "<script language=\"javascript\">alert(\"Congratulations! You have won a free month token. Your special code is " . $code . ". To redeem simply E-mail your code along with the name of your prize to winbutton@velocitycompetitions.co.uk and we will E-mail you back with details on how to claim your prize. You will not be able to play again for 48 hours.\")</script>";
$userno = rand(1,100000);
$winno = rand(1,100000);
if ($userno!=$winno)
{
play6();
}
else
{
mail("winbutton@velocitycompetitions.co.uk", "Win Button", " CODE: " . $code . "\n\nPRIZE: Free month token");
echo $winmsg;
}
}
function play6()
{
$code = date("YnjG");
$nowin = "<script language=\"javascript\">alert(\"Sorry, you did not win a prize. You will not be able to play again for 48 hours.\")</script>";
$winmsg = "<script language=\"javascript\">alert(\"Congratulations! You have won £15!! Your special code is " . $code . ". To redeem simply E-mail your code along with the name of your prize to winbutton@velocitycompetitions.co.uk and we will E-mail you back with details on how to claim your prize. You will not be able to play again for 48 hours.\")</script>";
$userno = rand(1,1000000);
$winno = rand(1,1000000);
if ($userno!=$winno)
{
echo $nowin;
}
else
{
mail("winbutton@velocitycompetitions.co.uk", "Win Button", " CODE: " . $code . "\n\nPRIZE: £15");
echo $winmsg;
}
}
$i2 = fopen("Win Buttton Records" . $ip . ".txt", "w");
fwrite($i2, date("U"));
fclose($i2)
?>
</body>
</html>