Abd
04-29-2003, 05:12 PM
Hi All,
my Application, at login stores the system time, and at logout stores system time and redirect to the login page, there after, it compute the difference in time as the Log Time, this Log Time is inserted ino the Database.
My problem is that even before login, on loading the login page it insert a time into the Database because my ASP code that handle DatedDiff and inserting is in the login page. I NEED HELP, SO THAT ON LOADING THE LOGIN PAGE IT DOES NOT INSERT INTO THE DATABASE EXCEPT IF IT WAS REDIRECTED FROM LOGOUT PAGE.
Bellow is my code;
sessionlength=DateDiff("s", session("logintime"), Now )
dim con
set con=server.CreateObject("adodb.connection")
con.Open "PROVIDER=SQLOLEDB;DATA SOURCE=ARahim4-OFS;UID=sa;PWD=;DATABASE=abdul"
dim rs
set rs = server.CreateObject("adodb.recordset") 'recordset object creation
dim sql,username
sql="INSERT INTO crmcalltime (calltime,crmuser,crmdate) VALUES (thelength,'theuser','thedate')"
sql=replace(sql,"thelength",sessionlength )
sql=replace(sql,"theuser",session("username") )
sql=replace(sql,"thedate",session("crmdate") )
rs.Open sql, con
Thanks
Abdul
my Application, at login stores the system time, and at logout stores system time and redirect to the login page, there after, it compute the difference in time as the Log Time, this Log Time is inserted ino the Database.
My problem is that even before login, on loading the login page it insert a time into the Database because my ASP code that handle DatedDiff and inserting is in the login page. I NEED HELP, SO THAT ON LOADING THE LOGIN PAGE IT DOES NOT INSERT INTO THE DATABASE EXCEPT IF IT WAS REDIRECTED FROM LOGOUT PAGE.
Bellow is my code;
sessionlength=DateDiff("s", session("logintime"), Now )
dim con
set con=server.CreateObject("adodb.connection")
con.Open "PROVIDER=SQLOLEDB;DATA SOURCE=ARahim4-OFS;UID=sa;PWD=;DATABASE=abdul"
dim rs
set rs = server.CreateObject("adodb.recordset") 'recordset object creation
dim sql,username
sql="INSERT INTO crmcalltime (calltime,crmuser,crmdate) VALUES (thelength,'theuser','thedate')"
sql=replace(sql,"thelength",sessionlength )
sql=replace(sql,"theuser",session("username") )
sql=replace(sql,"thedate",session("crmdate") )
rs.Open sql, con
Thanks
Abdul