Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > ASP > ASP Forum > มีปัญหาที่หน้า login ค่ะ รบกวนด้วยค่ะ ปัญหาคือ มันไม่ redirect ให้ค่ะ แล้วก็ไม่ยอมโชว์คำเตือนเมื่อพิมพ์ id กับ pass ผิด



 

มีปัญหาที่หน้า login ค่ะ รบกวนด้วยค่ะ ปัญหาคือ มันไม่ redirect ให้ค่ะ แล้วก็ไม่ยอมโชว์คำเตือนเมื่อพิมพ์ id กับ pass ผิด

 



Topic : 045721



โพสกระทู้ ( 4 )
บทความ ( 0 )



สถานะออฟไลน์




ปัญหาคือ มันไม่ redirect ให้ค่ะ แล้วก็ไม่ยอมโชว์คำเตือนเมื่อพิมพ์ id กับ pass ผิด

พอดีว่ามือใหม่ค่ะ ช่วยทีนะคะ

พยายามหาในบทเรียน asp แล้วก็ยังทำไม่ได้ค่ะ T T

server 2000

asp + access97

ขอบคุณค่ะ

ปอลิง S_Connection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database.mdb")


Code (ASP)
<!--#INCLUDE FILE="lib/inc/Main.inc"-->
<%

strThisPage = "admin_login.asp"
'Get Form value
strUsername =Request.Form("username")
strPassword =Request.Form("password")
Session(S_Username) = strUsername

If strUsername <> "" Then
conn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("database.mdb")
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Mode = adModeReadWrite
    Conn.Open S_Connection
    
    'Open Recordset 
	SQLStr1 = "select * from emp_table  where " & _
		" username='" & Request("username") & "'" 
        Set rs1 = Conn.Execute(sQLStr1)
        
   	    if rs1.EOF then
   	    
   	       Response.Write "<script>alert('ท่านยังไม่เคยสมัครเป็นสมาชิก');"
   	       Response.Write "</script>"
   	   else 
   	
   	SQLStr = "select * from emp_table  where " & _
		" username='" & Request("username") & "'" & _
		" and password='" &   Request("password") & "'" 
        Set rs = Conn.Execute(sQLStr)
  
   If Not RS.EOF Then

	blnPass = True
	Session("darkagent") = true
	
	Set Conn1 = Server.CreateObject("ADODB.Connection")
	Conn1.Mode = adModeReadWrite
	Conn1.Open S_connection
	strSQL1 = "SELECT * FROM query3 where emp_no = '" & rs("username")  & "'"
	Set RS1 = Server.CreateObject("ADODB.Recordset")
	RS1.Open strSQL1, Conn1, adOpenKeySet, adLockOptimistic, adCmdText
	session("emp_no") = rs1("emp_no")
	session("newcode") = rs1("newcode")
	Session("title_name") = RS1("title_name")
	session("emp_name") = rs1("emp_name")
	session("emp_position") = rs1("emp_position")

	Response.Redirect "administrator.asp"

    Else  
       'ไม่พบสมาชิก
	 blnPass = False
       Session(S_Login) = ""
       strErrorMessage = "หมายเลขประจำตัวพนักงาน หรือ รหัสผ่านไม่ถูกต้อง"
	end if

	If blnPass Then
	 	Response.Redirect strNextURL
          	
	rs.Close
          	rs1.Close
	conn.Close 
	conn1.Close 
	End If
	End If
End If
%>

<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-874"> 
<title>LOG IN</title>
<LINK REL="stylesheet" HREF="Lib/css/General.css">
<script language="JavaScript" src="Lib/js/form.js">
</script>
<style>
body{ 
 scrollbar-3dlight-color: #ffffff;
 scrollbar-arrow-color: #0000ff;
 scrollbar-track-color: #ffffff; 
 scrollbar-darkshadow-color: #ffffff; 
 scrollbar-face-color: #ffffff; 
 scrollbar-highlight-color: #1e90ff;
 scrollbar-shadow-color: #1e90ff;
}
</style>
</head>

<body>
<%If strErrorMessage <> "" Then%> 
<font size="2"> 
<br></font><div class="ErrorText" align="center"><font size="2"><%=strErrorMessage%></font></div>
<font size="2"><br>
<%End If%> </font>

<FORM METHOD="post" ACTION="<%=strThisPage%>" id=form1 name=form1>
<div align="center">
<table width="564" height="350" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="125" height="178"><span class="style2"></span></td>
    <td width="254"><span class="style2"></span></td>
    <td width="40"><span class="style2"></span></td>
    <td width="200">&nbsp;</td>
    <td width="37">&nbsp;</td>
  </tr>
  <tr>
    <td height="23"><span class="style2"></span></td>
    <td bgcolor="#FFFFCC"><span class="style2"></span></td>
    <td bgcolor="#FFFFCC"><span class="style2"></span></td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
  </tr>
  <tr>
    <td height="25"><div align="left"></div></td>
    <td bgcolor="#FFFFCC"><div align="right" class="style7 style2 style8">
		<b>
		<font face="Microsoft Sans Serif" size="2">หมายเลขประจำตัวพนักงาน  :</font> 
		</b> </div></td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
    <td bgcolor="#FFFFCC"><font face="Microsoft Sans Serif"><input name="username" style="text-align: center" size="20" maxlength="10"/></font></td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
  </tr>
  <tr>
    <td height="19">&nbsp;</td>
    <td bgcolor="#FFFFCC"><span class="style8"></span></td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
  </tr>
  <tr>
    <td height="25"><span class="style2"></span></td>
    <td bgcolor="#FFFFCC"><div align="right" class="style7 style2 style8">
		<b>
		<font face="Microsoft Sans Serif" size="2">รหัสผ่าน : </font>   </b>   </div></td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
    <td bgcolor="#FFFFCC"><font face="Microsoft Sans Serif"><input  name="password" type="password" style="text-align: center" size="20" maxlength="20"/></font></td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
  </tr>
  <tr>
    <td height="19">&nbsp;</td>
    <td bgcolor="#FFFFCC" colspan="4" height="19">&nbsp;</td>
    </TR>
  <tr>
    <td height="61">&nbsp;</td>
    <td bgcolor="#FFFFCC" colspan="4" height="61">
	<p align="center"><font face="MS Sans Serif"> 
	<INPUT TYPE="button" NAME="Button" VALUE="     Log in     " onClick="ValidateForm(this.form, this.form.Login.value, 'หมายเลขประจำตัวพนักงาน', true, 'Text',this.form.password.value, 'รหัสผ่าน', true, 'Text');" style="font-weight: 700"></font></td>
    </TR>
  <tr>
    <td height="61">&nbsp;</td>
    <td bgcolor="#FFFFCC" colspan="4" height="61">
	<p align="center">
		<b>
		<font size="2" face="Microsoft Sans Serif" color="#FF0000"><span class="style5">
		<font size="2" face="Microsoft Sans Serif">พนักงานเข้าใหม่ กรุณาติดต่อ 8350</font></span></font></b></p>
	<font size="2">
      </font></td>
    </TR>
    </TABLE>
    </div>
</FORM><DIV ALIGN="center">&nbsp;</DIV>
    
    </body>
</html>





Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-07-20 09:19:04 By : embell View : 1396 Reply : 5
 

 

No. 1



โพสกระทู้ ( 4 )
บทความ ( 0 )



สถานะออฟไลน์


หรือว่ามันจะผิดทั้งหมด - -






Date : 2010-07-20 14:59:07 By : embell
 


 

No. 2



โพสกระทู้ ( 3,144 )
บทความ ( 1 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


พอไปเขียน oop แล้วกลับมาดูแบบนี้แล้วไม่เกิดอารมณ์เลยครับ

ลองเขียนโฟวแล้วลองไล่ดูครับ ปัญหามันน่าจะเกิดจากลอจิกมากกว่าโค้ด
Date : 2010-07-20 15:12:30 By : tungman
 

 

No. 3



โพสกระทู้ ( 4 )
บทความ ( 0 )



สถานะออฟไลน์


ค่ะ ขอบคุณค่ะ T T
Date : 2010-07-20 15:22:32 By : embell
 


 

No. 4



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ลองใช้ Response.End() ในการ Debug ว่าค่าหรือ flow มันวิ่งผ่านตรงไหนบ้างครับ
Date : 2010-07-21 06:29:53 By : webmaster
 


 

No. 5



โพสกระทู้ ( 4 )
บทความ ( 0 )



สถานะออฟไลน์


ค่ะ ตอนนี้ทำผ่าน แล้วค่ะ ขอบคุณพี่ๆมากค่ะ ^3^

จะขอลง code ที่รันผ่านไว้นะคะ เผื่อคนที่กำลังมีปัญหาเหมือนกันกำลัง search หาอยู่

Code (ASP)
<!--#INCLUDE FILE="lib/inc/Main.inc"-->
<%

strThisPage = "admin_login.asp"
'Get Form value
strUsername =Request.Form("username")
strPassword =Request.Form("password")
Session(S_Username) = strUsername

If strUsername <> "" Then

   	Set Conn = Server.CreateObject("ADODB.Connection")
    	Conn.Mode = adModeReadWrite
    	Conn.open S_connection
    
   'Open Recordset 
   	SQLStr1 = "select * from emp_table  where " & _
		" username='" & Request("username") & "'" 
        Set rs1 = Conn.Execute(sQLStr1)
   	    if rs1.EOF then
   	       Response.Write "<script>alert('ท่านยังไม่เคยสมัครเป็นสมาชิก');"
   	       Response.Write "</script>"
   	   else 
   	
   	SQLStr = "select * from emp_table  where " & _
		" username='" & Request("username") & "'" & _
		" and password='" &   Request("password") & "'" 
        Set rs = Conn.Execute(sQLStr)
  
   If Not RS.EOF Then
	
	blnPass = True
	Session("darkagent") = true

	Set Conn1 = Server.CreateObject("ADODB.Connection")
	Conn1.Mode = adModeReadWrite
	Conn1.Open S_connection
	strSQL1 = "SELECT * FROM query3 where emp_no = '" & rs("username")  & "'"
	Set RS1 = Server.CreateObject("ADODB.Recordset")
	RS1.Open strSQL1, Conn1, adOpenKeySet, adLockOptimistic, adCmdText
	session("emp_no") = rs1("emp_no")
	session("newcode") = rs1("newcode")
	Session("title_name") = rs1("title_name")
	session("emp_name") = rs1("emp_name")
	session("dept_name") = rs1("dept_name")
	session("emp_position") = rs1("emp_position")

	Response.Redirect  "administrator.asp"

    Else  
       'ไม่พบสมาชิก
	 blnPass = False
       Session(S_username) = ""
       strErrorMessage = "รหัสประจำตัวพนักงาน หรือ รหัสผ่านไม่ถูกต้อง"
    End If


	If blnPass Then
	 	Response.Redirect strNextURL
          	rs.Close
          	rs1.Close
			conn.Close 
			conn1.Close 
	End If
	 end if  
End If
%>

<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-874"> 
<title>LOG IN</title>
<LINK REL="stylesheet" HREF="Lib/css/General.css">
<script language="JavaScript" src="Lib/js/form.js">
</script>
<style>
body{ 
 scrollbar-3dlight-color: #ffffff;
 scrollbar-arrow-color: #0000ff;
 scrollbar-track-color: #ffffff; 
 scrollbar-darkshadow-color: #ffffff; 
 scrollbar-face-color: #ffffff; 
 scrollbar-highlight-color: #1e90ff;
 scrollbar-shadow-color: #1e90ff;
}
</style>
</head>

<body>
<%If strErrorMessage <> "" Then%> 
<font size="2"> 
<br></font><div class="ErrorText" align="center"><font size="2"><%=strErrorMessage%></font></div>
<font size="2"><br>
<%End If%> </font>

<FORM METHOD="post" ACTION="<%=strThisPage%>" id=form1 name=form1>
<div align="center">
<table width="508" height="350" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="256">&nbsp;<p>&nbsp;</p>
	<p>&nbsp;</td>
    <td width="24"><span class="style2"></span></td>
    <td width="128">&nbsp;</td>
    <td width="99">&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFCC"><span class="style2"></span></td>
    <td bgcolor="#FFFFCC"><span class="style2"></span></td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFCC"><div align="right" class="style7 style2 style8">
		<b>
		<font face="Microsoft Sans Serif" size="2">หมายเลขประจำตัวพนักงาน  :</font> 
		</b> </div></td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
    <td bgcolor="#FFFFCC"><font face="Microsoft Sans Serif"><input name="username" style="text-align: center" size="20" maxlength="10"/></font></td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFCC"><span class="style8"></span></td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFCC"><div align="right" class="style7 style2 style8">
		<b>
		<font face="Microsoft Sans Serif" size="2">รหัสผ่าน : </font>   </b>   </div></td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
    <td bgcolor="#FFFFCC"><font face="Microsoft Sans Serif"><input  name="password" type="password" style="text-align: center" size="20" maxlength="20"/></font></td>
    <td bgcolor="#FFFFCC">&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFCC" colspan="4" height="19">&nbsp;</td>
    </TR>
  <tr>
    <td bgcolor="#FFFFCC" colspan="4" height="61">
	<p align="center"><font face="MS Sans Serif"> 
	<INPUT TYPE="button" NAME="Button" VALUE="     Log in     " onClick="ValidateForm(this.form, this.form.username.value, 'หมายเลขประจำตัวพนักงาน', true, 'Text',this.form.password.value, 'รหัสผ่าน', true, 'Text');" style="font-weight: 700"></font></td>
    </TR>
  <tr>
    <td colspan="4" height="61">
	<p align="center">
		&nbsp;</p>
	<p align="center">
		<b>
		<font size="2" face="Microsoft Sans Serif" color="#FF0000">
		<span class="style5">
		<font size="2" face="Microsoft Sans Serif">พนักงานเข้าใหม่ กรุณาติดต่อ 8350</font></span></font></b></p>
	<p align="center">
		&nbsp;<a href="default.html">กลับหน้าหลัก</a></p>
	<p align="center">
		&nbsp;</p>
	</td>
    </TR>
    </TABLE>
    </div>
</FORM><DIV ALIGN="center">&nbsp;</DIV>
    
    </body>
</html>


Date : 2010-07-21 09:58:16 By : embell
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : มีปัญหาที่หน้า login ค่ะ รบกวนด้วยค่ะ ปัญหาคือ มันไม่ redirect ให้ค่ะ แล้วก็ไม่ยอมโชว์คำเตือนเมื่อพิมพ์ id กับ pass ผิด
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่