Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: MOD Implementation
 Gatekeeper Mod error message
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 24 August 2008 :  13:55:00  Show Profile
I am currently (trying) installing the Gatekeeper Mod into the Greetings Card Mod and have so far succesfully got the Anti-Spam Question and Input answer box to work. (link)

The stumbling block I have encountered is trying to get the error routines to work, ie no answer entered or the wrong anti-spam answer.

The code I have for the greetings_card_preview is: (Green original error code and red supplied with gatekeeper mod)

<font color="green">if toname = "" then
Response.Write "<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>You forgot to enter your friends details!<br> <a href=""javascript:history.back()"">Return</a></font>" & vbNewLine
else
if ida = "" then
Response.Write "<font face=""" & strDefaultFontFace & """ color=""#FF0000"" size=""" & strDefaultFontSize & """>Please remember to select an image<br> <a href=""javascript:history.back()"">Back</a></font>" & vbNewLine
else
if fromname = "" then
Response.Write "<font face=""" & strDefaultFontFace & """ color=""#FF0000"" size=""" & strHeadFontSize & """>Please enter your name!<br> <a href=""javascript:history.back()"">Back</a></font>" & vbNewLine
else
if title = "" then
Response.Write "<font face=""" & strDefaultFontFace & """ color=""#FF0000"" size=""" & strdefaultFontSize & """><br>This Greeting Card Title is blank!<br></font>" & vbNewLine
Response.Write "<font face=""" & strDefaultFontFace & """ size=""" & strdefaultFontSize & """>Please enter the Greetings Card Title that is missing<br />Thank You <br><a href=""javascript:history.back()"">Back</a></font>" & vbNewLine
else
if message = "" then
Response.Write "<font face=""" & strDefaultFontFace & """ color=""#FF0000"" size=""" & strdefaultFontSize & """><br>This Greeting Card is blank!<br><br></font>" & vbNewLine
Response.Write "<font face=""" & strDefaultFontFace & """ size=""" & strdefaultFontSize & """>You will need to return and enter the details that are missing<br />Greetings Title, the recipients details and email address and your Greeting Card message<br>Thank You <br><a href=""javascript:history.back()"">Back</a></font>" & vbNewLine
else
If IsEmpty(Request("tomail")) Then
Msg = "<font face=""" & strDefaultFontFace & """ color=""#FF0000"" size=""" & strHeadFontSize & """>An Email address is needed to send your card!</font>" & vbNewLine
elseIf InStr(Request("tomail"), "@") = 0 Then
response.write "<font face=""" & strDefaultFontFace & """ color=""#FF0000"" size=""" & strDefaultFontSize & """>Please enter an email address <br> in the form username@domain.co.uk<br><a href=""javascript:history.back()"">Retry</a></font>" & vbNewLine
else
If IsEmpty(Request("frommail")) Then
Msg = "<font face=""" & strDefaultFontFace & """ color=""#FF0000"" size=""" & strDefaultFontSize & """>Please enter your email address.</font>" & vbNewLine
elseIf InStr(Request("frommail"), "@") = 0 Then
response.write "<font face=""" & strDefaultFontFace & """ color=""#FF0000"" size=""" & strDefaultFontSize & """>Please enter an email address<br />in the form username@domain.co.uk<br /><a href=""javascript:window.close()"">Back</a></font>" & vbNewLine
else

<font color="red"> 'Gatekeeper Mod
if strRegistrationGatekeeper = "1" then
select case len(Request.Form("GateKeeperAnswer"))
case "0"
Err_Msg = Err_Msg & "<li>You have not entered an answer for the Antispam question. Please use your back button and try again.</li>"
case else
if (lcase(Request.Form("GateKeeperAnswer")) <> lcase(strGatekeeperAnswer1)) and (lcase(Request.Form("GateKeeperAnswer")) <> lcase(strGatekeeperAnswer2)) then
Err_Msg = Err_Msg & "<li>You have entered a wrong answer for the Antispam question. Please use your back button and try again.</li>"
end if
end select
end if
'Gatekeeper Mod</font id="red">
</font id="green">



I would appreciate if some advise could pinpoint why the gatekeeper error messages fail to work
Thanking you in advance
andy

Carefree
Advanced Member

Philippines
4222 Posts

Posted - 24 August 2008 :  15:25:16  Show Profile
Post a link to the file in .txt format & we'll have a look.

BTW your question leaves a number of possible answers:
12, twelve, Twelve, XII, etc.

To preclude the more obvious ones, you could say:
"What is the sum of six added to six (numerals only)?

Then force numeric replies by enclosing your case else instructions with something like this:


	'Gatekeeper Mod
		if strRegistrationGatekeeper = "1" then
			select case len(Request.Form("GateKeeperAnswer"))
			case "0"
				Err_Msg = Err_Msg & "<li>You have not entered an answer for the Antispam question. Please use your back button and try again.</li>"
			case else
				if IsNumeric(Request.Form("GateKeeperAnswer")) then
					if (lcase(Request.Form("GateKeeperAnswer")) <> lcase(strGatekeeperAnswer1)) and (lcase(Request.Form("GateKeeperAnswer")) <> lcase(strGatekeeperAnswer2)) then
						Err_Msg = Err_Msg & "<li>You have entered a wrong answer for the Antispam question. Please use your back button and try again.</li>"
					end if
				else
					Err_Msg = Err_Msg & "<li>You must use numbers, letters are not accepted. Please use your back button and try again.</li>"
				end if
			end select
		end if
	'Gatekeeper Mod
<

Edited by - Carefree on 24 August 2008 15:28:42
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 24 August 2008 :  15:41:55  Show Profile
CF: Re: txt link, I will post link in morning, currently do not have access to files..(working night shift)

Valid point regarding the antispam question; thank you.


<
Go to Top of Page

Jezmeister
Senior Member

United Kingdom
1141 Posts

Posted - 24 August 2008 :  17:02:04  Show Profile  Visit Jezmeister's Homepage
May seem like a stupid question but is strRegistrationGatekeeper 1? would nicely explain your problem if it's not <
Go to Top of Page

Carefree
Advanced Member

Philippines
4222 Posts

Posted - 24 August 2008 :  17:25:11  Show Profile
Yes, because the antispam form is displayed. Andy's problem lies in error and data validity logic.<
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 25 August 2008 :  03:57:33  Show Profile
CF: Please find two files
greeting_cards_preview.asp textlink
greeting_cards_cat.asp textlink
The alterations in greeting_cards_cat.asp start with
if strLinkSpamGatekeeper = "1" then lines 309-324
The alterations in greeting_cards_preview.asp - the antispam error check are between lines 171-182

The readme file of the Gatekeeper Mod (link in first post above) explains how to incorporate the code with other sitz files. But I got stuck with this validity check here..

Thanking you in advance
edit line numbers changed in reference links<

Edited by - Andy Humm on 25 August 2008 04:36:37
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 25 August 2008 :  04:23:03  Show Profile
CF: I have managed to get an error message/validity check of sorts displaying in the preview page, using this code:
'Gatekeeper Mod
if strRegistrationGatekeeper = "1" then
select case len(Request.Form("GateKeeperAnswer"))
case "0"
response.write "<font face=""" & strDefaultFontFace & """ color=""#FF0000"" size=""" & strDefaultFontSize & """><b>You have not entered an answer for the Antispam question.</b><br /><a href=""javascript:history.back()"">Back</a></font>" & vbNewLine
case else
if (lcase(Request.Form("GateKeeperAnswer")) <> lcase(strGatekeeperAnswer1)) and (lcase(Request.Form("GateKeeperAnswer")) <> lcase(strGatekeeperAnswer2)) then
response.write "<font face=""" & strDefaultFontFace & """ color=""#FF0000"" size=""" & strHeaderFontSize & """><b>You have entered a wrong answer for the Antispam question</b><br /><a href=""javascript:history.back()"">Back</a></font>" & vbNewLine
end if
end select
end if
'Gatekeeper Mod


But if you could look at the preview page , the greeting card will send, even though the error messages are being displayed.
As a way ahead or solution, could the error validity prevent the 'Send this Greeting' button from being active until there are no errors or possible not show the preview panel until all error have cleared?
thanking you
<
Go to Top of Page

Carefree
Advanced Member

Philippines
4222 Posts

Posted - 25 August 2008 :  05:49:31  Show Profile
Definitely, that's what data validation is all about. If you asked for an EMail address and the user typed 1600 Pennsylvania Avenue, he probably wouldn't get the EMail. So you don't want to cause a crash by attempting to insert illegal values into your database - make the burden of compliance fall on the users.<
Go to Top of Page

Carefree
Advanced Member

Philippines
4222 Posts

Posted - 25 August 2008 :  05:57:29  Show Profile
I just saw another flaw in the data validation. It checks for the presence of an @ sign in email fields, but doesn't check if there is any period or anything following a period.

So I could type humbug@christmas - and it thinks it has an EMail address.

This needs a little more work.<
Go to Top of Page

Carefree
Advanced Member

Philippines
4222 Posts

Posted - 25 August 2008 :  06:01:04  Show Profile
You have a number of lines of data validation that aren't having the effect they should. Primarily because the "send this greeting" isn't constrained by an if/then routine.

What needs to happen is to convert all of those Response.Write's to strError = strError & (new message). Then when you get to the "send this greeting", you make it conditional on strError="".<
Go to Top of Page

Carefree
Advanced Member

Philippines
4222 Posts

Posted - 25 August 2008 :  06:40:30  Show Profile
Here, Andy, try these. Your cat file was (other than cosmetic changes & the gatekeeper) very close to mine. I did have a couple of sql injection preventative measures in mine.

Here's your files: gcc gcp<
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 25 August 2008 :  07:30:54  Show Profile
CF, Thank you for your valuable input, and as you say there are quite a few areas that need addressing, especially the data validation routine. When I first downloaded this mod, I tried to tackle some of the flaws, as you say, and got critisised for looking for changes that were not in the initial design concept. However, I have realised there are issues that do require updating and hence tried myself. I am glad you agree there are issues. I understand the data validation lines that aren't having the effect they should, ie email xxx@xxxx will carry without the xxxx.xxxxxx.xx .
The reason for this gatekeeper addon as to to prevent nuisense spamming within the whole forum package from non-members of bot orientation. Thank you so far..

quote: You have a number of lines of data validation that aren't having the effect they should. Primarily because the "send this greeting" isn't constrained by an if/then routine.
What needs to happen is to convert all of those Response.Write's to strError = strError & (new message). Then when you get to the "send this greeting", you make it conditional on strError="".


Is there a way to utilise an 'if/then' to check that the gatekeeper validation is true then display the rest of the preview panel like the other error message routines. I know you mentioned about converting the error to strErrors but I am out of my depth at the moment attempting, I did try, hence, the route I have taken so far.

Thank you again
Andy<
Go to Top of Page

Carefree
Advanced Member

Philippines
4222 Posts

Posted - 25 August 2008 :  07:40:14  Show Profile
I converted the preview page for you already, the validation routine will now work. I also blocked two sql injection loopholes. However, I have not yet tackled the EMail issue. Those changes are in the file links I posted above.<
Go to Top of Page

Carefree
Advanced Member

Philippines
4222 Posts

Posted - 25 August 2008 :  07:56:14  Show Profile
I added in a check for your Gatekeeper - now there won't be a submit button if an error condition still exists.<
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 25 August 2008 :  07:56:52  Show Profile
Thank you I have noted and used the changes, much appreciated,,

I was investigating the routines as we now have them, maybe if we could slot the following code (in green) into the case statements of the gatekeeper and then provided true, we can introduce the final code to show the 'Send this Greeting' button
" <input type=""submit"" value=""Send this Greeting"" name=""B1"">" & vbNewLine & _


response.write "<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>If you need to amend the details above, return back,<br> but please remember to select an image you want displayed on your greeting card <br><a href=""javascript:history.back()"">Back</a></font><br><br>" & vbNewLine &_

warmest regards andy

<
Go to Top of Page

Andy Humm
Average Member

United Kingdom
908 Posts

Posted - 25 August 2008 :  08:03:51  Show Profile
CF, that was quick, just as I have posted my reply and refreshed this thread you have kindly provided a solution to the submit button.
I see the code changes but have not seen them work yet as i have the following error:
Microsoft VBScript compilation error '800a03ea'
Syntax error
/forumtest/greeting_cards_preview.asp, line 90
elseif fromname = "" then strError = strError & "Please enter your name!<br>"
^


Did you ament these routines?<
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.39 seconds. Powered By: Snitz Forums 2000 Version 3.4.07