php simple login script - Mostlikers

29 July, 2013

php simple login script

This coding I explain about login concept from user side. User give the correct username its post through the database to check available user allowed and pass the value in session else field display on login error msg. coding make on php and mysql querys.


 Create below database file:            

CREATE TABLE `singup` (
`username` VARCHAR( 25 ) NOT NULL ,  
`password` VARCHAR( 25 ) NOT NULL
INSERT INTO users VALUES ('Mostlikers', '12345');


Design below form to post value in database its check the available username and password its matched on database Display the username else username or password error message.

    $check=mysql_query("SELECT * FROM signup WHERE username='$user'
    and password='$pwd' ");
        $msg="Login Sucessful"; 
        $msg="Invalide username";
<div class="login">
<form name="form" method="post">
<p>Email<br />
<input type="text" name="user" title="username"  />
<p>Password<br />
<input type="password" name="password" title="password"  />
<p><input type="submit" value="login" title="submit" name="submit" />
<p><?php if(isset($_POST['submit']))
{ echo $msg; } ?>

No comments:

Post a comment