ok i have got the form to do what i want it to do i now want to add a little extra to it to make sure the username (sign up form) does not already exist here is what i have so far,
- Code: Select all
<%@LANGUAGE="VBSCRIPT"%>
<%
function WriteToFile(FileName, Contents, Append)
on error resume next
if Append = true then
iMode = 8
else
iMode = 2
end if
set oFs = server.createobject("Scripting.FileSystemObject")
set oTextFile = oFs.OpenTextFile(FileName, iMode, True)
oTextFile.Write Contents
oTextFile.Close
set oTextFile = nothing
set oFS = nothing
end function
%>
<!--#include file="includes/functions.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>AlternatePK :: Beta</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
<div id="header">
<h1>Alternate-PK</h1>
<h2><% Response.Write currentday&" "&datenow&" "&monthnow&" "&year(now)%>
</h2>
</div>
<!-- end div#header -->
<div id="menu">
<ul>
<li><a href="index.asp">Home</a></li>
<li><a href="rules.asp">Rules</a></li>
<li><a href="donations.asp">Donations</a></li>
<li><a href="status.asp">Server Status</a></li>
<li><a href="downloads.asp">Downloads</a></li>
<li><a href="http://alternate-pk.users-board.net/index.htm">Forum</a></li>
<li><a href="signup.asp">Sign up</a></li>
<li><a href="staff.asp">Staff</a></li>
</ul>
</div>
<!-- end div#menu -->
<div id="page">
<div id="content">
<div id="welcome">
<h1><div style="border-bottom: 1px solid #1C1C1C;">Apply for an account!</div></h1>
<p><%
' declare variables
Dim UserName
Dim Password
Dim Email
' get posted data into variables
UserName = Trim(Request.Form("UserName"))
Password = Trim(Request.Form("Password"))
Email = Trim(Request.Form("Email"))
' validation
Dim validationOK
validationOK=true
If (Trim(UserName)="") Then validationOK=false
If (Trim(UserName)="eof") Then validationOK=false
If (Trim(UserName)="EOF") Then validationOK=false
If (Trim(Password)="") Then validationOK=false
If (Trim(Email)="") Then validationOK=false
IF (Trim(UserName)="EOF" or Trim(Password)="EOF" or Trim(Email)="EOF") Then validationOK=false & response.write("If you have entered <strong>EOF</strong> in any of the fields then.<br>")
If (validationOK=false) Then
Response.write("Please go back fill in all ")
Response.write("the requied information<br>")
Response.write("<a href=""signup.asp"">Click here</a> to return to the form.")
ELSE
'Add account to Database
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open(sConnection)
Set objRS = objConn.Execute("INSERT INTO accounts (user,password,email ) VALUES ('" & username & "','" & password & "','" & email & "')")
Response.write("<h2>Account Added!</h2>" & "<BR>")
Response.write("Account: " & UserName & "<BR>")
Response.write("Password: " & Password & "<BR>")
Response.write("Email: " & Email)
Writetofile "C:\sphere\accounts\sphereacct.scp", "[" & UserName & "]" & vbcrlf, True
Writetofile "C:\sphere\accounts\sphereacct.scp", "Plevel=1" & vbcrlf, True
Writetofile "C:\sphere\accounts\sphereacct.scp", "Password=" & Password & vbcrlf, True
Writetofile "C:\sphere\accounts\sphereacct.scp", vbcrlf, True
END IF
%></p>
</div>
<!-- end div#welcome -->
<!-- end div#sample1 -->
<!-- end div#sample2 -->
</div>
<!-- end div#content -->
<div id="sidebar">
<ul>
<li id="submenu">
<h2>Navigation</h2>
<ul>
<li><a href="index.asp">Home</a></li>
<li><a href="rules.asp">Rules</a></li>
<li><a href="donations.asp">Donations</a></li>
<li><a href="status.asp">Server Status</a></li>
<li><a href="downloads.asp">Downloads</a></li>
<li><a href="http://alternate-pk.users-board.net/index.htm">Forum</a></li>
<li><a href="signup.asp">Sign up</a></li>
<li><a href="staff.asp">Staff</a></li>
</ul>
</li>
<li id="submenu">
<h2>Tables</h2>
<ul>
<li><a href="armor.asp">Armors</a></li>
<li><a href="level.asp">Level</a></li>
</ul>
</li>
<li id="submenu">
<h2>Status</h2>
<iframe width="180" frameborder="0" scrolling="no" scrolling="no" src="<A href="http://alternate-pk.co.uk:2593"></iframe><br/">http://alternate-pk.co.uk:2593"></iframe><br/>
<li id="submenu">
<h2>Vote For US</h2>
<ul>
<li><a href="<A href="http://www.gamesites200.com/ultimaonline/in.php?id=349"><img">http://www.gamesites200.com/ultimaonline/in.php?id=349"><img border="0" src="http://www.gamesites200.com/ultimaonline/vote.gif"></a></li>
</ul>
</li>
<!-- end li#news -->
</ul>
</div>
<!-- end div#sidebar -->
<div style="clear: both; height: 1px"></div>
</div>
<!-- end div#page -->
<div id="footer">
<p id="legal">Copyright © 2007 Alternate-PK.</p>
<p id="links"><a href="status.asp">Shard Status</a> | <a href="signup.asp">Join Us!</a></p>
</div>
<!-- end div#footer -->
</div>
<!-- end div#wrapper -->
</body>
</html>
what do i need to add to make sure the username, email does not already exist in the MySql database?
and how would i add a section that sends an email saying thank you for signing up on blah blah blah..........
Here is the actual website
http://www.alternate-pk.co.uk