Pastoid

The page you are looking at now is at this URL: http://pastoid.com/am6

This paste was last updated on February 9, 2009 at 3:18 pm.

Pasted Coderaw

/**
* Get my data from the DB.
*/
function res_contract_detail() {
	if (user_access('view emergency info')) {
 
    $dbConnect = mssql_connect_estab($conn);
 
    $pid = ldap_pbu_id_get_id();
 
    $sql = "SELECT P.COMM_LIFE AS COMM_LIFE, P.RES_CONTRACT AS RES_CONTRACT, p.revision_date as revision_date FROM PBU_WEB_SIGNED_CONTRACTS P WHERE P.people_id='{$pid}'";
    $result = mssql_query($sql);
 
    if($result === false || !mssql_num_rows($result)) {
	    drupal_set_message(t('ERROR: No Resident Contract info on File for you.'), 'error');
    } else {
      }
      $row = mssql_fetch_assoc($result);
      return $row;
 
  }
}
 
/**
* Called when the user goes to the page.
*/
function res_contract_page() {
			$rec = res_contract_detail();
 
			$myVarz = variable_get('res_contract_days', '');
 
			//date to compare
			$rev_date = $rec['revision_date'];
 
			//get todays datetime in seconds
			$today = time();
 
			//global days variable into seconds
			$comp = $myVarz * 86400;
 
			//convert MSSQL datetime to unix epoch time.
			$dbTime = strptime($rev_date, '%Y-%m-%d %H:%M:%S');
			//$revInt = mktime($dbTime['tm_hour'], $dbTime['tm_min'], $dbTime['tm_sec'], $dbTime['tm_mon'], $dbTime['tm_mday'], $dbTime['tm_year']);
			$revInt = mktime(0, 0, 0, $dbTime['tm_mon'], $dbTime['tm_mday'], $dbTime['tm_year']);
 
			//today in seconds minus revision_datatime in seconds
			$diff = $today - $revInt;
 
			//figure out many days that result is then round it.
			$diff2 = $diff/86400;			
			$diff3 = array();
			$diff3 = round($diff2);
 
			//if it is more than the limit, show the form
			if ($diff > $comp) {
 
				drupal_set_message(t('Your data is !days days old.', array('!days' => $diff3)), 'error');
				$output .= t('<p>HERE ARE MY TERMS. ACCEPT OR DIE.</p>');
				$output .= t('DB Date:'. $rev_date .'<br />');
				$output .= t('DB TIME:'. $revInt .'<br />');
				$output .= t('DB array:'. $dbTime['tm_year'] .'<br />');	
				$output .= t('Today:'. $today .'<br />');	
				$output .= t('Diff:'. $diff .'<br />');
				$output .= t('var_days:'. $myVarz .'<br />');
				$output .= t('var_secs:'. $comp .'<br />');
				$output .= t('Diff2:'. $diff2 .'<br />');
				$output .= t('Diff3:'. $diff3 .'<br />');	
				$output .= drupal_get_form('res_contract_form');
				return $output;
			} else {
			drupal_goto('node');
			}
}
 

Toggle wordwrap

Referring DomainHits
Unknown Referer 127
pastoid.com 5
search.live.com 2
Is this paste spam?
<Hide