Guest User

Untitled

a guest
Jun 7th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. <?
  2. @session_start();
  3. ?>
  4.  
  5. <?
  6. // 이전화면에서 이름이 입력되지 않았으면 "이름을 입력하세요"
  7. // 메시지 출력
  8. if(!$_POST['id']) {
  9. echo("
  10. <script>
  11. window.alert('아이디를 입력하세요.')
  12. history.go(-1)
  13. </script>
  14. ");
  15. exit;
  16. }
  17.  
  18. if(!$_POST['pass']) {
  19. echo("
  20. <script>
  21. window.alert('비밀번호를 입력하세요.')
  22. history.go(-1)
  23. </script>
  24. ");
  25. exit;
  26. }
  27.  
  28. include "../lib/dbconn.php";
  29.  
  30. $sql = "SELECT * FROM user_info WHERE user_id='{$_POST['id']}';";
  31. $result = $conn->query($sql);
  32.  
  33. $num_match = $result->num_rows;
  34.  
  35.  
  36. if(!$num_match)
  37. {
  38. echo("
  39. <script>
  40. window.alert('등록되지 않은 아이디입니다.')
  41. history.go(-1)
  42. </script>
  43. ");
  44. }
  45. else
  46. {
  47.  
  48. $row = $result->fetch_assoc();
  49.  
  50. $db_pass = $row['et_pw'];
  51.  
  52. if($_POST['pass'] != $db_pass)
  53. {
  54. echo("
  55. <script>
  56. window.alert('비밀번호가 틀립니다.')
  57. history.go(-1)
  58. </script>
  59. ");
  60.  
  61. exit;
  62. }
  63. else
  64. {
  65. $userid = $row['user_id'];
  66. $username = $row['user_name'];
  67. $usercheck = $row['admin_check'];
  68.  
  69. $_SESSION['userid'] = $userid;
  70. $_SESSION['username'] = $username;
  71. $_SESSION['usercheck'] = $usercheck;
  72.  
  73. header('location:../index.html');
  74. }
  75. }
  76. ?>
Add Comment
Please, Sign In to add comment