PDA

View Full Version : header() issues


Tyler
March 11th, 2006, 18:28
I am dumbfounded at why this is happening.

I have install.php, and here is what I have:

//Licensing details, MAY NOT REMOVE UNDER ANY CIRUMSTANCES
$ip = str_replace('.','-',$_SERVER['REMOTE_ADDR']);
$hostname = str_replace('.','-',$_SERVER['HTTP_HOST']);
$path = str_replace('/','-',$_SERVER['PHP_SELF']);
$path = str_replace('.','-',$path);
$time = time();

$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = 'install.php?finish=true';
header("Referer: http://$host$uri/$extra\r\n");
header("Location: URLtolicense");



And then I have my license script:


$ref = $_SERVER['HTTP_REFERER'];
header("Location: $ref");


Now this is the weird part...If I go from the directory and then click on install.php, it'll redirect me to the directory listing. But if I do install.php as a direct URL, it'll redirect to the license script and just sit there. And in my error log, it has an undefined referrer.

So I am very lost at why this is happening! :blush:

Anoop
March 12th, 2006, 04:46
Hi Tyler, I think the 'referer' header won't work the way you intend. You are correctly sending the 'Referer' header along with the response, but after that the browser should send the same with the next request. Browser will not allow you to spoof referer.
http://www.datatrendsoftware.com/spoof.html

Can you make clear what you want to achieve using the script, so that we can try some alternative method :)

Tyler
March 12th, 2006, 05:11
Howdy Annop,

I thought I already updated the thread, but I guess I only dreamed about it :blush:

What I finally got to work (with the help of Cameron) was I just stuck it in the URL, and used $_GET to get the original script.

What I was trying to do was...

install.php -> licensing -> install.php

Thanks for your help though :)