Re: Data validation doesn't work when on live server

2010-02-18 Thread Atti
I have instructed my host to upgrade the software on the server as I
dont have control over it.

On Feb 18, 10:36 am, jperras  wrote:
> 1) You're probably running CentOS on your production server.
> 2) CentOS ships with broken PCRE UTF-8 libraries.
> 3) A few of the validation rules in CakePHP use multibyte flags (e.g.
> for alphanumeric validation)
>
> Combine the above, and you get the problem you've described.
>
> Solutions:
>
> 1) Ditch CentOS. It's a piece of shit for PHP web development. It
> ships with PHP 5.1.6 (4 years old), an ancient version of Apache,
> OpenSSL 3.x (which is currently at a 5.x release), and more. Using
> CentOS is just going to cause pain and trouble.
>
> 2) Stick with the shit that is CentOS, and fix the 
> RPMs:http://gaarai.com/2009/01/31/unicode-support-on-centos-52-with-php-an...
>
> 3) Write your own custom validation rules for any built-in rules that
> use multibyte flags in the regular expressions.
>
> There aren't really any other options.
> -jperras
>
> On Feb 17, 3:43 pm, Atti  wrote:
>
> > Hi all,
> > Just a quick question, I managed to get my data validation working
> > perfectly on my local apache (XAMPP) web server, but as soon as I
> > uploaded the site to the internet the validation flag seems to be
> > always true, ie, there is not validation going on, so it seems. What
> > settings on my live server would allow this to happen, the page im
> > talking about is:http://www.findworkabroad.com/signup
>
> > any help grately appreciated
>
> > Thanks
> > Atti

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: Data validation doesn't work when on live server

2010-02-18 Thread Atti
Model:
class Registration extends AppModel {
var $name = 'Registration';
var $validate = array(
'name'  => array(
 'rule' => array('minLength', 
5),
'required' => true,
 'message' => 'Please enter 
your full name'
 ),
 'email' => array(
'rule' => array('email'),
 'message' => 'Please supply a 
valid email address.'
),
'password' => array(
 'rule' =>array('minLength', 5),
'required' => true,
 'message' => 'Your password 
must be longer than 5 characters'
),
 'tel' => array(
 'rule' => array('phone', 
"/((\+44\s?\(0\)\s?\d{2,4})|(\+44\s?
(01|02|03|07|08)\d{2,3})|(\+44\s?(1|2|3|7|8)\d{2,3})|(\(\+44\)\s?
\d{3,4})|(\(\d{5}\))|((01|02|03|07|08)\d{2,3})|(\d{5}))(\s|-|.)
(((\d{3,4})(\s|-)(\d{3,4}))|((\d{6,7})))/", null),
'required' => true,
 'message' => 'Please enter a 
correct UK number'
 ),
 'mobile' => array(
 'rule' => array('phone', 
"/((\+44\s?\(0\)\s?\d{2,4})|(\+44\s?
(01|02|03|07|08)\d{2,3})|(\+44\s?(1|2|3|7|8)\d{2,3})|(\(\+44\)\s?
\d{3,4})|(\(\d{5}\))|((01|02|03|07|08)\d{2,3})|(\d{5}))(\s|-|.)
(((\d{3,4})(\s|-)(\d{3,4}))|((\d{6,7})))/", null),
 'message' => 'Please enter a 
correct UK mobile number'
 ),
'add1' => array(
 'rule' =>array('minLength', 5),
'required' => true,
 'message' => 'You must enter 
the first line of your address'
),
'postcode' => array(
 'rule' =>array('minLength', 3),
'required' => true,
 'message' => 'You must enter your postcode'
),


 );
 }
controller:
App::import('Sanitize');
class RegistrationsController extends AppController {
var $name = 'Registrations';
var $helpers =  array('Form');
var $components = array('Email');
function signup() {
 $this->pageTitle = 'Find Work Abroad:Sign up for free online today -
Guaranteed work TEFL Teaching english in southern China, Guaranteed
job and placement, EFL, ESL Teach English in China';
$validates = true;
$saved = true;
$alldone = false;
$message = "";
 if(isset($_GET['year'])) {
 $this->set('year', 
Sanitize::paranoid($_GET['year']));
} else if(isset($_POST['signupYear'])) {
$this->set('year', 
Sanitize::paranoid($_POST['signupYear']));
} else {
$this->set('year','2010');
}

if(isset($this->data['Registration']['name'])) {
$this->set("registration", $this->data);
   $this->Registration->set($this->data);

if($this->data['Registration']['password']!=$this-
>data['Registration']['password2']) {

$this->Registration->invalidate('password2', 'Your passwords
must match');
}
 if ($this->Registration->validates()) {
 //check we dont have that email already
if(($this->Registration->find('count', 
array('conditions' =>
array('Registration.email' => $this->data['Registration']
['email']==0)   
{

$this->data['Registration']['address'] = $this-
>data['Registration']['add1']."  ".$this->data['Registration']
['add2'];

$this->data['Registration']['password'] = md5($this-
>data['Registration']['password']);

$this->data['Registration']['signupdate'] = date('l jS \of F Y
h:i:s A');
  

Re: Data validation doesn't work when on live server

2010-02-18 Thread jperras
1) You're probably running CentOS on your production server.
2) CentOS ships with broken PCRE UTF-8 libraries.
3) A few of the validation rules in CakePHP use multibyte flags (e.g.
for alphanumeric validation)

Combine the above, and you get the problem you've described.

Solutions:

1) Ditch CentOS. It's a piece of shit for PHP web development. It
ships with PHP 5.1.6 (4 years old), an ancient version of Apache,
OpenSSL 3.x (which is currently at a 5.x release), and more. Using
CentOS is just going to cause pain and trouble.

2) Stick with the shit that is CentOS, and fix the RPMs:
http://gaarai.com/2009/01/31/unicode-support-on-centos-52-with-php-and-pcre/

3) Write your own custom validation rules for any built-in rules that
use multibyte flags in the regular expressions.

There aren't really any other options.
-jperras

On Feb 17, 3:43 pm, Atti  wrote:
> Hi all,
> Just a quick question, I managed to get my data validation working
> perfectly on my local apache (XAMPP) web server, but as soon as I
> uploaded the site to the internet the validation flag seems to be
> always true, ie, there is not validation going on, so it seems. What
> settings on my live server would allow this to happen, the page im
> talking about is:http://www.findworkabroad.com/signup
>
> any help grately appreciated
>
> Thanks
> Atti

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: Data validation doesn't work when on live server

2010-02-17 Thread Jamal Aziz
Can you post your model and your controller action?

On Feb 18, 3:43 am, Atti  wrote:
> Hi all,
> Just a quick question, I managed to get my data validation working
> perfectly on my local apache (XAMPP) web server, but as soon as I
> uploaded the site to the internet the validation flag seems to be
> always true, ie, there is not validation going on, so it seems. What
> settings on my live server would allow this to happen, the page im
> talking about is:http://www.findworkabroad.com/signup
>
> any help grately appreciated
>
> Thanks
> Atti

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