By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,718 Members | 1,349 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,718 IT Pros & Developers. It's quick & easy.

Redirect problem

P: n/a
I downloaded a PHP webcounting script from the web. I got it working on
my home test server but the same thing does not work when I put on my
hosting server.

the string that calls the script is:
<a href="webcounter.php?src=http://www.cnn.com"> CNN </a>
The code that handles it is:

$extra_ext = "redirect:";

if (basename($PHP_SELF)=="webcounter.php") {
// we are indexing a different file
$source = $_GET['src'];

$tmp = substr($source, 0, 6);

if ($tmp=='http:/' || $tmp=='https:' || $tmp=='ftp://') {
$location=$source;
$rpage = $extra_ext.$source;

}
else {
$location=$rootpage.$source;
$rpage = $extra_int.$source;
}
webcounter ($ctype,$rpage);
header ("Location: $location");
exit;
}

I can post some more of the code if anyone needs it. On the host server
the string is being formed right but the redirect is not working.

Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Will wrote:
I downloaded a PHP webcounting script from the web. I got it working on
my home test server but the same thing does not work when I put on my
hosting server.


What are the differences between the two servers?
Linux/Windows?
IIS/Apache?
PHP 4.1.0/PHP 5.0.0?

and most importantly
home php.ini / host php.ini ?
Try inserting at the top of your scripts the two lines that follow so
that PHP will report the use of uninitialized variables:

error_reporting(E_ALL);
ini_set('display_errors', '1');
Happy Bug Hunting :)
--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2

P: n/a
Test server: Remote server:
Windows XP pro. Linux
Apache 1.3.27 Apache 1.3.27
PHP 4.3.4 PHP 4.3.2

I did a phpinfo() on the two servers and I did n't see any differences
that I thought would cause this but then what do I know.

Pedro Graca wrote:
Will wrote:
I downloaded a PHP webcounting script from the web. I got it working on
my home test server but the same thing does not work when I put on my
hosting server.

What are the differences between the two servers?
Linux/Windows?
IIS/Apache?
PHP 4.1.0/PHP 5.0.0?

and most importantly
home php.ini / host php.ini ?
Try inserting at the top of your scripts the two lines that follow so
that PHP will report the use of uninitialized variables:

error_reporting(E_ALL);
ini_set('display_errors', '1');
Happy Bug Hunting :)


Jul 17 '05 #3

P: n/a
Will wrote:
I downloaded a PHP webcounting script from the web. I got it working on
my home test server but the same thing does not work when I put on my
hosting server.

the string that calls the script is:
<a href="webcounter.php?src=http://www.cnn.com"> CNN </a>
The code that handles it is:

$extra_ext = "redirect:";

if (basename($PHP_SELF)=="webcounter.php") {
// we are indexing a different file
$source = $_GET['src'];

$tmp = substr($source, 0, 6);

if ($tmp=='http:/' || $tmp=='https:' || $tmp=='ftp://') {
$location=$source;
$rpage = $extra_ext.$source;

}
else {
$location=$rootpage.$source;
$rpage = $extra_int.$source;
}
webcounter ($ctype,$rpage);
header ("Location: $location");
Maybe your problem is not the header call, but something on the
webcounter function ...

Try a echo() before and after the call to webcounter()

// since you're debugging this turn on error reporting too
error_reporting(E_ALL);
ini_set('display_errors', '1');

echo 'before webcounter()';
webcounter($ctype, $rpage);
echo 'after webcounter()';
header('Location: ' . $location);
exit;
}

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.