<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/scripts/classes/class.User.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/scripts/classes/class.DataHandling.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/scripts/lib/reg_auth.inc'; if (isset($_POST['submit'])) { $post = GetPOST(); $smarty->assign($fields = [User::ROOM_FLD => $post['room'], User::NAME_FLD => $post['name'], User::LOGIN_FLD => $post['login'], User::SURNAME_FLD => $post['surname']]); try { (new DataHandling())->ValidateLogin($post['login'])->ValidateRoom($post['room'])->ValidatePassword($post['pass'])->ValidateRepeatPasswords($post['pass'], $post['repass']); Registration::Register($fields, $post['pass']); DisplaySuccess('isRegister', true); } catch (Exception $e) { $smarty->assign('db_error', $e->getMessage()); } } $smarty->display('registration.tpl');
<title>Verify email address</title> <META http-equiv="refresh" content="10;URL=login.php"> </head> <body> <link rel="stylesheet" type="text/css" href="style.css"> <br><br> <?php /* ----- setup variables ----- */ $k = GetVariable("k"); /* database connection */ $link = mysql_connect($GLOBALS['db_hostname'], $GLOBALS['cfg']['mysqluser'], $GLOBALS['cfg']['mysqlpassword']) or die("Could not connect: " . mysql_error()); mysql_select_db($GLOBALS['cfg']['mysqldatabase']) or die("Could not select database<br>"); /* validate the key and redirect as necessary */ if (Validate($k)) { DisplaySuccess(); } else { DisplayFail(); } /* -------------------------------------------- */ /* ------- DisplaySuccess --------------------- */ /* -------------------------------------------- */ function DisplaySuccess() { ?> <div align="center"> <br><br> <b>Thank you for activating your NiDB account</b><br> You may <a href="login.php">login</a>, or wait to be redirected to the login page in 10s </div> <?php
extract($post); if (!empty($phone)) { $data_h->validatePhone($phone); } (new DataHandling())->ValidateRoom($room); $_user->SetFieldByName(User::ROOM_FLD, $room)->SetFieldByName(User::PHONE_FLD, $phone)->UpdateByLogin($login); DisplaySuccess('contact_data', true); break; case CHANGE_NAME: extract($post); if (empty($name)) { $smarty->assign('errorName', 'Имя не может быть пустым'); throw new Exception(''); } $_user->SetFieldByName(User::NAME_FLD, $name)->SetFieldByName(User::SURNAME_FLD, $surname)->UpdateByLogin($login); DisplaySuccess('name_data', true); break; // case FORGOTTEN_PASS: // $email = $post['email']; // $data_h->validateEmail($email); // $new_pass = AuthorizedUser::ForgottenPassword($email); // $mail = new Mail(); // $mail->SendForgottenPassMail($email, $new_pass); // DisplaySuccess('new_pass'); // break; // case FORGOTTEN_PASS: // $email = $post['email']; // $data_h->validateEmail($email); // $new_pass = AuthorizedUser::ForgottenPassword($email); // $mail = new Mail(); // $mail->SendForgottenPassMail($email, $new_pass);