Jump to content


This topic is now archived and is closed to further replies.


Get variables...

Recommended Posts

Hi everyone I'm new here, I'd like to ask if my php page got something like this in the url
Now php understood variable 1 and 2 but couldn't understand variable 3. In variable 1 %3A is ":" and %2F is "/" but once we reach variable 3, we start having %3F which is "?" and %3D which is "=". And then %26 is "&" and %253A becomes ":" and %252F becomes "/" (basicly, since we have another "?", 25 is being added to these things, like %2F becomes %252F....)

Now is there anyway to let php understand the variables that come after var3? I usually use $HTTP_GET_VARS ir request to get variables.......

If there is no way, I thought I could take the entire unknown text as var3 and then replace each occurence of %26, %253A etc by the correct character and then I will be left with a variable, say [code]$var3 = "http://www.something.com/something.php?q=naruto&var4=......"[/code] now how can I extract var4 or "q" out of var3. I hope I didnt confuse the hell out of you....I'm sorry if I did....

Share this post

Link to post
Share on other sites
it looks to me like a few things could be going on here, for one you should do a little name changing, don't put spaces in the names of your filenames for your server, and try not to use underscores. Just leave the names together, capital letters if needed, that confuses things, another thing is all of those variables you have listed there are strings. So they should be formatted as follows
var1 = "http%3A%2F%2Fmangataz.free.fr%2Fmanga%2Fnaruto.htm&";
var2 = "naruto&";
var3 = "http%3A%2F%2Fsomething.com%2Fsomething.php%3Fq%3Dnaruto%26";
var4 = "%3Dhttp%253A%252F%252Fmangataz.free.fr%252Fmanga%252Fnaruto.htm%26imagesrc%3D";[/code]
as you noticed you had them all bunched together unreadable, secondly you were missing quotation marks, third you didn't have the closing colons like this;. The last one isn't necessary but I do it out of habbit. Now your 4th variable didn't even have an equal symbol, reformat your text like this, make any necessary changes to the urls and your script should run like normal. The section you had before the first one wasn'te ven assigned to a variable. And if you are doing all this because of trying to make it Xhtml compliant by using ampersands, well you don't need to do that for text that is within the
if it's inside that you don't have a need to replace every little symbol with an ampersand

Share this post

Link to post
Share on other sites
Use the following code to decode this mess:
$w = 'http://www.something.com/something.php?var1=http%3A%2F%2Fmangataz.free.fr%2Fmanga%2Fnaruto.htm&var2=naruto&var3=http%3A%2F%2Fsomething.com%2Fsomething.php%3Fq%3Dnaruto%26var4%3Dhttp%253A%252F%252Fmangataz.free.fr%252Fmanga%252Fnaruto.htm%26imagesrc%3D';
echo urldecode(urldecode($w));
$z = parse_url(urldecode(urldecode($w)));
echo '<pre>' . print_r($z,true) . print_r($x,true) . '</pre>';


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.