Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 15th, 2004, 11:54 AM
kokkee kokkee is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 8 kokkee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 8 m 42 sec
Reputation Power: 0
pls help me, i am novice in asp

<%
Option Explicit
Dim strError, strSQL

'see if the form has been submitted
'If Request.Form("action")="register" Then
'the form has been submitted

'// validate the form
'check if a username has been entered
If Request.Form("username") = "" Then
strError = strError & "Please enter a username<br> "& vbNewLine
response.Write(strError)
'end if

'check if a password has been entered
elseif Request.Form("password") = "" Then
strError = strError & " Please enter a password<br>" & vbNewLine
response.Write(strError)

'check if the passwords are the same... but don't display it if the password field is blank.
elseif Request.Form("password") <> Request.Form("password_confirm")_
And Request.Form("password") <> "" Then
strError = strError & "- Your passwords do not match<br>" & vbNewLine
response.Write(strError)
end if
'// check if an error has occured

If strError = "" Then
'continue
'include database connection code
%>
<!--#include file="sqlconnection.asp"-->
<%

' On Error Resume Next


'// check for an error
'// ATTENTION: this should be changed depending on the database provider
'
If Err.Number = -2147217900 Then
strError = "- That username is already in use. Please choose another<br>" & vbNewLine
response.Write(strError)
Else If Err.Number <> 0 Then
strError = "- An error occured. " & Err.Number & " : " & _
Err.Description & "<br>" & vbNewLine


'record created... redirect
'// create the SQL
Else Response.Write "Your user name and password has been accepted."
strSQL = "INSERT INTO members ([username],[password]) VALUES " & _
"('" & Request.Form("username") & "','" & _
Request.Form("password") & "')"
'// run the SQL
objConn.Execute strSQL

Response.Redirect "login.asp?msg=" & Server.URLEncode("Thank you for registering")
Response.End
End If

'restore standard error handling
On Error Goto 0

End If
If strError <> "" Then
'output the error message
'add extra HTML...
strError = "<p><font color=""#FF0000"">The following errors occured:" & _
"</font><br>" & vbNewLine & strError
End If
End If
'End If

'Function fixQuotes(strData)
' fixQuotes = Replace(strData,"'","''")
'End Function
%>


here is my code for registration form... help me about how to check izzit the username exist in database
or not...
pls give me the code that can solve my problem... thanks alot

Reply With Quote
  #2  
Old December 15th, 2004, 03:47 PM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 36
Code:
 sql_checkname = "SELECT * FROM members WHERE username='" & request.form("username") & "'"
 SET checkname = objConn.execute(sql_checkname)
 if not checkname.EOF then
 	 '	the username already exists 
 else
 	 '	 the username doesn't already exist
 end if 

Reply With Quote
  #3  
Old December 16th, 2004, 01:37 AM
kokkee kokkee is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 8 kokkee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 8 m 42 sec
Reputation Power: 0
thank

thank you , i can do it already from ur help...

Reply With Quote
  #4  
Old December 16th, 2004, 09:01 AM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 36
great! Glad I could help

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > pls help me, i am novice in asp


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway