PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
</head>
<body >
<?
if ($_REQUEST['done']<>'1')
{
?>
<script type="text/javascript">
<!--
window.location = "test.php?java=1&done=1"
//-->
</script>
<?
}
?>
<?
if (($_REQUEST['java']=='1') and ($_REQUEST['done']=='1'))
{
?>
<script type="text/javascript">
<!--
if (screen.width==800||screen.height==600) //if 800x600
window.location.replace("800.php")
else if (screen.width==640||screen.height==480) //if 640x480
window.location.replace("640.php")
else if (screen.width==1024||screen.height==768) //if 1024x768
window.location.replace("1024.php")
else //if all else
window.location.replace("defaultjava.php")
//-->
</script>
<?
}
else
{
header("Location:nojava.php");
}
?>
</body>
</html>
my problem is that it executes the "else" and not the java redirect.
if i eliminate the "else" the script works just fine. any ideeas what i'm doing wrong or any other code to do the same thing ? 10x in advance
i modified the code a bit and it works on Apache/2.0.45 and PHP/4.2.4
the problem is on the latest version of apache and php.
Last edited by z3phir on Fri Apr 08, 2005 6:21 am, edited 1 time in total.
For a start, you can't output anything to the page before header() is sent... That fails immediately.
So putting <script> which shows in the HTML source code, before header() causes errors (try putting error_reporting(E_ALL);) on the top line of you page and it may help
i placed all code corectly is inside the body tags but it dosen't work it executes the else and not the redirect script. i have java activated.
here is the whole page