|
Joined: Feb 2007
Posts: 57
journeyman
|
journeyman
Joined: Feb 2007
Posts: 57 |
I'm trying to write ASP code to add a new user directly into the MySQL database. I have everything figured out except for two fields: the password and registration time.
Does anyone know how to generate the proper hash code for a given password? I don't know much PHP, but any help at all would be great, and might save me a few hours of mulling through the source.
Also, can anyone explain how the datecodes are stored in the database? It's probably some MySQL standard, but I usually deal with Access and SQL Server, so if anyone knows how it stores, or the proper ASP translation code, or if there's a way to put the date & time right into the SQL statement, that would be great.
Note: we're running UBB Threads v7.1...I think.
Thanks a lot!!
Shane
RnJpZW5kc2hpcCB3aXRoIHRoZSB3b3JsZCBpcyBob3N0aWxpdH kgdG93YXJkcyBHb2QuICBKYW1lcyA0OjQ=
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
md5(txtPassword)
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
and time is simply unix time http://www.captain.at/review-unixtime-javascript.php.NET example: TimeSpan ts = (DateTime.UtcNow - new DateTime(1970,1,1,0,0,0)); double unixTime = ts.TotalSeconds;
|
|
|
|
Joined: Feb 2007
Posts: 57
journeyman
|
journeyman
Joined: Feb 2007
Posts: 57 |
Thanks, that should help! **wikipedia, what's md5?** **google, some code please?** http://en.wikipedia.org/wiki/Md5http://rossm.net/Electronics/Computers/Software/ASP/http://en.wikipedia.org/wiki/Unix_timeNow I have everything figured out except how to convert local time to UTC from within VBScript. I'd probably have to write a COM component to do it, but it's not that important, I guess. I'd hard-code it, but then it'd be messed up during DST. LMK if anyone has any other ideas. Thanks again!!
RnJpZW5kc2hpcCB3aXRoIHRoZSB3b3JsZCBpcyBob3N0aWxpdH kgdG93YXJkcyBHb2QuICBKYW1lcyA0OjQ=
|
|
|
|
Joined: Feb 2007
Posts: 57
journeyman
|
journeyman
Joined: Feb 2007
Posts: 57 |
No, I couldn't stop there. With some more help from Google, I wrote the VB6 COM component to get the current unix time: Option Explicit
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Declare Function FileTimeToLocalFileTime Lib "kernel32" (lpFileTime As FILETIME, lpLocalFileTime As FILETIME) As Long
Private Declare Function LocalFileTimeToFileTime Lib "kernel32" (lpLocalFileTime As FILETIME, lpFileTime As FILETIME) As Long
Private Declare Function FileTimeToSystemTime Lib "kernel32" (lpFileTime As FILETIME, lpSystemTime As SYSTEMTIME) As Long
Private Declare Function SystemTimeToFileTime Lib "kernel32" (lpSystemTime As SYSTEMTIME, lpFileTime As FILETIME) As Long
' Convert a Date into a SYSTEMTIME.
Private Sub DateToSystemTime(ByVal the_date As Date, ByRef _
system_time As SYSTEMTIME)
With system_time
.wYear = Year(the_date)
.wMonth = Month(the_date)
.wDay = Day(the_date)
.wHour = Hour(the_date)
.wMinute = Minute(the_date)
.wSecond = Second(the_date)
End With
End Sub
' Convert a SYSTEMTIME into a Date.
Private Sub SystemTimeToDate(system_time As SYSTEMTIME, _
ByRef the_date As Date)
With system_time
the_date = DateSerial(.wYear, .wMonth, .wDay) + _
TimeSerial(.wHour, .wMinute, .wSecond)
End With
End Sub
' Convert a local time to UTC.
Public Function LocalTimeToUTC(ByVal the_date As Date) As _
Date
Dim system_time As SYSTEMTIME
Dim local_file_time As FILETIME
Dim utc_file_time As FILETIME
' Convert it into a SYSTEMTIME.
DateToSystemTime the_date, system_time
' Convert it to a FILETIME.
SystemTimeToFileTime system_time, local_file_time
' Convert it to a UTC time.
LocalFileTimeToFileTime local_file_time, utc_file_time
' Convert it to a SYSTEMTIME.
FileTimeToSystemTime utc_file_time, system_time
' Convert it to a Date.
SystemTimeToDate system_time, the_date
LocalTimeToUTC = the_date
End Function
' Convert a UTC time into local time.
Public Function UTCToLocalTime(ByVal the_date As Date) As _
Date
Dim system_time As SYSTEMTIME
Dim local_file_time As FILETIME
Dim utc_file_time As FILETIME
' Convert it into a SYSTEMTIME.
DateToSystemTime the_date, system_time
' Convert it to a UTC time.
SystemTimeToFileTime system_time, utc_file_time
' Convert it to a FILETIME.
FileTimeToLocalFileTime utc_file_time, local_file_time
' Convert it to a SYSTEMTIME.
FileTimeToSystemTime local_file_time, system_time
' Convert it to a Date.
SystemTimeToDate system_time, the_date
UTCToLocalTime = the_date
End Function
Public Function UTCToUnixTime(the_date As Date) As Long
UTCToUnixTime = CLng(DateDiff("s", #1/1/1970#, the_date))
End Function
Public Function UnixNow() As Long
UnixNow = UTCToUnixTime(LocalTimeToUTC(Now()))
End Function
Public Function LocalTimeToUnixTime(the_date As Date) As Long
LocalTimeToUnixTime = UTCToUnixTime(LocalTimeToUTC(the_date))
End Function
RnJpZW5kc2hpcCB3aXRoIHRoZSB3b3JsZCBpcyBob3N0aWxpdH kgdG93YXJkcyBHb2QuICBKYW1lcyA0OjQ=
|
|
|
|
Joined: Nov 2006
Posts: 3,095 Likes: 1
Carpal Tunnel
|
Carpal Tunnel
Joined: Nov 2006
Posts: 3,095 Likes: 1 |
We use scripts on KiXtart.org to slice and dice date and time to and from many formats.
All self contained scripts that just need to be called with the parameters of what you're looking for.
|
|
|
|
|