Jump to content

  •  

  • Tutorial info Visit support topic

    • Added on: Apr 07 2011 09:32 AM
    • Views: 694
     


    * * * * *
    0 Ratings

    Logging Authentication

    Posted by Kenny Kanashimi Chu on Apr 07 2011 09:32 AM
    How to stay logged in your own custom page. If you have a forum at yoursite.com/forum and you need a user to stay logged in at yoursite.com, you simply use this code and your member will be stay logged in until the sign-out button is pressed. Useful, if you don't want to display the logging page.

    <?php
    /***************************************************************************
    *
    ***************************************************************************/
    
    if (isset($_COOKIE["member_id"])) {
    	if ($_COOKIE["member_id"] == 0) {
    
    echo "<form action='http://chatngo.co.cc/chat/index.php?app=core&amp;module=global&amp;section=login&
    amp;do=process' method='post' name='LOGIN' id='login'>
    <strong>Username</strong>: <input id='username' type='text' name='username' size='25' /><br />
    <strong>Password</strong>: <input id='password' type='password' name='password' size='25' /><br />
    Remember Me? <input class='checkbox' type='checkbox' name='CookieDate' value='1' checked='checked' /><br />
    <input class='button' type='submit' name='submit' value='Log In' />
    </form><br />
    <a href='/forum/index.php?act=Reg'>Register</a>";
    	}
    	else { // Content that shows up if logged in
    echo "header( 'You are logged in.' )";
    	}
    }
    else {
    
    echo "<form action='/forum/index.php?act=Login&CODE=01' method='post' name='LOGIN' target='_top'>
    <strong>Username</strong>: <input type='text' size='25' maxlength='64' name='UserName' /><br />
    <strong>Password</strong>: <input type='password' size='25' name='PassWord' /><br />
    Remember Me? <input class='checkbox' type='checkbox' name='CookieDate' value='1' checked='checked' /><br />
    <input class='button' type='submit' name='submit' value='Log In' />
    </form><br />
    <a href='/forum/index.php?act=Reg'>Become a Member!</a>";
    }
    ?>

    Powered by Tutorials 1.4.1 © 2012, by Michael McCune