ASP LogIn Problem, can you help me???

Discussion in 'HTML & Website Design' started by meao007, Nov 13, 2006.

  1. #1
    I face a problem for ASP Login Script. There are two pages index.asp and login.asp, but after login I do not see the LOGOUT text, I see LOGIN again. So can you please tell me , where have I done mistake?

    Index.asp
    Codes:

    <html>

    <head>

    <title>¿¡ÇÁµðÀÌ(FDE)</title>

    </head>

    <body bgcolor="black" text="black" link="#000066" vlink="#000066" alink="#660033">
    <table border="0" width="977" align="center" bgcolor="#CCCCCC">
    <tr>
    <td width="967" colspan="2" height="34">
    <p> <b><font color="#330066">Welcome to FDE world! This is all yours.</font></b></p>
    </td>
    </tr>
    <tr>
    <td width="804" height="100">
    <p align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="804" height="100">
    <param name="movie" value="menu bar.swf">
    <param name="play" value="true">
    <param name="loop" value="true">
    <param name="quality" value="high">
    <embed width="804" height="100" src="menu bar.swf" play="true" loop="true" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object></p>
    </td>
    <td width="212" height="119">

    <p align="right">
    <%
    if session("id")="" then

    %>

    <a href="join.asp">Join</a>
    <a href="login.asp">Login</a>



    <% else %>
    <%=Session("id")%> <a href="logout.asp">Logout</a><% End If %>
    </p>

    </td>
    </tr>
    <tr>
    <td width="800" height="600">

    <table width=800 border="0" cellspacing="0" cellpadding="0" height=600>
    <tr>
    <td width=800 height="600">
    <iframe src="Introduction.asp" height="600" scrolling=auto frameborder=0
    name=main width="800" height="600" align=center leftmargin="0" topmargin="0"
    marginheight="0" marginwidth="0"></iframe>
    </td>
    </tr>
    </table>
    </td>
    <td width="212" height="600">

    <P style="line-height:130%; margin-top:0; margin-bottom:0;"> &nbsp;</p>
    </td>
    </tr>
    <tr>
    <td width="1012" height="25" colspan="2">
    <p style="margin-top:0;">&nbsp;&nbsp;<a href="education.asp" target="main">Education</a>&nbsp;&nbsp;<a href="Branch Office.asp" target="main">Branch Off</a>&nbsp;&nbsp;<a href="partnership.asp" target="main">Partnership Relation Ship</a>&nbsp;&nbsp;<a href="trade Section.asp" target="main">Trade Section</a><a href="introduction.asp" target="main"></a></p>
    </td>
    </tr>
    <tr>
    <td width="1012" colspan="2" height="66">
    <p style="line-height:130%; margin-top:0; margin-bottom:0;"><font size="1">&nbsp;Address : <span style="line-height:130%; margin-top:0; margin-bottom:0;">Chiram-dong ,Jinju-si, Gyeongsangnam-do, Korea </span>506-46 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Business&nbsp;Number : 613-81-41198</font></p>
    <P style="line-height:130%; margin-top:0; margin-bottom:0;"> <font size="1">&nbsp;Tel : 82-55-761-1243&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<a href="mailto:fde@hushmail.com">fde@hushmail.com</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Chaire&nbsp;man's E-mail : ruku@hanmir.com</font></p>
    <p style="line-height:130%; margin-top:0; margin-bottom:0;"> <font size="1">Manager : Kim&nbsp;Sung&nbsp;Dong ( Mike&nbsp;Kim )</font></p>
    </td>
    </tr>
    </table>
    </body>

    </html>

    login.asp
    Codes:
    <!--#include file="xt_login.asp"-->

    <HTML>
    <HEAD>
    <TITLE>&#47196;&#44536;&#51064;</TITLE>

    </HEAD>

    <BODY>
    <%
    If cnt > 0 Then
    Response.write "&#45796;&#51020; &#49324;&#54637;&#51012; &#45796;&#49884; &#54869;&#51064;&#54616;&#44256; &#47196;&#44536;&#51064; &#54616;&#49464;&#50836;<br>"
    For i = 1 To cnt
    %>
    <font size="2" color="red"><%=msg(i)%></font><br>
    <%
    Next
    End if
    %>


    <form method="post" action="index.asp">
    <input type="hidden" name="validate" value="1">
    <table>
    <tr>
    <td>id : </td><td><input type="text" name="id"> </td>
    </tr>
    <tr>
    <td>pw : </td><td><input type="text" name="pw"></td>
    </tr>
    <tr>
    <td>&nbsp;</td><td><input type="submit" value="&#47196;&#44536;&#51064;"></td>
    </tr>
    </table>
    </form>
    </BODY>
    </html>


    please send me , where is the problem that I do not see the LogOut after LogIn.

    Thanks
    Meao007
     
    meao007, Nov 13, 2006 IP
  2. j0ned

    j0ned Active Member

    Messages:
    684
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Not sure how it works with ASP, but I know in coldfusion the logout feature does not automatically appear jsut because you're logged in. I make a link similar to: index.cfm?logout=yes

    then use a cfif to check for yes

    <cfif IsDefined("URL.logout")>
    <cfif URL.logout EQ yes>
    <cflogout>
    </cfif>
    </cfif>

    something like that... I'm sure ASP is similar - you manually have to insert the code for the 'logout' feature.
     
    j0ned, Nov 14, 2006 IP
  3. DatR

    DatR Peon

    Messages:
    210
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    it doesnt look like you set the session variable with the id so it always holds true that session("id") is "" which displays the login. The way it looks as you have the form on login.asp and index.asp just requests the id passed from the form.

    If thats the case you should check the request. So:
    
    <p align="right">
    <% 
    if request("id")="" then
    %>
    <a href="join.asp">Join</a>
    <a href="login.asp">Login</a>
    <% else %>
    <%=Request("id")%> <a href="logout.asp">Logout</a><% End If %>
    </p>
    
    Code (markup):
    this to me is not right way to code it either though. To set a session variable in ASP you do something like:

    <%
    Session("username")="Donald Duck"
    Session("age")=50
    %>
    Welcome <%Response.Write(Session("username"))%>

    as you see you have to say Session("id") = something which you never do and thats why it is "" always.

    So the form should maybe go back to login.asp and say:

    Session("id") = Request("id")
    Response.Redirect index.asp

    Then when it gets to index.asp session("id") should have the proper value

    PM me or write back if you need more details
     
    DatR, Nov 14, 2006 IP