[thelist] Friday Freebie

Scott Dexter sgd at ti3.com
Thu Jul 20 16:12:57 CDT 2000


(sending now because who knows how long my mail server will take)

<tip type="Setting dates in LDAP, ASP">
LDAP expects to have dates in a certain format; here's a little function
that you can use to read/write date fields in your LDAP store:


function MakeDate(byval dval, byval direction)
' converts a VBScript looking date to/from an LDAP formatted date
' direction = True ==> make LDAP
' direction = False ==> make VBScript
if direction then
	' piece dval into yyyymmddhhmmss
	if not isDate(dval) then dval = Now

' this line is all on one line
	MakeDate =
year(dval)&zeropad(month(dval),2)&zeropad(day(dval),2)&zeropad(hour(dval),2)
&zeropad(minute(dval),2)&zeropad(second(dval),2)
' the line above is all on one line

else
	' dval comes out of LDAP in mm/dd/yyyy hh:mm:ss, just CDate it
	MakeDate = CDate(dval)
end if 
end function

example:

<%
' you already know the userid, you just want to set their last access date
set oUser = Server.CreateObject("MemberShip.Userobjects")
oUser.SetUserName = userid
oUser.lastVisit = MakeDate(Now, True)
oUser.SetInfo

' now get the last visit date back for display
lastvisit = MakeDate(oUser.lastVisit, False)
%>
</tip>


<tip type="disk space and FP extensions">
Make sure you have enough disk space. If --while working with IIS4 and FP
extensions-- you are uploading files and the server runs out of space, you
have to reboot the server to get access to the file that was being uploaded
when the disk filled. This is because the OS is still holding onto the file;
you can't delete it or rename it or even edit it.
</tip>

sgd
--
think safely




More information about the thelist mailing list