If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > carrying id user

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-13-04, 01:22
ayu ayu is offline
Registered User
 
Join Date: Apr 2004
Location: Malaysia
Posts: 25
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.
Reply With Quote
  #2 (permalink)  
Old 04-13-04, 01:39
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
you could store it in a session variable. that would solve your problem....
Reply With Quote
  #3 (permalink)  
Old 04-13-04, 02:23
Riax Riax is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 04-13-04, 03:04
ayu ayu is offline
Registered User
 
Join Date: Apr 2004
Location: Malaysia
Posts: 25
error in retrieve database

Quote:
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
Reply With Quote
  #5 (permalink)  
Old 04-13-04, 03:09
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
can you post the code you are using. then we could see what is causing the error.
Reply With Quote
  #6 (permalink)  
Old 04-13-04, 22:45
ayu ayu is offline
Registered User
 
Join Date: Apr 2004
Location: Malaysia
Posts: 25
Post sending code

Quote:
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>
Reply With Quote
  #7 (permalink)  
Old 04-13-04, 22:51
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
but where are you setting Session("loginid")??
Reply With Quote
  #8 (permalink)  
Old 04-13-04, 22:55
ayu ayu is offline
Registered User
 
Join Date: Apr 2004
Location: Malaysia
Posts: 25
Lightbulb

Quote:
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
Reply With Quote
  #9 (permalink)  
Old 04-13-04, 23:12
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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.
Reply With Quote
  #10 (permalink)  
Old 04-14-04, 03:37
ayu ayu is offline
Registered User
 
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
Reply With Quote
  #11 (permalink)  
Old 04-14-04, 21:15
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
*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?
Reply With Quote
  #12 (permalink)  
Old 04-16-04, 04:16
ayu ayu is offline
Registered User
 
Join Date: Apr 2004
Location: Malaysia
Posts: 25
TQ

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


Quote:
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On