Forum Moderators: coopster

Message Too Old, No Replies

check URL for string - how?

         

marcus76

4:57 pm on Jul 7, 2005 (gmt 0)

10+ Year Member



hi, Can someone pls advise - i want to check my URL for the string '-t.html', and when this is present load 'file1.php' else 'file2.php'

Code below..

Many thanks

Marcus

if (
(!stristr(basename$PHP_SELF),'-t.html'))
) {
require(DIR_WS_INCLUDES . 'file1.php');
}
else require(DIR_WS_INCLUDES . 'file2.php');
?>

coopster

5:32 pm on Jul 7, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You missed the parenthesis around your basename function. Also, you should be using the superglobal variables rather than having register_globals On as this is a security issue.
if (stristr(basename($_SERVER['PHP_SELF']),'-t.html')) { 
require(DIR_WS_INCLUDES . 'file1.php');
} else {
require(DIR_WS_INCLUDES . 'file2.php');
}