/** * Adds a request in the DB * * @return string salt */ function addRequest($handle, $email, $firstName, $lastName, $pw1, $pw2) { $data = array('handle' => $handle, 'firstname' => $firstName, 'lastname' => $lastName, 'email' => $email, 'password' => $pw1, 'password2' => $pw2, 'purpose' => 'vote in general election', 'fromt_site' => SITE, 'moreinfo' => '', 'homepage' => ''); include_once 'pear-database-user.php'; $useradd = user::add($data, false, true); if (is_array($useradd) || DB::isError($useradd)) { return $useradd; } $salt = $this->_makeSalt($handle); $created_on = gmdate('Y-m-d'); $query = ' INSERT INTO election_account_request (created_on, handle, email, salt) VALUES (?, ?, ?, ?)'; $res = $this->dbh->query($query, array($created_on, $handle, $email, $salt)); if (DB::isError($res)) { user::remove($handle); return $res; } //$this->find($salt); //$this->sendRequest(); return $salt; }
/** Adds a new user */ public function add() { global $__in, $__out; $user = new user(); if ($__in['__is_form_submitted']) { // if form is submitted try { $user->add($__in['user']); return dispatcher::redirect("getall", "added_successfully"); } catch (ValidationException $ex) { $ex->publish_errors(); $__out['user'] = $__in['user']; return false; } catch (Exception $ex) { throw $ex; } } else { // if form is not submitted $__out['user'] = array(); return true; } // end if form submitted }
$pixelG = $pixelRGB >> 8 & 0xff; $pixelB = $pixelRGB & 0xff; if ($pixelB) { $sectorType = 0; $sectorId = rand(1, 4); } else { if ($pixelG) { $sectorType = 1; $sectorId = rand(1, 10); } } array_push($query, '(' . $i . ', ' . $j . ', ' . $sectorType . ', ' . $sectorId . ')'); } } $db->query('insert into grid (x, y, type, id) values ' . implode(', ', $query)); $user->add(); $message = $ui['installed']; } else { $message = $ui['nameTaken']; } } else { $message = $ui['wrongCode']; } } else { $message = $ui['rePassNotMatch']; } } else { $message = $ui['insufficientData']; } } else { $_SESSION['regCode'] = rand(1, 9999);
function user_handler() { $this->check_login(); $params = $this->input->post(); if (isset($params['save'])) { user::add($params); } redirect('admin/users'); }
private function addPeople($peopleArray) { $user = new user(); foreach ($peopleArray->person as $person) { $company = 0; //note that this should be updated when company becomes a used object $isAdmin = 1; $rolesobj = new roles(); $adminrid = $rolesobj->add("BasecampAdmin", array("add" => 1, "edit" => 1, "del" => 1, "close" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1), array("add" => 1, "edit" => 1, "del" => 1), array("add" => 1, "edit" => 1, "del" => 1, "read" => 1), array("add" => 0), array("add" => 1)); $userrid = $rolesobj->add("BasecampUser", array("add" => 1, "edit" => 1, "del" => 0, "close" => 0), array("add" => 1, "edit" => 1, "del" => 0), array("add" => 1, "edit" => 1, "del" => 1), array("add" => 1, "edit" => 1, "del" => 1), array("add" => 1, "edit" => 1, "del" => 1), array("add" => 1, "edit" => 1, "del" => 1, "read" => 0), array("add" => 1), array("add" => 0)); $username = $person->{'user-name'}; $email = $person->{'email-address'}; $pass = $email; $uid = $user->add($username, $email, $company, $pass); if ($uid) { if ($person->{'administrator'} == "true") { $rolesobj->assign($adminrid, $uid); $isAdmin = 5; } elseif ($person->{'client-id'} != 0) { $rolesobj->assign($userrid, $uid); $isAdmin = 0; } $iid = "" . $person->{'id'}; $this->peopleHash[$iid] = $uid; ++$this->peopleCount; } } }
function onDoSignupBtn($info) { if ($info['email'] != "" && $info['password'] != "" && $info['passwordagain'] != "") { $u = new user(""); $signup = $u->add($info['email'], $info['password'], $info['passwordagain'], $info['userName'], $info['Address'], $info['Country'], $info['PostalCode'], 'user'); switch ($signup) { case 1: //All set - user added and logged in! $this->msg = "Please Check Your email!"; $this->_bookframe("frmMain"); break; case -1: //user already exist $this->msg = "user already exist"; $this->_bookframe("frmMain"); break; case -2: //passwords didn't match... $this->msg = "passwords didn't match..."; $this->_bookframe("frmMain"); break; default: osLog('viewslogin', $this->_fullname, "##### weird..."); $this->_bookframe("frmMain"); break; } } }
function confirmRequest($handle, $password, $name) { $sql = 'SELECT handle FROM users WHERE handle = ?'; if ($handle == $this->dbh->getOne($sql, array($handle))) { $id = $this->dbh->nextId("karma"); $query = 'INSERT INTO karma VALUES (?, ?, ?, ?, NOW())'; $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.bug', 'pearweb')); return true; } list($firstname, $lastname) = explode(' ', $name, 2); $data = array('handle' => $handle, 'firstname' => $firstname, 'lastname' => $lastname, 'email' => $this->email, 'purpose' => 'bug tracker', 'password' => $password, 'password2' => $password, 'purpose' => 'Open/Comment on bugs', 'moreinfo' => 'Automatic Account Request', 'homepage' => ''); include_once 'pear-database-user.php'; $useradd = user::add($data, true, true); if ($useradd !== true) { return $useradd; } $sql = 'SELECT handle from bug_account_request WHERE salt = ?'; $temphandle = $this->dbh->getOne($sql, array($this->salt)); // update all relevant records to the new handle $this->dbh->query('UPDATE bugdb_comments set reporter_name = ? WHERE handle = ?', array($name, $temphandle)); $this->dbh->query('UPDATE bugdb set reporter_name = ? WHERE handle = ?', array($name, $temphandle)); $this->dbh->query('UPDATE users set handle = ? WHERE handle = ?', array($handle, $temphandle)); $this->dbh->query('UPDATE bugdb set registered = 1, handle = ? WHERE handle = ?', array($handle, $temphandle)); $this->dbh->query('UPDATE bugdb_comments set handle = ? WHERE handle = ?', array($handle, $temphandle)); $this->dbh->query('UPDATE bugdb_patchtracker set developer = ? WHERE developer = ?', array($handle, $temphandle)); $this->handle = $handle; // activate the handle and grant karma // implicitly without human intervention // copied from the user class and Damblan_Karma include_once 'pear-database-user.php'; $user = user::info($handle, null, 0); if (!isset($user['registered'])) { return false; } @($arr = unserialize($user['userinfo'])); include_once 'pear-database-note.php'; note::removeAll($handle); $data = array(); $data['registered'] = 1; $data['password'] = $password; $data['name'] = $name; if (is_array($arr)) { $data['userinfo'] = $arr[1]; } $data['create'] = gmdate('Y-m-d'); $data['createBy'] = SITE . 'web'; $data['handle'] = $handle; user::update($data, true); $query = 'INSERT INTO karma VALUES (?, ?, ?, ?, NOW())'; $id = $this->dbh->nextId('karma'); $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.bug', SITE . 'web')); $id = $this->dbh->nextId('karma'); $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.voter', SITE . 'web')); if (!DB::isError($sth)) { require_once 'bugs/pear-bugs-utils.php'; $pbu = new PEAR_Bugs_Utils(); note::add($this->handle, 'Account opened', SITE . 'web'); $bugs = $this->dbh->getAll('SELECT * FROM bugdb WHERE handle = ?', array($this->handle), DB_FETCHMODE_ASSOC); foreach ($bugs as $bug) { $this->sendBugEmail($bug); } $patches = $this->dbh->getAll('SELECT bugdb.package_name, bugdb_patchtracker.* FROM bugdb_patchtracker, bugdb WHERE bugdb_patchtracker.developer = ? AND bugdb.id = bugdb_patchtracker.bugdb_id', array($this->handle), DB_FETCHMODE_ASSOC); foreach ($patches as $patch) { $pbu->sendPatchEmail($patch); } $bugs = $this->dbh->getAll('SELECT bugdb_comments.email,bugdb_comments.comment, bugdb_comments.reporter_name, bugdb.id, bugdb.bug_type,bugdb.package_name,bugdb.sdesc, bugdb.ldesc,bugdb.php_version, bugdb.php_os,bugdb.status, bugdb.assign,bugdb.package_version FROM bugdb_comments, bugdb WHERE bugdb.id = bugdb_comments.bug AND bugdb_comments.handle = ?', array($this->handle), DB_FETCHMODE_ASSOC); foreach ($bugs as $bug) { $this->sendBugCommentEmail($bug); } $msg = "Your PEAR bug tracker account has been opened.\n" . "Bugs you have opened will now be displayed, and you can\n" . "add new comments to existing bugs"; $xhdr = "From: " . PEAR_WEBMASTER_EMAIL; if (!DEVBOX) { mail($user['email'], "Your PEAR Bug Tracker Account Request", $msg, $xhdr, "-f " . PEAR_BOUNCE_EMAIL); } $this->deleteRequest(); return true; } return false; }
function insert() { $response = $this->get_response('insert'); $form = $response->form; if (!$form->get_errors() && $response->submit()) { $user = $form->get_request('user'); $ini = $user; unset($ini['pass2']); if (isset($user['user_password']) && !isset($user['pass2']) || isset($user['user_password']) && $user['user_password'] !== $user['pass2']) { $form->set_error('user[pass2]', sprintf($this->lang['error_no_match'], $this->lang['password_repeat'], $this->lang['password'])); } if (!$form->get_errors()) { $check = new user($user['user_name']); // Check user exists if (!$check->check_user_exists()) { global $USER_INFO_TABLE; $ini['user_id'] = (int) str_replace(".", "", str_pad(microtime(true), 15, "0")); $check->add($ini); $pass = new user($ini['user_name']); $pass->change_htpasswd('insert'); } else { $form->set_error('user[user_name]', sprintf($this->lang['error_user_exists'], $user['user_name'])); $error = sprintf($this->lang['error_user_exists'], $user['user_name']); } if (!isset($error) || $error === '') { $response->msg = sprintf($this->lang['msg_saved'], $user['user_name']); } else { $response->error = $error; } } else { $response->error = join('<br>', $form->get_errors()); } } if ($form->get_errors()) { $response->error = join('<br>', $form->get_errors()); } return $response; }
/** * Migrate a single Moodle user to the Curriculum Management system. Will * only do this for users who have an idnumber set. */ function cm_moodle_user_to_cm($mu) { global $CURMAN, $CFG; require_once CURMAN_DIRLOCATION . '/lib/customfield.class.php'; require_once CURMAN_DIRLOCATION . '/lib/user.class.php'; require_once $CFG->dirroot . '/user/profile/lib.php'; // re-fetch, in case this is from a stale event $mu = addslashes_recursive($CURMAN->db->get_record('user', 'id', $mu->id)); if (empty($mu->idnumber) && $CURMAN->config->auto_assign_user_idnumber) { $mu->idnumber = $mu->username; $CURMAN->db->update_record('user', $mu); } if (empty($mu->idnumber)) { return true; } else { if (empty($mu->country)) { //this is necessary because PM requires this field return true; } else { if ($cu = $CURMAN->db->get_record('crlm_user', 'idnumber', $mu->idnumber)) { $cu = new user(addslashes_recursive($cu)); // synchronize any profile changes $cu->username = $mu->username; $cu->password = $mu->password; $cu->idnumber = $mu->idnumber; $cu->firstname = $mu->firstname; $cu->lastname = $mu->lastname; $cu->email = $mu->email; $cu->address = $mu->address; $cu->city = $mu->city; $cu->country = $mu->country; $cu->phone = empty($mu->phone1) ? empty($cu->phone) ? '' : $cu->phone : $mu->phone1; $cu->phone2 = empty($mu->phone2) ? empty($cu->phone2) ? '' : $cu->phone2 : $mu->phone2; $cu->language = empty($mu->lang) ? empty($cu->language) ? '' : $cu->language : $mu->lang; $cu->timemodified = time(); // synchronize custom profile fields profile_load_data($mu); $fields = field::get_for_context_level(context_level_base::get_custom_context_level('user', 'block_curr_admin')); $fields = $fields ? $fields : array(); require_once CURMAN_DIRLOCATION . '/plugins/moodle_profile/custom_fields.php'; foreach ($fields as $field) { $field = new field($field); if (isset($field->owners['moodle_profile']) && $field->owners['moodle_profile']->exclude == cm_moodle_profile::sync_from_moodle) { $fieldname = "field_{$field->shortname}"; $cu->{$fieldname} = $mu->{"profile_field_{$field->shortname}"}; } } $cu->update(); } else { $cu = new user(); $cu->username = $mu->username; $cu->password = $mu->password; $cu->idnumber = $mu->idnumber; $cu->firstname = $mu->firstname; $cu->lastname = $mu->lastname; $cu->email = $mu->email; $cu->address = $mu->address; $cu->city = $mu->city; $cu->country = $mu->country; $cu->phone = $mu->phone1; $cu->phone2 = $mu->phone2; $cu->language = $mu->lang; $cu->transfercredits = 0; $cu->timecreated = $cu->timemodified = time(); // synchronize profile fields profile_load_data($mu); $fields = field::get_for_context_level(context_level_base::get_custom_context_level('user', 'block_curr_admin')); $fields = $fields ? $fields : array(); require_once CURMAN_DIRLOCATION . '/plugins/moodle_profile/custom_fields.php'; foreach ($fields as $field) { $field = new field($field); if (isset($field->owners['moodle_profile']) && $field->owners['moodle_profile']->exclude == cm_moodle_profile::sync_from_moodle) { $fieldname = "field_{$field->shortname}"; $cu->{$fieldname} = $mu->{"profile_field_{$field->shortname}"}; } } $cu->add(); } } } return true; }
mkdir(CL_ROOT . "/files/" . CL_CONFIG . "/"); mkdir(CL_ROOT . "/files/" . CL_CONFIG . "/avatar/", 0777); mkdir(CL_ROOT . "/files/" . CL_CONFIG . "/ics/", 0777); require CL_ROOT . "/config/" . CL_CONFIG . "/config.php"; // Start database connection $conn = new PDO("mysql:host={$db_host};dbname={$db_name}", $db_user, $db_pass); $user = $_POST['name']; $pass = $_POST['pass']; // create the first user $usr = new user(); $installChk = $usr->getAllUsers(); if ($installChk) { // There already are users. abort install. die("Collabtive seems to be already installed.<br />If this is an error, please clear your database."); } $usrid = $usr->add($user, "", 0, $pass); if (!$usrid) { $template->assign("errortext", "Error: Failed to create first user."); $template->display("error.tpl"); die; } // insert default roles $rolesobj = new roles(); $adminrid = $rolesobj->add("Admin", array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "read" => 1, "view" => 1), array("add" => 1), array("add" => 1)); $userrid = $rolesobj->add("User", array("add" => 1, "edit" => 1, "del" => 0, "close" => 0, "view" => 1), array("add" => 1, "edit" => 1, "del" => 0, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "close" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "view" => 1), array("add" => 1, "edit" => 1, "del" => 1, "read" => 0, "view" => 1), array("add" => 1), array("add" => 0)); $clientrid = $rolesobj->add("Client", array("add" => 0, "edit" => 0, "del" => 0, "close" => 0), array("add" => 0, "edit" => 0, "del" => 0, "close" => 0), array("add" => 0, "edit" => 0, "del" => 0, "close" => 0), array("add" => 0, "edit" => 0, "del" => 0, "close" => 0), array("add" => 0, "edit" => 0, "del" => 0), array("add" => 0, "edit" => 0, "del" => 0, "read" => 0), array("add" => 0), array("add" => 0)); if (!$adminrid or !$userrid or !$clientrid) { $template->assign("errortext", "Error: Failed to create initial roles."); $template->display("error.tpl"); die; }
} if (!isset($stripped['captcha']) || !isset($_SESSION['answer']) || $stripped['captcha'] != $_SESSION['answer']) { $errors[] = 'Incorrect CAPTCHA'; $display_form = true; } $p = isset($stripped['existingpackage']) ? $stripped['existingpackage'] : ''; $package = $dbh->getOne('SELECT count(id) FROM packages WHERE packages.name = ?', array($p)); if (!$package) { $errors[] = 'Package "' . htmlspecialchars($p) . '" does not ' . 'exist, please choose a pre-existing package name'; } if ($errors) { break; } // The add method performs further validation then creates the account include_once 'pear-database-user.php'; $ok = user::add($stripped); if (PEAR::isError($ok)) { $errors[] = 'This email address has already been registered by another user'; $display_form = true; break; } if (isset($stripped['display_form'])) { $display_form = $stripped['display_form']; } if (is_array($ok)) { $errors = $ok; break; } elseif ($ok === true) { report_success('Your account request has been submitted, it will' . ' be reviewed by a human shortly. This may take from' . ' two minutes to several days, depending on how much' . ' time people have.' . ' You will get an email when your account is open,' . ' or if your request was rejected for some reason.'); $mailData = array('username' => $stripped['handle'], 'firstname' => $stripped['firstname'], 'lastname' => $stripped['lastname'], 'package' => $stripped['existingpackage']); if (!DEVBOX) {
} $i2 = $i2 + 1; } } $title = $langfile['useradministration']; $template->assign("title", $title); SmartyPaginate::assign($template); $template->assign("users", $users); $template->assign("projects", $projects); $template->assign("roles", $roles); $template->display("adminusers.tpl"); } elseif ($action == "adduser") { // Get the system locale and set it as the default locale for the new user $sysloc = $settings["locale"]; // Add the user $newid = $user->add($name, $email, $company, $pass, $sysloc, $tags, $rate); //user has been created successfully if ($newid) { //are there projects the userd should be assigned to if (!empty($assignto)) { // Assign the user to all selected projects foreach ($assignto as $proj) { $project->assign($newid, $proj); } } $roleobj = (object) new roles(); $roleobj->assign($role, $newid); if ($settings["mailnotify"]) { if (!empty($email)) { $subject = $langfile["profileaddedsubject"] . ' (' . $langfile['by'] . ' ' . $username . ')'; $mailcontent = $langfile["hello"] . ",<br /><br/>" . $langfile["profileaddedtext"] . "<br /><br />" . $langfile["profileusername"] . ": " . "{$name}<br />" . $langfile["profilepass"] . ": " . "{$pass}<br /><br />" . "<a href = \"{$url}\">{$url}</a>";
/** * Sign up a new user ready for confirmation. * Password is passed in plaintext. * * @param object $user new user object (with system magic quotes) * @param boolean $notify print notice with link and terminate */ function user_signup($user, $notify = true) { global $CFG; require_once $CFG->dirroot . '/user/profile/lib.php'; /// Create a new curriculum user. $curuser = new user($user); // $curuser->generate_password(); /// Calculate the birthdate. // $curuser->birthdate = (sprintf('%04d', $user->birthdate['year'])) . '/' . // (sprintf('%02d', $user->birthdate['month'])) . '/' . // (sprintf('%02d', $user->birthdate['day'])); /// Create a new Moodle user from the user object passed in. $moodleuser = new Object(); $moodleuser = clone $user; /// Modify the Moodle user with any curriculum user data. $moodleuser->username = $curuser->username; $moodleuser->password = $curuser->password; $moodleuser->password = hash_internal_user_password($moodleuser->password); $moodleuser->idnumber = $curuser->idnumber = $curuser->username; $moodleuser->timemodified = time(); //** TODO - Fix email validation **// /// Validate the email address. if (!validate_email($curuser->email)) { if (!validate_email($curuser->email2)) { $moodleuser->email = '*****@*****.**'; /// This will only happen if both are set to "none" (see '/blocks/curr_admin/customscripts/login/signup_form.php'). } else { $moodleuser->email = $user->email2; } } else { $moodleuser->email = $curuser->email; } if (!($user->id = insert_record('user', $moodleuser))) { print_error('auth_emailnoinsert', 'auth'); } /// Save any custom profile field information profile_save_data($user); $curuser->email2 = $curuser->contactemail = $user->email2; if (!$curuser->add()) { print_error('curr_usernotcreated', 'curr'); } /// Assign them to the default curriculum (*** MAKE THIS CONFIGURABLE ***) // $curuser->assign_curriculum(array('idnumber' => 'CRS')); if (!$curuser->send_confirmation_email($this->config->crlm_fromemail, $this->config->crlm_emailadmins)) { print_error('auth_emailnoemail', 'auth'); } if ($notify) { $emailconfirm = get_string('emailconfirm'); $navlinks = array(); $navlinks[] = array('name' => $emailconfirm, 'link' => null, 'type' => 'misc'); $navigation = build_navigation($navlinks); print_header($emailconfirm, $emailconfirm, $navigation); $notice = new Object(); $notice->email = $user->email; $this->notice(get_string('emailconfirmsent', 'auth_crlm', $notice), $CFG->wwwroot); } else { return true; } }
public function addUser(User $user) { $this->users->add($user); $user->setUniversite($this); return $this; }
<?php session_start(); if (!isset($_SESSION['user'])) { header('location: login.php'); } require_once 'include/clases.php'; if (isset($_POST["altausuario"])) { if ($_SESSION['tipo'] == 'ADM') { user::add($_POST["nombre"], $_POST["apellido"], $_POST["email"], $_POST["username"], $_POST["pass1"], $_POST["pass2"], @$_POST["adm"]); } var_dump(msg::get()); } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script style="color: rgb(0, 0, 0);" src="js/jquery-1.11.1.min.js"></script> <!---<script src="https://code.jquery.com/jquery-1.10.2.js"></script>---> <script src="js/functions.js"></script> <script src="js/colors.js"></script> <script src="js/funciones.js"></script> <script src="js/switchery.min.js"></script> <link rel="stylesheet" type="text/css" media="all" href="css/styles-form.css"> <link rel="stylesheet" type="text/css" media="all" href="css/switchery.min.css"> <link href="css/style.css" rel="stylesheet" type="text/css" media="all"> <link href="css/estilo.css" rel="stylesheet" type="text/css" media="all"> <title>[StockMGR]</title> <link rel="icon"
<?php /*! * Action Lib * * Author: lincong1987@gmail.com * * Date: 2011/10/7 */ include "../function.php"; $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : ""; if ($action == "add") { $user = new user(); $result = $user->add(); switch ($result) { case "success": error("添加成功!", "alertGoTo", $_SERVER['HTTP_REFERER']); break; case "error": error($user->getActionError, "alertGoTo", $_SERVER['HTTP_REFERER']); break; } }
$dbh_person = new person(); $dbh_person->add($arr_form_data); $person_id = $dbh_person->auto_id; $arr_form_data['person_id'] = $person_id; require 'password_crypto.php'; //Hash the password using default Cobalt password hashing technique $hashed_password = cobalt_password_hash('NEW', $password, $username, $new_salt, $new_iteration, $new_method); $arr_form_data['password'] = $hashed_password; $arr_form_data['salt'] = $new_salt; $arr_form_data['iteration'] = $new_iteration; $arr_form_data['method'] = $new_method; $arr_form_data['role_id'] = 3; $arr_form_data['skin_id'] = 1; require_once 'subclasses/user.php'; $dbh_user = new user(); $dbh_user->add($arr_form_data); //Permissions from role, if role was chosen if ($arr_form_data['role_id'] != '') { $db = new data_abstraction(); $db->execute_query("INSERT `user_passport` SELECT '" . quote_smart($username) . "', `link_id` FROM user_role_links WHERE role_id='" . quote_smart($arr_form_data['role_id']) . "'"); } redirect("notification.php"); } } if ($arr_form_data['region'] != "") { $chosen_region = $arr_form_data['region']; } if ($arr_form_data['province'] != "") { $chosen_province = $arr_form_data['province']; } if ($arr_form_data['city'] != "") {
if ($_POST['regCode'] == $_SESSION['regCode']) { if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $user->data['name'] = $_POST['name']; $user->data['email'] = $_POST['email']; $user->data['password'] = sha1($_POST['password']); if ($flags['activation']) { $user->data['level'] = 0; } else { $user->data['level'] = 1; } $user->data['joined'] = strftime('%Y-%m-%d', time()); $user->data['lastVisit'] = strftime('%Y-%m-%d %H:%M:%S', time()); $user->data['ip'] = $_SERVER['REMOTE_ADDR']; $user->data['template'] = 'default'; $user->data['locale'] = 'en'; $status = $user->add(); if ($flags['activation']) { if ($status == 'done') { include 'core/email/email.php'; $user->get('name', $user->data['name']); $code = rand(1000000000, 9999999999); $link = $location . 'activate.php?user='******'name'] . '&code=' . $code; $body = $title . ' ' . $ui['accountActivationLink'] . ': <a href="' . $link . '" target="_blank">' . $link . '</a>'; $activation = new activation(); $activation->data['user'] = $user->data['id']; $activation->data['code'] = $code; $status = $activation->add(); if ($status == 'done') { $status = email($title, $user->data['email'], $title . ' ' . $ui['registration'], $body); } }