Re: Quick Question re: Windows/Linux PHP
| From: | Jochem Maas | Date: | Sat, 01 Jul 2006 10:41:14 +0000 |
| Subject: | Re: Quick Question re: Windows/Linux PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239051@lists.php.net to get a copy of this message | ||
Beauford wrote:
> Hi,
>
> I'm just curious, because I come across this from time to time.
>
> Why does the code below work on Windows and not on Linux. PHP is 5.0 on
> Linux and 4.4 on Windows (still can't get 5 on Windows). The code at the
what stops you from installing php5 on windows? - it's not like it's very difficult.
> very bottom is how I got it to work on Linux. Also, why is it with the same
ah yes good of you to point out which line(s) you changed.
> setup I can't call a function within a function in Linux, but can in
> Windows. Sorry I don't have the error, but something about calling a static
if your too lazy to run the code one more time to copy and paste the error
then why should anyone help you?
> function. Would this be a difference between OS's or with the different
> versions of PHP?
it's something to do with fact that OO in php4 is a world away from
OO in php5.
>
> Thanks
>
> B
>
> ---------------------------
>
> if (empty($subemail)) { $form->setError($field, emailnotentered);
> }
> else {
> $regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*"
> ."@[a-z0-9-]+(\.[a-z0-9-]{1,})*"
> ."\.([a-z]{2,}){1}$";
> if(!eregi($regex,$subemail)){
> $form->setError($field, emailinvalid);
> }
> $subemail = stripslashes($subemail);
> }
> elseif(in_array(strtolower($a), $language))
> $form->setError($field, profanity);
> elseif(in_array(strtolower($b), $language))
> $form->setError($field, profanity);
> elseif(in_array(strtolower($c), $language))
> $form->setError($field, profanity);
> else {
> $query = "SELECT * FROM users WHERE $subemail = 'email'";
> $result = mysql_query($query)or $mysqlerror = mysql_error();
> if ($mysqlerror) {
> $form->setError($field, tberror);
> }
> else {
> $numrows = mysql_fetch_row($result);
> if($numrows = mysql_num_rows($result)) {
> $form->setError($field, duplicatepassword);
> }
> }
> }
>
> ---------------------------
>
> $field = "email";
> list ($a, $b, $c) = split ('[@.]', $subemail);
> $regex =
> "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]{1,})*\.([a-z]{2,}){1}
> $";
>
> if (empty($subemail)) { $form->setError($field, emailnotentered);
> }
> elseif(!eregi($regex,$subemail)){
> $form->setError($field, emailinvalid);
> }
> elseif(in_array(strtolower($a), $language)) $form->setError($field,
> profanity);
> elseif(in_array(strtolower($b), $language)) $form->setError($field,
> profanity);
> elseif(in_array(strtolower($c), $language)) $form->setError($field,
> profanity);
>
> else {
> $query = "SELECT * FROM users WHERE $subemail = 'email'";
> $result = mysql_query($query)or $mysqlerror = mysql_error();
> if ($mysqlerror) {
> $form->setError($field, tberror);
>
> }
> else {
> $numrows = mysql_fetch_row($result);
> if($numrows = mysql_num_rows($result)) {
> $form->setError($field, duplicatepassword);
> }
> }
> }
>