Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Some fresh eyes and help please
Old 04-01-2005, 02:53 PM Some fresh eyes and help please
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
Hi all,

Ive got a asp page that checks login that is giving me some problems.

The page is called after login. It checks access db for a valid record. Does this fine. I then wish to write the login to another table to enable tracking of clients. The code I am using is just not working. Nothing is being written to the table. I have tried 2 methods of writing to the db , using INSERT and conn.execute and a RS SELECT with update. Niether are working.
I think this is something that fresh eyes may solve.

Ill hasten to say that this is a new table I have created. So as no confusion , my field names in the table are in capital letter and so is the table name PNETLOGGED. I resorted to capitalising as my original table used lower and upper case. I thought this might confuse .. not sure.

Anyway. The code is below. section that is not working is the RSlogged.Open with RSlogged.Update... the INSERT code that i used is also commented out there.
(ps I am not getting any errors either..... and the login check is working properly so i know accessing the table.... code is actually the same as registration code.. all i have done though that is different is build a new table and change the field names in the code below .. this is why absolutely baffled and wander about the table.)

This is really buggin me. Ive been looking at for hours now and just cant get through it.

Any help or ideas would really be appreciated.

cheers.

Code:

<%
Set Conn = Server.CreateObject("ADODB.Connection") 
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Dat a Source=" & Server.MapPath("db/database.mdb")

dim Conn,RS,RSlogged,SQL,userEmail
username = request("username")
password = request("password") 

SQL = "SELECT * FROM tb_user WHERE is_ava = 1 and loginName = '" & username & "' AND password = '" & password & "'"


Set RS = Conn.Execute(SQL)

  if not (RS.EOF and RS.BOF) then
    ' User Login Success
    Session("userID") = RS("ID")
	Session("loginname") = RS("loginname")
    userEmail = RS("emailAddress") 
	
	if RS("privilege") = 2 then
		Session("adminID") = 2
	end if 
	Conn.close
	Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Dat a Source=" & Server.MapPath("db/database.mdb")

	'Set RSlogged = Server.CreateObject("ADODB.RecordSet")
	
	RSlogged.Open "Select * FROM PNETLOGGED", Conn, adOpenDynamic, adLockPessimistic, adCMDText

	RSlogged.AddNew
	RSlogged("PNETID") = "1"
	RSlogged("PNETUSERNAME") = "Stephen"
	RSlogged("PNETEMAIL") = "ssmason@gmail.com"
 
	RSlogged.Update
	
	'insertSQL = "INSERT INTO pnets_logged(pnetID, loginName, emailAddress) values('"&Session("userID")&"', '"&Session("loginname")&"', '"&userEmail&"')"
	
	'conn.Execute(insertSQL)
	Response.Redirect "PNETindex.asp" 
  else
    ' Login Fail
	response.write ("<script>alert('Invalid username or password. Please try again!');window.history.back();</script>")
  end if
  
  
%>
<%
Conn.close
set RS   = nothing
RSlogged = nothing
set Conn = nothing
%>
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
 
Register now for full access!
Reply     « Reply to Some fresh eyes and help please
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.08312 seconds with 12 queries