473,544 Members | 1,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Asp Validation for login and registration (High importance and priority) respond fast

4 New Member
Hi,

Can some one tell me how to change the validation sequence for the code pasted below, actually what I want it when any one enters the wrong login information (already registered users) then it has to tell then them its wrong information but currently it takes then to a next page and then tells them its incorrect information. This is tedious as every time they enter wrong they will be redirected to a different page and then they have to come back and they try again it’s the same for registration. Pls do help i appreciate the quick help.....

Login validation code below:- (below the error. asp is the page where it gets directed and this page displays only stating the information is incorrect and no other information)

<%
YourIP = Request.ServerV ariables("Remot e_Host")
function validate(input)
bad_strings = array("'", "select", "union", "insert", "--")
for each i in bad_strings
if ( inStr(input, i) <> 0) then
validate = false
exit function
end if
next
validate = true
end function
LoginID = Trim(Request("L oginID"))
Password = Trim(Request("P assword"))

If Len(LoginID) < 1 Or Len(Password) < 1 Then
response.redire ct("Error.asp?O K=InValid Login ID / Password")
End If

If (not validate(LoginI D) or not validate(Passwo rd)) then
response.redire ct("Error.asp?O K=Invalid Email ID / Password")
end if

'------------- Login-----------------
AID = LoginID
If Len(AID) > 1 and (Session("JLogg edIn")) = "" Then
Session("JLogge dIn") = AID
%>
<!--#include file="datacon.a sp"-->
<%
Set Conn = Server.CreateOb ject ("ADODB.Connect ion")
Conn.Open xDb_Conn_Str
Set sql = Conn.Execute("S ELECT * FROM Seeker where EmailID = '"& AID &"' AND Password = '"& Password &"'")
If sql.EOF Then
Session("JLogge dIn") = ""
SUL = server.urlencod e("InValid Login ID / Password")
Response.Redire ct("Error.asp?O K=" & SUL)
else
Session("JLogge dIn") = "true"
Session("JLogin ID") = LoginID
Response.Redire ct("JobSeekers. asp")
End If
Conn.close
set Conn = nothing
End If
'---------------------End Of Login--------------
If session("JLogge dIn") = "true" then response.redire ct "jobseekers.asp "
%>

What i want is it show validate and then say in the same login page that the information for login is incorrect.



+============== =============== =============== ====+

2) For registration window: It has the same problem for ex:- there are many fiels like name phone number and other. if any one is incorrect when we hit submit button if the data is wrong then it goes to error.asp and then only displays whats the error. Actually i want it to display in the same registration page itself that the information is incorrect may be a pop up or just a information on the same page.

Registration page Code details:-

+============== =============== ==============+

<%
'-------------Validate Input for possible mischief
function validate(input)
bad_strings = array("'", "select", "union", "insert", "--")
for each i in bad_strings
if ( inStr(input, i) <> 0) then
validate = false
exit function
end if
next
validate = true
end function
CNT = 0
'-----------------Get the Form Details
LoginID = Trim (Request("Login ID"))
If Len(LoginID) > 0 Then
If Len(LoginID) > 50 or Len(LoginID) < 4 Then
WLID = "In Valid Login ID : "
CNT = 5
End If
If (not validate(LoginI D)) then
WLID = "In Valid Login ID : "
CNT = 5
end if
Password = Trim (Request("Passw ord"))
If Len(Password) > 20 or Len(Password) < 4 Then
WPW = "In Valid Password : "
CNT = 5
End If
If (not validate(Passwo rd)) then
WPW = "In Valid Password : "
CNT = 5
end if
RPassword = Trim (Request("RPass word"))
If Len(RPassword) > 20 or Len(RPassword) < 4 Then
WRPW = "In Valid Repeat Password : "
CNT = 5
End If
If (not validate(RPassw ord)) then
WRPW = "In Valid Repeat Password : "
CNT = 5
end if
If Password <> RPassword Then
WPW = "Password and Repeate Password Do Not Match : "
WRPW = "Password and Repeate Password Do Not Match : "
CNT = 5
end if
Name = Trim (Request("Name" ))
If Len(Name) > 150 or Len(Name) < 3 Then
WN= "In Valid Name : "
CNT = 5
End If
If (not validate(Name)) then
WN = "In Valid Name : "
CNT = 5
end if
Designation = Trim (Request("Desig nation"))
If Len(Designation ) > 50 or Len(Designation ) < 2 Then
WDe = "In Valid Designation : "
CNT = 5
End If
If (not validate(Design ation)) then
WDe = "In Valid Designation : "
CNT = 5
end if
Web = Trim (Request("Web") )
If Len(Web) > 100 or Len(Web) < 4 Then
WWe = "In Valid Web URL : "
CNT = 5
End If
If (not validate(Web)) then
WWe = "In Valid Web URL : "
CNT = 5
end if
Company = Trim (Request("Compa ny"))
If Len(Company) > 100 or Len(Company) < 4 Then
WCO = "In Valid Company : "
CNT = 5
End If
If (not validate(Compan y)) then
WCO = "In Valid Company : "
CNT = 5
end if
Industry = Trim (Request("Indus try"))
If Len(Industry) > 50 or Len(Industry) < 2 Then
WIn = "In Valid Industry : "
CNT = 5
End If
If (not validate(Indust ry)) then
WIn = "In Valid Industry : "
CNT = 5
End if
CompanyType = Trim (Request("Compa nyType"))
If Len(CompanyType ) > 100 or Len(CompanyType ) < 2 Then
WCT = "In Valid Company Type : "
CNT = 5
End If
If (not validate(Compan yType)) then
WCT = "In Valid Company Type : "
CNT
End If
Email = Trim (Request("Email "))
If Len(Email) > 75 or Len(Email) < 4 Then
WEID = "In Valid Email ID : "
CNT = 5
End If
If (not validate(Email) ) then
WEID = "In Valid Email ID : "
CNT = 5
end if
If Len(Email) >= 4 Then
EmailatRate = InStr(Email, "@")
If EmailatRate < 2 Then
WEID = "InValid Email ID"
CNT = 5
End If
EmailatRate1 = InStr(Email, ".")
If EmailatRate1 < 2 Then
WEID = "InValid Email ID"
CNT = 5
End if
End if
Phone = Trim (Request("Phone "))
If Len(Phone) > 15 or Len(Phone) < 5 Then
WPh = "In Valid Phone : "
CNT = 5
End If
If (not validate(Phone) ) then
WPh = "In Valid Phone ID : "
CNT = 5
end if
Mobile = Trim (Request("Mobil e"))
If Len(Mobile) > 15 or Len(Mobile) < 10 Then
WMO = "In Valid Mobile Number : "
CNT = 5
End If
If (not validate(Mobile )) then
WMO = "In Valid Mobile Number : "
CNT = 5
end if
Add = Trim (Request("Add") )
If Len(Add) > 200 or Len(Add) < 4 Then
WAdd = "In Valid Address : "
CNT = 5
End If
If (not validate(Add)) then
WAdd = "In Valid Address : "
CNT = 5
end if
City = Trim (Request("City" ))
If Len(City) > 50 or Len(City) < 4 Then
WCy = "In Valid City : "
CNT = 5
End If
If (not validate(City)) then
WCy = "In Valid City : "
CNT = 5
end if
State = Trim (Request("State "))
If Len(State) > 50 or Len(state) < 4 Then
WSt = "In Valid State : "
CNT = 5
End If
If (not validate(State) ) then
WSt = "In Valid State : "
CNT = 5
end if
Pin = Trim (Request("Pin") )
If Len(Pin) > 15 or Len(Pin) < 4 Then
WPN = "In Valid Pin Number : "
CNT = 5
End If
If (not validate(Pin)) then
WPN = "In Valid Pin Number : "
CNT = 5
end if
Country = Trim (Request("Count ry"))
If Len(Country) > 100 or Len(Country) < 2 Then
WCO = "In Valid Country : "
CNT = 5
End If
If (not validate(Countr y)) then
WCO = "In Valid Country : "
CNT = 5
end if
If CNT < 5 Then
'--------------Get the IP Address of the Person Signing Up
YourIP = Request.ServerV ariables("Remot e_Host")
%>
<!--#include file="datacon.a sp"-->
<%
'-----------Open DataBase Connections
Set Conn = Server.CreateOb ject ("ADODB.Connect ion")
Conn.Open xDb_Conn_Str
'-------------Open Database to Check Email ID Exists
Set CSql = Conn.Execute("S ELECT * FROM Employer where LoginID = '" & LoginID & "'")
If CSql.EOF Then
OK = "Yes"
else
WLID = "Login ID Already Exists"
CNT = 5
End If
End If
'----------Insret Account
If CNT < 5 Then
YourIP = Request.ServerV ariables("Remot e_Host")
JoinDate = Date()
Status = "Pending"
Level = "Administra tor"
sSql = "insert into [Employer] ([LoginID], [Name],[Designation], [Company], [Industry], [CompanyType], [email], [Phone], [Mobile], [Add1], [City], [State], [Pin], [Country], [JoinDate], [IP], [Accounts], [Status], [Logins], [Web]) values ('"& LoginID & "', '"& Name &"', '"& Designation & "', '"& Company & "', '"& Industry & "', '"& CompanyType & "', '"& Email & "', '"& Phone & "', '"& Mobile & "', '"& Add & "', '"& City & "', '"& State & "', '"& Pin & "', '"& Country & "', '"& JoinDate & "', '"& YourIP & "', 1, '"& Status &"',0, '"& Web &"')"
Conn.Execute sSql
Set NSql = Conn.Execute("S ELECT * FROM Employer where LoginID = '" & LoginID & "'")
ID = NSql("ID")
sSql1 = "insert into [EmployerSub] ([ID],[LoginID], [Password], [Level], [Status]) values ('"& ID & "', '"& LoginID & "', '"& Password & "', '"& Level &"', 'InActive')"
Conn.Execute sSql1
End If
'----------------End of Account Creations
'--------------Create CDonts
If CNT < 5 Then
Set objCDO = Server.CreateOb ject("CDONTS.Ne wMail")
objCDO.To = Email
objCDO.From = "------------------------"
objCDO.cc = "------------------------"
txtSubject = "If you have not Submitted and the following details are not yours please send a mail to us at -------------------------- with DELETE as the subject from this Email Id -" & Email & " " & vbcrlf&_
"______________ _______________ _______________ ______ __________"& vbcrlf&_
" " & vbcrlf&_
"Dear "& Name & ","& vbcrlf&_
" "& vbcrlf&_
"Thank You For Registering at ----------------------"& vbcrlf&_
"Your Registered Details are as follows -"& vbcrlf&_
" "& vbcrlf&_
"Name - "& Name & ""& vbcrlf&_
"Company - "& Company & ""& vbcrlf&_
"Login ID - "& LoginID & ""& vbcrlf&_
"Password - "& Password & ""& vbcrlf&_
" "& vbcrlf&_
"Your Login URL is - ----------------------------/eLogin.asp"&vbc rlf&_
" "& vbcrlf&_
"You can use your Login ID and Password to Access Your Employer Account. " & vbcrlf&_
"Best Wishes"&vbcrlf& _
""& vbcrlf&_
""
objCDO.Subject = " Employer Account Creation"
'-----------End Of Mail Copy
objCDO.Body = txtSubject
objCDO.Send
'---------------If All Validation are OK Redirect to eLogin Page
Response.Redire ct("elogin.asp" )
Conn.close
set Conn = nothing
End If
End If
%>
<!--#include file="eheader.a sp"-->
<SCRIPT TYPE="text/javascript" src=formval.js> </SCRIPT>
<SCRIPT TYPE="text/javascript">
// Only script specific to this form goes here.
// General-purpose routines are in a separate file.
function validateOnSubmi t() {
var elem;
var errs=0;
// execute all element validations in reverse order, so focus gets
// set to the first one in error.
if (!validateEmail (document.forms .signup.Email, 'inf_Email', true)) errs += 1;
if (!validatePrese nt(document.for ms.signup.Login ID, 'inf_LoginID')) errs += 1;
if (!validatePrese nt(document.for ms.signup.Passw ord, 'inf_Password') ) errs += 1;
if (!validatePrese nt(document.for ms.signup.FName , 'inf_Name')) errs += 1;
if (!validatePrese nt(document.for ms.signup.Add, 'inf_Add')) errs += 1;
if (!validatePrese nt(document.for ms.signup.City, 'inf_City')) errs += 1;
if (!validatePrese nt(document.for ms.signup.Zip, 'inf_Zip')) errs += 1;
if (!validatePrese nt(document.for ms.signup.State , 'inf_State')) errs += 1;
if (!validatePrese nt(document.for ms.signup.Count ry, 'inf_Country')) errs += 1;
if (!validatePrese nt(document.for ms.signup.Phone , 'inf_Phone')) errs += 1;

if (errs>1) alert('There are fields which need correction before sending');
if (errs==1) alert('There is a field which needs correction before sending');

return (errs==0);
};
</SCRIPT>

And also

+============== =============== ==============+

<%
'--------------Get the IP Address of the Person Signing Up
IP = Request.ServerV ariables("Remot e_Host")
'-------------Validate the Email and Password for possible mischief
function validate(input)
bad_strings = array("'", "select", "union", "insert", "--")
for each i in bad_strings
if ( inStr(input, i) <> 0) then
validate = false
exit function
end if
next
validate = true
end function
'-----------------Get the Form Details
FName = Trim (Request("FName "))
FName = Replace(FName, "'", "''")
If Len(FName) > 75 Then response.redire ct("Error.asp?O K=First Name is Over 75 Char")
If Len(FName) < 4 Then response.redire ct("Error.asp?O K=First Name Should be at Least 4 Characters Long!")
If (not validate(FName) ) then
response.redire ct("Error.asp?O K=Invalid First Name")
end if
LName = Trim (Request("LName "))
LName = Replace(LName, "'", "''")
If Len(LName) > 75 Then response.redire ct("Error.asp?O K=Last Name is Over 75 Char")
If Len(LName) < 4 Then response.redire ct("Error.asp?O K=Last Name Should be at Least 4 Characters Long!")
If (not validate(LName) ) then
response.redire ct("Error.asp?O K=Invalid Last Name")
end if
Sex = Trim (Request("Sex") )
Sex = Replace(Sex, "'", "''")
If Sex = "Male" Or Sex = "Female" Then
'
Else
Sex = "Male"
End If
DOBD = Request("Day")
If Len(DOBD) < 1 Then response.redire ct("Error.asp?O K=Date Required")
DOBM = Request("Month" )
If Len(DOBM) < 1 Then response.redire ct("Error.asp?O K=Date Required")
DOBY = Request("Year")
If Len(DOBY) < 1 Then response.redire ct("Error.asp?O K=Date Required")
If DOBD > 29 And DOBM = "February" Then response.redire ct("Error.asp?O K=Invalid Date-1")
If DOBD > 30 And (DOBM = "February" or DOBM = "April" or DOBM = "June" or DOBM = "September" or DOBM = "November") Then response.redire ct("Error.asp?O K=Invalid Date-2")
DOBY1 = DOBY/4
DOBY1 = InStr(DOBY1, ".")
If DOBD = 29 And DOBM = "February" And DOBY1 > 0 Then response.redire ct("Error.asp?O K=Invalid Date-3")
If Len(Company) > 10 Then response.redire ct("Error.asp?O K=Invalid Date")
If (not validate(DOBD)) then
response.redire ct("Error.asp?O K=Invalid Day")
end if
If (not validate(DOBM)) then
response.redire ct("Error.asp?O K=Invalid Month")
end if
If (not validate(DOBY)) then
response.redire ct("Error.asp?O K=Invalid Year")
end if
Mobile = Trim (Request("Mobil e"))
Mobile = Replace(Mobile, "'", "''")
If Len(Mobile) > 15 Then response.redire ct("Error.asp?O K=Mobile Number is Over 15 Char")
If Len(Mobile) < 10 Then response.redire ct("Error.asp?O K=Mobile Number Should be at Least 10 Characters Long!")
If (not validate(Mobile )) then
response.redire ct("Error.asp?O K=Invalid Mobile Number")
end if
Landline = Trim (Request("Landl ine"))
Landline = Replace(Landlin e, "'", "''")
If Len(Landline) > 15 Then response.redire ct("Error.asp?O K=Landline is Over 15 Char")
If Len(Landline) < 5 Then response.redire ct("Error.asp?O K=Landline Number Should be at Least 5 Characters Long!")
If (not validate(Landli ne)) then
response.redire ct("Error.asp?O K=Invalid Landline Number")
end if
Qualification = Trim (Request("Quali fication"))
Qualification = Replace(Qualifi cation, "'", "''")
If Len(Qualificati on) > 25 Then response.redire ct("Error.asp?O K=Qualification is Over 25 Char")
If Len(Qualificati on) < 2 Then response.redire ct("Error.asp?O K=Qualification Should be at Least 2 Characters Long!")
If (not validate(Qualif ication)) then
response.redire ct("Error.asp?O K=Invalid Qualification Entry!")
end if
Institute = Trim (Request("Insti tute"))
Institute = Replace(Institu te, "'", "''")
If Len(Institute) > 75 Then response.redire ct("Error.asp?O K=Institute is Over 75 Char")
If Len(Institute) < 4 Then response.redire ct("Error.asp?O K=Institute Should be at Least 4 Characters Long!")
If (not validate(Instit ute)) then
response.redire ct("Error.asp?O K=Invalid Institute Entry!")
end if
CurrentLocation = Trim (Request("Curre ntLocation"))
CurrentLocation = Replace(Current Location, "'", "''")
If Len(CurrentLoca tion) > 50 Then response.redire ct("Error.asp?O K=CurrentLocati on is Over 50 Char")
If Len(CurrentLoca tion) < 4 Then response.redire ct("Error.asp?O K=CurrentLocati on Should be at Least 4 Characters Long!")
If (not validate(Curren tLocation)) then
response.redire ct("Error.asp?O K=Invalid CurrentLocation Entry!")
end if
PreferredLocati on = Trim (Request("Prefe rredLocation"))
PreferredLocati on = Replace(Preferr edLocation, "'", "''")
If Len(PreferredLo cation) > 50 Then response.redire ct("Error.asp?O K=PreferredLoca tion is Over 50 Char")
If Len(PreferredLo cation) < 4 Then response.redire ct("Error.asp?O K=PreferredLoca tion Should be at Least 4 Characters Long!")
If (not validate(Prefer redLocation)) then
response.redire ct("Error.asp?O K=Invalid PreferredLocati on Entry!")
end if
WorkExperiencY = Trim (Request("WorkE xperiencY"))
If Len(WorkExperie ncY) > 10 Then response.redire ct("Error.asp?O K=WorkExperienc Y is Over 10 Char")
If Len(WorkExperie ncY) < 1 Then response.redire ct("Error.asp?O K=WorkExperienc Y Should be at Least 1 Characters Long!")
If (not validate(WorkEx periencY)) then
response.redire ct("Error.asp?O K=Invalid WorkExperiencY Entry!")
end if
WorkExperiencM = Trim (Request("WorkE xperiencM"))
If Len(WorkExperie ncM) > 10 Then response.redire ct("Error.asp?O K=WorkExperienc M is Over 10 Char")
If Len(WorkExperie ncM) < 1 Then response.redire ct("Error.asp?O K=WorkExperienc M Should be at Least 1 Characters Long!")
If (not validate(WorkEx periencM)) then
response.redire ct("Error.asp?O K=Invalid WorkExperiencM Entry!")
end if
CurrentIndustry = Trim (Request("Curre ntIndustry"))
CurrentIndustry = Replace(Current Industry, "'", "''")
If Len(CurrentIndu stry) > 100 Then response.redire ct("Error.asp?O K=CurrentIndust ry is Over 100 Char")
If (not validate(Curren tIndustry)) then
response.redire ct("Error.asp?O K=Invalid CurrentIndustry Entry!")
end if
Relocate = Trim (Request("Reloc ate"))
If Relocate = "Yes" Or Relocate = "No" Then
Else
Relocate = "Yes"
End If
CCTCL = Request("CCTCL" )
CCTCT = Request("CCTCT" )
ECTCL = Request("ECTCL" )
ECTCT = Request("ECTCT" )
CurrentEmployer = Trim (Request("Curre ntEmployer"))
CurrentEmployer = Replace(Current Employer, "'", "''")
If Len(CurrentEmpl oyer) > 75 Then response.redire ct("Error.asp?O K=CurrentEmploy er is Over 75 Char")
If (not validate(Curren tEmployer)) then
response.redire ct("Error.asp?O K=Invalid CurrentEmployer Entry!")
end if
PreviousEmploye r = Trim (Request("Previ ousEmployer"))
PreviousEmploye r = Replace(Previou sEmployer, "'", "''")
If Len(PreviousEmp loyer) > 75 Then response.redire ct("Error.asp?O K=PreviousEmplo yer is Over 75 Char")
If (not validate(Previo usEmployer)) then
response.redire ct("Error.asp?O K=Invalid PreviousEmploye r Entry!")
end if
Skills = Trim (Request("Skill s"))
Skills = Replace(Skills, "'", "''")
If Len(Skills) > 250 Then response.redire ct("Error.asp?O K=Skills is Over 250 Char")
If Len(Skills) < 5 Then response.redire ct("Error.asp?O K=Skills Should be at Least 5 Characters Long!")
If (not validate(Skills )) then
response.redire ct("Error.asp?O K=Invalid Skills Entry!")
end if
Role = Trim (Request("Role" ))
Role = Replace(Role, "'", "''")
If Len(Role) > 50 Then response.redire ct("Error.asp?O K=Role is Over 50 Char")
If Len(Role) < 5 Then response.redire ct("Error.asp?O K=Role Should be at Least 5 Characters Long!")
If (not validate(Role)) then
response.redire ct("Error.asp?O K=Invalid Role Entry!")
end if
Title = Trim (Request("Title "))
Title = Replace(Title, "'", "''")
If Len(Title) > 75 Then response.redire ct("Error.asp?O K=Title is Over 75 Char")
If Len(Title) < 2 Then response.redire ct("Error.asp?O K=Title Should be at Least 2 Characters Long!")
If (not validate(Title) ) then
response.redire ct("Error.asp?O K=Invalid Title Entry!")
end if
JResume = Trim (Request("Resum e"))
JResume = Replace(JResume , "'", "''")
If Len(Title) > 10000 Then response.redire ct("Error.asp?O K=Resume is Over 10000 Char")
If (not validate(JResum e)) then
response.redire ct("Error.asp?O K=Invalid Resume Entry!")
end if
Email = Trim (Request("Email ID"))
Email = Replace(Email, "'", "")
If Len(Email) > 85 Then response.redire ct("Error.asp?O K=Email is Over 85 Char")
If Len(Email) < 5 Then response.redire ct("Error.asp?O K=EmailID Should be at Least 5 Characters Long!")
Password = Trim (Request("Passw ord"))
Password = Replace(Passwor d, "'", "")
If Len(Password) >= 20 Then response.redire ct("Error.asp?O K=Password is Over 20 Char")
If Len(Password) < 5 Then response.redire ct("Error.asp?O K=Password Should be at Least 5 Characters Long!")
If (not validate(Email) or not validate(Passwo rd) or not validate(LoginI D)) then
response.redire ct("Error.asp?O K=Invalid Email ID / Password")
end if
EmailC = Trim (Request("Email IDC"))
If EmailC = Email Then
'
Else
response.redire ct("Error.asp?O K=EmailID and Confirm Email ID Do not Match!")
End If
'-------If email id is not valid Redirect to the Sign UP Page Again.
If Len(Email) < 4 Then
response.redire ct("Error.asp?O K=InValid Email")
end If
If Len (Email) > 4 Then
Elen = Len(Email)
St = 1
do while Elen > 0
var = Mid(Email, st, 1)
If var = "@" Then
Elen = 0
Else
st = st + 1
Elen = Elen - 1
End If
Loop
If var <> "@" Then
randr = "Error.asp?OK=I nValid Email"
Response.Redire ct(randr)
End If
end if
%>
<!--#include file="datacon.a sp"-->
<%
DABase = "Data"
'-----------Open DataBase Connections
Set Conn = Server.CreateOb ject ("ADODB.Connect ion")
Conn.Open xDb_Conn_Str
'-------------Open Database to Check Email ID Exists
Set CSql = Conn.Execute("S ELECT * FROM Seeker where EmailID = '" & Email & "'")
If CSql.EOF Then
OK = "Yes"
else
OK = "Email ID Already Exists"
End If
'----------Insret Account
If OK = "Yes" Then
JDate = Date()
DOB = Request("DOB")
sSql = "insert into [Seeker] ([EmailID], [Password], [FName], [LName], [DOBDay], [DOBMonth], [DOBYear], [JDate], [Sex], [Mobile], [Landline], [Qualification], [Institute], [CurrentLocation], [PreferredLocati on], [TotalWorkExpY], [TotalWorkExpM], [CurrentIndustry], [Relocate], [CCTCL], [CCTCT], [ECTCL], [ECTCT], [CurrentEmployer], [PreviousEmploye r], [Skills], [Role], [Title], [Resume], [IP]) values ('"& Email & "', '"& Password & "', '"& FName & "', '"& LName & "', '"& DOBD & "', '"& DOBM & "', '"& DOBY & "', '"& JDate & "', '"& Sex & "', '"& Mobile & "', '"& Landline & "', '"& Qualification & "', '"& Institute & "', '"& CurrentLocation & "', '"& PreferredLocati on & "', '"& WorkExperiencY & "', '"& WorkExperiencM & "', '"& CurrentIndustry &"', '"& Relocate &"', '"& CCTCL &"', '"& CCTCT &"', '"& ECTCL &"', '"& ECTCT &"', '"& CurrentEmployer & "', '"& PreviousEmploye r & "', '"& Skills & "', '"& Role & "', '"& Title &"', '"& JResume & "', '"& IP &"')"
Conn.Execute sSql
End If
'----------------End of Account Creations
'--------------Create CDonts
If OK = "Yes" Then
Set objCDO = Server.CreateOb ject("CDONTS.Ne wMail")
objCDO.To = Email
objCDO.From = "-----------------------------"
objCDO.cc = "--------------"
txtSubject = "If you have not Submitted and the following details are not yours please send a mail to us at ---------------- with DELETE as the subject from this Email Id -" & Email & " " & vbcrlf&_
"______________ _______________ _______________ ______ __________"& vbcrlf&_
" " & vbcrlf&_
"Dear "& FName & " " & LName & ","& vbcrlf&_
" "& vbcrlf&_
"Thank You For Registering at --------"& vbcrlf&_
"Your Registered Details are as follows -"& vbcrlf&_
" "& vbcrlf&_
"Login ID - "& Email & ""& vbcrlf&_
"Password - "& Password & ""& vbcrlf&_
" "& vbcrlf&_
"Your Login URL is - ----------/JLogin.asp"&vbc rlf&_
" "& vbcrlf&_
"You can use your Login ID and Password to Access Your Account. " & vbcrlf&_
" "&vbcrlf&_
"Best Of Luck"&vbcrlf&_
""& vbcrlf&_
""
objCDO.Subject = "-------------------------------"
'-----------End Of Mail Copy
objCDO.Body = txtSubject
objCDO.Send
Dim var3
End If
'---------------If the Email Or ID Exists Redirect the Applicant to the Error Page
If OK = "Yes" Then
c3 = "JLogin.asp "
else
c3 = "Error.asp? OK=" & OK
end if
Response.Redire ct(c3)
Conn.close
set Conn = nothing
%>
Apr 3 '08 #1
3 6209
jeffstl
432 Recognized Expert Contributor
The answer to your problem can be 1 of 2 things

Option 1) Set up the Error.asp page to always redirect back to the original page (this is not good style or efficient processing, but it might be your quickest solution)

So in your error.asp page you would need to set up something like this :
Expand|Select|Wrap|Line Numbers
  1. dim NewOK
  2.  'this will get the parameter sent by the original registration page
  3. NewOK = response.querystring("OK")
  4. 'this will send them right back to the registration page with the error passed
  5. response.redirect("registrationpage.asp?OK=" & NewOK & "")
  6.  
Then you would need to move all your code that handled the printing of the error message from error.asp to the registrationpag e.asp.

Silly isn't it? This basically means error.asp becomes useless page, but like i said it would be a very quick and dirty solution. Thats why option 2 is actually better


Option 2: Change registrationpag e.asp\login page to handle all errors

This would mean going through the entire code you posted and replacing the

response.redire ct("error.asp?O K=InvalidUser")

with

response.redire ct("registratio npage.asp?OK=In validUser")

THEN after that you would move all the code that handles printing the error information from error.asp into registrationpag e.asp and\or your login page.

This completely eliminates error.asp, so if it has any other functions you might need to move those too (such as log writing, etc).

If you need more help let me know
Apr 4 '08 #2
satishknight
4 New Member
Thanks that was a quick solution and responding so fast i never expected i would get a reply at this pace, i am really happy to be on this forum its great.

Well first the solution was really ingenious, well i have another doubt now because it gets redirected again to the registration page as per your solution all the data typed by the registrants will be gone. Now how do i go about doing a change that will validate the data entered and then show the error in the same page so that the there is no data loss whatever was entered cos every time its wrong during registration then it will be redirected to the same page with blank information.

Also in some fields i want the sample data to be shown when they click on the text box (i dont want the data to be present in the text box but it should pop up (Ex; The ajax feature). Can you help me. I am sorry if its annoying i am not an expert in asp.

For Example of the text box pop please see this link if possible. Thanks for your patience.

http://my.naukri.com/manager/createa...cp=5422&wExp=N
Apr 4 '08 #3
jeffstl
432 Recognized Expert Contributor
Thanks that was a quick solution and responding so fast i never expected i would get a reply at this pace, i am really happy to be on this forum its great.

Well first the solution was really ingenious, well i have another doubt now because it gets redirected again to the registration page as per your solution all the data typed by the registrants will be gone. Now how do i go about doing a change that will validate the data entered and then show the error in the same page so that the there is no data loss whatever was entered cos every time its wrong during registration then it will be redirected to the same page with blank information.

Also in some fields i want the sample data to be shown when they click on the text box (i dont want the data to be present in the text box but it should pop up (Ex; The ajax feature). Can you help me. I am sorry if its annoying i am not an expert in asp.

For Example of the text box pop please see this link if possible. Thanks for your patience.

http://my.naukri.com/manager/createa...cp=5422&wExp=N
Oh ok.

I understand your problem.

What you will need to do probably is use Session variables. These are variable that are maintained throughout a user's session, no matter which page they are on.

The way you set a session variable is simple.
Expand|Select|Wrap|Line Numbers
  1. Session("NewName") = request.form("txtName")
  2.  
OK. So now that you have it you can reprint it out when they are redirected
Expand|Select|Wrap|Line Numbers
  1. <input type="text" name="txtName" value="<%Session("NewName")%>">
  2.  
So now that you are introducing this however, you need to make sure you check if they are being redirected. If they are not being redirected you must clear out the session variables to blanks to make sure they are not holding old data or something.

Expand|Select|Wrap|Line Numbers
  1. if UserRedirected = "True" then
  2.      Session("NewName") = ""
  3. end if
  4.  
As you may have noticed your issue does open up alot of problems. This is why it is much better form to use a single page to handle all errors and validations, especially in classic ASP.

That way you dont have to worry about holding variables values between pages all the time, it does get tedious.

Good luck, hopefully this helps you out.

Oh and as far as printing out error examples you just need a conditional response.write to handle it everywhere on the page you want validation messages.

Expand|Select|Wrap|Line Numbers
  1. if UserError1 <> "" then 'check if error is blank
  2.      response.write MyErrorMsg
  3. else
  4.      'do nothing
  5. end if
  6.  
Apr 7 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5504
by: Mike D | last post by:
The code below gives an error. Object doesn't support this property or method: 'myMail.Importance' How do I set importance on an email? Everywhere I have looked it looks like my syntax is right but is it? Thanks Mike Set myMail = CreateObject("CDO.Message")
6
9037
by: Peter Croft | last post by:
Hello. Can someone please tell me how to set the priority of an email message sent from an ASP script using CDOSYS as below - set oCdoMsg = server.createobject("CDO.Message") oCdoMsg.from=... oCdoMsg.to=... oCdoMsg.subject=... oCdoMsg.importance=1 ' fails oCdoMsg.HTMLBody=....
0
1883
by: ab | last post by:
I need help . I found that microsoft asserts that there is a bug on the framework. the symptom is "The underlying connection was closed. An unexpected error occured on send." http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B819450 I download the patch they talk about, but it not works on the computer. it says that the version of...
2
1859
by: sheaguevara | last post by:
This is my first post onto the forum. So first off, I'd like to say hello to everyone. I just started working on a login/registration system and I am trying to have a feature where the user will login and they can see all of their information about their account (e-mail, website, state, etc.). Unfortunately I have something wrong with the...
1
3066
by: carl2k2 | last post by:
Ok First I have a very simple way of entering data into a form and saving that into a text file, I made two text files for username(text1) and password(text2), I would like to make a simple login with the outcome out this, Code for Registration: Dim savefile As Long savefile = FreeFile() Open "I:\College Work ------- Updated 2008...
1
192
by: Rob Eventine | last post by:
hello, i really need this little problem solving... i have used the asp.net login / registration wizards to set up a secure area. everything works great but not when uploaded to the server. the aspnetdb database NAME is not allowed. i am also not allowed to use the aspnet_regsql to create the DB online.
2
2007
by: dgbb | last post by:
Hi, I have read many posts and have tried many solutions to this problem. Simply enough, I can assign a role to a user programically during development, but when I publish to the 'web', the system doesn’t work. I am useing VWD 2008 in VB.Net. I have been using permutations of : Roles.AddUserToRole("User.Name", "User"). Roles work...
1
1422
by: Arielle | last post by:
I'm mainly looking for assistance pointing me in the right direction for my research. I have a few theories of my own but would welcome any others that could help me figure out what the problem is. The problem is very intermitten but our logs are getting the following error: System.Data.SqlClient.SqlException: Login failed for user...
0
7426
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7368
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7610
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7774
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7381
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5914
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4920
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
989
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.