Results 1 to 12 of 12
  1. #1
    Join Date
    Apr 2004
    Location
    Malaysia
    Posts
    25

    Unanswered: carrying id user

    In my case, when user open the page, they have to login. Then they can go to 2'nd and 3td page. My problem is I want to carry the user id to every page they want to open so that their detail will be retrieve. For example, after login it goes to biadata.asp and will view the user detail. From this page user can go to family.asp page and view their family detail automatically without search their login again.

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    you could store it in a session variable. that would solve your problem....

  3. #3
    Join Date
    Mar 2004
    Posts
    16
    use this in login page

    session("userid") = loginid

    and in the next pages you can directly retrive the id as

    getid = session("userid")

    where loginid : the id u got from login page

  4. #4
    Join Date
    Apr 2004
    Location
    Malaysia
    Posts
    25

    error in retrieve database

    Originally posted by rokslide
    you could store it in a session variable. that would solve your problem....
    when i change my filtering url parameter to session variable, i get error in retrieve data from database

  5. #5
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    can you post the code you are using. then we could see what is causing the error.

  6. #6
    Join Date
    Apr 2004
    Location
    Malaysia
    Posts
    25

    Post sending code

    Originally posted by rokslide
    can you post the code you are using. then we could see what is causing the error.
    <form action="borangcuti.asp" method="get" name="form1">
    ( this command is use in my index file. After login they should go to borangcuti.asp)


    MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
    If (Request.QueryString <> "") Then
    MM_editAction = MM_editAction & "?" & Request.QueryString
    End If
    ( this command is where the action take place )

    <%
    Dim Recordset2__MMColParam
    Recordset2__MMColParam = "1"
    If (Session("loginid") <> "") Then
    Recordset2__MMColParam = Session("loginid")
    End If
    %>
    <%
    Dim Recordset2
    Dim Recordset2_numRows

    Set Recordset2 = Server.CreateObject("ADODB.Recordset")
    Recordset2.ActiveConnection = MM_Maklumatku_STRING
    Recordset2.Source = "SELECT * FROM staffIT WHERE nostaffuitm = '" + Replace(Recordset2__MMColParam, "'", "''") + "'"
    Recordset2.CursorType = 0
    Recordset2.CursorLocation = 2
    Recordset2.LockType = 1
    Recordset2.Open()

    Recordset2_numRows = 0
    %>

    Error Type:
    ADODB.Field (0x800A0BCD)
    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
    /cuti/borangcuti.asp, line 244


    This is line 244 <td width="27%"> <input name="kc" type="text" id="kc" value="<%=(Recordset2.Fields.Item("kelayakancuti") .Value)%>" size="5">
    hari</td>
    </tr>

  7. #7
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    but where are you setting Session("loginid")??

  8. #8
    Join Date
    Apr 2004
    Location
    Malaysia
    Posts
    25

    Lightbulb

    Originally posted by rokslide
    but where are you setting Session("loginid")??
    where should i put the session("loginid". is it in my index page or burangcuti

  9. #9
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    you are submiting to you burangcuti to valid the user yes?? if this is the case then that is where you should set it. if you are validating the user in the login page and then redirecting to burangcuti then you should set it in the login page.

  10. #10
    Join Date
    Apr 2004
    Location
    Malaysia
    Posts
    25

    Unhappy

    I send my coding from burangcuti.asp and in did my validate in this file.

    <% session("userid") = loginid
    %>
    <%
    Dim Recordset2__MMColParam
    Recordset2__MMColParam = "1"
    If (Session("userid") <> "") Then
    Recordset2__MMColParam = Session("userid")
    End If
    %>
    <%
    Dim Recordset2
    Dim Recordset2_numRows

    Set Recordset2 = Server.CreateObject("ADODB.Recordset")
    Recordset2.ActiveConnection = MM_Maklumatku_STRING
    Recordset2.Source = "SELECT * FROM staffIT WHERE nostaffuitm = '" + Replace(Recordset2__MMColParam, "'", "''") + "'"
    Recordset2.CursorType = 0
    Recordset2.CursorLocation = 2
    Recordset2.LockType = 1
    Recordset2.Open()

    It is what u mean. But I still get error hen retrieve the data form table


    Error Type:
    ADODB.Field (0x800A0BCD)
    Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
    /cuti/borangcuti.asp, line 246

  11. #11
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    *sigh* okie look....

    here is your total flow of logic,.... you have to make you pages work in this manner....

    1. show login page
    2. user submits login page which points to burangcuti
    3. burangcuti requests username and password data from the login page
    4. burangcuti validates username and password
    5. if validation succeed then set the session variable to the login id
    6. if the validation fails redirect back to the login page with login error
    7. if the validation has succeeded you should now be able to run your query

    now, which bits have you implemented. Which bits do you know how to implement? what do you need help with?

  12. #12
    Join Date
    Apr 2004
    Location
    Malaysia
    Posts
    25

    TQ

    Thank u for your help. It solve my problem....


    Originally posted by Riax
    use this in login page

    session("userid") = loginid

    and in the next pages you can directly retrive the id as

    getid = session("userid")

    where loginid : the id u got from login page

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •