PHP User::randpass Examples

PHP User::randpass - 5 examples found. These are the top rated real world PHP examples of User::randpass extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 if (isset($_POST['token']) && Token::isExist($_POST['token'])) {
     /*check if username is exist or not */
     $username = Typo::cleanX(Typo::strip($_POST['username']));
     $sql = sprintf("SELECT `userid`,`email`,`status`,`activation` FROM `user` WHERE `userid` = '%s'", $username);
     $usr = Db::result($sql);
     $c = Db::$num_rows;
     //echo $c;
     //print_r($usr);
     if ($c == "1") {
         //$alertgreen = "";
         // check if user is active
         if ($usr[0]->status == '1') {
             /* get user password */
             $newpass = User::generatePass();
             $id = User::id($username);
             $pass = User::randpass($newpass);
             $vars = array('id' => $id, 'user' => array('pass' => $pass));
             User::update($vars);
             $date = Date::format(date("Y-m-d H:i:s"));
             $msg = "\n\t\tHello {$usr[0]->userid},\n\n\t\tYou are requesting Password Reset at " . Site::$name . " on {$date}. \n\t\tBelow are your new Password :\n\n\t\t{$newpass}\n\n\t\tNow you can login with your new Password at " . Site::$url . "\n\n\n\t\tBest Regards,\n\n\n\t\t" . Site::$name . "\n\t\t" . Site::$email . "\n\t\t\t\t";
             $vars = array('to' => $usr[0]->email, 'to_name' => $usr[0]->userid, 'message' => $msg, 'subject' => 'Password Reset at ' . Site::$name, 'msgtype' => 'text');
             //echo "<pre>".$msg."</pre>";
             if (Mail::send($vars)) {
                 $alertgreen = PASSWORD_SENT_NOTIF;
             }
         } else {
             if ($usr[0]->activation != '') {
                 $alertred[] = ACOUNT_NOT_ACTIVE;
             } else {
                 $alertred[] = ACOUNT_NOT_ACTIVE_BLOCK;
             }
Example #2
0
     }
 }
 if (!isset($alertred)) {
     /*check if username is exist or not */
     $username = Typo::cleanX(Typo::strip($_POST['username']));
     $sql = sprintf("SELECT `userid`,`status`,`activation` FROM `user` WHERE `userid` = '%s'", $username);
     $usr = Db::result($sql);
     $c = Db::$num_rows;
     //echo $c;
     //print_r($usr);
     if ($c == "1") {
         //$alertgreen = "";
         // check if user is active
         if ($usr[0]->status == '1') {
             /* get user password */
             $pass = User::randpass($_POST['password']);
             $sql = "SELECT `pass`,`group` FROM `user` WHERE `userid` = '{$username}'";
             $l = Db::result($sql);
             $c = Db::$num_rows;
             foreach ($l as $v) {
                 # code...
                 //print_r($v);
                 $p = $v->pass;
                 $g = $v->group;
             }
             //echo $p;
             if ($p == $pass) {
                 $vars = array('username' => $username, 'loggedin' => true, 'group' => $g);
                 Session::set_session($vars);
                 /*
                 $_SESSION['username'] = $_POST['username'];
Example #3
0
         }
         if (!isset($_POST['pass2']) || $_POST['pass2'] == "") {
             // VALIDATE ALL
             $alertred[] = PASS2_CANNOT_EMPTY;
         }
         if (!User::is_exist($_POST['userid'])) {
             $alertred[] = MSG_USER_EXIST;
         }
         if (!User::is_same($_POST['pass1'], $_POST['pass2'])) {
             $alertred[] = MSG_USER_PWD_MISMATCH;
         }
         if (!User::is_email($_POST['email'])) {
             $alertred[] = MSG_USER_EMAIL_EXIST;
         }
         if (!isset($alertred)) {
             $vars = array('user' => array('userid' => $userid, 'pass' => User::randpass($_POST['pass1']), 'email' => $email, 'group' => $group, 'status' => '1', 'join_date' => date("Y-m-d H:i:s")));
             User::create($vars);
             Hooks::run('user_submit_add_action', $_POST);
             Token::remove($_POST['token']);
             $data['alertgreen'][] = USER . " {$_POST['userid']}, " . MSG_USER_ADDED;
         } else {
             $data['alertred'] = $alertred;
         }
         if (isset($_POST['token'])) {
             Token::remove($_POST['token']);
         }
         break;
     default:
         # code...
         break;
 }
Example #4
0
        if (!Xaptcha::verify($_POST['g-recaptcha-response'])) {
            $alertred[] = "Your Captcha is not correct.";
        }
    }
    if (!User::is_exist($_POST['userid'])) {
        $alertred[] = MSG_USER_EXIST;
    }
    if (!User::is_same($_POST['pass1'], $_POST['pass1'])) {
        $alertred[] = MSG_USER_PWD_MISMATCH;
    }
    if (!User::is_email($_POST['email'])) {
        $alertred[] = MSG_USER_EMAIL_EXIST;
    }
    if (!isset($alertred)) {
        $activation = Typo::getToken(60);
        $vars = array('user' => array('userid' => Typo::cleanX(Typo::strip($_POST['userid'])), 'pass' => User::randpass($_POST['pass1']), 'email' => $_POST['email'], 'group' => '4', 'status' => '0', 'join_date' => date("Y-m-d H:i:s"), 'activation' => $activation), 'user_detail' => array('userid' => Typo::cleanX(Typo::strip($_POST['userid']))));
        if (User::create($vars) === true) {
            $data['alertgreen'][] = REG_ACTIVATE_ACCOUNT;
        } else {
            $alertred[] = REG_CANT_CREATE_ACCOUNT;
        }
        $vars = array('to' => $_POST['email'], 'to_name' => $_POST['userid'], 'subject' => 'Account Activation Needed at ' . Site::$name, 'message' => '
                            Hi ' . $_POST['userid'] . ', 

                            Thank You for Registering with Us. Please activate your account by clicking this link :
                            ' . Site::$url . '/register.php?activation=' . $activation . '

                            Sincerely,
                            {$sitename}
                            ', 'mailtype' => 'text');
        $mailsend = Mail::send($vars);
Example #5
0
     Session::set_session($vars);
     Theme::install('step2');
     break;
 case '3':
     $vars = array('adminname' => isset($_POST) ? $_POST['adminname'] : "", 'adminuser' => isset($_POST) ? $_POST['adminuser'] : "", 'adminpass' => isset($_POST) ? $_POST['adminpass'] : "");
     Session::set_session($vars);
     Theme::install('step3');
     break;
 case '4':
     try {
         $file = GX_PATH . "/inc/config/config.php";
         $config = Install::makeConfig($file);
         if (System::existConf()) {
             Install::createTable();
             Install::insertData();
             $vars = array('user' => array('userid' => Session::val('adminuser'), 'pass' => User::randpass(Session::val('adminpass')), 'email' => 'admin@' . Session::val('sitedomain'), 'group' => '0', 'join_date' => date("Y-m-d H:i:s"), 'status' => '1'), 'detail' => array('userid' => Session::val('adminuser'), 'fname' => Session::val('adminname')));
             User::create($vars);
             echo "Installation Success. Go to <a href=\"gxadmin\">Admin Page</a>.";
         } else {
             echo "<h2>Error !! Config File Not Found.</h2>\n                Please make sure you had permission to write on the config directory. \n                Do ftp to the server and CHMOD 777 the config directory. After \n                config file is created, you can chmod it back to 755.\n                <br>\n                <br>\n                After You had set the permission, please refresh this page. \n                <br>\n                <br>\n                or <a href=\"?step=4\" class=\"btn btn-primary\">Click Here</a>";
         }
     } catch (exception $e) {
         echo $e->getMessage();
     }
     break;
 default:
     if (System::existConf()) {
         # code...
         echo "Config File Already Exist";
     } else {
         Theme::install('step0');