FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


redirect(append_sid()); - need help !





Summer
When I entered this into a page .

redirect(append_sid("$url", true));

It says "Redirection Limit exceeded , this maybe due to cookies blocked " when loading although I allowed all the cookies .

Is my code correct ? or Is there another way to link the user to $url ?
SystemWisdom
I use something like the following in my PHP code:

Code:

    function PageRedirect( $szLocation = 'self' )
    { 
        $szDomainName = strlen($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
$szFullDomain = ($_SERVER['SERVER_PORT'] == '443') ? 'https://'.$szDomainName : 'http://'.$szDomainName;

        if( !headers_sent() )
        {   $szBaseDir = str_replace( '/', '', $szFullDomain );

            if( strlen(dirname($_SERVER['PHP_SELF'])) > 2 )
                $szBaseDir .= dirname($_SERVER['PHP_SELF']);

            session_write_close();
            if( $szLocation == 'self' )
                header('location: ' . $szBaseDir . $_SERVER['PHP_SELF'] );
            else
                header('location: ' . $szBaseDir . '/' . $szLocation );
            exit;
        }else
        {   trigger_error( 'Developer Error: Failed to Redirect Page ('.$szLocation.').  Page Headers already sent!', E_USER_WARNING );
        }
        return;
    }
ml
if your having problems with redirect() you should pst the source code for this function or at least give the name of the class declaring it.

you can also check php reference for header() and look for header("Location: ...");
misterdimiz
You can simply use one of these script:

PHP:

Code:
<?

$url="http://www.yoursite.com";


header("Location: $url");


?>


JS:

Code:
<script LANGUAGE="JavaScript">

location = "http://www.yoursite.com";

</script>
Summer
Thanks .
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.