Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Js and coldfusion.

Posted on 2002-06-05
9
Medium Priority
?
134 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
Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

 
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 400 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Geo-targeting is the practice of distributing content based on a person’s location, as best as you can determine it. Let’s look at some ways you could successfully use this tactic. The following tips and case studies could lead to meaningful results.
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
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…
Suggested Courses

649 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