|
From: Benjamin C. <bc...@us...> - 2001-11-03 14:38:20
|
Update of /cvsroot/phpbt/phpbt In directory usw-pr-cvs1:/tmp/cvs-serv26110 Modified Files: install.php Log Message: Make sure the admin login is a valid email address since we default to email and login being the same Index: install.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/install.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- install.php 2001/10/30 04:08:35 1.2 +++ install.php 2001/11/03 14:38:17 1.3 @@ -78,6 +78,13 @@ return $text; } +/// +/// Check the validity of an email address +/// (From zend.com user russIndr) +function valid_email($email) { + return eregi('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$', $email); +} + function grab_config_file() { global $t, $_pv; @@ -123,6 +130,8 @@ $error = 'Please enter the phpBT email address'; } elseif (!$_pv['admin_login'] = trim($_pv['admin_login'])) { $error = 'Please enter the admin login'; + } elseif (!valid_email($_pv['admin_login'])) { + $error = 'Please use a valid email address for the admin login'; } elseif (!$_pv['admin_pass'] = trim($_pv['admin_pass'])) { $error = 'Please enter the admin password'; } elseif (!$_pv['admin_pass2'] = trim($_pv['admin_pass2'])) { |