Re: expiration date page (was- Fwd: Hello Sir)

2010-02-09 Thread Céryl
I;m not really sure about the exact mechanics you'd like, but you can
probably set the view so that it changes according to the date:

set('layout', "christmas");
} elseif ((date("Y-m-d") < date("2010-08-01") && (date("Y-m-d") >
date("2010-06-01"))) {
   $this->set('layout', "summer");
}
 and then in the view:
echo $this->renderElement($layout);


Just two ideas from the top of my head.




On 9 feb, 05:23, Marcelo Andrade  wrote:
> -- Forwarded message --
> From: r sai lingeswara reddy 
> Date: Mon, Feb 8, 2010 at 1:31 PM
> Subject: Hello Sir
>
> Hello Sir,
> How are you?
> I have a doubt regarding the php(I'm using cakephp framework). What I
> need to do is...I have to set the expiration date a certain page. For
> example.
> I am creating a christmas party page.
> 1) I need to first set the user login page
> 2) then redirect it to the main party page
> 3) And I need to close the page on a particular date
>   for example:- the party page shud be available on from dec 1st 2010
> to dec 27th 2010
>     How do i do it sir? Can u guide me..Do I have to make use
> of session--put ---get?? Do u have any examples that I can go
> through...Thank u in advance...have a nice day
>
> Looking forward to ur reply...
>
> Sincerely,
> Sai
>
> --
> MARCELO F ANDRADE
> Belem, Amazonia, Brazil
>
> "I took the red pill"

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


expiration date page (was- Fwd: Hello Sir)

2010-02-08 Thread Marcelo Andrade
-- Forwarded message --
From: r sai lingeswara reddy 
Date: Mon, Feb 8, 2010 at 1:31 PM
Subject: Hello Sir

Hello Sir,
How are you?
I have a doubt regarding the php(I'm using cakephp framework). What I
need to do is...I have to set the expiration date a certain page. For
example.
I am creating a christmas party page.
1) I need to first set the user login page
2) then redirect it to the main party page
3) And I need to close the page on a particular date
  for example:- the party page shud be available on from dec 1st 2010
to dec 27th 2010
    How do i do it sir? Can u guide me..Do I have to make use
of session--put ---get?? Do u have any examples that I can go
through...Thank u in advance...have a nice day

Looking forward to ur reply...

Sincerely,
Sai

-- 
MARCELO F ANDRADE
Belem, Amazonia, Brazil

"I took the red pill"

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Session.timeout vs session cookie expiration date

2009-06-11 Thread lapinski



I was having the same concern. I looked at session.php (under cake/libs/),
in function __initSession():

security: high : $this->cookieLifeTime = 0 
security: medium : $this->cookieLifeTime = 7 * 86400
security: low : $this->cookieLifeTime = 78894


foldiman wrote:
> 
> 
> I haven't found any documentation on this. But I'm assuming the
> Session.timeout and Cookie expiration date are not equal. In fact, by
> experimenting with the three different security levels, I found the
> following:
> 
> low = cookie expires in 25 years
> medium = cookie expires in 1 week
> high = cookie expires at the end of the session
> 
> Can anyone confirm these values? Also, I'm assuming a new session uses
> the same cookie if it exists rather than overwriting itcorrect?
> 
> Thanks.
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Session.timeout-vs-session-cookie-expiration-date-tp23985613p23987281.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Session.timeout vs session cookie expiration date

2009-06-11 Thread foldiman

I haven't found any documentation on this. But I'm assuming the
Session.timeout and Cookie expiration date are not equal. In fact, by
experimenting with the three different security levels, I found the
following:

low = cookie expires in 25 years
medium = cookie expires in 1 week
high = cookie expires at the end of the session

Can anyone confirm these values? Also, I'm assuming a new session uses
the same cookie if it exists rather than overwriting itcorrect?

Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Expiration Date

2009-03-12 Thread brian

On Fri, Mar 13, 2009 at 12:03 AM, Dave Maharaj :: WidePixels.com
 wrote:
>
> I am trying to use the beforeSave function to create an expiration date 30
> days from creation time.
>
> function beforeSave() {
>        if(!empty($this->data['Ticket']['user_id'])) {
>                $this->data['Ticket']['expires'] =
> $this->expiresDate($this->data['Ticket']['created']);
>        }
>        return true;
> }
>
> function expiresDate($dateString) {
>        $future = strtotime('+30 days', $dateString);
>        return date('Y-m-d', strtotime($future));
> }
>

I was just working on something similar. You have to pass a timestamp
as the 2nd param:

$future = strtotime('+30 days', strtotime($dateString));

So, you could just change the method to:

function expiresDate($dateString) {
return date(
'Y-m-d',
strtotime(
'+30 days',
strtotime($dateString)
)
);
}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Expiration Date

2009-03-12 Thread Dave Maharaj :: WidePixels.com

I am trying to use the beforeSave function to create an expiration date 30
days from creation time.
 
function beforeSave() {
if(!empty($this->data['Ticket']['user_id'])) {
$this->data['Ticket']['expires'] =
$this->expiresDate($this->data['Ticket']['created']);
}
return true;
}

function expiresDate($dateString) {
$future = strtotime('+30 days', $dateString);
return date('Y-m-d', strtotime($future)); 
}

But its not doing anything.

Is there something missing or wrong here?
 
Dave


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Credit Card Expiration Date Validation

2009-02-16 Thread JoshSchramm

Oh cool i didnt know i could code a custom method and call it from the
validates array. Thats way better than what I've been doing (override
validates.) Thanks.


On Feb 11, 9:37 am, grigri  wrote:
> Here's an excerpt from a model I had for validating this sort of
> thing:
>
> class Order extends AppModel {
>   var $name = "Order";
>
>         var $validate = array(
>                 // ...
>                 'card_valid_from' => array(
>                         'on' => 'card',
>                         'allowEmpty' => false,
>                         'rule' => array('validateRelativeDate', false),
>                         'message' => 'Time travellers are not allowed to shop 
> here'
>                 ),
>                 'card_valid_to' => array(
>                         'on' => 'card',
>                         'allowEmpty' => false,
>                         'rule' => array('validateRelativeDate', true),
>                         'message' => 'That card has expired'
>                 ),
>                 // ...
>         );
>
>         function deconstruct($field, $data) {
>                 if ($field == 'card_valid_from' || $field == 'card_valid_to') 
> {
>                         $data['day'] = '01';
>                 }
>                 return parent::deconstruct($field, $data);
>         }
>
>         function validateRelativeDate($date, $inFuture) {
>                 $now = date('Y-m') . '-01';
>
>                 $date = reset($date);
>
>                 if ($inFuture) {
>                         return $date >= $now;
>                 }
>                 else {
>                         return $date <= $now;
>                 }
>         }
>
> }
>
> The view form elements look like this (excerpt):
>
> echo $form->inputs(array(
>         'legend' => 'Pay by Credit Card',
>         'card_valid_from' => array('type' => 'date', 'dateFormat' => 'MY'),
>         'card_valid_to' => array('type' => 'date', 'dateFormat' => 'MY')
> ));
>
> hth
> grigri
>
> On Feb 10, 7:38 pm, JoshSchramm  wrote:
>
> > Hey all,
>
> > I cant seem to find anything online to explain this so i'm hoping you
> > all can help a bit.
>
> > I am validating credit card information and right now i'm working on
> > ensuring the user enters an expiration date.
> > For this i have to fields one for month and one for year both using
> > $form->input('type'='date')
>
> > When they post the data looks like
> > [ExpirationMonth] { [month]=>XX }, [ExpirationYear] { [year]=>}
>
> > On the back end I'm trying to validate this and it doesnt want to
> > work. My validate array looks like this.
>
> > 'ExpirationMonth.month'=>array(
> >                         'numeric'=>array(
> >                                 'rule'=>'numeric',
> >                                 'allowEmpty'=>false,
> >                                 'required'=>true,
> >                                 'message'=>'ExpirationMonthInvalid'
> >                         ),
> >                         'between'=>array(
> >                                 'rule'=>array('between', 1, 12),
> >                                 'allowEmpty'=>false,
> >                                 'required'=>true,
> >                                 'message'=>'ExpirationMonthInvalid'
> >                         ),
> >                 ),
> >                 'ExpirationYear.year'=>array(
> >                         'notEmpty'=>array(
> >                                 'rule'=>'notEmpty',
> >                                 'allowEmpty'=>false,
> >                                 'required'=>true,
> >                                 'message'=>'ExpirationYearInvalid'
> >                         ),
> >                         'numeric'=>array(
> >                                 'rule'=>'numeric',
> >                                 'allowEmpty'=>false,
> >                                 'required'=>true,
> >                                 'message'=>'ExpirationYearInvalid'
> >                         )
> >                 )
>
> > no matter what i do i don't get an error message back.
>
> > To clarify a bit more i have a 'empty'=>'Choose Month (or year)' in
> > the drop downs so I'm just trying to make sure the user selected
> > something other than that option.
>
> > Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Credit Card Expiration Date Validation

2009-02-11 Thread grigri

Here's an excerpt from a model I had for validating this sort of
thing:

class Order extends AppModel {
  var $name = "Order";

var $validate = array(
// ...
'card_valid_from' => array(
'on' => 'card',
'allowEmpty' => false,
'rule' => array('validateRelativeDate', false),
'message' => 'Time travellers are not allowed to shop 
here'
),
'card_valid_to' => array(
'on' => 'card',
'allowEmpty' => false,
'rule' => array('validateRelativeDate', true),
'message' => 'That card has expired'
),
// ...
);

function deconstruct($field, $data) {
if ($field == 'card_valid_from' || $field == 'card_valid_to') {
$data['day'] = '01';
}
return parent::deconstruct($field, $data);
}

function validateRelativeDate($date, $inFuture) {
$now = date('Y-m') . '-01';

$date = reset($date);

if ($inFuture) {
return $date >= $now;
}
else {
return $date <= $now;
}
}
}

The view form elements look like this (excerpt):

echo $form->inputs(array(
'legend' => 'Pay by Credit Card',
'card_valid_from' => array('type' => 'date', 'dateFormat' => 'MY'),
'card_valid_to' => array('type' => 'date', 'dateFormat' => 'MY')
));

hth
grigri

On Feb 10, 7:38 pm, JoshSchramm  wrote:
> Hey all,
>
> I cant seem to find anything online to explain this so i'm hoping you
> all can help a bit.
>
> I am validating credit card information and right now i'm working on
> ensuring the user enters an expiration date.
> For this i have to fields one for month and one for year both using
> $form->input('type'='date')
>
> When they post the data looks like
> [ExpirationMonth] { [month]=>XX }, [ExpirationYear] { [year]=>}
>
> On the back end I'm trying to validate this and it doesnt want to
> work. My validate array looks like this.
>
> 'ExpirationMonth.month'=>array(
>                         'numeric'=>array(
>                                 'rule'=>'numeric',
>                                 'allowEmpty'=>false,
>                                 'required'=>true,
>                                 'message'=>'ExpirationMonthInvalid'
>                         ),
>                         'between'=>array(
>                                 'rule'=>array('between', 1, 12),
>                                 'allowEmpty'=>false,
>                                 'required'=>true,
>                                 'message'=>'ExpirationMonthInvalid'
>                         ),
>                 ),
>                 'ExpirationYear.year'=>array(
>                         'notEmpty'=>array(
>                                 'rule'=>'notEmpty',
>                                 'allowEmpty'=>false,
>                                 'required'=>true,
>                                 'message'=>'ExpirationYearInvalid'
>                         ),
>                         'numeric'=>array(
>                                 'rule'=>'numeric',
>                                 'allowEmpty'=>false,
>                                 'required'=>true,
>                                 'message'=>'ExpirationYearInvalid'
>                         )
>                 )
>
> no matter what i do i don't get an error message back.
>
> To clarify a bit more i have a 'empty'=>'Choose Month (or year)' in
> the drop downs so I'm just trying to make sure the user selected
> something other than that option.
>
> Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Credit Card Expiration Date Validation

2009-02-10 Thread JoshSchramm

Hey all,

I cant seem to find anything online to explain this so i'm hoping you
all can help a bit.

I am validating credit card information and right now i'm working on
ensuring the user enters an expiration date.
For this i have to fields one for month and one for year both using
$form->input('type'='date')

When they post the data looks like
[ExpirationMonth] { [month]=>XX }, [ExpirationYear] { [year]=>}

On the back end I'm trying to validate this and it doesnt want to
work. My validate array looks like this.

'ExpirationMonth.month'=>array(
'numeric'=>array(
'rule'=>'numeric',
'allowEmpty'=>false,
'required'=>true,
'message'=>'ExpirationMonthInvalid'
),
'between'=>array(
'rule'=>array('between', 1, 12),
'allowEmpty'=>false,
'required'=>true,
'message'=>'ExpirationMonthInvalid'
),
),
'ExpirationYear.year'=>array(
'notEmpty'=>array(
'rule'=>'notEmpty',
'allowEmpty'=>false,
'required'=>true,
'message'=>'ExpirationYearInvalid'
),
'numeric'=>array(
'rule'=>'numeric',
'allowEmpty'=>false,
'required'=>true,
'message'=>'ExpirationYearInvalid'
)
)

no matter what i do i don't get an error message back.

To clarify a bit more i have a 'empty'=>'Choose Month (or year)' in
the drop downs so I'm just trying to make sure the user selected
something other than that option.

Any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---