This topic is locked

Redirect based on date

3/9/2009 12:00:56 PM
PHPRunner General questions
bobvance author

Hello... after logging into the database, I would like the user to be redirected to another website (and logged out) if the date in one of my date fields is greater than 12 months old. Also, is it possible to use a date field that is not showing on the list screen?
Thanks for your help!

J
Jane 3/10/2009

Hi,
use AfterSuccessfulLogin event on the Events tab for this purpose.

Select required date from database, compare it with current date and redirect to another page if needed.

Use Redirect to another page action as a sample.

bobvance author 3/10/2009

Hi,

use AfterSuccessfulLogin event on the Events tab for this purpose.

Select required date from database, compare it with current date and redirect to another page if needed.

Use Redirect to another page action as a sample.


Thanks Jane. Here is the code I wrote to accomplish in case it can help someone else:
global $conn;

$str = "select * from Client_models where password='".$_SESSION["OwnerID"]."'";

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);

$date1 = date("Y-m-d");

$date2 = $data["Risk_recd_date"];

if ((strtotime($date1) - strtotime($date2))/60/60/24/365 > 1){

header('Location: http://www.xxxxx.com');;)

exit();

}