|
|
|
||||
|
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. |
![]() |
|
|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
|
Thread Tools |
|
|
#1 |
|
Confirmed User
Industry Role:
Join Date: Sep 2001
Location: North America
Posts: 2,016
|
Need PHP basic help
Okay, pretty simple stuff but I'm not able to find out wtf doesn't work.
I need the "rid" from http://www.blah.com/gallery.php?rid=2000 to be added to each sponsor link. ie: http://www.blah.com/gallery.php?rid=2000 goes to http://www.sponsor.com/tour.php?rid=2000 And if I type a different "rid", it will automatically modify all the links. Currently, all pages are in .php and links look like this: http://www.sponsor.com/tour.php?rid= I'm sure I have something to add in the header in php. thanks! |
|
|
|
|
|
#2 |
|
Confirmed User
Join Date: Feb 2002
Location: "A measure of a man is his post count". Write that down.
Posts: 900
|
If I understand your need correctly this should work:
PHP Code:
-Tony |
|
|
|
|
|
#3 |
|
Confirmed User
Join Date: Feb 2001
Location: UK
Posts: 543
|
Noob!
PHP Code:
__________________
|
|
|
|
|
|
#4 |
|
Confirmed User
Join Date: Jun 2002
Location: far beyond reality
Posts: 2,336
|
PHP Code:
|
|
|
|
|
|
#5 |
|
Confirmed User
Industry Role:
Join Date: Sep 2001
Location: North America
Posts: 2,016
|
great, thanks guys
|
|
|
|
|
|
#6 |
|
Registered User
Join Date: Aug 2003
Posts: 16
|
Another longer way to do it (which could have issues if your linking elsewhere off your site), but it would save time adding the code to each link... is just to get the page to open the original file as an input and go a preg_replace for all link tags adding ?rid=$rid to the end of the link values. Sure this is the longer way around and the page might load slightly slower, but hell I'm lazy and I don't want to spend the 3 secs it takes to do a search/replace on a page of code :P
Plus you ever seen the face of a graphic designer when they see "funny" code. They stop in their tracks with this strange look, then it... "what do I do with this"... |
|
|
|
|
|
#7 |
|
Registered User
Join Date: Jun 2002
Location: Michigan
Posts: 86
|
Save the following to a file called fixlinks.php:
PHP Code:
PHP Code:
http://www.sponsor.com/tour.php?rid=1000 rid=1000 is your default code if someone forgets to add an rid= parameter to the url or it gets lost. Works on PHP 4.1 or later. Alternatively, in your .htaccess file put PHP Code:
PHP Code:
I haven't tested any of this. You'll be lucky if it works. Damn, the PHP highlighting colors are fugly on this board. and vBulleton mangles code. There is a \ in front of the .php and in front of .html in the .htacces file samples. you really will be lucky to get this to work. |
|
|
|
|
|
#8 |
|
Confirmed User
Join Date: Sep 2002
Location: Las Vegas
Posts: 208
|
jesus what a fucking mess... man. if you want to do it.. in most cases the very first reply will work fine. If it DOESNT work, use the second one.. if you want to get confused and more than you wanted to deal with, try the other suggestions. Thing is, that the first one is the most tedious to code, but is most flexible. The second one will make it so that EVERY coded link on the page will go to the same place (defined by $url) not necessarily bad, but just not quite as flexible as doing it all by hand.
D
__________________
--------------- |
|
|
|
|
|
#9 |
|
Registered User
Join Date: Aug 2003
Posts: 16
|
yeah agreed that the first is the simplest, but thin of the pain when it comes to adding that code to each link and you have a front end with the main graphic split into 40~50+ linked images... aaah the pain :P
But yeah, do it which ever way, it gets you the same result in the end. |
|
|
|
|
|
#10 |
|
Confirmed User
Industry Role:
Join Date: Nov 2003
Location: Online
Posts: 856
|
how come scripting always comes in so small?
specifically php |
|
|
|
|
|
#11 | |
|
Confirmed User
Join Date: Sep 2002
Location: Las Vegas
Posts: 208
|
Quote:
__________________
--------------- |
|
|
|
|
|
|
#12 | |
|
Confirmed User
Join Date: Feb 2003
Location: Canby, OR
Posts: 7,453
|
Quote:
jDoG
__________________
NSCash now powering ReelProfits.com ALSO FEATURING: NSCash.com :: SoloDollars.com :: ReelProfits.com :: BiminiBucks.com :: VOD PROGRAMS COMING SOON: Greedy Bucks :: Vengeance Cash NOW OFFERING OVER 60 SITES CONTACT :: JAMES SMITH :: CHIEF TECHNOLOGY OFFICER :: ICQ (711385133) |
|
|
|
|
|
|
#13 | |
|
Registered User
Join Date: Jun 2002
Location: Michigan
Posts: 86
|
Quote:
This will work on PHP 4.1 or better: PHP Code:
|
|
|
|
|