[Phpwm] Simple PHP Contact Form

Alex Mace alex at hollytree.co.uk
Wed Oct 14 08:02:55 UTC 2009


Nah, I didn't get caught by that, fortunately because I've never  
really used the ereg libraries, plus I had compiled PHP myself before  
I upgraded.

We did get caught in work though when someone upgraded to 5.3 on one  
of the boxes we run scripts on though as a lot of our legacy code base  
does use ereg...

Alex

On 14 Oct 2009, at 00:25, Dave Holmes wrote:

> That's sound like a man with snow leopard which foisted 5.3 in as  
> part of the upgrade ;)
>
> All ours app's started to moan about quite a few things...
>
>
> Alex Mace wrote:
>>
>> Apart from the fact that eregi was deprecated in PHP 5.3 and will be
>> removed in 6...
>>
>> Alex
>>
>> On 13 Oct 2009, at 23:09, <phil at infolinkelectronics.co.uk> wrote:
>>
>>
>>>> You'd be best off performing some sort of regular expression  
>>>> match -
>>>> or using the filter extension ...
>>>>
>>>> $email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL);
>>>> if(!$email) {
>>>>        // invalid email address
>>>> }
>>>> (Requires PHP5, I think my syntax/usage is correct, but I've not
>>>> checked it)
>>>>
>>> The regex is (acting on the incoming variable $emaila)
>>>
>>> if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z] 
>>> {2,4}$",
>>> $emaila)) error_alert("Invalid Email Address");
>>>
>>> where:-
>>>
>>> function error_alert($msg){global $flag; $flag = 1; echo
>>> "<script>alert(\"Error: $msg\");history.go(-1)</script>";}
>>>
>>> Thats from a page where the form, validation and sending are done as
>>> three
>>> invocations via a switch, case, do something and break method. a -1
>>> history
>>> kickback works.
>>> The eregi bit should be fairly PHP version unspecific though.
>>>
>>> Regards,
>>>
>>> Phil Beynon
>>> Sales & Operations Director
>>>
>>> ** Infolink Electronic Systems Ltd.
>>> ** S/W Birmingham's Longest Established ISV & VAR
>>> ** http://www.infolinkelectronics.co.uk
>>> ** Professional Web 2.0 Design & Advanced Hosting Platforms
>>> ** http://www.coeus-computica.co.uk
>>> ** Affordable Knowledgebase Solutions
>>> ** Contact: Sales at infolinkelectronics.co.uk
>>> ** Tel / Fax 0121 441 3558
>>> <Phil Beynon.vcf>_______________________________________________
>>> Phpwm mailing list
>>> Website : http://www.phpwm.org
>>> Twitter : http://www.twitter.com/phpwm
>>> Facebook: http://www.facebook.com/group.php?gid=2361609907
>>>
>>> Post to list: Phpwm at mailman.lug.org.uk
>>> Archive etc : https://mailman.lug.org.uk/mailman/listinfo/phpwm
>>>
>>
>>
>> _______________________________________________
>> Phpwm mailing list
>> Website : http://www.phpwm.org
>> Twitter : http://www.twitter.com/phpwm
>> Facebook: http://www.facebook.com/group.php?gid=2361609907
>>
>> Post to list: Phpwm at mailman.lug.org.uk
>> Archive etc : https://mailman.lug.org.uk/mailman/listinfo/phpwm
>>
>>
> _______________________________________________
> Phpwm mailing list
> Website : http://www.phpwm.org
> Twitter : http://www.twitter.com/phpwm
> Facebook: http://www.facebook.com/group.php?gid=2361609907
>
> Post to list: Phpwm at mailman.lug.org.uk
> Archive etc : https://mailman.lug.org.uk/mailman/listinfo/phpwm

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/phpwm/attachments/20091014/03e7ca8c/attachment-0001.htm 


More information about the Phpwm mailing list