Search

Friday, October 29, 2010

simple login system using php

login system is very common in php. In this post you can get an idea to make a login system in php. Before the starting the coding for login system you have to check what you want to represent to the user on login panel. You have to use some CSS to give better look for login panel.

here is php code for login system :

// first we check the name of submit button is set or not
if(isset($_POST['submit']))
{
   $name = $_POST['username'];
   $pass = $_POST['password'];

// check the value of input box
   if($name == "")
       echo 'Name field is empty!';
   elseif($pass == "")
       echo 'Password filed is empty!';
   else
   {

      // temporary username and password
      $uname = 'user1';
      $upass = '12345';

      if($name == $uname && $pass == $upass)
         echo 'Welcome : ' . $uname;
      else
         echo 'Username or Password didn't match!';

   }
}

You can change username and password as you want. It just a idea for login system. Hope it will help you to develop a login system.

No comments:

Related Posts Plugin for WordPress, Blogger...