Posted by Rik on 10/08/55 11:56
paullefil wrote:
> I have 3 files on my website
>
> tes1.php :
> <?php
> require_once("test2.php");
>
> if ($_GET['redirige'] == 1)
> {
> @header( "Location: http://www.mydomain.com/test3.php" );
> }
> else
> {
> echo "it's test1.php";
> }
>>
>
> and test2.php (one file without php code !)
>
> <?php
>>
>
> and test3.php :
>
> <?php
> print "it's test3.php";
>>
>
> Now if you load :
> http://www.mydomain.com/test1.php
> (it's written "it's test1.php")
>
> Now if you load :
> http://www.mydomain.com/test1.php?redirige=1
>
> The result is a blank page but normally you will be redirect to
> http://www.mydomain.com/test3.php with "it's test3.php" written.
>
> Now in the test1.php file, you delete the ligne
> require_once("test2.php");
> So your test1.php file is :
>
> <?php
> if ($_GET['redirige'] == 1)
> {
> @header( "Location: http://www.mydomain.com/test3.php" );
> }
> else
> {
> echo "on affiche test1.php";
> }
>>
>
> Now if you load :
> http://www.mydomain.com/test1.php
> (it's written "it's test1.php")
>
> Now if you load :
> http://www.mydomain.com/test1.php?redirige=1
>
> The result is a OK you are redirect to
> http://www.mydomain.com/test3.php with "it's test3.phpp" written.
>
> Could you help me, where is the bug ?
Probably a space/newline/something outside <?php ?> in test2.php.
Try this in test1.php:
ini_set('display_errors',1);
error_reporting(E_ALL);
Which will probably tell you headers are already sent by test2.php
Grtz,
--
Rik Wasmus
[Back to original message]
|