묻고답하기

php초보 입니다..

아이디 비번 똑같이 다 쳤는데 로그인이 안되요.. ㅠㅠ  근데 회원가입 해서 등록하면 그 자료는 member에 들어가요 ;;; ㅠㅠ 왜 그러는지 ;; ㅠ
뭐가 틀렸나요?? ㅠㅠ 답변 부탁드립니다.  ㅠㅠ

제 생각엔 session.php  와 login_engine.php 가 이상한거 같은 ;; ㅠㅠ 근데 다른게 문제면 ㅠㅠ


로그인은 안되는데.. -_-a  회원가입해서 등록하면 그 자료는 member에 들어가요 ;;; ㅠㅠ 왜 그러지 ;; ㅠ

뭐가 틀렸나요?? ㅠㅠ 답변 부탁드립니다.  ㅠㅠ


멤버 테이블입니다

CREATE TABLE member(

count integer notnull auto_increment,
name varchar(10) NOT NULL,
id varchar(16) NOT NULL,
passwd varchar(16) NOT NULL,
email varchar(30) NOT NULL,
home varchar(50),
memo varchar(100),
PRIMARY KEY(count)

);



데타계정은 임의로 바꾸었어요.

dbcon.php      

<?
/////데이터베이스 연결계정 정의 시작///////
$db_hostname="localhost";
$db_username="aaaa";
$db_password="aaaa";
$dbname = "aaaa";
/////데이터베이스 연결계정 정의 끝///////

$sock = mysql_connect($db_hostname,$db_username,$db_password)
  or die ("데이터베이스 서버에 연결할 수 없습니다.");
$db = mysql_select_db($dbname,$sock)
  or die ("'$dbname' 데이터베이스를 찾을 수 없거나 접근권한이 없습니다.");
?>



session.php   // 이게 뭐죠?? 이거 때문에.. 그런거 같기도 하고.ㅠㅠ

<?
session_start();
$session_userid=$HTTP_SESSION_VARS["session_userid"];
if (!session_is_registered ("session_userid")) session_register("session_userid");
$session_auth=$HTTP_SESSION_VARS["session_auth"];
if (!session_is_registered ("session_auth")) session_register("session_auth");
?>
<p> </p>



login_form.php   (문제의 로그인 ;; ㅠㅠ 왜 안되는지 .ㅠㅠ OTL)


<?
include_once("session.php");
include_once("dbcon.php");

if ($session_userid!="") {
echo "
<script>
location.replace('login_success.php');
</script>
";
die;
}
?>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<link href="../global.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br>
<br>
<table width="183" border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#EBDBF2" style="border:0px #333333 solid;border-top-width:3px;">
  <tr>
    <td><b>로그인</b></td>
    <td align="right"> </td>
  </tr>
</table>
<br>
<table width="183" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><a href="add_form.php">[회원가입]</a></td>
  </tr>
</table>
<br>
<form action="login_engine.php" method="post" name="login_form" id="login_form" style="margin:0px;" onSubmit="return checkForm(this.form);">
  <table width="183" border="0" align="center" cellpadding="0" cellspacing="1">
    <tr>
      <td width="74" align="right" bgcolor="#EFD8F1"> <font color="#FF0000">*</font>
         아이디</td>
      <td width="106" bgcolor="#E8E8E8"> <input name="id" type="text" id="id" size="8" style="border:1px #333333 solid;width:100px;height:20px;" maxlength="8">
      </td>
    </tr>
    <tr>
      <td align="right" bgcolor="#EFD8F1" width="74"> <font color="#FF0000">*</font>
         암호</td>
      <td bgcolor="#E8E8E8" width="106"> <input name="passwd" type="password" id="passwd" size="8" style="border:1px #333333 solid;width:100px;height:20px;" maxlength="8">
      </td>
    </tr>
  </table>
  <br>
  <table width="183" height="15" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#EBDBF2" style="border:0px #333333 solid;border-bottom-width:3px;">
    <tr>
      <td align="center">
<input type="submit" name="Submit" value="인증">
        <input type="reset" name="Reset" value="취소">
      </td>
    </tr>
  </table>
</form>
<script>
function checkForm(theForm) {
if (theForm.id.value=="") {
  alert("아이디를 입력하십시오.");
  theForm.id.focus();
  return false;
} else {
  return true;
}
}
</script>
</body>
</html>



login_engine.php  (여기에 보면 userid 도 있고;  $session_userid 도 있는데 ;;; 다 뭔지 ;; ㅠㅠ )

<?
include_once("/session.php");
include_once("/dbcon.php");

$sql = "select * from member where id='$userid'";
$res = mysql_query($sql);
if ($res) $rs = mysql_fetch_array($res);

if ($rs[userid]==$userid && $userid!="") {//아이디 일치
if ($rs[password]==md5($password)) {//암호 일치
  $session_userid = $rs[userid];//인증완료
  echo "
  <script>
  location.replace('login_success.php');
  </script>
  ";
} else {//암호오류
  echo "
  <script>
  alert('[인증실패] 암호가 올바르지 않습니다.');
  location.replace('login_form.php');
  </script>
  ";
}
} else {//아이디 오류
echo "
  <script>
  alert('[인증실패] 아이디가 올바르지 않습니다.');
  location.replace('login_form.php');
  </script>
  ";
}
?>




login_success.php  (로그인을 성공하면 이화면이 나와야 해요. ㅠㅠ)


<?
include_once("session.php");
include_once("dbcon.php");

$sql = "select * from member where id='$session_userid'";
$res = mysql_query($sql);
if ($res) $rs = mysql_fetch_array($res);

if ($session_userid=="" || $rs[id]=="") {
$session_userid=="";
echo "
<script>
location.replace('login_form.php');
</script>
";
die;
}
?>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<link href="/global.css" rel="stylesheet" type="text/css">
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br>
<br>
<table width="183" border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#EBDBF2" style="border:0px #333333 solid;border-top-width:3px;">
  <tr>
    <td><b>인증완료</b></td>
    <td align="right"> </td>
  </tr>
</table>
<br>
<form name="login_form" id="login_form" style="margin:0px;">
  <table width="183" height="50" border="0" align="center" cellpadding="5" cellspacing="1">
    <tr>
      <td align="center" bgcolor="#E8E8E8"><b>"<? echo $rs[name];?>[<? echo $rs[id];?>]"</b>님
        <br>환영합니다.</td>
    </tr>
  </table>
  <br>
  <table width="184" height="40" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#EBDBF2" style="border:0px #333333 solid;border-bottom-width:3px;">
    <tr>
      <td align="center" width="184">
        <table border="0" cellspacing="0" cellpadding="0" width="184">
          <tr>
            <td width="76"><input type="button" name="Button" value="로그아웃" onClick="location.replace('logout.php');"></td>
            <td width="108"><input type="button" name="Button" value="회원정보수정" onClick="self.location='edit_form.php';"></td>
          </tr>
                    <tr>
            <td width="76"><input type="button" name="Button" value="암호변경" onClick="self.location='change_password_form.php';"></td>
            <td width="108">
                            <p align="center"><input type="button" name="Button" value="탈퇴" onClick="if (confirm('정말로 탈퇴하시겠습니까?rnrn탈퇴하시면 개인정보보호정책에 따라 회원정보가 완전히 삭제됩니다.')) location.replace('/resign.php');"></td>
                    </tr>
        </table> </td>
    </tr>
  </table>
</form>
</body>
</html>







logout.php (로그아웃)

<?
include_once("session.php");

$session_userid = "";//인증해제
echo "
<script>
location.replace('login_form.php');
</script>
";
?>
글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
승훈 IP차단하기 (특정아이피만 제외) [1] 2007.08.10
일반인 홈에 투표창좀 달아주실분 ㅠㅠㅠ [1] 2007.08.10
Nam Kim 외부로그인과 게시판을통한 로그인 질문이요...  
정대남 외부로그인 만들어서 삽입시겨주실분요 [2] 2007.08.10
황영미 php질문] 왜 로그인이.. 안될까요?? 아이디, 비번 다 있는거 쳤는데..ㅠㅠ 소스 포함 [1] 2007.08.10
조승희 이미지가 깨져요. 도와주세요...ㅜㅡ  
박형준 페이지 배경설정  
강민혁 php게시판에 html 허용 금지 [1] 2007.08.10
치우 윈엠프, 방송 상태 에 질문입니다.  
서민규 다음페이지로 넘어가는 버튼 [2] 2007.08.10
서민규 하위 폴더에 있는 폴더를 불러오는 프로그래밍  
Sam Kim image 에서 map 을 이용한 하이퍼링크 질문드립니다  
함종태 PHP질문입니다.(MYSQL도...) [1] 2007.08.10
장철희 나모 질문드립니다 선배님들 부탁드려요.. [5] 2007.08.10
uhae 색채우는거 밖으로 안번지게 채우는법좀 알려주세요;; [1] 2007.08.10
도로도로 PHP 에서 변수값이 지정되지 않았을경우...? [6] 2007.08.10
dauphin3 페이지 오류 에러 메시지가 나옵니다..  
podo 홈페이지내의 문서를 검색하는 검색창...  
붉은빛노을 음악 파일에서 아이콘을 클릭하면 다운받는게 아니라 재생하는 법을 알고 싶습니다 [1] 2007.08.10
조현웅 이 홈페이지 처럼 만들 수 있는 방법 없을까요?  
유진 새창을 가운데 뜨게 하는 방법을 알고 싶어요  
Morningdew 이거 대체 어떻게 하는거죠?  
박재진 메인이미지 디자인..  
김복용 여기 nzeo사이트에 보면 XML 이라는 곳이 있는데요...그게 왜 있는건가요?? [1] 2007.08.10
조성주 이미지 맵이 링크가 안걸립니다. [2] 2007.08.10
윤소영 홈페이지 새창으로 띄우기..  
동글이 홈페이지에서 신청서 폼 만드는 법 질문드려요 [2] 2007.08.10
최성이 마우스 (오른쪽버튼) 우클릭 키다운시에~  
엠피매니아 embed 에서 동영상 불러올때 플레이버튼을 눌러야 파일을 읽는 방법 없나요?  
최일랑 자바 기초 관련질문인데염..