bob_the _builder Posted September 1, 2006 Share Posted September 1, 2006 Hi,When I use $_SERVER["HTTP_REFERER"] within a link like:[code=php:0]<a href="index.php?action=delete&subcat_id='.$_GET['subcat_id'].'&confirm=y&referer='.$_SERVER["HTTP_REFERER"].'">Yes</a>[/code]and try to call on $_GET['referer'] to redirect user back:[code=php:0]<meta http-equiv="refresh" content="3; url='.$_GET['referer'].'">';[/code]$_GET['referer'] only seems to hold the value:[code=php:0]http://localhost/gallery/index.php?action=sh_subcat[/code]but it should be:[code=php:0]http://localhost/gallery/index.php?action=sh_subcat&subcatid=4[/code]Seems that it takes out everthing after the & in the above url?Is there a work around for that?Thanks Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 1, 2006 Share Posted September 1, 2006 Uus $_SERVER['QUERY_STRING'] to get the query string from the url, the bit after the question mark$url = $_GET['REFERER'] . '?' . $_SERVER['QUERY_STRING']; Quote Link to comment Share on other sites More sharing options...
bob_the _builder Posted September 1, 2006 Author Share Posted September 1, 2006 Thanks,Is it bad pratice sending the url across like that to $_GET it at the destination? Quote Link to comment Share on other sites More sharing options...
trq Posted September 1, 2006 Share Posted September 1, 2006 [quote]Is it bad pratice sending the url across like that to $_GET it at the destination?[/quote]Its quite common practice really. Quote Link to comment Share on other sites More sharing options...
bob_the _builder Posted September 1, 2006 Author Share Posted September 1, 2006 Still not working .. Tried:&referer='.$_SERVER["HTTP_REFERER"].'?'.$_SERVER['QUERY_STRING'].'and:<meta http-equiv="refresh" content="3; url='.$_GET['referer'].'">but still get:http://localhost/gallery/index.php?action=sh_subcatbut it should be:http://localhost/gallery/index.php?action=sh_subcat&subcatid=4Thanks Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 1, 2006 Share Posted September 1, 2006 Try this:[code=php:0]$referer = urlencode($_SERVER["HTTP_REFERER"]. '?' .$_SERVER['QUERY_STRING']);echo '<a href="index.php?action=delete&subcat_id=' . $_GET['subcat_id'] . '&confirm=y&referer=' . $referer . '">Yes</a>';[/code]When you retrieve the referer you'll need to urldecode($_GET['referer']) Quote Link to comment Share on other sites More sharing options...
bob_the _builder Posted September 1, 2006 Author Share Posted September 1, 2006 Works using:&referer='.urlencode($_SERVER["HTTP_REFERER"]).'then:<meta http-equiv="refresh" content="3; url='.$_GET['referer'].'">Thanks! Quote Link to comment Share on other sites More sharing options...
lounger Posted September 1, 2006 Share Posted September 1, 2006 hey bob i too am having trouble with a script which uses this $ref=@$HTTP_REFERER; but unfortunatly i am unable to post it here as the system always says The page cannot be displayed, i need the script to get the pic url and not the browser url ,any ideas how i can post my script so that everone can see it?? Quote Link to comment Share on other sites More sharing options...
bob_the _builder Posted September 1, 2006 Author Share Posted September 1, 2006 Hi lounger,Not following your request that well, can you post some code to give a better idea on what you are trying to acheive?Thanks Quote Link to comment Share on other sites More sharing options...
lounger Posted September 1, 2006 Share Posted September 1, 2006 hi bobi have a send a page to your friends script on a web page in my site but this sends the recipient the browser url, this is bad because it means that when this url link is clicked the peson who clicked it is actually in the senders account and can cause lots of mischeif eg. delete files ect. what i need is the script to send the image url instead which is also shown on my web page but i do not know how to make the script use that url instead of the browser url.i cant post the script as this forum throws me out and shows me the page -The page cannot be displayed i cant even post a snippet or am i doing somthing wrong?? im just cut and pasting it on here? Quote Link to comment Share on other sites More sharing options...
bob_the _builder Posted September 1, 2006 Author Share Posted September 1, 2006 Should be able to copy and paste into the text area .. maybe you are trying to paste more code than the limit allowed here? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 1, 2006 Share Posted September 1, 2006 lounger for now post your code over at http://www.pastebin.comAlso are you asking bob_the _builder for help, or are you in some way trying to help bob_the _builder? If you are asking for help then post in your own topic. Dont [i]hijack[/i] other peoples threads. Quote Link to comment Share on other sites More sharing options...
lounger Posted September 1, 2006 Share Posted September 1, 2006 ok ill post in pastebin, im not hijacking anything im just giving bob support as i too am in a similar situation with i think the same problem??and bob i was only tring to post one line so im not sure why it wont let me but ill try the other site now good luck with that buddy. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 1, 2006 Share Posted September 1, 2006 I didnt say go away, just post your code over at pastebin.com then provbide the link to the code you pasted over at pastebin.com. Also read your thread you posted earlier [url=http://www.phpfreaks.com/forums/index.php/topic,106564.0.html]here[/url] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.