Link to home
Start Free TrialLog in
Avatar of Larry Vollmer
Larry Vollmer

asked on

PHP question

I have a very basic question - just started using cakephp and i am having trouble getting my index page to render.

I have two pages: 1 is the index page and one is the expiration page. I have a date set, and if the current date does not exceed the $expiration_date, the index page is supposed to render. I keep getting a 404 error - am I doing anything obviously wrong?
<?php

class ftaf2Controller extends AppController {
	/**
	 * @access	public
	 * @var		string
	 */
	public $name = 'ftaf2';

	/**
	 * @access	public
	 * @var		array
	 */
	public $uses = array(
		'Coupon'
	);
	
	/**
	 * @access	public
	 * @var		array
	 */
	public $components = array(
        'Session',
		'EmailDeployment'
	);

	/**
	 * beforeFilter callback
	 *
	 * @since	0.3
	 * @access  public
	 * @return  void
	 */
	public function beforeFilter() {

		$expiration_date = '2011-12-06 00:00:00';

		if (date('Y-m-d H:i:s') > $expiration_date) {
			$this->render('expired');
			exit;
		}

 public function index() {
		 } 
	
	}

?>

Open in new window

Avatar of seanmccully
seanmccully

First you are not comparing dates  correctly, use the strtotime function to compare dates.
Avatar of Larry Vollmer

ASKER

can you show me an example of what should be done?
ASKER CERTIFIED SOLUTION
Avatar of Chris Harte
Chris Harte
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh, remove the printf statements after you understand what is happening.
thanks