...

View Full Version : How do I automatically open URL based on IF condition being met ?



gudipudi
05-09-2009, 01:20 PM
In continuation to

http://www.codingforums.com/showthread.php?t=165903
( special thanks to abduraooft )

How do I automatically open URL based on IF condition being met ?


<?php
if(isset($_COOKIE['lastVisit'])){
$link = "c.html";
}
else{
$inTwoMonths = 60 * 60 * 24 * 60 + time();
setcookie('lastVisit', date("G:i - m/d/y"), $inTwoMonths);
$link = "b.html";
}
?>
<html>
<head></head>
<body>
<?php
echo "<a href=\"$link\">Link</a>";
?>
</body>
</html>

when i added
echo "<meta http-equiv="refresh" content="1;url=http://www.tycheit.com/c.html" /> "; in the if section...i am getting an error

abduraooft
05-09-2009, 01:25 PM
<?php
if(isset($_COOKIE['lastVisit'])){
$link = "c.html";
}
else{
$inTwoMonths = 60 * 60 * 24 * 60 + time();
setcookie('lastVisit', date("G:i - m/d/y"), $inTwoMonths);
$link = "b.html";
}
header($link);
?>

Or

<?php
if(isset($_COOKIE['lastVisit'])){
$link = "c.html";
}
else{
$inTwoMonths = 60 * 60 * 24 * 60 + time();
setcookie('lastVisit', date("G:i - m/d/y"), $inTwoMonths);
$link = "b.html";
}
?>
<html>
<head>
<?php
echo "<meta http-equiv=\"refresh\" content=\"1;url=$link\" /> ";
?>
</head>
<body>
<?php
echo "<a href=\"$link\">Link</a>";
?>
</body>
</html>

gudipudi
05-09-2009, 01:52 PM
awsome ......its working:)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum