Solved

Js and coldfusion.

Posted on 2002-06-05
9
130 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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
What You Need to Know when Searching for a Webhost Provider
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…

696 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