게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
php 회원정보 불러오기 질문드립니다.!!
게시물ID : programmer_17316짧은주소 복사하기
작성자 : 귀두
추천 : 0
조회수 : 576회
댓글수 : 0개
등록시간 : 2016/05/22 10:43:25
옵션
  • 본인삭제금지
로그인 처리코드
<?
           session_start();
?>
<meta charset="utf-8">
<?
  $id = $_POST['id'];
  $pass = $_POST['pass'];
  $name = $_POST['name'];
  $nick = $_POST['nick'];
  $level = $_POST['level'];
   // ����ȭ�鿡�� �̸��� �Էµ��� �ʾ����� "�̸��� �Է��ϼ���"
   // �޽��� ����
   if(!$id) {
     echo("
           <script>
             window.alert('���̵��� �Է��ϼ���.')
             history.go(-1)
           </script>
         ");
         exit;
   }
   if(!$pass) {
     echo("
           <script>
             window.alert('���й�ȣ�� �Է��ϼ���.')
             history.go(-1)
           </script>
         ");
         exit;
   }
   include "../lib/dbconn.php";
   $sql = "select * from member where id='$id'";
   $result = mysql_query($sql, $connect);
   $num_match = mysql_num_rows($result);
   if(!$num_match)
   {
     echo("
           <script>
             window.alert('���ϵ��� ���� ���̵��Դϴ�.')
             history.go(-1)
           </script>
         ");
    }
    else
    {
        $row = mysql_fetch_array($result);
        $db_pass = $row[pass];
        if($pass != $db_pass)
        {
           echo("
              <script>
                window.alert('���й�ȣ�� Ʋ���ϴ�.')
                history.go(-1)
              </script>
           ");
           exit;
        }
        else
        {
           $id = $row[id];
         $name = $row[name];
         $nick = $row[nick];
         $level = $row[level];
           $_SESSION['id'] = $_POST['id'];
           $_SESSION['name'] = $_POST['name'];
           $_SESSION['nick'] = $_POST['nick'];
           $_SESSION['level'] = $_POST['level'];
           $_SESSION['pass'] = $_POST['pass'];
           $_SESSION['hp1'] = $_POST['hp1'];
           $_SESSION['hp2'] = $_POST['hp2'];
           $_SESSION['hp3'] = $_POST['hp3'];
           $_SESSION['email1'] = $_POST['email1'];
           $_SESSION['email2'] = $_POST['email2'];
 
           echo("
              <script>
                location.href = '../index.php';
              </script>
           ");
        }
   }
?>
회원정보에 회원정보 뿌려주는 코드
<?
    session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<link href="../css/common.css" rel="stylesheet" type="text/css" media="all">
<link href="../css/member.css" rel="stylesheet" type="text/css" media="all">
<script>
   function check_id()
   {
     window.open("check_id.php?id=" + document.member_form.id.value,
         "IDcheck",
          "left=200,top=200,width=250,height=100,scrollbars=no,resizable=yes");
   }
   function check_nick()
   {
     window.open("check_nick.php?nick=" + document.member_form.nick.value,
         "NICKcheck",
          "left=200,top=200,width=250,height=100,scrollbars=no,resizable=yes");
   }
   function check_input()
   {
      if (!document.member_form.pass.value)
      {
          alert("���й�ȣ�� �Է��ϼ���");
          document.member_form.pass.focus();
          return;
      }
      if (!document.member_form.pass_confirm.value)
      {
          alert("���й�ȣȮ���� �Է��ϼ���");
          document.member_form.pass_confirm.focus();
          return;
      }
      if (!document.member_form.name.value)
      {
          alert("�̸��� �Է��ϼ���");
          document.member_form.name.focus();
          return;
      }
      if (!document.member_form.nick.value)
      {
          alert("�г����� �Է��ϼ���");
          document.member_form.nick.focus();
          return;
      }
      if (!document.member_form.hp2.value || !document.member_form.hp3.value )
      {
          alert("�޴��� ��ȣ�� �Է��ϼ���");
          document.member_form.nick.focus();
          return;
      }
      if (document.member_form.pass.value !=
            document.member_form.pass_confirm.value)
      {
          alert("���й�ȣ�� ��ġ���� �ʽ��ϴ�.\n�ٽ� �Է����ּ���.");
          document.member_form.pass.focus();
          document.member_form.pass.select();
          return;
      }
      document.member_form.submit();
   }
   function reset_form()
   {
      document.member_form.id.value = "";
      document.member_form.pass.value = "";
      document.member_form.pass_confirm.value = "";
      document.member_form.name.value = "";
      document.member_form.nick.value = "";
      document.member_form.hp1.value = "010";
      document.member_form.hp2.value = "";
      document.member_form.hp3.value = "";
      document.member_form.email1.value = "";
      document.member_form.email2.value = "";
      document.member_form.id.focus();
      return;
   }
</script>
</head>
<?
    include "../lib/dbconn.php";
    $sql = "select * from member where id='$id'";
    $result = mysql_query($sql, $connect);
    $row = mysql_fetch_array($result);
    $hp = explode("-", $row[hp]);
    $hp1 = $hp[0];
    $hp2 = $hp[1];
    $hp3 = $hp[2];
    $email = explode("@", $row[email]);
    $email1 = $email[0];
    $email2 = $email[1];
    mysql_close();
?>
<body>
<div id="wrap">
  <div id="header">
    <? include "../lib/top_login2.php"; ?>
  </div>  <!-- end of header -->
  <div id="menu">
 <? include "../lib/top_menu2.php"; ?>
  </div>  <!-- end of menu -->
  <div id="content">
 <div id="col1">
  <div id="left_menu">
<?
   include "../lib/left_menu.php";
?>
  </div>
 </div> <!-- end of col1 -->
 <div id="col2">
        <form  name="member_form" method="post" action="modify.php">
  <div id="title">
   <img src="../img/title_member_modify.gif">
  </div>

  <div id="form_join">
   <div id="join1">
   <ul>
   <li>* 아이디</li>
   <li>* 비밀번호</li>
   <li>* 비밀번호 확인</li>
   <li>* 이름</li>
   <li>* 닉네임</li>
   <li>* 전화번호</li>
   <li>&nbsp;&nbsp;&nbsp;*이메일</li>
   </ul>
   </div>
   <div id="join2">
   <ul>
   <li><?= $_SESSION['id'] ?></li>
   <li><?=$_SESSION['pass'] ?><input type="password" name="pass"></li>
   <li><?=$_SESSION['pass'] ?><input type="password" name="pass_confirm"></li>
   <li><?= $_SESSION['name'] ?></li>
   <li><div id="nick1"><?= $_SESSION['nick']?><input type="text" name="nick"></div><div id="nick2" ><a href="#"><img src="../img/check_id.gif" onclick="check_nick()"></a></div></li>
   <li><?= $_SESSION['hp1]']?><input type="text" class="hp" name="hp1">
             - <?= $_SESSION['hp2]']?><input type="text" class="hp" name="hp2"> - <?= $_SESSION['hp3]']?><input type="text" class="hp" name="hp3"></li>
   <li><?= $_SESSION['email1]']?><input type="text" id="email1" name="email1"> @ <?= $_SESSION['hp3]']?><input type="text" name="email2"></li>
   </ul>
   </div>
   <div class="clear"></div>
   <div id="must"> * 필수 입력 사항입니다.^^</div>
  </div>
  <div id="button"><a href="#"><img src="../img/button_save.gif"  onclick="check_input()"></a>&nbsp;&nbsp;
                   <a href="#"><img src="../img/button_reset.gif" onclick="reset_form()"></a>
  </div>
     </form>
 </div>
  </div>
</div>
</body>
</html>
 
이렇게 짰는데요 회원정보 페이지에 들어가보면 id 랑 비밀번호는 세션값을 받아서 화면에 나오는데
그이외에 닉네임 이름 전화번호 이메일 얘네들이 화면에 안나오는데
닉네임 ,이름 ,전화번호 ,이메일 하는방식을 id랑 똑같이했는데 왜이런걸까요??
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호