![]() |
PROGRAMMERS: Nested PHP variables?
Ok using gallery spots I have run into a snag
they use PHP for thier gallery links with 2 variables. My TGP scripts also use multiple PHP variables. Using links like this outscript.php?varA=80&varB=10&url=http://babes.spotbrokers.com/gallery.php?snid=58&linkid=pop-14 does not work becasue it only appears to be sending the first variable to the gallery script and the second seems to only go the tgp out script. is there a way I can nest 2 PHP urls that use multiple variables? (outscript.php?var=80&var=1&url=)(gallery.php?snid =58&linkid=pop-14) Many thanks if somone could enlighten me. :( :Graucho |
What are the two variable names?
|
Quote:
var= snid= linkid= |
outscript.php?var=80&var=1&url=http://babes.spotbrokers.com/gallery.php?snid=58&linkid=pop-14
var=80 var=1 You have two vars with the same name, tray to put the url in ' ' it has a questionmark in it |
Quote:
outscript.php?var=80&url='http://babes.spotbrokers.com/gallery.php?snid=58&linkid=pop-14' doesnt work |
you can do it like this:
firsturl.php?avar=2&bvar=3&url=http://www.blegh.com/script.php?ohio:kansas then just explode() the querystring on : on the second url. make sure you check the variables for validity/security though. |
try this
outscript.php?var=80&var=1&url='gallery.php?snid=5 8&linkid=pop-14' |
Quote:
Quote:
The surfer is going through my out link then to Galleyspots scipt on thier server. Its not my PHP script outscript.php is in my root but the other is not. |
Quote:
|
Quote:
|
Quote:
What does the following code do? What is the purpose of the first var declaration? var=80&var=1 |
Quote:
Is the variables in the SECOND url athat are not goign through. |
Quote:
:321GFY |
Quote:
blah.php?varA=1&varB=2&url=bling.php?varA=1&varB=2 would STILL explain my qestion varB is not getting parsed by bling.php its abstract, it doesnt matter if my urls are correct or even real; its the concept of the code. |
Quote:
$testvar = $_SERVER['QUERY_STRING']; $quervar = explode(":", "$testvar"); $varcount = count($quervar); for($i=0;$i<$varcount;$i++){ echo($quervar[$i] . "\n"); } |
The code I just gave you gets the querystring, chops it up into an array, and displays each piece on a new line. That should help you on your way.
|
Simple solution:
replace the ampersands in the 2nd url with % 2 6 (no spaces in the symbol. This turns the url into 1 long string. Then call your outscript as normal. Most tradescripts will then not choke on the extra symbols. If you have a custom script you must call the urldecode() php function in your internal code on the url before sending out the hit. This puts the url back together for the browser. example outscript.php var=80&var=1&url=http://babes.spotbrokers.com/gallery.php?snid=58%26linkid=pop-14 hope this helps |
Quote:
so If i replace this $url = header_check($url); with $url = urldecode(header_check($url)); in my outscript.php that should do it??? |
Blah, it doesnt work becasue thers is a hahahahahahahahahaha involved that is converting the %26 when it generates the page.
can somone tell me how to do a simple character replacment? like take a string and convert all the "|"'s in the string to "&"s using PHP I think that would be the simplest way, but I dont know how to do it. |
Quote:
Php automaticly passes the variables from a querystring or a HTTP POST into your script as is you should not need to call header_check(). Unless you redefine it. Just make sure the url in your html pages you change out the ampersands in the 2nd url. This will ensure that $url is passed as 1 long string. |
Quote:
Doh! Shoulda looked better :) (oh, and what you should do now depends on what that header_check function does) |
Quote:
hahah it jsut keeps getting deeper and deeper but I think jsut using some kinda simple char replacment code would be my best bet. Quote:
but not the gallery.php (its on a different server) |
Quote:
use urlencode to translate special characters to ascii codes and ulrdecode to translate it back....allthough your browser also understand the ascii codes for the special characters. DynaMite :thumbsup |
Wasn't it you that laughed at some poor guy who needed help yesterday?
Quote:
|
Quote:
|
Quote:
|
Quote:
If you are generating pages using php use the urlencode() function on the url as you generating the page. If you have them hard coded use str_replace: mixed str_replace ( mixed search, mixed replace, mixed subject) Without disecting yourscript thats 1 way to approach it. |
If your going to Quote me MonkeyBoy get it right
|
Quote:
I wonder why the hell thats censored. |
str_replace("|", "&", $url);
^ that would do it?? :Graucho |
Just use the special characters for the querystring (not for other stuff), and you don't need to do anything special at all, you can just leave it that way.
|
Quote:
part DynaMite |
Stop helping this Fucking Jerk!
Quote:
|
Quote:
|
If you want it find it yourself
|
Quote:
just do a search/replace using your html editor then , just single step each replacement or cut out the urls into a blank page the s/r then paste back in. Pain but it is the only way. |
hmmm
$url = header_check($url); str_replace("|", "&", $url); header("Location: $url"); Shouldnt that work?? Im not seeing whats wrong with my code but its not replacing the |'s |
Quote:
Your outscript code $url = "Location:" . urldecode($url); header ($url); That's it! The header_check() is not needed unless it serves to verify the url passed for some reason. your html source ttt-out.php?url=http://www.dollars4babes.com/mpa2/gallhit.php?w=100349%26p=2%26gall=1040389346&link= roxycarter I took this url from my site to show you since the second url has multiple variables. The focus of your changes is in your html source not the script code. Try that out |
Quote:
|
Thanks for the help I ended up using.
$url = header_check($url); $url = str_replace("|", "&", $url); header("Location: $url"); And everthings wokring great. |
AMP must be asleep.
Dancing Pig needed STAT! |
| All times are GMT -7. The time now is 08:11 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123