Ejemplo n.º 1
0
function update_password()
{
    global $sql;
    if (isset($_POST['uaction']) && $_POST['uaction'] === 'updt_pass') {
        if (!vhcs_password_check($_POST['pass'], 20)) {
            set_page_message(tr('Incorrect password range or syntax!'));
        } else {
            if ($_POST['pass'] === '' || $_POST['pass_rep'] === '') {
                set_page_message(tr('Please fill up both data fields!'));
            } else {
                if ($_POST['pass'] !== $_POST['pass_rep']) {
                    set_page_message(tr('Passwords does not match!'));
                } else {
                    $upass = crypt_user_pass($_POST['pass']);
                    $user_id = $_SESSION['user_id'];
                    $query = <<<SQL_QUERY
                update
                    admin
                set
                    admin_pass = ?
                where
                    admin_id = ?
SQL_QUERY;
                    $rs = exec_query($sql, $query, array($upass, $user_id));
                    set_page_message(tr('User password updated successfully!'));
                }
            }
        }
    }
}
Ejemplo n.º 2
0
function chk_password($password)
{
    if (vhcs_password_check($password, 50) == 0) {
        return 1;
    }
    /* seems ok ! */
    return 0;
}
function check_ruser_data(&$tpl, $NoPass)
{
    global $dmn_name, $hpid, $dmn_user_name;
    global $user_email, $customer_id, $first_name;
    global $last_name, $firm, $zip;
    global $city, $country, $street_one;
    global $street_two, $mail, $phone;
    global $fax, $inpass, $domain_ip;
    $rau_error = '_off_';
    $inpass_re = '';
    // Get data for fields from previus page
    if (isset($_POST['userpassword'])) {
        $inpass = $_POST['userpassword'];
    }
    if (isset($_POST['userpassword_repeat'])) {
        $inpass_re = $_POST['userpassword_repeat'];
    }
    if (isset($_POST['domain_ip'])) {
        $domain_ip = $_POST['domain_ip'];
    }
    if (isset($_POST['useremail'])) {
        $user_email = $_POST['useremail'];
    }
    if (isset($_POST['useruid'])) {
        $customer_id = $_POST['useruid'];
    }
    if (isset($_POST['userfname'])) {
        $first_name = $_POST['userfname'];
    }
    if (isset($_POST['userlname'])) {
        $last_name = $_POST['userlname'];
    }
    if (isset($_POST['userfirm'])) {
        $firm = $_POST['userfirm'];
    }
    if (isset($_POST['userzip'])) {
        $zip = $_POST['userzip'];
    }
    if (isset($_POST['usercity'])) {
        $city = $_POST['usercity'];
    }
    if (isset($_POST['usercountry'])) {
        $country = $_POST['usercountry'];
    }
    if (isset($_POST['userstreet1'])) {
        $street_one = $_POST['userstreet1'];
    }
    if (isset($_POST['userstreet2'])) {
        $street_two = $_POST['userstreet2'];
    }
    if (isset($_POST['useremail'])) {
        $mail = $_POST['useremail'];
    }
    if (isset($_POST['userphone'])) {
        $phone = $_POST['userphone'];
    }
    if (isset($_POST['userfax'])) {
        $fax = $_POST['userfax'];
    }
    //if(isset($_SESSION['local_data']) )
    //	list($dmn_name, $hpid, $dmn_user_name) = explode(";", $_SESSION['local_data']);
    // Begin checking...
    if ('_no_' == $NoPass) {
        if ('' === $inpass_re || '' === $inpass) {
            $rau_error = tr('Please fill up both data fields for password!');
        } else {
            if ($inpass_re !== $inpass) {
                $rau_error = tr('Passwords does not match!');
            } else {
                if (!vhcs_password_check($inpass, 20)) {
                    $rau_error = tr('Incorrect password range or syntax!');
                }
            }
        }
    }
    /* we don't wannt to validate Customer ID, First and Second name and also ZIP
    
    	else if(!vhcs_limit_check($customer_id, 999)){
    
    		$rau_error = tr('Incorrect customer ID syntax!');
    	}
    	else if(!vhcs_name_check($first_name, 40)){
    
    		$rau_error = tr('Incorrect first name range or syntax!');
    	}else if(!vhcs_name_check($last_name, 40)){
    
    		$rau_error = tr('Incorrect second name range or syntax!');
    	}else if(!vhcs_limit_check($zip, 999999)){
    
    		$rau_error = tr('Incorrect post code range or syntax!');
    	} */
    if ($rau_error == '_off_') {
        $tpl->assign('MESSAGE', '');
        // send data throught session
        return true;
    } else {
        $tpl->assign('MESSAGE', $rau_error);
        return false;
    }
    return true;
}