Exemplo n.º 1
0
 if (!check::address($postvar['address'])) {
     main::errors(nl2br("Your address may only contain letters, numbers and the following characters:.- and space."));
 }
 if (!check::city($postvar['city'])) {
     main::errors(nl2br("Your city may only contain letters and spaces."));
 }
 if (!check::state($postvar['state'])) {
     main::errors(nl2br("Your state may only contain letters and the following characters:.- and space"));
 }
 if (!check::zip($postvar['zip'])) {
     main::errors(nl2br("Your zip may only be 10 characters long and contain only  letters, numbers, and the following characters: - and space"));
 }
 if (!check::country($postvar['country'])) {
     main::errors(nl2br("Your country code may only contain 2 letters."));
 }
 if (!check::phone($postvar['phone'])) {
     main::errors(nl2br("Your phone number may only contain numbers and the - character and must be between 10 and 20 numbers long."));
 }
 if (!check::tzone($postvar['tzones'])) {
     main::errors(nl2br("Your time zone may only contain letters and the / _ and - characters."));
 }
 if (!check::human($postvar['human'])) {
     main::errors(nl2br("You're not human.  Neither am I for that matter.  =P  lol  Check the code you entered for the captcha."));
 }
 $coupon_chk = check::coupon($postvar['coupon'], $postvar['username'], $getvar['package']);
 //Can return text as well.  Text is seen as true unless it's "0"
 $getvar['coupon'] = $postvar['coupon'];
 //For any types (Ex. p2h) that might need to grab a coupon.
 if (!$coupon_chk) {
     main::errors(nl2br("The coupon code entered was invalid."));
 }
Exemplo n.º 2
0
 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);
 }