Solved

Js and coldfusion.

Posted on 2002-06-05
9
131 Views
Last Modified: 2013-12-24
I am attempting something that I hate to work with, that is dates.

could someone help me out or point me in the right direction.

this is what I am trying to accomplish.

I am trying to script out a code that will run in my include.cfm.
My include.cfm checks for the existance of a login.

I would like it to check to see if today is =<5 days before my  needtochange(field in table of db) date.
if it is I would like the user to have to go to my pwdchange.cfm and change there password before proceeding.
if the date (today)does not fall in that criteria then proceed as normal thru the site.

thanks in advance
 
0
Comment
Question by:jriver12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 5

Expert Comment

by:Yog
ID: 7059253
since you are checking for login after submitting in the server side,it is better you script this with coldfusion, or create a stored proc which does this, and return a boolean yes or no, are you using sqlserver ?
0
 

Author Comment

by:jriver12
ID: 7059271
yes I am using sql server 2000.
can you help point me in the right direction I have not done any of the suggestions you have mentioned.?
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 7059313
your DB is MSAccess right?

Try this:

<cfquery name="myquery" datasource="mydatasource">
    SELECT needtochange FROM user_account_table
    where accountID = #SESSION.accountID#
</cfquery>

<cfset daysUntilPasswordChangeRequired = DateDiff("d", Now(), myquery.needtochange)>

<cfif daysUntilPasswordChangeRequired <= 5>
   <cflocation url="pwdchange.cfm">
</cfif>

CJ
0
Don't Miss ATEN at InfoComm 2017!

Visit booth #2167 to see the  new ATEN VM3200 32 x 32 Modular Matrix Switch. Other highlights include the VE8950 4K HDMI Over IP Extender, VS1912 12-Port DP Video Wall Media Player  and VK2100 ATEN Control System. Register now with Free Pass Code ATEN288!

 
LVL 19

Expert Comment

by:cheekycj
ID: 7059325
That should work with SQL Server too.

I am sure you can incorperate the check in the query itself.

When you check login, you can check for it and redirect immediately.  Is needtochange always in the future (or ideally is it)?

0
 

Author Comment

by:jriver12
ID: 7059332
cj,
yes needtochange is always in the future.
0
 
LVL 19

Accepted Solution

by:
cheekycj earned 100 total points
ID: 7059378
you can try this:
<cfquery name="checkLogin" datasource="mydatasource">
   SELECT DATEDIFF (d, sysdate, needtochange) as daysUntilPasswordChangeRequired, accountID FROM user_account_table
   where username = '#Form.userName#' And Password = '#FORM.password#'
   
</cfquery>


<cfif checkLogin.daysUntilPasswordChangeRequired <= 5>
  <cflocation url="pwdchange.cfm">
</cfif>

OR

<cfquery name="myquery" datasource="mydatasource">
   SELECT DATEDIFF (d, sysdate, needtochange) as daysUntilPasswordChangeRequired FROM user_account_table
   where accountID = #SESSION.accountID#
</cfquery>

<cfif myquery.daysUntilPasswordChangeRequired <= 5>
  <cflocation url="pwdchange.cfm">
</cfif>


HTH,
CJ
0
 

Author Comment

by:jriver12
ID: 7062758
cj I'm haven't tested it jet.  just a lil O.B.E(s).will let you know.
0
 

Author Comment

by:jriver12
ID: 7069704
thanks again
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 7070166
Glad I could help and Thanx for the "A".

CJ
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question