![]() |
![]() |
![]() |
||||
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
Join Date: Aug 2002
Posts: 1,844
|
php experts - simple php question?
hi
i'm trying to make a very simple jump script for a particular reason and it works to a point but seems to give me an error. i've got a redirect script link.php which contains the following: Code:
<?php $url = ($_GET['lnk']); header("Location: $url"); exit; ?> Code:
http://www.somesite.com/?some-query-string!&id=27 Code:
http://mydomain.com/link.php?lnk=http://www.somesite.com/?some-query-string!&id=27 Code:
http://www.somesite.com/?some-query-string! Code:
http://www.somesite.com/?some-query-string!&id=27 ![]() thanks in advance |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Writer
Industry Role:
Join Date: Feb 2007
Posts: 3,123
|
id suggest setting a variable for each of the sites you 'lnk', then just link it to the variable.... might work that way
__________________
MAKE MORE MONEY FROM YOUR WEB TRAFFIC - 15% BONUS ![]() And contact me if you need high quality translating and writing work done - angelo22 (AT) gmail (DOT) com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
|
try to urlencode(lnk) .. Query strings don't seem to dig two ? marks.
__________________
Your post count means nothing. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: Mar 2003
Location: Las Vegas
Posts: 153
|
You are correct sir.
__________________
Earn up to 70% per sale and 15% on webmaster referrals Signup for Horny Teen Cum Sluts A CCBill and NoCreditCard partner |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: Jun 2004
Posts: 689
|
Yep, the urlencode() will solve your problem...
__________________
Webmasters! Looking for new affiliate programs to promote? Affiliate Program Search <-- Search for programs with FHGs, RSS feed, specific niche sponsors, ... |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Confirmed User
Join Date: Aug 2002
Posts: 1,844
|
thanks guys for the responses. i've tried urlencode like this:
Code:
<?php $url = urlencode($_GET['lnk']); header("Location: $url"); exit; ?> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Join Date: Aug 2002
Posts: 1,844
|
for anyone that's interested, i couldn't get it to work with urlencode, but this worked:
Code:
<?php $url=substr($_SERVER['QUERY_STRING'],4); header("Location: $url"); ?> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Registered User
Join Date: Nov 2005
Posts: 28
|
That'll work but you really should encode the ampersand in your address (you can use urlencode or replace &'s with %26). The reason its chopping off the end of it is the ampersand is splitting it into another GET variable:
$_GET['lnk'] and $_GET['id'] |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Join Date: Aug 2002
Posts: 1,844
|
ok thanks, i'll take a look another look at it.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed IT Professional
Industry Role:
Join Date: Nov 2005
Location: Hollywood, CA
Posts: 3,744
|
You really should sanatize your variables man. With the way it is there if I were a spammer I could use your script as my own redirect tool. And now that I think of it, using header like that to redirect complete url's is kinda dumb. Make a database hold the urls you want to use then call them by id.
![]()
__________________
The Best Affiliate Software, Ever. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | |
Confirmed User
Join Date: Aug 2002
Posts: 1,844
|
Quote:
regarding using an id to call the url's, that's a good idea, but i'm using autoblogger to post to blogs and this relates to my sourcelinks on the blog posts, and i can't edit the autoblogger code. this was my only solution i could think of for the particular problem i had. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 | |
Confirmed IT Professional
Industry Role:
Join Date: Nov 2005
Location: Hollywood, CA
Posts: 3,744
|
Quote:
Two, it's a fairly ok solution to your problem, but you leave your script vulnerable because, like I stated above, anyone can use it to forward their own url's to wherever with your script. Ok, so you're a newbie to PHP. Read up on mysql man. With php and mysql you can do literally anything you want with a dynamic website. Not everyone has the mental abilities to understand code, so you may be part of the little percentage of people who can understand how it works and how to use it to your advantage. Check out the tutorials at programmingtutorials.com on mysql and php. I've taught myself everything I know about programming in general so I know it's possible for others to teach themselves the same. If you're serious about it hit me up and I'll help you out.
__________________
The Best Affiliate Software, Ever. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 | |
Confirmed User
Join Date: Aug 2002
Posts: 1,844
|
Quote:
hi nookster, thanks for the advice. yeah i see what you mean about other people being able to use the script to forward there own urls. i think i have a new solution now. thanks again. ![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |