0

i want to save the value of there username and password in field. so that next time they only have to hit login.
so i only have one file for login page.
login.php
//html code

<form  id='login' action='login.php' method='POST'>
 <input type="text" name="username" id="login_username" class="login_field" value="" />
 <input type="password" name="password" id="login_password" class="login_field" value=""/>
 <input type="checkbox" name="remember" id="login_remember" value="yes" />
 <button type="submit">Log in</button> 
</form>




//php code
<!-- Connect -->
//in side my header.php i have include connect, session...
<?php
    include("include/header.php");
?>

<!-- REMEMBER PASSWORD SCRIPT-->
<?php
    if(isset($_COOKIE['save'])) 
    {
    $user_name_c = $_COOKIE['save']['username']; 
    $password_c = $_COOKIE['save']['password']; 
    $query = "SELECT * FROM login WHERE username = '$username' AND password = '$password'"; 
    $result = mysql_query($query); 

    if(mysql_num_rows($result)) 
    { 
        $_SESSION['loggedin'] = 1; 

        header('Location:index.php'); 
        exit(); 
    }  
    }
?>

this doesnt save the value. also i want to make sure iam iam on right track. or should i try some thing different.

2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by LastMitch
4

@hwoarang69

this doesnt save the value. also i want to make sure iam iam on right track. or should i try some thing different.

The reason why it didn't save because of this:

$_COOKIE['save']

$_SESSION['loggedin'] = 1; 

http://php.net/manual/en/reserved.variables.cookies.php

http://php.net/manual/en/reserved.variables.session.php

Those term doesn't work anymore!

You need to find another login/logout script.

Try this:

http://php.about.com/od/finishedphp1/ss/php_login_code.htm

Edited by LastMitch: grammer

Votes + Comments
To Rectify what some retard did to LastMitch
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.