Creating a second login page that automatically logs in the user

Posted by nsilva on Stack Overflow See other posts from Stack Overflow or by nsilva
Published on 2012-09-24T07:49:36Z Indexed on 2012/11/14 11:01 UTC
Read the original article Hit count: 273

Filed under:
|
|

I have a login page as follows:

<form action="?" method="post" id="frm-useracc-login" name="frm-useracc-login" >

    <div id="login-username-wrap" >

        <div class="login-input-item left">

            <div class="div-search-label left">

                <div id="div-leftheader-wrap">

                    <p class="a-topheader-infotext left"><strong>Username: </strong></p>

                </div>

            </div>

            <div class="login-input-content left div-subrow-style ui-corner-all">

                <input type="text" tabindex="1" name="txt-username" id="txt-username" class="input-txt-med required addr-search-input txt-username left">

            </div>

        </div>

    </div>

    <div id="login-password-wrap" >

        <div class="login-input-item left">

            <div class="div-search-label left">

                <div id="div-leftheader-wrap">

                    <p class="a-topheader-infotext left"><strong>Password: </strong></p>

                </div>

            </div>

            <div class="login-input-content left div-subrow-style ui-corner-all">

                <input type="password" tabindex="1" name="txt-password" id="txt-password" class="input-txt-med required addr-search-input txt-password left">

            </div>

        </div>

    </div>

    <div id="login-btn-bottom" class="centre-div">

        <div id="login-btn-right">

            <button name="btn-login" id="btn-login" class="btn-med ui-button ui-state-default ui-button-text-only ui-corner-all btn-hover-anim btn-row-wrapper left">Login</button>
            <button name="btn-cancel" id="btn-cancel" class="btn-med ui-button ui-state-default ui-button-text-only ui-corner-all btn-hover-anim btn-row-wrapper left">Cancel</button><br /><br />

        </div>

    </div>

</form>

And here my session.controller.php file:

Click Here

Basically, what I want to do is create a second login page that automatically passes the value to the session controller and logs in. For example, if I go to login-guest.php, I would put the default values for username and password and then have a jquery click event that automatically logs them in using $("#btn-login").trigger('click');

The problem is that the session controller automatically goes back to login.php if the session has timed out and I'm not sure how I could go about achieving this. Any help would be much appreciated!

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery