what is the function with wich i can see if a string is in other string?
php quik question
Collapse
X
-
You can use substr_count() to count the number of times a given string is found within another.
http://us4.php.net/manual/en/function.substr-count.php -
ereg(), eregi()Comment
-
thanks for your reply
i want to make an redirect to another page if a string is in the referer page...i've tryed eregi() and strstr() and both times i get same error
this is the code i used:
and this is the error i get when i come to this page from another page which the "amateur" in the url:PHP Code:<? if (strstr($_SERVER['HTTP_REFERER'], "amateur")) { header("location: [url]http://www.mydomain.com/amateur.html[/url]"); die();} ?>
"Cannot add header information - headers already sent by (output started at /home/..............) "
any ideea why i get this error?Comment
-
ehm you shouldn't include any html tags there, make it like this.
edit: nevermind this, it's VBulletin adding the html tags even when outputing PHP code.
also any output command such as echo/print being executed before your re-direct will cause it to fail. so make sure there is nothing in your script that outputs info before it's supposed to re-direct.PHP Code:<? if (strstr($_SERVER['HTTP_REFERER'], "amateur")) { header("Location: http://www.mydomain.com/amateur.html"); }; ?>
Comment
-
feel free to use my code
php.hahahahahahahaha%%#)I$)#.PHP!
that should take care of ya
cheers
Comment


Comment