Odyssey
hcuKeepAlive.prg
1 <?php
2 /*
3  * hcuKeepAlive
4  *
5  * The purpose of this script will be to keep the current session alive,
6  * first it must validate the current session.
7  * If it is successful, then it wil increase the length of time for the cookie
8  * with current HomeCU settings
9  *
10  */
11 
12 
13  $serviceSkipCredentials = true;
14  $serviceSkipSecurity = true;
15  $serviceShowInfo = false;
16  $serviceLoadMenu = false;
17 
18  require_once(dirname(__FILE__) . '/../library/hcuService.i');
19 
20  // ** We called hcuService and skipped all validation.
21  // ** now call check_member_credentials for current status
22  $mbrStatus = Check_Member_Credentials($HB_ENV, HCU_array_key_value("Ticket", $_COOKIE));
23  // ** two dimensional array
24 
25  if (!$mbrStatus['result']) {
26  // ** We do NOT have a valid session, print FAIL.. nothing else to do
27  print "FAIL";
28  } else {
29  // ** we have a valid session -- I want to reset the time on the cookie
30  $now = time();
31  $newCtime = $now;
32  $newCe = $now + $HB_ENV['SYSENV']['ticket']['expires'];
33 
34  SetTicket($HB_ENV, $_COOKIE['Ticket'], "Ctime={$newCtime}&Ce={$newCe}");
35 
36  print "OK";
37  }