Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-15-2004, 07:09 AM   #1
alex79
Confirmed User
 
Join Date: Jun 2002
Location: france
Posts: 996
php quik question

what is the function with wich i can see if a string is in other string?
alex79 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2004, 07:21 AM   #2
nibbi
Confirmed User
 
Join Date: Sep 2002
Location: Nashville, TN
Posts: 104
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
nibbi is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2004, 07:21 AM   #3
jennycards
Confirmed User
 
Join Date: Feb 2002
Location: European Union
Posts: 1,124
ereg(), eregi()
jennycards is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2004, 07:27 AM   #4
Ash@phpFX
Confirmed User
 
Join Date: Nov 2003
Posts: 4,292
or preg_match()
Ash@phpFX is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2004, 07:44 AM   #5
natkejs
Confirmed User
 
Industry Role:
Join Date: Jan 2003
Location: Nomad Land
Posts: 1,629
strstr($string, "string")

find the first occurance of "string" in $string ... this command is pretty useful.

in your case...

if (strstr($string, "UHH")) { echo "YES.. UHH is in string!" }
__________________
natkejs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2004, 08:06 AM   #6
alex79
Confirmed User
 
Join Date: Jun 2002
Location: france
Posts: 996
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:
PHP Code:
<?
if (strstr($_SERVER['HTTP_REFERER'], "amateur"))
{ header("location: [url]http://www.mydomain.com/amateur.html[/url]"); die();}
?>
and this is the error i get when i come to this page from another page which the "amateur" in the url:


"Cannot add header information - headers already sent by (output started at /home/..............) "

any ideea why i get this error?
alex79 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2004, 09:55 AM   #7
natkejs
Confirmed User
 
Industry Role:
Join Date: Jan 2003
Location: Nomad Land
Posts: 1,629
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.

PHP Code:
<?
if (strstr($_SERVER['HTTP_REFERER'], "amateur")) { header("Location: http://www.mydomain.com/amateur.html"); };
?>
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.
__________________
natkejs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2004, 10:05 AM   #8
sweet7
Confirmed User
 
Join Date: May 2003
Posts: 1,792
Quote:
Originally posted by asher
or preg_match()
__________________
ICQ: 282814268
sweet7 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2004, 10:07 AM   #9
Chris
Too lazy to set a custom title
 
Chris's Avatar
 
Industry Role:
Join Date: May 2003
Location: icq: 71462500 Skype: Jupzchris
Posts: 27,880
feel free to use my code
php.hahahahahahahaha%%#)I$)#.PHP!

that should take care of ya

cheers
__________________
[email protected]
Chris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.