Results 1 to 2 of 2

Thread: Login System

  1. #1
    Join Date
    Jan 2014

    Login System

    Hi guys,
    I'm creating a login system and there is one small bug that I am trying to iron out, so any input is appreciated
    Once I log out as a user, I get redirected to my login page like:
    Now that I am logged out, if I try to "bypass" the login page and go straight to the index.php page (without logging in this time), I can still access the "secure" page (..not that secure, and I get the following message:

    Notice: Undefined index: status in /Applications/MAMP/htdocs/login-form/classes/membership.php on line 32

    Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/login-form/classes/membership.php:32) in /Applications/MAMP/htdocs/login-form/classes/membership.php on line 33
    You are Logged In User!!!!
    Log Out


    This is the code in membership.php (please see towards the end I have marked the link 32 where I get the notice & warning message)

    PHP Code:
    require 'mysql.php';


    $mysql = New Mysql();
    $ensure_credentials $mysql->verify_Username_and_Pass($unmd5($pwd));
    // if credentials returns true, log in to index page
    if($ensure_credentials) {
    $_SESSION['status'] ='authorized';
    header("location: index.php");
                } else return 
    "Please enter a correct username and password";

    log_User_Out() {
    setcookie(session_name('Mylogin'), ''time() - 1000);
    confirm_Member(){   // This is Line 32 where I am Getting the Notice Error
    $_SESSION['status'] !='authorized') { 
    header("location: login.php");            //////////////// I think that this is the issue, instead this should be returning "True", but what is the syntax?

    The code in my login.php page is:

    require_once 'classes/membership.php';
    $membership = new Membership();
    //if clicked on log out link on index page
    if(isset($_GET['status']) && $_GET['status'] == 'loggedout'){
    //validate user
    if($_POST && !empty($_POST['username']) && !empty($_POST['pwd'])){
        $response = $membership->validate_user($_POST['username'], $_POST['pwd']);
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <meta http-equiv="Content-Type" content="text/html; charset=uft-8" />
           <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
    <script type="text/javascript">
                $('<span class="exit"> X</span>').appendTo('h4.alert');
        <div id="login">
            <form method="post" action="">
                <h2>Login <small>enter your credentials</small></h2>
                    <label for="name">Username: </label>
                    <input type="text" name="username" />
                    <label for="pwd">Password: </label>
                    <input type="password" name="pwd" />
                <p><input type="submit" id="submit" value="login" name="submit" /></p>
            <?php if (isset($response)) echo "<h4 class='alert'>".$response."</h4> "; ?>

    Any advise please?

    Attached Images Attached Images

  2. #2
    Join Date
    Mar 2007
    session_start() should be the very first item your page has in all pages that use the sessions object.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles