User::Password PHP Method

Password() public method

public Password ( )
    public function Password()
    {
        $this->EncryptPassword();
        $revised_array = array();
        foreach ($this->users as $user => $data) {
            if ($data['username'] == $this->username) {
                $revised_array[] = array("username" => $data['username'], "password" => $this->password, "project" => $data['project']);
            } else {
                $revised_array[] = array("username" => $data['username'], "password" => $data['password'], "project" => $data['project']);
            }
        }
        // Save array back to JSON
        saveJSON('users.php', $revised_array);
        // Response
        echo formatJSEND("success", null);
    }

Usage Example

{
    return $cache->get_valor($chave);
}
$cacheArquivo = new CacheArquivo();
$cacheSessao = new CacheSessao();
$Contact = new Contact();
$UsId = $Contact->GetUserIdByUserName($_REQUEST['userName']);
$Contact->UserId($UsId);
$Contacts = $Contact->getAllContacts();
$valor = json_encode($Contacts);
guardar_valor($cacheArquivo, $UsId, $valor);
guardar_valor($cacheSessao, $UsId, $valor);
guardar_valor($cacheSessao, 'USERID', $UsId);
setcookie('USERID', $UsId);
$u->UserName($_REQUEST['userName']);
$u->Password($_REQUEST['password']);
$res = $u->VerifyLogin();
if ($res) {
    echo 'Usuário logado!';
    echo '<html>';
    echo '<br>';
    echo '<form action="Main.php">';
    echo '<input type="submit" value="Continuar"> </input>';
    echo '</form>';
    echo '</html>';
} else {
    echo 'Usuário e/ou senha não existe(m)!';
    echo '<html>';
    echo '<br>';
    echo '<form action="Login.html">';
    echo '<input type="submit" value="Voltar"> </input>';
All Usage Examples Of User::Password