Jump to content

Recommended Posts

I used var page=document.location.search.substring(5)

 

But the I need to call the page variable into the location function.  Here's my code:

var page=document.location.search.substring(5)
        if(page==undefined) {
            location='gateway.php';
        }
        else { location="page"; }

 

How do I get it to output the value of page instead of http://mydomain.com/page


Let me repost my full code.

<?php
    if(isset($HTTP_COOKIE_VARS["resolution"])) {
        if(!isset($_GET

)) {
            header("Location: gateway.php");
        }
        else { header("Location: $_GET

"); }
    }
    else {
?>
<script language="javascript">
    <!--
    writeCookie();
    function writeCookie() {
        var today=new Date();
        var the_date=new Date("December 31, 2023");
        var the_cookie_date=the_date.toGMTString();
        var the_cookie="resolution="+ screen.width +"x"+ screen.height;
        var the_cookie=the_cookie + ";expires=" + the_cookie_date;
        document.cookie=the_cookie
        
        var page=document.location.search.substring(5)
        if(page==undefined) {
            location='gateway.php';
        }
        else { location=page; }
    }
    //-->
</script>
<?php
    }
?>

 

This code mostly works, the page variable in the javascript works great, but the line

"else { location=page; }"

doesn't work right.  It's output in the address bar is http://mydomain.com/=res_maint.php.

 

res_maint.php is what the page variable is set to, but it's putting in that "=" and causing the browser to not find the page.  How can I fix this?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.