![]() |
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 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 |
id suggest setting a variable for each of the sites you 'lnk', then just link it to the variable.... might work that way
|
try to urlencode(lnk) .. Query strings don't seem to dig two ? marks.
|
Quote:
|
Yep, the urlencode() will solve your problem...
|
thanks guys for the responses. i've tried urlencode like this:
Code:
<?php |
for anyone that's interested, i couldn't get it to work with urlencode, but this worked:
Code:
<?php |
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'] |
Quote:
|
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. :2 cents: See sig for example.
|
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. |
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. |
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. :) |
All times are GMT -7. The time now is 05:15 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123