JamieFuller
Programmer
I have written this function in VB but would ideally love to convert it into php so that I can run it from my website.
Function explaination:
take a 5 char string (55555)
splice in a 6 byte date string (DDMMYY) resulting in an 11 byte string (D5D5M5M5Y5Y)
Convert each char into the hex (2chars) of the ascii value for that char.
this then results in a 22 char long text, then replace each char with an alternate char based on
a table of chars (enc2)
Please help!!!
Just an explaination of the php alternatives to the mid$,hex() and instr() commands would be enough to start me off but the more info you can share the better!
Many Thanks!
Kindest Regards
Jamie
Code:
Private function gen(text1) as string
dim c as int
Dim b As String
enc = "FEDCBA9876543210"
enc2= "0123456789ABCDEF"
tmpDate = Format(Day(Date), "00") & Format(Month(Date), "00") & Mid$(Year(Date), 3, 2)
Text2 = Mid$(tmpDate, 1, 1)
Text2 = Text2 & Mid$(Text1, 1, 1)
Text2 = Text2 & Mid$(tmpDate, 2, 1)
Text2 = Text2 & Mid$(Text1, 2, 1)
Text2 = Text2 & Mid$(tmpDate, 3, 1)
Text2 = Text2 & Mid$(Text1, 3, 1)
Text2 = Text2 & Mid$(tmpDate, 4, 1)
Text2 = Text2 & Mid$(Text1, 4, 1)
Text2 = Text2 & Mid$(tmpDate, 5, 1)
Text2 = Text2 & Mid$(Text1, 5, 1)
Text2 = Text2 & Mid$(tmpDate, 6, 1)
For C = 1 To 11
tmp1 = Hex(Asc(Mid$(Text2, C, 1)))
tmp2 = tmp2 & Mid$(enc, InStr(1, enc2, Mid$(b, 1, 1)), 1)
tmp2 = tmp2 & Mid$(enc, InStr(1, enc2, Mid$(b, 2, 1)), 1)
Next
gen = tmp2
End function
take a 5 char string (55555)
splice in a 6 byte date string (DDMMYY) resulting in an 11 byte string (D5D5M5M5Y5Y)
Convert each char into the hex (2chars) of the ascii value for that char.
this then results in a 22 char long text, then replace each char with an alternate char based on
a table of chars (enc2)
Please help!!!
Just an explaination of the php alternatives to the mid$,hex() and instr() commands would be enough to start me off but the more info you can share the better!
Many Thanks!
Kindest Regards
Jamie