Page 1 of 1

Change content based on url`s

Posted: Thu Feb 21, 2013 7:52 am
by Wunderkid
Hello!
I`m newbie and just started with php. Could you help me?
I want to change text based on many url.
I write code, but it filtering only one url :(

Code: Select all

<?php
$ref=getenv('HTTP_REFERER');
if (strpos($ref,"www.site.com/news")>0) 
{
echo "News;

}
else
{
echo "";
};
?>  
I want to make something like that

Code: Select all

<?php
$ref=getenv('HTTP_REFERER');
if (strpos($ref,"www.site.com/1")>0) 
{
echo "1;

}
else
{

if (strpos($ref,"www.site.com/2")>0) 
{
echo "2;

}
else
{

if (strpos($ref,"www.site.com/3")>0) 
{
echo "3;

}
else
{

?>  
Hope you will help me...

Re: Change content based on url`s

Posted: Thu Feb 21, 2013 11:15 am
by Christopher
It looks like you are using mod_rewrite. Take a look at the value in $_SERVER['PATH_INFO'].