PDA

View Full Version : redirection... if....


Xavior
19-06-2003, 20:40
I'm trying to use php to redirect a user if...
the top URL aint index.php
(i'm using include...)
how can this be done?

It's like... i will be loading this page thru index.php
so if people access this page directly, it will redirect them to index.php
can this be done with php? or must i use javascript?
and how?(lazy to find in the net.. lalala)

seahorse
19-06-2003, 20:58
maybe you can use $_SERVER['HTTP_REFERER']
to check if it is index.php.

If it is, then continue to else use header(Location: 'index.php') to redirect them to index.php

alien
19-06-2003, 22:35
if ($_SERVER["PHP_SELF"] == "/index.php") {
// Yes, do this
}
else {
// No, do this
}


Only check if the file equal to "index.php"..

Or if you just want to "break out of frame", JavaScript will do.. Check out the JavaScripts section at HotScripts (http://www.hotscripts.com)

:D