473,385 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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.ServerVariables("Remote_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("LoginID"))
Password = Trim(Request("Password"))

If Len(LoginID) < 1 Or Len(Password) < 1 Then
response.redirect("Error.asp?OK=InValid Login ID / Password")
End If

If (not validate(LoginID) or not validate(Password)) then
response.redirect("Error.asp?OK=Invalid Email ID / Password")
end if

'------------- Login-----------------
AID = LoginID
If Len(AID) > 1 and (Session("JLoggedIn")) = "" Then
Session("JLoggedIn") = AID
%>
<!--#include file="datacon.asp"-->
<%
Set Conn = Server.CreateObject ("ADODB.Connection")
Conn.Open xDb_Conn_Str
Set sql = Conn.Execute("SELECT * FROM Seeker where EmailID = '"& AID &"' AND Password = '"& Password &"'")
If sql.EOF Then
Session("JLoggedIn") = ""
SUL = server.urlencode("InValid Login ID / Password")
Response.Redirect("Error.asp?OK=" & SUL)
else
Session("JLoggedIn") = "true"
Session("JLoginID") = LoginID
Response.Redirect("JobSeekers.asp")
End If
Conn.close
set Conn = nothing
End If
'---------------------End Of Login--------------
If session("JLoggedIn") = "true" then response.redirect "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("LoginID"))
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(LoginID)) then
WLID = "In Valid Login ID : "
CNT = 5
end if
Password = Trim (Request("Password"))
If Len(Password) > 20 or Len(Password) < 4 Then
WPW = "In Valid Password : "
CNT = 5
End If
If (not validate(Password)) then
WPW = "In Valid Password : "
CNT = 5
end if
RPassword = Trim (Request("RPassword"))
If Len(RPassword) > 20 or Len(RPassword) < 4 Then
WRPW = "In Valid Repeat Password : "
CNT = 5
End If
If (not validate(RPassword)) 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("Designation"))
If Len(Designation) > 50 or Len(Designation) < 2 Then
WDe = "In Valid Designation : "
CNT = 5
End If
If (not validate(Designation)) 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("Company"))
If Len(Company) > 100 or Len(Company) < 4 Then
WCO = "In Valid Company : "
CNT = 5
End If
If (not validate(Company)) then
WCO = "In Valid Company : "
CNT = 5
end if
Industry = Trim (Request("Industry"))
If Len(Industry) > 50 or Len(Industry) < 2 Then
WIn = "In Valid Industry : "
CNT = 5
End If
If (not validate(Industry)) then
WIn = "In Valid Industry : "
CNT = 5
End if
CompanyType = Trim (Request("CompanyType"))
If Len(CompanyType) > 100 or Len(CompanyType) < 2 Then
WCT = "In Valid Company Type : "
CNT = 5
End If
If (not validate(CompanyType)) 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("Mobile"))
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("Country"))
If Len(Country) > 100 or Len(Country) < 2 Then
WCO = "In Valid Country : "
CNT = 5
End If
If (not validate(Country)) then
WCO = "In Valid Country : "
CNT = 5
end if
If CNT < 5 Then
'--------------Get the IP Address of the Person Signing Up
YourIP = Request.ServerVariables("Remote_Host")
%>
<!--#include file="datacon.asp"-->
<%
'-----------Open DataBase Connections
Set Conn = Server.CreateObject ("ADODB.Connection")
Conn.Open xDb_Conn_Str
'-------------Open Database to Check Email ID Exists
Set CSql = Conn.Execute("SELECT * 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.ServerVariables("Remote_Host")
JoinDate = Date()
Status = "Pending"
Level = "Administrator"
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("SELECT * 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.CreateObject("CDONTS.NewMail")
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"&vbcrlf&_
" "& 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.Redirect("elogin.asp")
Conn.close
set Conn = nothing
End If
End If
%>
<!--#include file="eheader.asp"-->
<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 validateOnSubmit() {
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 (!validatePresent(document.forms.signup.LoginID, 'inf_LoginID')) errs += 1;
if (!validatePresent(document.forms.signup.Password, 'inf_Password')) errs += 1;
if (!validatePresent(document.forms.signup.FName, 'inf_Name')) errs += 1;
if (!validatePresent(document.forms.signup.Add, 'inf_Add')) errs += 1;
if (!validatePresent(document.forms.signup.City, 'inf_City')) errs += 1;
if (!validatePresent(document.forms.signup.Zip, 'inf_Zip')) errs += 1;
if (!validatePresent(document.forms.signup.State, 'inf_State')) errs += 1;
if (!validatePresent(document.forms.signup.Country, 'inf_Country')) errs += 1;
if (!validatePresent(document.forms.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.ServerVariables("Remote_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.redirect("Error.asp?OK=First Name is Over 75 Char")
If Len(FName) < 4 Then response.redirect("Error.asp?OK=First Name Should be at Least 4 Characters Long!")
If (not validate(FName)) then
response.redirect("Error.asp?OK=Invalid First Name")
end if
LName = Trim (Request("LName"))
LName = Replace(LName, "'", "''")
If Len(LName) > 75 Then response.redirect("Error.asp?OK=Last Name is Over 75 Char")
If Len(LName) < 4 Then response.redirect("Error.asp?OK=Last Name Should be at Least 4 Characters Long!")
If (not validate(LName)) then
response.redirect("Error.asp?OK=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.redirect("Error.asp?OK=Date Required")
DOBM = Request("Month")
If Len(DOBM) < 1 Then response.redirect("Error.asp?OK=Date Required")
DOBY = Request("Year")
If Len(DOBY) < 1 Then response.redirect("Error.asp?OK=Date Required")
If DOBD > 29 And DOBM = "February" Then response.redirect("Error.asp?OK=Invalid Date-1")
If DOBD > 30 And (DOBM = "February" or DOBM = "April" or DOBM = "June" or DOBM = "September" or DOBM = "November") Then response.redirect("Error.asp?OK=Invalid Date-2")
DOBY1 = DOBY/4
DOBY1 = InStr(DOBY1, ".")
If DOBD = 29 And DOBM = "February" And DOBY1 > 0 Then response.redirect("Error.asp?OK=Invalid Date-3")
If Len(Company) > 10 Then response.redirect("Error.asp?OK=Invalid Date")
If (not validate(DOBD)) then
response.redirect("Error.asp?OK=Invalid Day")
end if
If (not validate(DOBM)) then
response.redirect("Error.asp?OK=Invalid Month")
end if
If (not validate(DOBY)) then
response.redirect("Error.asp?OK=Invalid Year")
end if
Mobile = Trim (Request("Mobile"))
Mobile = Replace(Mobile, "'", "''")
If Len(Mobile) > 15 Then response.redirect("Error.asp?OK=Mobile Number is Over 15 Char")
If Len(Mobile) < 10 Then response.redirect("Error.asp?OK=Mobile Number Should be at Least 10 Characters Long!")
If (not validate(Mobile)) then
response.redirect("Error.asp?OK=Invalid Mobile Number")
end if
Landline = Trim (Request("Landline"))
Landline = Replace(Landline, "'", "''")
If Len(Landline) > 15 Then response.redirect("Error.asp?OK=Landline is Over 15 Char")
If Len(Landline) < 5 Then response.redirect("Error.asp?OK=Landline Number Should be at Least 5 Characters Long!")
If (not validate(Landline)) then
response.redirect("Error.asp?OK=Invalid Landline Number")
end if
Qualification = Trim (Request("Qualification"))
Qualification = Replace(Qualification, "'", "''")
If Len(Qualification) > 25 Then response.redirect("Error.asp?OK=Qualification is Over 25 Char")
If Len(Qualification) < 2 Then response.redirect("Error.asp?OK=Qualification Should be at Least 2 Characters Long!")
If (not validate(Qualification)) then
response.redirect("Error.asp?OK=Invalid Qualification Entry!")
end if
Institute = Trim (Request("Institute"))
Institute = Replace(Institute, "'", "''")
If Len(Institute) > 75 Then response.redirect("Error.asp?OK=Institute is Over 75 Char")
If Len(Institute) < 4 Then response.redirect("Error.asp?OK=Institute Should be at Least 4 Characters Long!")
If (not validate(Institute)) then
response.redirect("Error.asp?OK=Invalid Institute Entry!")
end if
CurrentLocation = Trim (Request("CurrentLocation"))
CurrentLocation = Replace(CurrentLocation, "'", "''")
If Len(CurrentLocation) > 50 Then response.redirect("Error.asp?OK=CurrentLocation is Over 50 Char")
If Len(CurrentLocation) < 4 Then response.redirect("Error.asp?OK=CurrentLocation Should be at Least 4 Characters Long!")
If (not validate(CurrentLocation)) then
response.redirect("Error.asp?OK=Invalid CurrentLocation Entry!")
end if
PreferredLocation = Trim (Request("PreferredLocation"))
PreferredLocation = Replace(PreferredLocation, "'", "''")
If Len(PreferredLocation) > 50 Then response.redirect("Error.asp?OK=PreferredLocation is Over 50 Char")
If Len(PreferredLocation) < 4 Then response.redirect("Error.asp?OK=PreferredLocation Should be at Least 4 Characters Long!")
If (not validate(PreferredLocation)) then
response.redirect("Error.asp?OK=Invalid PreferredLocation Entry!")
end if
WorkExperiencY = Trim (Request("WorkExperiencY"))
If Len(WorkExperiencY) > 10 Then response.redirect("Error.asp?OK=WorkExperiencY is Over 10 Char")
If Len(WorkExperiencY) < 1 Then response.redirect("Error.asp?OK=WorkExperiencY Should be at Least 1 Characters Long!")
If (not validate(WorkExperiencY)) then
response.redirect("Error.asp?OK=Invalid WorkExperiencY Entry!")
end if
WorkExperiencM = Trim (Request("WorkExperiencM"))
If Len(WorkExperiencM) > 10 Then response.redirect("Error.asp?OK=WorkExperiencM is Over 10 Char")
If Len(WorkExperiencM) < 1 Then response.redirect("Error.asp?OK=WorkExperiencM Should be at Least 1 Characters Long!")
If (not validate(WorkExperiencM)) then
response.redirect("Error.asp?OK=Invalid WorkExperiencM Entry!")
end if
CurrentIndustry = Trim (Request("CurrentIndustry"))
CurrentIndustry = Replace(CurrentIndustry, "'", "''")
If Len(CurrentIndustry) > 100 Then response.redirect("Error.asp?OK=CurrentIndustry is Over 100 Char")
If (not validate(CurrentIndustry)) then
response.redirect("Error.asp?OK=Invalid CurrentIndustry Entry!")
end if
Relocate = Trim (Request("Relocate"))
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("CurrentEmployer"))
CurrentEmployer = Replace(CurrentEmployer, "'", "''")
If Len(CurrentEmployer) > 75 Then response.redirect("Error.asp?OK=CurrentEmployer is Over 75 Char")
If (not validate(CurrentEmployer)) then
response.redirect("Error.asp?OK=Invalid CurrentEmployer Entry!")
end if
PreviousEmployer = Trim (Request("PreviousEmployer"))
PreviousEmployer = Replace(PreviousEmployer, "'", "''")
If Len(PreviousEmployer) > 75 Then response.redirect("Error.asp?OK=PreviousEmployer is Over 75 Char")
If (not validate(PreviousEmployer)) then
response.redirect("Error.asp?OK=Invalid PreviousEmployer Entry!")
end if
Skills = Trim (Request("Skills"))
Skills = Replace(Skills, "'", "''")
If Len(Skills) > 250 Then response.redirect("Error.asp?OK=Skills is Over 250 Char")
If Len(Skills) < 5 Then response.redirect("Error.asp?OK=Skills Should be at Least 5 Characters Long!")
If (not validate(Skills)) then
response.redirect("Error.asp?OK=Invalid Skills Entry!")
end if
Role = Trim (Request("Role"))
Role = Replace(Role, "'", "''")
If Len(Role) > 50 Then response.redirect("Error.asp?OK=Role is Over 50 Char")
If Len(Role) < 5 Then response.redirect("Error.asp?OK=Role Should be at Least 5 Characters Long!")
If (not validate(Role)) then
response.redirect("Error.asp?OK=Invalid Role Entry!")
end if
Title = Trim (Request("Title"))
Title = Replace(Title, "'", "''")
If Len(Title) > 75 Then response.redirect("Error.asp?OK=Title is Over 75 Char")
If Len(Title) < 2 Then response.redirect("Error.asp?OK=Title Should be at Least 2 Characters Long!")
If (not validate(Title)) then
response.redirect("Error.asp?OK=Invalid Title Entry!")
end if
JResume = Trim (Request("Resume"))
JResume = Replace(JResume, "'", "''")
If Len(Title) > 10000 Then response.redirect("Error.asp?OK=Resume is Over 10000 Char")
If (not validate(JResume)) then
response.redirect("Error.asp?OK=Invalid Resume Entry!")
end if
Email = Trim (Request("EmailID"))
Email = Replace(Email, "'", "")
If Len(Email) > 85 Then response.redirect("Error.asp?OK=Email is Over 85 Char")
If Len(Email) < 5 Then response.redirect("Error.asp?OK=EmailID Should be at Least 5 Characters Long!")
Password = Trim (Request("Password"))
Password = Replace(Password, "'", "")
If Len(Password) >= 20 Then response.redirect("Error.asp?OK=Password is Over 20 Char")
If Len(Password) < 5 Then response.redirect("Error.asp?OK=Password Should be at Least 5 Characters Long!")
If (not validate(Email) or not validate(Password) or not validate(LoginID)) then
response.redirect("Error.asp?OK=Invalid Email ID / Password")
end if
EmailC = Trim (Request("EmailIDC"))
If EmailC = Email Then
'
Else
response.redirect("Error.asp?OK=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.redirect("Error.asp?OK=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=InValid Email"
Response.Redirect(randr)
End If
end if
%>
<!--#include file="datacon.asp"-->
<%
DABase = "Data"
'-----------Open DataBase Connections
Set Conn = Server.CreateObject ("ADODB.Connection")
Conn.Open xDb_Conn_Str
'-------------Open Database to Check Email ID Exists
Set CSql = Conn.Execute("SELECT * 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], [PreferredLocation], [TotalWorkExpY], [TotalWorkExpM], [CurrentIndustry], [Relocate], [CCTCL], [CCTCT], [ECTCL], [ECTCT], [CurrentEmployer], [PreviousEmployer], [Skills], [Role], [Title], [Resume], [IP]) values ('"& Email & "', '"& Password & "', '"& FName & "', '"& LName & "', '"& DOBD & "', '"& DOBM & "', '"& DOBY & "', '"& JDate & "', '"& Sex & "', '"& Mobile & "', '"& Landline & "', '"& Qualification & "', '"& Institute & "', '"& CurrentLocation & "', '"& PreferredLocation & "', '"& WorkExperiencY & "', '"& WorkExperiencM & "', '"& CurrentIndustry &"', '"& Relocate &"', '"& CCTCL &"', '"& CCTCT &"', '"& ECTCL &"', '"& ECTCT &"', '"& CurrentEmployer & "', '"& PreviousEmployer & "', '"& Skills & "', '"& Role & "', '"& Title &"', '"& JResume & "', '"& IP &"')"
Conn.Execute sSql
End If
'----------------End of Account Creations
'--------------Create CDonts
If OK = "Yes" Then
Set objCDO = Server.CreateObject("CDONTS.NewMail")
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"&vbcrlf&_
" "& 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.Redirect(c3)
Conn.close
set Conn = nothing
%>
Apr 3 '08 #1
3 6197
jeffstl
432 Expert 256MB
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 registrationpage.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 registrationpage.asp\login page to handle all errors

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

response.redirect("error.asp?OK=InvalidUser")

with

response.redirect("registrationpage.asp?OK=Invalid User")

THEN after that you would move all the code that handles printing the error information from error.asp into registrationpage.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
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 Expert 256MB
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
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...
6
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=......
0
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."...
2
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...
1
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...
1
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....
2
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...
1
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....
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.