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.

Member Avatar for LastMitch

@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

commented: To Rectify what some retard did to LastMitch +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.