Sunday, 24 May 2015

login logout page with database

 Login.php
=============================== 
 <?php                    include 'connection.php';                      if(isset($_POST['login'])){$username=$_POST["username"];   $pass=$_POST["pass"];      $selquery=mysql_query("SELECT username ,password,id 
FROM registration WHERE username='$username' AND password='$pass'");         $fetch_data=mysql_fetch_array($selquery);                 $n=mysql_num_rows($selquery);         echo $n;         if($n==1)         {
             $_SESSION["username"]=$fetch_data["username"];             $_SESSION["id"]=$fetch_data["id"];                           header("Location:ordersummery.php");             die();                   }}
 
================================================= 
logout.php
=================================================
<?php         session_start();
      unset($_SESSION['username']);        header("Location:index.php");

?>

No comments:

Post a Comment