This topic is locked

forciing password expiration

8/31/2009 4:45:53 PM
PHPRunner General questions
J
jakedorst author

This the database im pulling the log in data from

dbo.pwlog
here are the fields:
id: usernameÂ

pw: passwordÂ

name: John DoeÂ

chgdate: 8/28/2009Â
I want to look at the chgdate for the user loging in (the id feild) and compare that with a last changed date (chgdate) with the current date. If its older than 180 days I want to redirect to the change password page.
so what do i replace in the sample code with first?
//** Check if specific record exists ****

global $conn;

$strSQLExists = "select * from AnyTable where AnyColumn='AnyValue'";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

if($data)

{

// if record exists do something

}

else

{

// if dont exist do something else

}
And what is the php to compare and then redirect to the main page or the change password page?

D
danaci 9/1/2009

user table using the date field and the value you want after login event date in the past if you can force to change password

Sergey Kornilov admin 9/1/2009

Here is the query that does the job (SQL Server):
$strSQLExists = "select * from dbo.pwlog where datediff(d, chgdate, getdate()) >180";