asimryu

login.php - 1

Jan 4th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $userid = "";
  4. $userpw = "";
  5. if( isset( $_POST['userid'] ) ) {
  6. $userid = $_POST['userid'];
  7. }
  8. if( isset( $_POST['userpw'] ) ) {
  9. $userpw = $_POST['userpw'];
  10. }
  11. if( $userid && $userpw ) {
  12. include("../dbcon.php");
  13. $userpws = md5($userpw);
  14. $sql = "select * from users ";
  15. $sql .= " where userid='{$userid}'";
  16. $sql .= " and userpw='{$userpws}'";
  17. if( $rs = $db->query($sql) ){
  18. if( $user = $rs->fetch() ) {
  19. $_SESSION['userid'] = $user['userid'];
  20. $_SESSION['username'] = $user['username'];
  21. }
  22. }
  23. }
  24. header("Location: index.php");
Add Comment
Please, Sign In to add comment