Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 26th, 2004, 12:18 PM
Authorized User
 
Join Date: Sep 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Validate Expiration date

I am trying to validate membership expiration date. (I am a beginner)

Although this part works fine:
<td class='headerTD'><strong>
 My Discussions | </strong>
   <% =f_name %>&nbsp;<% =l_name %> <% if session("dtlast") <> "" then response.write " | <i>your last visit was:</i> " %><% =session("dtlast") %>&nbsp;<% response.Write("| Your membership expires on ") %><% =dtExpire%>&nbsp;<% response.Write("| current date ") %><% =FormatDateTime(Now(),2) %>
</td>


This part is not working. Is there anything wrong with this code?

...
dtExpire = trim(request("dtExpire"))
    if dtExpire <= FormatDateTime(Now(),2) then
        response.Redirect("login_MEMBERSHIP.asp")
    end if
...
 
Old January 26th, 2004, 12:29 PM
Authorized User
 
Join Date: Aug 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default

the only thing I can see is that

dtExpire = trim(request("dtExpire"))

is dealing with a string and your comparing it to a date with your if...then.

maybe try:

dtExpire = CDate(trim(request("dtExpire")))
 
Old January 26th, 2004, 12:38 PM
Authorized User
 
Join Date: Sep 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I replaced the suggested line. Same problem. It let's me log in even though the membership expired.
 
Old January 26th, 2004, 12:43 PM
Authorized User
 
Join Date: Aug 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try:

Response.Write(dtExpire & "<br />" & FormatDateTime(Now(),2))

and see if that sheds any light.
 
Old January 26th, 2004, 12:53 PM
Authorized User
 
Join Date: Sep 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am not sure what you mean...
Response.Write(dtExpire & "<br />" & FormatDateTime(Now(),2))
writes
1/22/04
1/26/04

 ...both dates are formated the same





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to validate date jijish ASP.NET 2.0 Professional 4 December 20th, 2007 07:17 AM
Validate date format is correct gayatrikeshkamat VB How-To 0 April 4th, 2006 07:48 AM
Validate Date sparc ASP.NET 1.0 and 1.1 Basics 1 September 20th, 2005 09:55 AM
validate date javascript lcsgeek Classic ASP Basics 3 October 3rd, 2003 04:07 PM
how to validate a date clientside lcsgeek Classic ASP Professional 2 October 3rd, 2003 03:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.