Author |
Topic  |
Davio
Development Team Member
    
Jamaica
12217 Posts |
Posted - 01 December 2001 : 02:01:17
|
I was working in another program with 2 browser windows open in the background, with Snitz. An error message popped up and said that this program has made some error and that it will be closed. It was IE it was reffering to. So I clicked close and it closed my 2 browser windows. I instantly opened back my browser to the active.asp page, hopening I won't lose my last login time. But it was taking a really loooong time to load the page. I just stopped it. When I looked at the date, it said "Last Visit on 12 January 2001 00:07:13"!!!!
So it was loading all the topics that has been posted since the beginning of the year. I am guessing the cookie might have been corrupted or damaged when IE caused that error. Just clicked the mark All topics as read button to fix it.
But this was a first.
- David |
|
Davio
Development Team Member
    
Jamaica
12217 Posts |
Posted - 01 December 2001 : 02:11:48
|
Actually, I am seeing the problem over at HuwR's forum. Thier posts are being posted as January 12. I guess it's because we are in the first day of the 12th month, that the forum is interpreting the date wrong?
But it seems this forum isn't being affected by it. 
- David |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 01 December 2001 : 02:19:28
|
I fixed it on this forum. I was seeing the same thing. My Last Here Date was in January instead of December. |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 01 December 2001 : 02:23:44
|
I changed the ReadLastHereDate function in inc_functions.asp from this:
function ReadLastHereDate(UserName) dim TempLastHereDate dim rs_date dim strSql ' if UserName = "" then ' exit function ' end if if not isDate(strForumTimeAdjust) then strForumTimeAdjust = strToDate(strForumTimeAdjust) end if '## Forum_SQL strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.M_LASTHEREDATE " strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS " strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS."&Strdbntsqlname&" = '" & ChkString(UserName, "SQLString") & "' " Set rs_date = Server.CreateObject("ADODB.Recordset") rs_date.open strSql, my_Conn if (rs_date.BOF and rs_date.EOF) then TempLastHereDate = DateAdd("d",-10,strForumTimeAdjust) else TempLastHereDate = StrToDate(rs_date("M_LASTHEREDATE")) if TempLastHereDate = "" or IsNull(TempLastHereDate) then TempLastHereDate = DateAdd("d",-10,strForumTimeAdjust) end if end if rs_date.close set rs_date = nothing '## Forum_SQL - Do DB Update strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS " strSql = strSql & " SET M_LASTHEREDATE = '" & DateToStr(strForumTimeAdjust) & "'" strSql = strSql & ", M_LAST_IP = '" & Request.ServerVariables("REMOTE_ADDR") & "'" strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS." & strDBNTSQLName & " = '" & ChkString(UserName, "SQLString") & "' " my_conn.Execute (strSql) ReadLastHereDate = DateToStr(TempLastHereDate) end function
to this:
function ReadLastHereDate(UserName) dim TempLastHereDate dim rs_date dim strSql ' if UserName = "" then ' exit function ' end if if not isDate(strForumTimeAdjust) then strForumTimeAdjust = strToDate(strForumTimeAdjust) end if '## Forum_SQL strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.M_LASTHEREDATE " strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS " strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS." & strDBNTSQLName & " = '" & ChkString(UserName, "SQLString") & "' " Set rs_date = Server.CreateObject("ADODB.Recordset") rs_date.open strSql, my_Conn if (rs_date.BOF and rs_date.EOF) then ReadLastHereDate = DateToStr(DateAdd("d",-10,strForumTimeAdjust)) else TempLastHereDate = StrToDate(rs_date("M_LASTHEREDATE")) if TempLastHereDate = "" or IsNull(TempLastHereDate) then ReadLastHereDate = DateToStr(DateAdd("d",-10,strForumTimeAdjust)) else ReadLastHereDate = rs_date("M_LASTHEREDATE") end if end if rs_date.close set rs_date = nothing '## Forum_SQL - Do DB Update strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS " strSql = strSql & " SET M_LASTHEREDATE = '" & DateToStr(strForumTimeAdjust) & "'" strSql = strSql & ", M_LAST_IP = '" & Request.ServerVariables("REMOTE_ADDR") & "'" strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS." & strDBNTSQLName & " = '" & ChkString(UserName, "SQLString") & "' " my_conn.Execute (strSql) end function
I found the fix here: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=9242
in a post by cran |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 01 December 2001 : 02:32:52
|
btw... Fixed for .04 |
 |
|
Davio
Development Team Member
    
Jamaica
12217 Posts |
Posted - 01 December 2001 : 02:52:16
|
LoL wow. Richard, all I can say is, you are quick. Although I could have been a bit faster but...  ...I'll give you the credit.  
- David |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 01 December 2001 : 02:57:10
|
Had to do something. The Active.asp page kept timing out when I tried to view it because it was trying to show almost a years worth of Active Topics.  |
 |
|
HuwR
Forum Admin
    
United Kingdom
20595 Posts |
Posted - 01 December 2001 : 03:55:05
|
unfortunately, this doesn't fix the fact that it is psting as 12 jan, a phenomena which is very odd, since the dates were working perfectly until about 2 days ago.
I have checked the stiings on the web server, and they are identical to those on my test server at home, yet on the webserver the dates do not work, but on my test server I have no problem at all.
|
 |
|
HuwR
Forum Admin
    
United Kingdom
20595 Posts |
Posted - 01 December 2001 : 05:07:21
|
I have discovered the problem, it is i the strToDate function
basically it does a cdate which returns the wrong date, I have fixed it by changing the day and month around in the cdate function.
|
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
Posted - 01 December 2001 : 05:12:06
|
weird that it affected your forum and not this one.
On this forum, the only thing I saw was the problem with the last_here_date, not with the posting date. |
 |
|
HuwR
Forum Admin
    
United Kingdom
20595 Posts |
Posted - 01 December 2001 : 05:58:25
|
it affected mine because I have an extra line in chkdate() for the time zone stuff, this was using strToDate which was causing the problem.
|
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 01 December 2001 : 08:41:03
|
I had discussion with HUWR here on this problem.
http://forum.snitz.com/forum/topic.asp?TOPIC_ID=14329
As I posted in the earlier topic also, IMHO the correct solution is as below:
TempLastHereDate = strToDate(rs_date("M_LASTHEREDATE"))
Replace the above statement as below:
TempLastHereDate = chKDate(rs_date("M_LASTHEREDATE")) & chKTime(rs_date("M_LASTHEREDATE"))
Also within the following functions: function ReadLastHereDate and function DateToStr
I think following statements are not required:
if not isDate(strForumTimeAdjust) then strForumTimeAdjust = strToDate(strForumTimeAdjust) end if
strForumTimeAdjust is populated in config.asp and is always a date. Below is part of code in config.asp
strForumTimeAdjust = DateAdd("h", strTimeAdjust , Now())
GauravBhabu There is only one miracle...That is LIFE! | It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying. |
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 01 December 2001 : 08:57:32
|
quote:
I have discovered the problem, it is i the strToDate function basically it does a cdate which returns the wrong date, I have fixed it by changing the day and month around in the cdate function.
HUWR
Yes that is correct. But changing the day and month around means having different codes.
Below is part of my discussion with you earlier here http://forum.snitz.com/forum/topic.asp?TOPIC_ID=14329
quote:
When i worked with ajb he had the settings UK Long. As far I have observed, it is the cDate function where the month is being switched to day and day to month.
GauravBhabu Posted - 05 August 2001 : 17:26:08
quote:
...But the day and month will be switched when a call is made to function strTodate. If chkDate and chkTime functions are used it won't matter what the settings are on the server and what region it is in. Is it neccessary to use function strTODate.
There are two processes within strTODate function
calls chkDateFormat where isDate function determines whether the string can be converted to a valid date or not.
and cDate function converts the datestring into a date
if chkDateFormat is called from within the function ChkDate it will serve the same purpose of validating the datestring for a date and save from the switching being caused by the cDate function.
GauravBhabu Posted - 05 August 2001 : 18:55:06
quote: ...function chKDate uses numerals to get the monthname and it always gets the correct numerals (5,2) to be converted, It is not vulnerable to switching between day and month.
GauravBhabu Posted - 05 August 2001 : 19:28:28
GauravBhabu There is only one miracle...That is LIFE! | It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying.
Edited by - GauravBhabu on 01 December 2001 09:01:59 |
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 01 December 2001 : 10:00:07
|
Looking more closely at function ReadLastHeredate and the fix by Richard:
if (rs_date.BOF and rs_date.EOF) then ReadLastHereDate = DateToStr(DateAdd("d",-10,strForumTimeAdjust)) else TempLastHereDate = StrToDate(rs_date("M_LASTHEREDATE")) if TempLastHereDate = "" or IsNull(TempLastHereDate) then ReadLastHereDate = DateToStr(DateAdd("d",-10,strForumTimeAdjust)) else ReadLastHereDate = rs_date("M_LASTHEREDATE") end if end if
The changes: 1. Richard has removed the following statement (was just before the end of function ReadLastHereDate) ReadLastHereDate = DateToStr(TempLastHereDate)
2. and ReadLastHereDate is now being populated directly.
Question: 1. Do we really need the statements in red above?
TempLastHereDate = StrToDate(rs_date("M_LASTHEREDATE"))
2. function strToDate will not return a "" or Null value. so the condition per the following statement will be false always:
if TempLastHereDate = "" or IsNull(TempLastHereDate)
3. Why we have to call the function strToDate? This is what seems to be causing the problem.
The code below will achieve the objective correctly:
if (rs_date.BOF and rs_date.EOF) then ReadLastHereDate = DateToStr(DateAdd("d",-10,strForumTimeAdjust)) else if (rs_date("M_LASTHEREDATE") = "") or IsNull(rs_date("M_LASTHEREDATE") then ReadLastHereDate = DateToStr(DateAdd("d",-10,strForumTimeAdjust)) else ReadLastHereDate = rs_date("M_LASTHEREDATE") end if end if
One of the reasons for conditions per statement in red to be true will be, when there is a problem (somwhere else in the code) updating/storing values in the column M_LASTHEREDATE in the DB.
GauravBhabu There is only one miracle...That is LIFE! | It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying.
Edited by - GauravBhabu on 01 December 2001 10:24:22 |
 |
|
HuwR
Forum Admin
    
United Kingdom
20595 Posts |
Posted - 01 December 2001 : 10:39:18
|
but as i said in my earlier post, my chkdate function unlike Snitz's calls the strTodate function, so i can not use chkdate inplace of strToDate
|
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 01 December 2001 : 10:55:14
|
quote:
but as i said in my earlier post, my chkdate function unlike Snitz's calls the strTodate function, so i can not use chkdate inplace of strToDate
I see what you mean. May be you can then call function chkDateTime instead of calling function strTodate.
GauravBhabu There is only one miracle...That is LIFE! | It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying. |
 |
|
Topic  |
|