Posts

Showing posts from December, 2017

Logout Using PHP

<?php // Inialize session session_start(); // Delete certain session unset($_SESSION['email']); unset($_SESSION['id']); // Delete all session variables session_destroy(); // Jump to login page echo '<script type="text/javascript">';  echo 'window.location.href = "index.php";'; echo '</script>';  ?>

Login Using PHP

<?php session_start(); include("config.php"); // or connection here ?> <?php if(isset($_POST['btn_login'])) {  $query="select * from admin_login where email='".$_POST['email']."' and password='".$_POST['password']."' ";  $res=mysqli_query($con,$query) or die(mysql_error($con)); if(mysqli_num_rows($res)>0)       {              $row=mysqli_fetch_array($res);             extract($row);                              //session_start();            $_SESSION['id']=$row['id'];           $_SESSION['email']=$row['email'];                                  ...