Print Page | Close Window

some asp help

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=28283
Printed Date: 28 March 2026 at 9:19am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: some asp help
Posted By: freakyfred
Subject: some asp help
Date Posted: 25 January 2010 at 4:16pm
can someone help me with this Embarrassed


<%

text = Server.URLEncode(request.form("text"))

if Hour(time)>20 OR Hour(time)<3 then

if  not request("text")  = "hello"  Then

    response.write("The text must say <b>hello</b>")

else

response.write("They said <b>hello</b>")

end if
end if


%>




I know i am going very wrong at the start of this but a push in the right direction would be great.




I should also mention that the text box on the form will only be open at the times given so this bit of code to check  only needs to be active at this time also. Hope it makes sense.



Replies:
Posted By: freakyfred
Date Posted: 25 January 2010 at 5:28pm
also tried this

if Hour(time)>20 OR Hour(time)<3 AND not request("text") = "hello" then

response.write("wrong")


But this still does not work.


Posted By: 123Simples
Date Posted: 25 January 2010 at 7:49pm
Do you mean like this? http://www.justcheck.co.uk/site129/" rel="nofollow - Link
If so the code should read:

<% @LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<%
if Hour(time)>20 OR Hour(time)<3 then
response.write("The text must say <b>hello</b>")
else
response.write("They said <b>hello</b>")
end if


%>
<body>
</body>
</html>





-------------
http://www.123simples.com/" rel="nofollow - Visit 123 Simples Web Design


Posted By: 123Simples
Date Posted: 25 January 2010 at 7:51pm
Well something like that anyway. Bruce, Scotty32 and others will have the better answers as I'm just a beginner still LOL but it seems to work so what the hell eh? Wink

-------------
http://www.123simples.com/" rel="nofollow - Visit 123 Simples Web Design


Posted By: freakyfred
Date Posted: 26 January 2010 at 10:36am
sorry i should have been a little more clearer as to what i am trying to achieve. Basically what i want is between the hours of 8pm (20:00) and 3am the form to request text or in this case a password.

so the form being something like this..

<%
if Hour(time)>20 OR Hour(time)<3 then
%>


Pass: <input type="password" name="password"> <br>
<%
end if
%>


and then the processing side to also work on the same principal so that when the text box is activated the code to check for the password is also activated but then on other times no password is required so not input box and no password cheking on processing form.

Holpe this is a little clearer




Posted By: WebWiz-Bruce
Date Posted: 26 January 2010 at 12:42pm
What you have will never work as 20:00 is a time, and 20 is a number so 20:00 is not going to be more than 20 as they are different data types.

Try looking up the VbScript function DateAdd to be able to handle times in this manner.


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net