Advertisement
Guest User

login.php

a guest
Jun 13th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.42 KB | None | 0 0
  1.  
  2.  
  3. <?php
  4.  
  5. include '../inc/config.php';
  6.  
  7. if($_POST)
  8. {
  9.  
  10. $username = stripslashes($_POST['user1']);
  11. $password = stripslashes($_POST['pass1']);
  12.  
  13. $result = mysql_query("SELECT * FROM admin where admin_name = '$username' and admin_pass = '$password'");
  14.   if($result){
  15.     $num_row = mysql_num_rows($result);
  16.     if($num_row > 0){
  17. while($row = mysql_fetch_array($result)){
  18.     if(
  19.         $row['admin_name'] == $username and $row['admin_pass'] == $password
  20.         )
  21.         {session_start();
  22.                 $_SESSION['sesadmin'] = $row['admin_name'];
  23.                 $_SESSION['sspass'] = $row['admin_pass'];
  24.                 echo "<div class='alert alert-success' id='shadow'><i class='icon-ok-sign'></i> تم تسجيل الدخول , جاري التحويل</div><meta http-equiv='refresh' content='1;url=page.php'/>";
  25.         }
  26.         else
  27.                 {
  28.                         echo "عذرا , تأكد من ملعومات تسجيل الدخول";
  29.                 }
  30. }
  31. }
  32. }
  33.   mysql_close();
  34.  
  35. }
  36. else {
  37.     echo '<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  38. <title>تسجيل الدخول</title><form action="" method="post">
  39.        <input type="text" name="user1" placeholder="أدخل اسم المستخدم">
  40.        <br>
  41.        <input type="text" name="pass1" placeholder="أدخل كلمه السر">
  42.        <br>
  43.        <input type="submit" name="sign" value="تسجيل دخول" />
  44. </form>';
  45. }
  46.  
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement