Esempio n. 1
0
        */
    /*
    case 'logout':
      unset($_SESSION['username']);
      echo 'true';
    break;
    */
    case 'verifyon':
        if (isset($_SESSION['username'])) {
            echo verify_online($_SESSION['username']);
        } else {
            echo 'You are offline';
        }
        break;
    case 'resetpwd':
        if (isset($_POST['auth_key']) && isset($_POST['username']) && isset($_POST['password'])) {
            echo reset_pwd($_POST['username'], $_POST['auth_key'], $_POST['password']);
        } else {
            exit('Invalid request');
        }
        break;
    case 'verify':
        if (isset($_POST['auth_key']) && isset($_POST['username'])) {
            echo verify($_POST['username'], $_POST['auth_key']);
        } else {
            exit('Invalid request');
        }
        break;
    default:
        echo 'Invalid request';
}
Esempio n. 2
0
***********************************************************/
session_start();
require 'dbc.php';
require '../' . $site . '/mail/PHPMailer-master/PHPMailerAutoload.php';
switch ($_GET['action']) {
    case 'login':
        login();
        break;
    case 'register':
        register();
        break;
    case 'recover':
        recover();
        break;
    case 'reset':
        reset_pwd();
        break;
}
function login()
{
    global $link;
    foreach ($_POST as $key => $value) {
        $data[$key] = $value;
        // post variables are filtered
    }
    $user_email = $data['user_email'];
    $pass = $data['pass'];
    if (strpos($user_email, '@') === false) {
        $user_cond = "user_name='{$user_email}'";
    } else {
        $user_cond = "user_email='{$user_email}'";