Function RandomNumber(intHighestNumber)
Randomize
RandomNumber = Int(Rnd * intHighestNumber) + 1
End Function
MyRand = RandomNumber(12345789)
MyRand2 = RandomNumber(1234)
MyRand3 = RandomNumber(12)
rndchr1 = int(rnd * 26) + 65
rndchr2 = int(rnd * 26) + 65
rndchr3 = int(rnd * 26) + 65
Myrndchr1 = chr(rndchr1)
Myrndchr2 = chr(rndchr2)
Myrndchr3 = chr(rndchr3)
FinalRandomNumber = Myrndchr1 & MyRand & Myrndchr2 & MyRand2 & Myrndchr3 & MyRand3
Now I can response.write my new random valule .. FinalRandomNumber
Remove Session in Classic ASP
To kill or terminate a session I direct users to a page with this code..
session.Abandon
session.Contents.RemoveAll()
‘HERE I set the session to nothing or blank…
session(“Authenticated”) =”"
session(“AUTH_ID”)=”"
session(“AUTH_USERNAME”)=”"
session(“LastLogin”)=”"
Reseed your primary key MYSQL
To reseed your primary key (change the value of the next primary key generated), use this cool MySQL function to have..
ALTER TABLE My_table AUTO_INCREMENT = 1;
On Change Event
Here’s how you can change items in a text box to uppercase on change..
<input onChange=”JavaScript:this.value=this.value.toUpperCase();” type=”text” name=”T1″ size=”20″>
Close Window With JavaScript
<a href=”javascript:window.close();”>Close This Window</a>
How To Refresh Page With JavaScript
<a href=”JavaScript:location.reload(true);”>Refresh this page</a>
History Back Hyperlink
<a href=”javascript: window.history.go(-1)”>Go Back 1 pages</a>
Confirm Form Button
<input type=”submit” name=”Submit” value=”Submit” onclick=”return confirm(‘Are you sure you want to set this job active?’)”>
Confirm Hyperlink
< a href=”logout.php” onclick=”return confirm(‘Are you sure you want to logout?’);”>Logout</a>
ASP Connection String To MYSQL
<% Set Conn = Server.CreateObject(“ADODB.Connection”)
Conn.ConnectionString = “DRIVER={MySQL ODBC 3.51 Driver};SERVER=mysql.com;
DATABASE=DBNAME;USER=DBUSER;PASSWORD=DBUSER_PASSWORD;OPTION=3;” %>