Beispiel #1
0
/**
 * main part
 *
 * @param   void
 *
 * @return  bool
 */
function fPwdLost()
{
    // only accept POST as request method to ask for a password
    // GET delivers password form exclusively
    if ($_SERVER['REQUEST_METHOD'] != 'POST') {
        $bOk = fPwdDisplay('pwd_lost');
        exit;
    }
    // validate password
    if (!isset($_POST['nick']) or strlen($_POST['nick']) == 0) {
        $bOk = fPwdDisplay('no_input');
        exit;
    }
    $aPwdData = fPwdLostVal($_POST['nick']);
    if (isset($aPwdData['error'])) {
        $bOk = fPwdLostNoUserLog($aPwdData);
        $bOk = fPwdDisplay('no_nick', $aPwdData);
        exit;
    }
    // get new password by function
    $aPwdData['new_pwd'] = fPwdGen();
    // update password to new password and
    // send an email to user
    $bOk = fDbPwdUpdate($aPwdData);
    $bOk = fPwdMail($aPwdData);
    $bOk = fPwdDisplay('send', $aPwdData);
    exit;
}
/**
 * main part
 *
 * @param   void
 *
 * @return  bool
 */
function fRegister()
{
    // only accept POST as request method to ask for a password
    // GET delivers password form exclusively
    if ($_SERVER['REQUEST_METHOD'] != 'POST') {
        $bOk = fRegDisplay('register');
        exit;
    }
    // validate input
    $aError = fRegBaseVal($_POST);
    if (!empty($aError)) {
        $bOk = fRegDisplay($aError);
        exit;
    }
    $aRegData = fRegVal($_POST);
    if (isset($aPwdData['error'])) {
        $bOk = fPwdLostNoUserLog($aPwdData);
        $bOk = fPwdDisplay('no_nick', $aPwdData);
        exit;
    }
    // get new password by function
    $aPwdData['new_pwd'] = fPwdGen();
    // update password to new password and
    // send an email to user
    $bOk = fDbPwdUpdate($aPwdData);
    $bOk = fPwdMail($aPwdData);
    $bOk = fPwdDisplay('send', $aPwdData);
    exit;
}