PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
case 'registering' :
try {
if($_POST['email'] != $_POST['email2'])
{throw new customException('Email 1 did not match email 2.');}
if($_POST['password'] != $_POST['password2'])
{throw new customException('Password 1 did not match Password 2.');}
if($_POST['username'] == '')
{throw new customException('You did not enter a username.');}
if(!eregi("^([a-z0-9]+)([._-]([a-z0-9]+))*[@]([a-z0-9]+)([._-]([a-z0-9]+))*[.]([a-z0-9]){2}([a-z0-9])?$", $_POST['email']))
{throw new customException('myemail@mydomian.com is an example of a working email address.');}
}
$userId = User::Register($_POST['username'], $_POST['password'], $_POST['email']);
mail($_POST['email'], 'You have now registered', 'Welcome '.$_POST['username'].', your userid is '.$userId->id, "From: ". $admin_email);
$smarty->assign('page_title', $titlebegin.' Registered');
$smarty->assign('message','You have successfully registered, you may now access the private area.');
$smarty->assign('page_include','success.tpl');
$smarty->display('index.tpl');
catch (customException $e)
{$smarty->assign($_POST);
$smarty->assign('page_title', $titlebegin.' Register');
$smarty->assign('page_include', 'register.tpl');
$smarty->display('index.tpl');}
break;
I'm new to the exception handling stuff, so I'm abit clueless.
$userId = User::Register($_POST['username'], $_POST['password'], $_POST['email']);
mail($_POST['email'], 'You have now registered', 'Welcome '.$_POST['username'].', your userid is '.$userId->id, "From: ". $admin_email);
$smarty->assign('page_title', $titlebegin.' Registered');
$smarty->assign('message','You have successfully registered, you may now access the private area.');
$smarty->assign('page_include','success.tpl');
$smarty->display('index.tpl');