Closed Thread Icon

Topic awaiting preservation: passing variable help / dereferer script Pages that link to <a href="http://ozoneasylum.com/backlink?for=12912" title="Pages that link to Topic awaiting preservation: passing variable help / dereferer script" rel="nofollow" >Topic awaiting preservation: passing variable help / dereferer script\

 
Author Thread
patric design
Bipolar (III) Inmate

From: 290 km/h, fast lane, Autobahn, Germany
Insane since: Feb 2001

posted posted 10-01-2003 15:14

I am trying to write a dereferer script but I keep on getting an error message.

i am calling this:

code:
<a href="http:\\www.domain.com\deref.php?site=www.link.de">link.de</a>



this is my deref.php

code:
<html> 
<head>
<title>Dereferer</title>
<meta http-equiv="Refresh" content="0; URL=<?php echo $site; ?>">
</head>
<body></body>
</html>



However all I am getting is: Page not found! with this adress in the URL bar:
http://www.domain.com/www.link.de/

Something is going very wrong! Any ideas?


<´¯`·.¸ Patric ¸.·´¯`>

quisja
Paranoid (IV) Inmate

From: everywhere
Insane since: Jun 2002

posted posted 10-01-2003 15:19

You're missing a http://
e.g. http://domain.com/deref.php?site=http://www.link.de

patric design
Bipolar (III) Inmate

From: 290 km/h, fast lane, Autobahn, Germany
Insane since: Feb 2001

posted posted 10-01-2003 15:36

thanx but it still doesn't work. Now the deref.php page keeps on refreshing itself instead of the liked site. i am not getting the page not found error anymore though.

<´¯`·.¸ Patric ¸.·´¯`>

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 10-01-2003 15:40

Try specifying where to get the variable data from, so:

$site = $_GET["site"];

patric design
Bipolar (III) Inmate

From: 290 km/h, fast lane, Autobahn, Germany
Insane since: Feb 2001

posted posted 10-01-2003 16:12

it works now. thanx to the both of you! I found that not every browser actually transmits the referer. I used a php script to test this on the target site. So far only opera sends the referrer... strange...

<´¯`·.¸ Patric ¸.·´¯`>

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 10-01-2003 16:26

patric design: As far as I can tell all browsers send a referer (unless you are blocking them with something like Proximitorn), however, using a JavaScript popup script stops IE/Win from sending them although other browsers are fine:
http://development.gurusnetwork.com/discussion/thread/2196/

___________________
Emps

FAQs: Emperor

trib
Paranoid (IV) Inmate

From: Den Haag, Netherlands
Insane since: Sep 2002

posted posted 10-08-2003 09:38

I guess it's time to remind those who need it that since 4.0.1 there has been a change in the way PHP handles query strings. Depending on the way your webmaster has set up the php.ini file (or right out of the box if you installed it yourself) the option Register_Globals has been set to false.

The practical upshot of this is that a query string like ?site=blah does not necessarily mean that there will be a variable called $site available to the the script being called. People really MUST get used to using constructions like

code:
$site = (isset($_POST["site"]))?$_POST["site"]:"default_value";
$foo = (isset($_GET["foo"]))?$_GET["foo"]:"default_value";
$bar = (isset($_SESSION["bar"]))?$_SESSION["bar"]:"default_value";
etc ...

thereby assigning their EGPCS array elements to 'real" variables.

There's a lot of old code out there which keeps breaking as the new installations become more common, and this is one of the prime reasons for it. For an explanation of why Register_Globals=true is a bad idea seehttp://www.php.net/register_globals and, more importantly, for a detailed look at the predefined variables and super-globals take a good look at http://www.php.net/manual/en/reserved.variables.php.

I see this problem so often it's no longer funny ... but it does make me a fair bit of beer money fixing the broken code ...

If someone can write this more clearly, I think it's a candidate for a good FAQing ...


Bug-free software only exisits in two places
A programmer's mind and a salesman's lips

[This message has been edited by trib (edited 10-08-2003).]

« BackwardsOnwards »

Show Forum Drop Down Menu