Page 1 of 1

how do you write if the url containes DESC?

Posted: Thu Mar 25, 2004 12:23 pm
by grudz
how would the that if statement

Code: Select all

if ($_SERVER['HTTP_REFERER'] == "%DESC%");

Posted: Thu Mar 25, 2004 12:47 pm
by Farrier
if (strpos($_SERVER['HTTP_REFERER'], 'DESC') !== false) {
// Note we must test exactly against false here.

Use stripos() if you want a case-insensitive match.

Posted: Thu Mar 25, 2004 1:16 pm
by grudz
it gives me a parse error

Posted: Thu Mar 25, 2004 1:34 pm
by TheBentinel.com

Code: Select all

<?php

if (strpos($_SERVER['HTTP_REFERER'], 'DESC') !== false) 
{
  echo "not false";
}
else
{
  echo "is false";
}

?>
Does that error if you use it just that way? I didn't test it, but it looks right.