Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("header.php");
- $username = "";
- $userid = "";
- $userpw = "";
- if( isset($_POST['username']) )
- $username = $_POST['username'];
- if( isset($_POST['userid']) )
- $userid = $_POST['userid'];
- if( isset($_POST['userpw']) )
- $userpw = $_POST['userpw'];
- //print_r($_POST);
- if( $username && $userid && $userpw ) {
- $password = md5($userpw);
- $joindate = date("Y-m-d H:i:s");
- $ip = $_SERVER['REMOTE_ADDR'];
- $sql = "insert into users(username, userid, userpw, joindate, ip) values(:username, :userid, :userpw, :joindate, :ip)";
- $rs = $db->prepare($sql);
- $rs->bindParam(":username", $username);
- $rs->bindParam(":userid", $userid);
- $rs->bindParam(":userpw", $password);
- $rs->bindParam(":joindate", $joindate);
- $rs->bindParam(":ip", $ip);
- if( $rs->execute() ) {
- $join = true;
- } else {
- $join = false;
- }
- }
- ?>
- <h2>회원가입</h2>
- <?php if( $join ):?>
- <h3><?php echo $username;?>님 축하합니다.</h3>
- <a href="/" class="btn btn-primary">메인페이지로</a>
- <?php else: ?>
- <h3>회원가입 실패</h3>
- <a href="/" class="btn btn-primary">메인페이지로</a>
- <a href="/join.php" class="btn btn-warning">회원가입 다시 하기</a>
- <?php endif ?>
- <?php
- include("footer.php");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement