Hi all
I'm trying to write a PHP that checks a statement and if so, then loads another page in the IE,
For example, I type this url in IE:
http://www.mysite.com/check.php
then check.php checks for example if a file entitled test.txt exists on server then I see http://www.google.com ang If NOT I see for example http://www.yahoo.com,
How can I do it by PHP?
Thanks in advance
msrox
Load another page if ...
Moderator: General Moderators
-
impulse()
- Forum Regular
- Posts: 748
- Joined: Wed Aug 09, 2006 8:36 am
- Location: Staffordshire, UK
- Contact:
Code: Select all
if (joe likes tea) {
header("Location: http://www.yahoo.com.com");
} else {
header("Location: http://www.google.com");
}- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
After using a header redirection always use exit. Code execution or script will continue running.
would change the $_SESSION value as well as extra processing time to complete the current script.
Use:
Code: Select all
if (joe likes tea) {
header("Location: http://www.yahoo.com.com");
} else {
header("Location: http://www.google.com");
}
$_SESSION['dont change']='blah';Use:
Code: Select all
if (joe likes tea) {
header("Location: http://www.yahoo.com.com");
exit;
} else {
header("Location: http://www.google.com");
exit;
}
$_SESSION['dont change']='blah';