undef HALF_FREQUENCY_SENDING_TO_CLIENT
[ryzomcore.git] / web / public_php / ams / func / userRegistration.php
blob632c0681d78c6c568440f2883a5a13cf4449c789
1 <?php
2 /**
3 * This function is beign used to change the users emailaddress info.
4 * It will first check if the user who executed this function is the person of whom the emailaddress is or if it's a mod/admin. If this is not the case the page will be redirected to an error page.
5 * The emailaddress will be validated first. If the checking was successful the email will be updated and the settings template will be reloaded. Errors made by invalid data will be shown
6 * also after reloading the template.
7 * @author Daan Janssens, mentored by Matthew Lagoe
8 */
9 function userRegistration()
12 try {
13 //if logged in
14 if (WebUsers::isLoggedIn()) {
16 $dbl = new DBLayer("lib");
17 $dbl->update("settings", Array('Value' => $_POST['userRegistration']), "`Setting` = 'userRegistration'");
19 $result['target_id'] = $_GET['id'];
20 global $SITEBASE;
21 require_once($SITEBASE . '/inc/settings.php');
22 $pageElements = settings();
23 $pageElements = array_merge(settings(), $result);
24 $pageElements['permission'] = unserialize($_SESSION['ticket_user'])->getPermission();
25 // pass error and reload template accordingly
26 helpers :: loadtemplate( 'settings', $pageElements);
27 throw new SystemExit();
29 } else {
30 //ERROR: user is not logged in
31 header("Location: index.php");
32 throw new SystemExit();
36 catch (PDOException $e) {
37 //go to error page or something, because can't access website db
38 print_r($e);
39 throw new SystemExit();