Web Design and Development Forums

[SOLVED] need a little help with my asp form

This is a discussion on "[SOLVED] need a little help with my asp form" within the ASP Forum section. This forum, and the thread "[SOLVED] need a little help with my asp form are both part of the Program Your Website category.


Go Back   Webforumz.com > Program Your Website > ASP Forum

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Nov 20th, 2007, 11:37   #1 (permalink)
Up'n'Coming Member
 
Join Date: Jul 2007
Location: Barry
Age: 22
Posts: 53
[SOLVED] need a little help with my asp form

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 &copy; 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

Last edited by Andrew1986; Nov 20th, 2007 at 11:38. Reason: added extra line
Andrew1986 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Nov 21st, 2007, 06:05   #2 (permalink)
Most Reputable Member
 
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
Blog Entries: 2
Send a message via Yahoo to Monie
Re: need a little help with my asp form

Perhaps you could check out my ASP Login Page that I have created HERE
or the working example HERE

HTML: Select all
'Open your database here...
 
'Check for duplicated entry for the Username and Fullname entered by the user in the registration form!
     do while not rs.EOF
       'If Username already exist, alert user with QueryString!
        if rs("username")=Username then
            set rs=nothing
            set conn=nothing
            Response.Redirect("duplicatedUsername.asp")

       'If Fullname already exist, alert user with QueryString!
        Else If rs("fullname")=Fullname Then 
            set rs=nothing
            set conn=nothing
            Response.Redirect("duplicatedEmail.asp")
        End If
        rs.MoveNext
    loop
Hope this will give you an idea how to do the validation..
__________________

Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Nov 21st, 2007, 11:48   #3 (permalink)
Up'n'Coming Member
 
Join Date: Jul 2007
Location: Barry
Age: 22
Posts: 53
Re: need a little help with my asp form

that is a supurb script thanks alot for the help the validation will come in great use. infact im going to make a member area this week is the code in the HTML part the login script if so may i use it on my site (i will add credits for you on the page)
Andrew1986 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Nov 23rd, 2007, 07:55   #4 (permalink)
Most Reputable Member
 
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
Blog Entries: 2
Send a message via Yahoo to Monie
Re: [SOLVED] need a little help with my asp form

No sweat Andrew!
happy to share that knowledge with you
__________________

Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] PHP contact form redirect to same form Posie PHP Forum 14 Jan 29th, 2008 20:28
[SOLVED] PHP Contact Form Stuart PHP Forum 8 Dec 4th, 2007 17:42
[SOLVED] Form Issue longstand PHP Forum 8 Nov 16th, 2007 06:14
[SOLVED] Contact Form Help danny322 PHP Forum 3 Nov 7th, 2007 16:05
[SOLVED] 2 different actions, same form AdRock HTML Forum 5 Oct 11th, 2007 18:02



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 13:30.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59