묻고답하기

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 남기남
금순이 php 폼메일 질문. 고수님들 도와주세요. 소스첨부  
Seeker 출력될 소스를 편집하여 재출력할 수 있나요? [1] 2007.08.10
김만갑 php질문입니다..(__)도와주세요.. [1] 2007.08.10
Jizon Pain 글자크기 고정관련 질문  
김만갑 어디 html코딩한 자료 구할 곳 없을까요?(psd)도 같이.. [1] 2007.08.10
띠웅~ 홈페이지 질문입니다..급질!! [2] 2007.08.10
qwert 폰트에 관한 질문입니다.(다른 컴퓨터로 보면 글씨가 이상합니다.) [1] 2007.08.10
DaDa™ windows , APM 에서 부팅시 APM이 자동실행되게 하는방법? [3] 2007.08.10
조한웅 폴더에 업로드 한 이미지를 슬라이드쇼로 보는 방법......  
영이 phpmyadmin 에서 디비 생성하려구 하는데 이런 에러가 뭔 말인가여?  
ⓜario君™ 외부 링크 막기는 어떻게...?  
ecstatic 링크 색상 다르게 지정하기  
정태호 플레시에서 링크 문제 입니다. [1] 2007.08.10
경문규 MYSQL DB 압축???  
차정우 select 폼 테두리 설정하는 것좀 알려주세요.  
장진철 바로가는거태그 알려주세요.. [1] 2007.08.10
왜 그러지 head는 나오는데...foot는 안 보이나요... [3] 2007.08.10
쪼이~ [급질문!] 아이프레임을 할때 플래시 메뉴는?? [2] 2007.08.10
경문규 mysql_close(); 를 쓸대와 안쓸때의 성능차이. [6] 2007.08.10
장상재 내용의 길이에 따라... 백그라운드 이미지가 늘어나게... [1] 2007.08.10
김정철 플래시 넘실거리는 이미지  
조상현 이메일발송 웹프로그래밍에대해서 질문하고 싶습니다. [1] 2007.08.10
강민석 단일 건 입력이 아닌 여러건 입력이 가능한 폼은 어떻게 만드는지 궁금합니다. [2] 2007.08.10
펠렌 자바 스크립트 오류에 관해.. [5] 2007.08.10
두부찌개 정말 이상한현상 [1] 2007.08.10
최민식 http://www.aurora2005.co.kr/ 에서 처럼 팝업창 마음데로 움직이고 늘리고 줄이고 하는 소스 [2] 2007.08.10
J&C PHP에서 특정날짜의 목록 추출 [1] 2007.08.10
한샘아빠 로그인할 때 엔터가 안먹혀요...  
카카로트 상세지도 보기를 하려면...  
승훈 IP차단하기 (특정아이피만 제외) [1] 2007.08.10