비밀번호 변경하기 > 기술자료 | 해피정닷컴

비밀번호 변경하기 > 기술자료

본문 바로가기

사이트 내 전체검색

비밀번호 변경하기 > 기술자료

PHP 비밀번호 변경하기

페이지 정보


본문

##### passwd.php #####

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html>
<head>
<title>비밀번호 변경</title>
<meta http-equiv='Content-Type' content='text/html; charset=euc-kr'>
<script type='text/javascript' language='javascript'>
 function check(form)
 {
  if(form.name.value.length < 1)
  {
   alert('이름을 입력하셔야 합니다.');
   form.name.focus();
   return false;
  }
  if(form.id.value.length < 1)
  {
   alert('아이디를 입력하셔야 합니다.');
   form.id.focus();
   return false;
  }
  if(form.password.value.length < 4)
  {
   alert('비밀번호는 최소 4자이상 입력하셔야 합니다.');
   form.password.focus();
   return false;
  }
 }  
</script>
</head>

<body>
<form name='form' onSubmit='return check(this);' method='post' action='passwd_or.php' enctype='multipart/form-data'>
<table width="590" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="35" bgcolor="#f7f7f7" class="contents_indent">이 름(*)</td>
    <td><input type='text' class='input' name='name' value='' /></td>
  </tr>
  <tr>
    <td width="140" height="35" bgcolor="#f7f7f7" class="contents_indent">아이디(*)</td>
    <td><input type='text' class='input' name='id' value='' /></td>
  </tr>
  <tr>
    <td height="35" bgcolor="#f7f7f7" class="contents_indent">비밀번호(*)</td>
    <td><input type='text' class='input' size='15' maxlength='15' name="password" /></td>
  </tr>
  <tr>
    <td align="center" colspan="2">
      <input type='submit' value='변경' class='input' style='cursor:pointer' />
      <input type='button' value='취소' onclick='self.close()' class='input' style='cursor:pointer' />
    </td>
  </tr>
</table>
</form>
</body>
</html>


##### dbconfig.php #####

<?php
global $host, $user, $pw, $dbname;
$db_host = "디비서버주소";
$db_user = "아이디";
$db_pass  = "비밀번호";
$db_name = "데이타베이스";
@mysqli_connect($db_host, $db_user, $pass) or die(mysqli_error());
@mysqli_select_db($db_name) or die(mysqli_error());
$dbconn = mysqli_connect($db_host, $db_user, $db_pass, $db_name);
?>


##### passwd_ok.php #####
<?php
include "dbconfig.php";
$member_id = $_POST['id'];
$member_name = $_POST['name'];
$new_pass = crypt(trim($_POST['password']));

$query = "select * from zavi_member where member_id='{$member_id}' and member_name = '{$member_name}'";
$result = mysqli_query($dbconn, $query);
$error = mysqli_num_rows($result);
//echo $error;
if($error == ""){
  echo "
 <script type='text/Javascript'>
 <!--
   alert('자료가 없습니다.\\n관리자에게 문의 하시기 바랍니다.');
   history.back();
 //-->
 </script>
 ";
 //echo"자료가 없습니다";
}
else {
//echo "자료가 있습니다."; 

  $query2 = "update zavi_member set
    member_pass='{$new_pass}'
    where  member_id='{$member_id}' ";    // 글 작성날짜 ->  필드명: date  ==  함수명 : now()
  //echo $query2;

  mysqli_query($dbconn, $query2);
  echo "<script type='text/javascript'>alert('변경 하였습니다.'); self.close();</script>";

}
?>


참고자료
http://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=qna_db&wr_id=132843

댓글목록

등록된 댓글이 없습니다.


Total 196건 7 페이지
  • RSS
기술자료 목록
76
PHP   16337  2010-08-21 09:37 ~ 2014-10-06 00:00  
75
PHP   22220  2010-07-21 21:47 ~ 2024-03-22 08:47  
74
PHP   22273  2010-07-10 15:48 ~ 2021-01-03 22:59  
73
PHP   27820  2010-04-13 23:06  
72
PHP   26209  2010-03-24 18:51 ~ 2022-09-27 10:16  
열람
PHP   19260  2010-03-21 12:30 ~ 2020-11-15 19:34  
70
PHP   19545  2010-03-18 22:00 ~ 2016-03-17 00:00  
69
PHP   20984  2010-03-16 22:11 ~ 2020-02-08 11:51  
68
PHP   26173  2010-03-08 19:42 ~ 2010-03-08 00:00  
67
PHP   38228  2009-10-23 02:37 ~ 2015-05-26 00:00  
66
PHP   23536  2009-10-21 19:46 ~ 2009-10-21 00:00  
65
PHP   15915  2009-10-14 11:12  
64
PHP   17649  2009-10-10 10:00 ~ 2017-05-19 00:00  
63
PHP   23663  2009-09-09 22:42  
62
PHP   15258  2009-08-25 20:51  
61
PHP   15587  2009-08-25 20:50  
60
PHP   25319  2009-08-25 20:46 ~ 2020-04-08 11:35  
59
PHP   46028  2009-08-21 01:29 ~ 2017-08-03 00:00  
58
PHP   12979  2009-08-06 22:35  
57
PHP   16308  2009-07-22 18:49  

검색

해피정닷컴 정보

회사소개 회사연혁 협력사 오시는길 서비스 이용약관 개인정보 처리방침

회사명: 해피정닷컴   대표: 정창용   전화: 070-7600-3500   팩스: 042-670-8272
주소: (34368) 대전시 대덕구 대화로 160 대전산업용재유통단지 1동 222호
개인정보보호책임자: 정창용   사업자번호: 119-05-36414
통신판매업신고: 제2024-대전대덕-0405호 [사업자등록확인]  
Copyright 2001~2025 해피정닷컴. All Rights Reserved.