EREG to PREG_MATCH Error
Posted: Sat Jun 12, 2010 6:43 am
Hi
I have built a system on my localhost, which is running PHP 5.2.1 and mySQL 5.0.33. I have used the following code:
I have uploaded the site (that works locally) and hit error after error. The first one I realised is that my local mySQL converted my passwords using the PASSWORD() parameter and resulted in letters and numbers. However, my hosted area has the newer PASSWORD() system that adds a * to the front.
I added * to my array for EREG but this still failed. I then realised that EREG has gone and that I should now use PREG_MATCH. However, I tried this:
This fails everytime, so what am I doing wrong?
My hosted system uses PHP 5.2.13 and mySQL 5.0.90.
***** EDIT ******
Okay, I now realise that I should have used \* rather than * to rule out it's use as a command. However, local is logging in, remote site is not. Any ideas?
I have built a system on my localhost, which is running PHP 5.2.1 and mySQL 5.0.33. I have used the following code:
Code: Select all
function validateTextOnly($theinput,$description = '') {
$result = ereg ("^[A-Za-z0-9\ ]+$", $theinput );
if ($result) { return true; }
else {
$this->errors[] = $description;
return false; }}
I added * to my array for EREG but this still failed. I then realised that EREG has gone and that I should now use PREG_MATCH. However, I tried this:
Code: Select all
$result = preg_match ("/^[A-Za-z0-9\ ]+$*/", $theinput );
My hosted system uses PHP 5.2.13 and mySQL 5.0.90.
***** EDIT ******
Okay, I now realise that I should have used \* rather than * to rule out it's use as a command. However, local is logging in, remote site is not. Any ideas?