I have a members only section that allows 30 day guest pass. When
logging in, I need to check to see if user is a registered member or a
registered visitor on a 30 day pass and to redirect them if 30 days has
expired. What am I doing wrong?
Thanks in advance.
<!--- login with 30 day pass --->
<CFPARAM name="LoginSubmit" default="">
<CFPARAM name="username" default="">
<CFPARAM name="pwd" default="">
<!--- check form variables to see if user is in db --->
<CFIF LoginSubmit EQUAL "Login">
<CFQUERY name="login" datasource="Namesql" username="bubba"
password="foo">
SELECT *
FROM Users
WHERE UserName='#username#'
AND Pwd = '#pwd#'
</CFQUERY>
<!--- pull signupdate from database, to see if user is on a 30 day pass
--->
<cfquery name="30DayPass" datasource="Namesql" username="bubba"
password="foo">
SELECT SignUpDate
FROM Users
WHERE UserName='#username#'
AND pwd = '#pwd#'
</cfquery>
<!--- make signupdate info available --->
<cfoutput query="30DayPass"></cfoutput>
<!--- Begin DateCompare --->
<!--- Compare signupdate with todays date to see if its been 30 days
--->
<cfif (SignUpDate + #DateFormat(Now())#) GTE 30 >
<!--- if GTE to 30 days redirect them to expiration page --->
<cflocation url="membership_expired.cfm">
<!--- check to see if signupdate is null --->
<cfelseif SignUpDate "">
<!--- if null then they are a paid member with full access,
redirect to login --->
<cflocation url="login.cfm">
<!--- check if less than 30 days --->
<cfelse (SignUpDate + #DateFormat(Now())#) LT 30>
<!--- if true, redirect them to login --->
<cflocation url="login.cfm">
</cfif>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Sams Teach Yourself Regular Expressions in 10 Minutes by Ben Forta
http://www.houseoffusion.com/banners/view.cfm?bannerid=40
Message: http://www.houseoffusion.com/lists.cfm/link=i:5:141527
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54