[PHP-DB] Form Validation

2002-02-14 Thread jas

Anyone know of a good function to strip characters and stuff that would
cause mysql to crash from forms?
Jas



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] form validation

2002-12-20 Thread Mignon Hunter


Hello list,

I am developing a db form that gets passed to another form.  I need to
validate the fields in form(1), before passing on.  The form action
posts to form(2), so that upon hitting submit - form(2) shows up in
browser...(the only way I know how to do this). 

I am trying to use php to validate.  I have been googling and checking
books and archives for 2 days and all examples use the same file to post
to.  In other words, form1.php uses form action="form1.php".  But I need
it to be form(2), but I still need to validate.

Does anyone have any ideas, or does everyone just use javascript with
say...alert boxes.  This will be my last resort.  

Thanks
Mignon

Here's the code for form1.php













Please Enter the Information Below and Press the
'Submit' Button When Finished.(All Fields Required)
 




Company Name:  







City:







Contact Name:  


















-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Form Validation

2002-02-14 Thread Rick Emery


addslashes()   stripslashes()

Your question is vague...

-Original Message-
From: jas [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 14, 2002 1:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Form Validation


Anyone know of a good function to strip characters and stuff that would
cause mysql to crash from forms?
Jas



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Form Validation

2002-02-14 Thread Gurhan Ozen

addslashes(), stripslashes(), strip_tags(), nl2br() , htmlspecialchars()
etc. etc ...
check PHP online documentation for more info on them..

But even without those functions, the data inserted thru form wouldn't crash
MySQL .. The worst that can happen is if the data has quotes or wrong format
etc. the data wouldn't be inserted into MySQL database..

Gurhan
-Original Message-
From: jas [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 14, 2002 2:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Form Validation


Anyone know of a good function to strip characters and stuff that would
cause mysql to crash from forms?
Jas



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation

2002-12-20 Thread Jason Wong
On Friday 20 December 2002 22:25, Mignon Hunter wrote:
> Hello list,
>
> I am developing a db form that gets passed to another form.  I need to
> validate the fields in form(1), before passing on.  The form action
> posts to form(2), so that upon hitting submit - form(2) shows up in
> browser...(the only way I know how to do this).
>
> I am trying to use php to validate.  I have been googling and checking
> books and archives for 2 days and all examples use the same file to post
> to.  In other words, form1.php uses form action="form1.php".  But I need
> it to be form(2), but I still need to validate.
>
> Does anyone have any ideas, or does everyone just use javascript with
> say...alert boxes.  This will be my last resort.

> Here's the code for form1.php

[snip]

> 

OK when some submits the form the contents are sent to form2.php ...

>  function check_form($comp_name, $city, $state, $contact) {
> if (!$comp_name || !$city || !$state || !$contact):
> print ("Please fill in all Fields");
> if (!$comp_name) {
> print ("Please fill in your company name");
> }
> if (!$city) {
> print ("Please fill in your city");
> }
> if (!$contact) {
> print ("Please fill in your contact name");
> }
> endif;
> }
> ?>

..., which means this validation doesn't run (it's run when form1.php is first 
displayed, but that's not what you want).

IOW your validation code must be at wherever you set the form action as.

There are at least a couple of ways you can do this:

1) If your forms are related, have a single page which deals your two (or more 
forms). You have to keep track of which stage the user is at (ie if they've 
filled in form1 then you should display form2).

2) Or have it as two pages (like you have now) but in form1.php have the 
action="form1.php" (so it processes its form). After you've processed it, 
stick the values into some session variables then use header() to redirect to 
form2.php.

Or you can have a look at www.phpclasses.org for some classes which can build 
and validate forms for you.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
Qvid me anxivs svm?
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation

2002-12-20 Thread Ignatius Reilly
Hi Mignon,

it is really quite simple:

you can pack several screens (each containing for instance a form) in a same script.

each form contains a hidden field, say "selector"

now, the script begins by a switch:

if ( isset( $_POST['submit'] ) ) {

switch ( $selector ) { 

// Switch 1: process the screen 1
// -
case "1" :

 // process form 1 : data validation, ...

// ...
// 

break ;

// Switch 2: process the screen 2
// -
case "2" :

// etc.
} else {

// show the blank form
}


Javascript validation is not even a last resort. Use it only for usability purposes, 
but validate everything server-side.

HTH
Ignatius

  - Original Message - 
  From: Mignon Hunter 
  To: [EMAIL PROTECTED] 
  Sent: Friday, December 20, 2002 3:25 PM
  Subject: [PHP-DB] form validation




  Hello list,

  I am developing a db form that gets passed to another form.  I need to
  validate the fields in form(1), before passing on.  The form action
  posts to form(2), so that upon hitting submit - form(2) shows up in
  browser...(the only way I know how to do this). 

  I am trying to use php to validate.  I have been googling and checking
  books and archives for 2 days and all examples use the same file to post
  to.  In other words, form1.php uses form action="form1.php".  But I need
  it to be form(2), but I still need to validate.

  Does anyone have any ideas, or does everyone just use javascript with
  say...alert boxes.  This will be my last resort.  

  Thanks
  Mignon

  Here's the code for form1.php

  
  
  
  
  
  
  

  

  
  
  Please Enter the Information Below and Press the
  'Submit' Button When Finished.(All Fields Required)
   
  
  
  

  Company Name:  
  
  
  
  

  
  
  City:
  
  
  
  

  
  
  Contact Name:  
  
  
  
  
  
  
  
  

  

  
  

  
  


  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php





Re: [PHP-DB] form validation

2002-12-20 Thread Mignon Hunter
Thanks for your suggestions.  I can see the pros and cons of each.  I
will give each some thought and decide the best way to go.  

Thx
Mignon

On Fri, 2002-12-20 at 08:41, Jason Wong wrote:
> On Friday 20 December 2002 22:25, Mignon Hunter wrote:
> > Hello list,
> >
> > I am developing a db form that gets passed to another form.  I need to
> > validate the fields in form(1), before passing on.  The form action
> > posts to form(2), so that upon hitting submit - form(2) shows up in
> > browser...(the only way I know how to do this).
> >
> > I am trying to use php to validate.  I have been googling and checking
> > books and archives for 2 days and all examples use the same file to post
> > to.  In other words, form1.php uses form action="form1.php".  But I need
> > it to be form(2), but I still need to validate.
> >
> > Does anyone have any ideas, or does everyone just use javascript with
> > say...alert boxes.  This will be my last resort.
> 
> > Here's the code for form1.php
> 
> [snip]
> 
> > 
> 
> OK when some submits the form the contents are sent to form2.php ...
> 
> >  > function check_form($comp_name, $city, $state, $contact) {
> > if (!$comp_name || !$city || !$state || !$contact):
> > print ("Please fill in all Fields");
> > if (!$comp_name) {
> > print ("Please fill in your company name");
> > }
> > if (!$city) {
> > print ("Please fill in your city");
> > }
> > if (!$contact) {
> > print ("Please fill in your contact name");
> > }
> > endif;
> > }
> > ?>
> 
> ..., which means this validation doesn't run (it's run when form1.php is first 
> displayed, but that's not what you want).
> 
> IOW your validation code must be at wherever you set the form action as.
> 
> There are at least a couple of ways you can do this:
> 
> 1) If your forms are related, have a single page which deals your two (or more 
> forms). You have to keep track of which stage the user is at (ie if they've 
> filled in form1 then you should display form2).
> 
> 2) Or have it as two pages (like you have now) but in form1.php have the 
> action="form1.php" (so it processes its form). After you've processed it, 
> stick the values into some session variables then use header() to redirect to 
> form2.php.
> 
> Or you can have a look at www.phpclasses.org for some classes which can build 
> and validate forms for you.
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> 
> 
> /*
> Qvid me anxivs svm?
> */
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation

2002-12-20 Thread Manuel Lemos
Hello,

On 12/20/2002 12:25 PM, Mignon Hunter wrote:

I am developing a db form that gets passed to another form.  I need to
validate the fields in form(1), before passing on.  The form action
posts to form(2), so that upon hitting submit - form(2) shows up in
browser...(the only way I know how to do this). 

I am trying to use php to validate.  I have been googling and checking
books and archives for 2 days and all examples use the same file to post
to.  In other words, form1.php uses form action="form1.php".  But I need
it to be form(2), but I still need to validate.

Does anyone have any ideas, or does everyone just use javascript with
say...alert boxes.  This will be my last resort.  

You may want to use this class that does exactly what you need.

--

Regards,
Manuel Lemos


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation

2002-12-22 Thread Antonio Bernabei
I am intersted, but maybe I lost the link to the class you mentioned
Antonio

- Original Message -
From: "Manuel Lemos" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 21, 2002 3:40 AM
Subject: Re: [PHP-DB] form validation


> Hello,
>
> On 12/20/2002 12:25 PM, Mignon Hunter wrote:
> > I am developing a db form that gets passed to another form.  I need to
> > validate the fields in form(1), before passing on.  The form action
> > posts to form(2), so that upon hitting submit - form(2) shows up in
> > browser...(the only way I know how to do this).
> >
> > I am trying to use php to validate.  I have been googling and checking
> > books and archives for 2 days and all examples use the same file to post
> > to.  In other words, form1.php uses form action="form1.php".  But I need
> > it to be form(2), but I still need to validate.
> >
> > Does anyone have any ideas, or does everyone just use javascript with
> > say...alert boxes.  This will be my last resort.
>
> You may want to use this class that does exactly what you need.
>
> --
>
> Regards,
> Manuel Lemos
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation

2002-12-22 Thread Manuel Lemos
Hello,

On 12/22/2002 07:48 AM, Antonio Bernabei wrote:

I am intersted, but maybe I lost the link to the class you mentioned


Sorry, I forgot to mention the URL:

http://www.phpclasses.org/multipageforms

--

Regards,
Manuel Lemos


I am developing a db form that gets passed to another form.  I need to
validate the fields in form(1), before passing on.  The form action
posts to form(2), so that upon hitting submit - form(2) shows up in
browser...(the only way I know how to do this).

I am trying to use php to validate.  I have been googling and checking
books and archives for 2 days and all examples use the same file to post
to.  In other words, form1.php uses form action="form1.php".  But I need
it to be form(2), but I still need to validate.

Does anyone have any ideas, or does everyone just use javascript with
say...alert boxes.  This will be my last resort.


You may want to use this class that does exactly what you need.



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] form validation question - regex not working

2002-08-21 Thread chip . wiegand

I hope this isn't too far off topic -

I have a regex for validating email addresses -

if (empty($useremail) || !eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])+\.
([A-Za-z]{2,3})+$", $useremail))

Notice the {2,3} which is supposed to limit the last part to 2 or 3
letters, but I have been testing this and
it allows as many letters as I put in there, but not 1 only.
What's wrong?
Also, when using eregi do I need to specify A-Za-z or just a-z, since it is
case-insensitive?

--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
 --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977
 (They why do I have 9? Somebody help me!)


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation question - regex not working

2002-08-21 Thread DL Neil

Chip,

It's not so much off topic as a perennial topic - see archives and many
tutorial articles.
When you've worked out the answer to this question, please try out your
algorithm on my (or any other 'foreign') address. Then consider the imminent
introduction of further TLDs, eg .info (four characters), .family, etc.

Regards,
=dn

PS Sorry, can't help with POSIX RegExs - I confuse myself without any
outside assistance using the PCRE variants.


> I hope this isn't too far off topic -
>
> I have a regex for validating email addresses -
>
> if (empty($useremail) || !eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])+\.
> ([A-Za-z]{2,3})+$", $useremail))
>
> Notice the {2,3} which is supposed to limit the last part to 2 or 3
> letters, but I have been testing this and
> it allows as many letters as I put in there, but not 1 only.
> What's wrong?
> Also, when using eregi do I need to specify A-Za-z or just a-z, since it
is
> case-insensitive?
>
> --
> Chip Wiegand
> Computer Services
> Simrad, Inc
> www.simradusa.com
> [EMAIL PROTECTED]
>
> "There is no reason anyone would want a computer in their home."
>  --Ken Olson, president, chairman and founder of Digital Equipment
> Corporation, 1977
>  (They why do I have 9? Somebody help me!)
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation question - regex not working

2002-08-21 Thread Jason Wong

On Thursday 22 August 2002 00:29, [EMAIL PROTECTED] wrote:
> I hope this isn't too far off topic -
>
> I have a regex for validating email addresses -
>
> if (empty($useremail) || !eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])+\.
> ([A-Za-z]{2,3})+$", $useremail))
>
> Notice the {2,3} which is supposed to limit the last part to 2 or 3
> letters, but I have been testing this and
> it allows as many letters as I put in there, but not 1 only.
> What's wrong?
> Also, when using eregi do I need to specify A-Za-z or just a-z, since it is
> case-insensitive?

You're strongly advised not to write your own regex for validating email 
addresses. Your regex (once you get it working) will invalidate a lot of 
valid email addresses. Search archives, or google for some tried and tested 
regex which will do the job properly.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
The most important things, each person must do for himself.
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation question - regex not working

2002-08-21 Thread DL Neil

Jason,

Concur with your advice, but was also amused by its juxtaposition with your
sig file philosophy...

=dn

[snipped]
> > I have a regex for validating email addresses -

> You're strongly advised not to write your own regex for validating email

> /*
> The most important things, each person must do for himself.
> */



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation question - regex not working

2002-08-21 Thread chip . wiegand

Jason Wong <[EMAIL PROTECTED]> wrote on 08/21/2002 10:00:23 AM:

> On Thursday 22 August 2002 00:29, [EMAIL PROTECTED] wrote:
> > I hope this isn't too far off topic -
> >
> > I have a regex for validating email addresses -
> >
> > if (empty($useremail) || !eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])
+\.
> > ([A-Za-z]{2,3})+$", $useremail))
> >
> > Notice the {2,3} which is supposed to limit the last part to 2 or 3
> > letters, but I have been testing this and
> > it allows as many letters as I put in there, but not 1 only.
> > What's wrong?
> > Also, when using eregi do I need to specify A-Za-z or just a-z, since
it is
> > case-insensitive?

> You're strongly advised not to write your own regex for validating email
> addresses. Your regex (once you get it working) will invalidate a lot of
> valid email addresses. Search archives, or google for some tried and
tested
> regex which will do the job properly.

> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

This is from a php/mysql book. I added the parenthesis simply to group the
sections, and added the {2,3} because a web site tutorial shows that will
limit the preceding section to that many characters (2 or 3 only in this
case).
The script works fine without the {2,3}, and I may have to use it that way,
since another response mentioned foreign addresses, I hadn't taken into
account.
I'd just like to know why it doesn't work, becuase the it's supposed to.

--
Chip

> /*
> The most important things, each person must do for himself.
> */

Interesting tag considering your respoonse that I shouldn't do this mysqlf,
eh? :-)


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation question - regex not working

2002-08-21 Thread Jason Wong

On Thursday 22 August 2002 02:54, [EMAIL PROTECTED] wrote:

> This is from a php/mysql book. 

If they're presenting it as something that you can use in your real-life code 
then you should look carefully at all the other code in the book to see 
whether they're all as sloppy. On the other hand if they're only presenting 
it as an example on using regex then it's fine for learning with.

> I added the parenthesis simply to group the
> sections, and added the {2,3} because a web site tutorial shows that will
> limit the preceding section to that many characters (2 or 3 only in this
> case).
> The script works fine without the {2,3}, and I may have to use it that way,
> since another response mentioned foreign addresses, I hadn't taken into
> account.
> I'd just like to know why it doesn't work, becuase the it's supposed to.

It's only checking for addresses of the form [EMAIL PROTECTED]

As you can see, the list address ([EMAIL PROTECTED]), and my address 
([EMAIL PROTECTED]) would be treated as invalid. Not very clever is it?


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
"His great aim was to escape from civilization, and, as soon as he had
money, he went to Southern California."
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation question - regex not working

2002-08-21 Thread Pierre-Alain Joye

On Thu, 22 Aug 2002 03:10:02 +0800
Jason Wong <[EMAIL PROTECTED]> wrote:

> On Thursday 22 August 2002 02:54, [EMAIL PROTECTED] wrote:

> As you can see, the list address ([EMAIL PROTECTED]), and my address 
> ([EMAIL PROTECTED]) would be treated as invalid. Not very clever is it?


Well, anyway there is only one sure way to valid email, confirmation message :-)

pa

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation question - regex not working

2002-08-21 Thread chip . wiegand

Jason Wong <[EMAIL PROTECTED]> wrote on 08/21/2002 12:10:02 PM:
> It's only checking for addresses of the form [EMAIL PROTECTED]

> As you can see, the list address ([EMAIL PROTECTED]), and my address
> ([EMAIL PROTECTED]) would be treated as invalid. Not very clever is
it?

Got it figured out, and foreign address do work now -
if (empty($useremail) ||
!eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])+\.([A-Za-z])+\.([a-z])*$",
$useremail))

--
Chip


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation question - regex not working

2002-08-21 Thread DL Neil

Regarding the good sense or otherwise for checking email addresses:

> This is from a php/mysql book...

If it was from page 115, then please turn over to page 116!

Regards,
=dn



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation question - regex not working

2002-08-21 Thread DL Neil

Regarding the problem you are actually asking about:

> > > if (empty($useremail) || !eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])
> +\.
> > > ([A-Za-z]{2,3})+$", $useremail))
> > Notice the {2,3} which is supposed to limit the last part to 2 or 3
> > letters, but I have been testing this and
> > it allows as many letters as I put in there, but not 1 only.
> > What's wrong?

Please be aware that I use PCRE not POSIX, but IIRC the last phrase says:

([A-Za-z]{2,3})+$

any upper or lower case letter,
repeated twice or three times,
and that appearing zero or more times, !!!???
appearing at the end of the string.

Remove the + immediately before the terminating $.

Regards,
=dn



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation question - regex not working

2002-08-21 Thread Ignatius Reilly

There is this cute suggestion in the Wrox PHP book:

/^.+@.+\\..+$/

Looks like a puzzle, but it works (almost) always.

Enjoy

Ignatius Reilly




  - Original Message - 
  From: DL Neil 
  To: [EMAIL PROTECTED] ; [EMAIL PROTECTED] 
  Sent: Wednesday, August 21, 2002 10:04 PM
  Subject: Re: [PHP-DB] form validation question - regex not working


  Regarding the problem you are actually asking about:

  > > > if (empty($useremail) || !eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])
  > +\.
  > > > ([A-Za-z]{2,3})+$", $useremail))
  > > Notice the {2,3} which is supposed to limit the last part to 2 or 3
  > > letters, but I have been testing this and
  > > it allows as many letters as I put in there, but not 1 only.
  > > What's wrong?

  Please be aware that I use PCRE not POSIX, but IIRC the last phrase says:

  ([A-Za-z]{2,3})+$

  any upper or lower case letter,
  repeated twice or three times,
  and that appearing zero or more times, !!!???
  appearing at the end of the string.

  Remove the + immediately before the terminating $.

  Regards,
  =dn



  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php





Re: [PHP-DB] form validation question - regex not working

2002-08-21 Thread Jason Wong

On Thursday 22 August 2002 04:01, [EMAIL PROTECTED] wrote:

> Got it figured out, and foreign address do work now -
> if (empty($useremail) ||
> !eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])+\.([A-Za-z])+\.([a-z])*$",
> $useremail))

What do you mean by 'foreign' addresses?

The above will still fail for:

  [EMAIL PROTECTED]

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
Dungeons and Dragons is just a lot of Saxon Violence.
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] form validation question - regex not working

2002-08-22 Thread Martin Adler
+(?![^(\040)<>@
,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff
])*\]))*(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x8
0-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*>)(?:[\040\t]|\((?:[^\\\x80-\xff\n\
015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*

--- short pattern end --
you find it on
http://www.cpan.org/authors/Tom_Christiansen/scripts/ckaddr.gz

this should be sufficient
preg_match("/^[a-zA-Z\d_-]+(\.[a-zA-Z\d_-]+)*@([a-zA-Z\d-]+\.)+([a-zA-Z]{2,4
})$/", $useremail)

Oh, what i also have to say
the ereg-funktions are to old you schould use the new php4 funktions
preg_match() preg_replace() preg_...

greet
Martin


- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 22, 2002 5:06 AM
Subject: Re: [PHP-DB] form validation question - regex not working


> On Thursday 22 August 2002 04:01, [EMAIL PROTECTED] wrote:
>
> > Got it figured out, and foreign address do work now -
> > if (empty($useremail) ||
> > !eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])+\.([A-Za-z])+\.([a-z])*$",
> > $useremail))
>
> What do you mean by 'foreign' addresses?
>
> The above will still fail for:
>
>   [EMAIL PROTECTED]
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
>
> /*
> Dungeons and Dragons is just a lot of Saxon Violence.
> */
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php