コード例 #1
0
ファイル: forgotPassword.php プロジェクト: Gameonn/basketball
    $success = "0";
    $msg = "Incomplete Parameters";
} else {
    $sql = "SELECT * from users where email=:email";
    $sth = $conn->prepare($sql);
    $sth->bindValue("email", $email);
    try {
        $sth->execute();
    } catch (Exception $e) {
    }
    $res = $sth->fetchAll();
    $user = $res[0]['first_name'];
    $username = $user ? $user : '******';
    if (count($res)) {
        $token = GeneralFunctions::generateRandomString();
        $password = GeneralFunctions::generateRandomString(6);
        $sql = "UPDATE users set token=:token,password=:password where email=:email";
        $sth = $conn->prepare($sql);
        $sth->bindValue("email", $email);
        $sth->bindValue("token", md5($token));
        $sth->bindValue('password', md5($password));
        $count = 0;
        try {
            $count = $sth->execute();
        } catch (Exception $e) {
        }
        if ($count) {
            $success = "1";
            $msg = "Email successfully sent.";
            $body_email = "<div style='font-size:16px;line-height:1.4;'>\n\t\t\t\t\t\t<p> Dear {$username} </p>\t\n\t\t\t\t\t\t<p>We have received your password reset request.</p>\n\t\t\t\t\t\t<p>Your Password is reset as per your request:</p>\n\t\t\t\t\t\t<p>New Password: {$password}</p>\n\t\t\t\t\t\t<p>Have a good NBA experience.</p>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t<p>Best,</p>\n\t\t\t\t\t\t<p>NBA Users</p>\n\t\t\t\t\t\t</div>";
            sendEmail($email, "NBA- Recover Password", $body_email, SMTP_EMAIL);
コード例 #2
0
ファイル: refresh_token.php プロジェクト: Gameonn/competition
$data = array();
// +-----------------------------------+
// + STEP 2: get data				   +
// +-----------------------------------+
$token = $_REQUEST['access_token'];
if (!$token) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    // +-----------------------------------+
    // + STEP 3: perform operations		   +
    // +-----------------------------------+
    $uid = GeneralFunctions::getUserId($token);
    if ($uid) {
        $code = GeneralFunctions::generateRandomString(12);
        $sth = $conn->prepare("update users set token=:token where id=:id");
        $sth->bindValue("id", $uid);
        $sth->bindValue('token', md5($code));
        try {
            $sth->execute();
            $success = '1';
            $msg = "Access Token Updated";
            $access_token = md5($code);
        } catch (Exception $e) {
        }
    } else {
        $success = '0';
        $msg = "Token Expired";
    }
}
コード例 #3
0
ファイル: resetPassword.php プロジェクト: Gameonn/qism
	<div class="container">
        <h2>Reset Password</h2>
	<!--<h1>Your college life is exclusive again!</h1>
  	<p class="lead">What is EmBazaar? Glad you asked. Its an exclusive social community just for your college or university. Make new friends, attend cool events, sell or trade stuff in the student only bazaar and always stay connected to news and social gossip on campus. It's the best thing to hit your campus since sliced bread!</p>-->
  <!--  temp -->
  <?php 
require_once 'phpInclude/db_connection.php';
require_once 'classes/AllClasses.php';
$key = $_REQUEST['token'];
if (isset($_POST['cc']) && $_POST['cc'] != '') {
    global $conn;
    $cc = $_POST['cc'];
    $pass = $_POST['new_pass'];
    $c_pass = $_POST['conf_pass'];
    if ($pass == $c_pass && !empty($pass)) {
        $confirm_code = GeneralFunctions::generateRandomString();
        $pass = md5($pass);
        $sql = "SELECT email from `user` WHERE pass_reset_key='{$cc}'";
        $result = $conn->query($sql);
        $row = $result->fetch(PDO::FETCH_ASSOC);
        if ($result->rowCount() == 1) {
            $sql = "UPDATE `user` SET password=:pass,pass_reset_key=:confirm_code WHERE pass_reset_key=:cc";
            $sth = $conn->prepare($sql);
            $sth->bindParam(':pass', $pass);
            $sth->bindParam(':confirm_code', $confirm_code);
            $sth->bindParam(':cc', $cc);
            try {
            } catch (Exception $e) {
                echo $e->getMessage();
                die;
            }