homepage Welcome to WebmasterWorld Guest from 54.197.110.151
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
pattern matching in refering url
oilman

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 650 posted 11:55 pm on Mar 26, 2003 (gmt 0)

I am trying to write a cookie (php) that sets a value based on the referrer string. ie: if user used the search phrase 'blue widgets' then value is set to one or if user used search phrase 'red widgets' then value is set to 2 and do on.

Little help? :)

 

andreasfriedrich

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 650 posted 12:25 am on Mar 27, 2003 (gmt 0)

Something along these lines should do the trick:

if (preg_match [php.net]("'red'", $_SERVER['REFERER'])) {
setcookie [php.net]();
} else {
setcookie [php.net]();
}

Andreas

oilman

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 650 posted 12:59 am on Mar 27, 2003 (gmt 0)

thanks - I was playing around with preg_match earlier but didn't have the syntax right. I'll give it a whirl right away.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved