Просмотр файла catalogdeep/input.php

Размер файла: 1.63Kb
  1. <?php
  2. include "init/config.php";
  3. //include "init/functions.php";
  4. session_start();
  5. $item = isset($_GET['item']) ? $_GET['item'] : (isset($_GET['item']) ? $_GET['item'] : "");
  6. switch($item){
  7. case 'enter':
  8. $login = mysql_escape_string(htmlspecialchars(trim($_REQUEST['login'])));
  9. $password = mysql_escape_string(htmlspecialchars(trim($_REQUEST['password'])));
  10. $error = '';
  11. $sql = mysql_query("SELECT * FROM `cat_users` WHERE `login` = '".$login."';");
  12. $ent = mysql_fetch_assoc($sql);
  13. if(($ent['password'] == $password) AND ($ent['login'] == $login)){
  14. SetCookie("login",$email,time()+3600);
  15. SetCookie("password",$password,time()+3600);
  16. header("Location: http://".$_SERVER['SERVER_NAME']."/mpanel.php");
  17. }else{
  18. header("Location: http://".$_SERVER['SERVER_NAME']."/mpanel.php?error");
  19. }
  20.  
  21. break;
  22.  
  23. case 'aenter':
  24. if(isset($_POST['alogin']) AND isset($_POST['apasswd'])){
  25. if(($_POST['alogin'] == ALOGIN) AND ($_POST['apasswd'] == APASSWORD)){
  26. $_SESSION['alogin'] = $_POST['alogin'];
  27. $_SESSION['apasswd'] = $_POST['apasswd'];
  28. header("Location: http://".$_SERVER['SERVER_NAME']."/adminpanel/index.php?");
  29. }else{
  30. header("Location: http://".$_SERVER['SERVER_NAME']."/adminpanel/index.php?item=error");
  31. }
  32. }else{
  33. header("Location: http://".$_SERVER['SERVER_NAME']."/adminpanel/index.php");
  34. }
  35. break;
  36. case 'exit':
  37. SetCookie("email","");
  38. SetCookie("password","");
  39. if(isset($_SESSION['apasswd']) AND isset($_SESSION['alogin'])){
  40. unset($_SESSION['apasswd']);
  41. unset($_SESSION['alogin']);
  42. }
  43. header("Location: http://".$_SERVER['SERVER_NAME']."/");
  44. break;
  45.  
  46. default:
  47. header("Location: http://".$_SERVER['SERVER_NAME']."/");
  48. }
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66. ?>