public function content() { global $dbh, $postvar, $getvar, $instance; $client_data = $dbh->client($_SESSION['cuser']); $packages_data = $dbh->select("packages", array("id", "=", $client_data['pid'])); $view_package_array['USER'] = $client_data['user']; $view_package_array['SIGNUP'] = main::convertdate("n/d/Y", $client_data['signup']); $view_package_array['DOMAIN'] = $client_data['domain']; $view_package_array['PACKAGE'] = $packages_data['name'] . " <a href = '?page=upgrade'>Change</a>"; $view_package_array['DESCRIPTION'] = $packages_data['description']; if ($_POST) { if (crypto::passhash($postvar['currentpass'], $client_data['salt']) == $client_data['password']) { if ($postvar['newpass'] == $postvar['cpass']) { $cmd = main::changeClientPassword($client_data['id'], $postvar['newpass']); if ($cmd === true) { main::errors("Details updated!"); } else { main::errors((string) $cmd); } } else { main::errors("Your passwords don't match!"); } } else { main::errors("Your current password wasn't correct!"); } } echo style::replaceVar("tpl/client/view-package.tpl", $view_package_array); }
private function ChangePassword($client) { global $dbh, $postvar, $getvar, $instance; $change_password_array['MSG'] = "This will change the user's password in THT and the control panel.<br><br>"; if ($_POST) { if (empty($postvar['passwd'])) { main::errors('A password was not provided.'); } else { $command = main::changeClientPassword($client['id'], $postvar['passwd']); if ($command === true) { main::errors('Password changed!'); } else { main::errors($command); } } } $clientview_array['BOX'] = ""; $clientview_array['CONTENT'] = style::replaceVar("tpl/admin/clients/change-password.tpl", $change_password_array); return $clientview_array; }
public function content() { global $dbh, $postvar, $getvar, $instance; $client = $dbh->client($_SESSION['cuser']); $edit_account_array['USER'] = $client['user']; $edit_account_array['EMAIL'] = $client['email']; $edit_account_array['DOMAIN'] = $client['domain']; $edit_account_array['FIRSTNAME'] = $client['firstname']; $edit_account_array['LASTNAME'] = $client['lastname']; $edit_account_array['ADDRESS'] = $client['address']; $edit_account_array['CITY'] = $client['city']; $edit_account_array['STATE'] = $client['state']; $edit_account_array['ZIP'] = $client['zip']; $edit_account_array['PHONE'] = $client['phone']; $edit_account_array['TZADJUST'] = main::tzlist($client['tzadjust']); $edit_account_array['DISP'] = "<div>"; $edit_account_array['COUNTRY'] = main::countries(1, $client['country']) . '<a title="Your country." class="tooltip"><img src="<ICONDIR>information.png" /></a>'; if ($_POST) { if (!check::email($postvar['email'], $_SESSION['cuser'])) { main::errors("Your email is the wrong format!"); } if (!check::state($postvar['state'])) { main::errors("Please enter a valid state!"); } if (!check::address($postvar['address'])) { main::errors("Please enter a valid address!"); } if (!check::phone($postvar['phone'])) { main::errors("Please enter a valid phone number!"); } if (!check::zip($postvar['zip'])) { main::errors("Please enter a valid zip/postal code!"); } if (!check::city($postvar['city'])) { main::errors("Please enter a valid city!"); } if (!check::firstname($postvar['firstname'])) { main::errors("Please enter a valid first name!"); } if (!check::lastname($postvar['lastname'])) { main::errors("Please enter a valid time last name!"); } if (!main::errors()) { if ($postvar['country']) { $country_q = ""; } $users_update = array("email" => $postvar['email'], "state" => $postvar['state'], "address" => $postvar['address'], "phone" => $postvar['phone'], "zip" => $postvar['zip'], "city" => $postvar['city'], "tzadjust" => $postvar['tzones'], "firstname" => $postvar['firstname'], "lastname" => $postvar['lastname'], "country" => $postvar['country']); $dbh->update("users", $users_update, array("id", "=", $_SESSION['cuser'])); if ($postvar['change']) { $client = $dbh->client($_SESSION['cuser']); if (crypto::passhash($postvar['currentpass'], $client['salt']) == $client['password']) { if ($postvar['newpass'] === $postvar['cpass']) { $cmd = main::changeClientPassword($_SESSION['cuser'], $postvar['newpass']); if ($cmd === true) { main::errors("Details updated!"); } else { main::errors((string) $cmd); } } else { main::errors("Your passwords don't match!"); } } else { main::errors("Your current password is incorrect."); } } else { $edit_account_array['DISP'] = "<div style=\"display:none;\">"; main::errors("Details updated!"); } } } echo style::replaceVar("tpl/client/edit-account.tpl", $edit_account_array); }
define("INFO", SUB); echo style::get("header.tpl"); if ($_POST) { check::empty_fields(); if (!main::errors()) { $user = $postvar['user']; $email_reset = $postvar['email']; unset($where); $where[] = array("user", "=", $user, "AND"); $where[] = array("email", "=", $email_reset); $client = $dbh->select("users", $where); if (!$client['user']) { main::errors("That account doesn't exist!"); } else { $password = rand(); $cmd = main::changeClientPassword($client['id'], $password); main::errors("Password reset!"); $forgot_pass_array['PASS'] = $password; $forgot_pass_array['LINK'] = $dbh->config("url") . "/client"; $emaildata = email::emailTemplate("client-password-reset"); email::send($email_reset, $emaildata['subject'], $emaildata['content'], $forgot_pass_array); } } } echo '<div align="center">' . main::table("Client Area - Reset Password", style::replaceVar("tpl/client/login/client-password-reset.tpl"), "300px") . '</div>'; echo style::get("footer.tpl"); } else { define("SUB", "Login"); define("INFO", "<b>Welcome to <NAME></b><br>" . SUB); if ($_POST) { if (main::clientLogin($postvar['user'], $postvar['pass'])) {