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 04-01-2007, 09:31 PM   #1
Mr. Mike
Confirmed User
 
Join Date: Aug 2004
Posts: 913
:mad PHP guys please fix this shit for me

PHP Code:
$full_url "http:///www.wojfun.com/contactus_form.html";
$pos_dslash strpos($full_url"/"7);
$trimmed_url substr($full_url0$pos_dslash); 
trimmed url= http://www.wojfun.com

Please fix this so result is only www.wojfun.com (without http://)

thanks!!!
__________________
Sig for sale. ICQ: 163-545-054
Mr. Mike is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-01-2007, 09:34 PM   #2
webgeek
Confirmed User
 
Join Date: Mar 2007
Posts: 165
check http://php.net/parse_url
__________________
webgeek
webgeek is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-01-2007, 09:35 PM   #3
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
$url = "http://www.site.com/blah/etc.com";
// remove the http://
$url = str_replace("http://","",$url);
// split at "/"
$exp = explode("/",$url);
// result is everything before first /
$end = $exp[0];

theres shorter ways but to show whats going on
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-01-2007, 09:35 PM   #4
BigBen
Confirmed User
 
Join Date: Nov 2004
Location: scv
Posts: 2,299
Edit - Nevermind.
BigBen is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-01-2007, 09:38 PM   #5
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
or you could just add this to the code you have ( last line )
$trimmed_url = str_replace("http://","",$trimmed_url);
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-01-2007, 09:39 PM   #6
Mr. Mike
Confirmed User
 
Join Date: Aug 2004
Posts: 913
Quote:
Originally Posted by SmokeyTheBear View Post
$url = "http://www.site.com/blah/etc.com";
// remove the http://
$url = str_replace("http://","",$url);
// split at "/"
$exp = explode("/",$url);
// result is everything before first /
$end = $exp[0];

theres shorter ways but to show whats going on
Perfect, thank you!!
__________________
Sig for sale. ICQ: 163-545-054
Mr. Mike is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-01-2007, 09:41 PM   #7
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
if you do it this way then the url can either have http:// or not it wont matter
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-01-2007, 09:43 PM   #8
Mr. Mike
Confirmed User
 
Join Date: Aug 2004
Posts: 913
Quote:
Originally Posted by SmokeyTheBear View Post
if you do it this way then the url can either have http:// or not it wont matter
yeah the urls are all in a db, they all have http://, your code worked perfect.
__________________
Sig for sale. ICQ: 163-545-054
Mr. Mike is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-01-2007, 09:43 PM   #9
Bro Media - BANNED FOR LIFE
MOBILE PORN: IMOBILEPORN
 
Join Date: Jan 2004
Location: Tinseltown NL
Posts: 16,502
preg_match('!^https?://([a-zA-Z\-_\.0-9]+)!',addslashes(htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES)), $ref);

$ref[1] result in www.referringsite.com
Bro Media - BANNED FOR LIFE is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-01-2007, 10:20 PM   #10
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
Quote:
Originally Posted by webgeek View Post
another bump for people trying to reinvent the wheel
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-01-2007, 11:24 PM   #11
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
Quote:
Originally Posted by Alky View Post
another bump for people trying to reinvent the wheel
no harm in that , people have made billions over the years reinventing the wheel over and over..
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-01-2007, 11:36 PM   #12
tommy gun
Registered User
 
Join Date: Apr 2007
Posts: 13
I like the perl version:

Code:
print "please paypal $100";
my $deposit = <STDIN>;
if ($deposit == 100) {
    do_work();
}

Last edited by tommy gun; 04-01-2007 at 11:37 PM..
tommy gun is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-01-2007, 11:42 PM   #13
Alky
Confirmed User
 
Alky's Avatar
 
Join Date: Apr 2002
Location: Houston
Posts: 5,651
Quote:
Originally Posted by SmokeyTheBear View Post
no harm in that , people have made billions over the years reinventing the wheel over and over..
rewriting a function which uses more system resources can make millions?
Alky is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-01-2007, 11:52 PM   #14
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
Code:
$full_url = "http:///www.wojfun.com/contactus_form.html";
$trimmed_url = str_replace("http://","",$full_url);
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-02-2007, 12:08 AM   #15
tommy gun
Registered User
 
Join Date: Apr 2007
Posts: 13
Code:
$trimmed_url = preg_replace('/^http:\/\/:/', '', $full_url);
$trimmed_url = preg_replace('/\/.*/', '', $trimmed_url);
tommy gun 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.