Advertisement
asimryu

join_ok.php

Aug 2nd, 2017
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.22 KB | None | 0 0
  1. <?php
  2. include("header.php");
  3. $username = "";
  4. $userid = "";
  5. $userpw = "";
  6. if( isset($_POST['username']) )
  7.     $username = $_POST['username'];
  8. if( isset($_POST['userid']) )
  9.     $userid = $_POST['userid'];
  10. if( isset($_POST['userpw']) )
  11.     $userpw = $_POST['userpw'];
  12. //print_r($_POST);
  13.  
  14. if( $username && $userid && $userpw ) {
  15.     $password = md5($userpw);
  16.     $joindate = date("Y-m-d H:i:s");
  17.     $ip = $_SERVER['REMOTE_ADDR'];
  18.     $sql = "insert into users(username, userid, userpw, joindate, ip) values(:username, :userid, :userpw, :joindate, :ip)";
  19.     $rs = $db->prepare($sql);
  20.     $rs->bindParam(":username", $username);
  21.     $rs->bindParam(":userid", $userid);
  22.     $rs->bindParam(":userpw", $password);
  23.     $rs->bindParam(":joindate", $joindate);
  24.     $rs->bindParam(":ip", $ip);
  25.     if( $rs->execute() ) {
  26.         $join = true;
  27.     } else {
  28.         $join = false;
  29.     }
  30. }
  31. ?>
  32. <h2>회원가입</h2>
  33.  
  34. <?php if( $join ):?>
  35.     <h3><?php echo $username;?>님 축하합니다.</h3>
  36.     <a href="/" class="btn btn-primary">메인페이지로</a>
  37. <?php else: ?>
  38.     <h3>회원가입 실패</h3>
  39.     <a href="/" class="btn btn-primary">메인페이지로</a>
  40.     <a href="/join.php" class="btn btn-warning">회원가입 다시 하기</a>
  41. <?php endif ?>
  42.  
  43. <?php
  44. include("footer.php");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement