Пример #1
0
function ModifyPassword($userID, $password)
{
    include_once '../DAL/userDal.php';
    if (isset($userID) && !$userID == '') {
        $result = UpdatePassword($userID, $password);
    }
    //  $= count($userlist);
    if ($result > 0) {
        return true;
    }
    return false;
}
// This should update the user's password with the specified password
//
// Steve McLaughlin
session_name('reglogin');
session_start();
// Check the form was filled in correctly
if (!isset($_POST['username']) || !isset($_POST['password1']) || !isset($_POST['password2'])) {
    die("You did not fill in the form correctly.  Try again.");
}
if (!preg_match('/^[A-Za-z0-9_]+$/', $_POST['username'])) {
    die("Username must consist only of letters, numbers, underscore.");
}
if ($_POST['password1'] != $_POST['password2']) {
    die("Passwords don't match.  Try again.");
}
include "/export/home/mclaug67/source_html/public_html/awp/PhotoSite/Connect-webuser.php";
include "DB_Functions.php";
$dbh = ConnectDB();
$user_id = UpdatePassword($dbh, $_POST['password1'], $_POST['username']);
// get user_id and update the password
// I think i'll need to add a new function in DB_Functions.php
//$user_id = AddNewUser($dbh, $_POST['username'], $_POST['password1']);
// log them in
$_SESSION['username'] = $_POST['username'];
$_SESSION['user_id'] = $user_id;
header("Location: user_page.php");
?>


Пример #3
0
function PHPOperation($Action)
{
    switch ($Action) {
        case "UnitTest":
            UnitTest($Action);
            break;
        case "AddAccount":
            AddAccount($Action);
            break;
        case "SignIn":
            SignIn($Action);
            break;
        case "SignInPet":
            SignInPet($Action);
            break;
        case "SignOut":
            SignOut($Action);
            break;
        case "FetchErrors":
            FetchErrors($Action);
            break;
        case "AddError":
            AddError($Action);
            break;
        case "FetchActivities":
            FetchActivities($Action);
            break;
        case "FetchSignInPet":
            FetchSignInPet($Action);
            break;
        case "FetchBreeds":
            FetchBreeds($Action);
            break;
        case "ValidateSession":
            ValidateSession($Action);
            break;
        case "ResetPassword":
            ResetPassword($Action);
            break;
        case "UpdatePassword":
            UpdatePassword($Action);
            break;
        case "AddPet":
            AddPet($Action);
            break;
        case "AddBreed":
            AddBreed($Action);
            break;
        case "FetchUsers":
            FetchUsers($Action);
            break;
        case "FetchUserPets":
            FetchUserPets($Action);
            break;
        case "FetchUserStatus":
            FetchUserStatus($Action);
            break;
        case "FetchPetStatus":
            FetchPetStatus($Action);
            break;
        case "FetchPet":
            FetchPet($Action);
            break;
        case "UpdateAccountStatus":
            UpdateAccountStatus($Action);
            break;
        case "UpdatePetStatus":
            UpdatePetStatus($Action);
            break;
        case "UpdatePetName":
            UpdatePetName($Action);
            break;
        case "UpdatePetBreed":
            UpdatePetBreed($Action);
            break;
        case "UpdatePetGender":
            UpdatePetGender($Action);
            break;
        case "UpdateBreed":
            UpdateBreed($Action);
            break;
        case "FetchPetNameCount":
            FetchPetNameCount($Action);
            break;
        case "FetchUserEmail":
            FetchUserEmail($Action);
            break;
    }
}
Пример #4
0
 } else {
     if ($_GET['t'] == 8) {
         if ($_GET['c'] == "signup") {
             FacebookSignUp($_GET['url']);
         } else {
             if ($_GET['c'] == "login") {
                 FacebookLogin($_GET['url']);
             }
         }
     } else {
         if ($_GET['t'] == 9) {
             echo FacebookUrl($_GET['c'], $_GET['url']);
             // c = "login" or "signup"
         } else {
             if ($_GET['t'] == 10) {
                 UpdatePassword($_GET['c']);
             } else {
                 if ($_GET['t'] == 'special') {
                     $pageNo = $_GET['pageNo'];
                     if ($pageNo == null) {
                         $pageNo = -1;
                     }
                     $searchParam = $_GET['searchParam'];
                     if ($searchParam == null) {
                         $searchParam = '';
                     }
                     $postId = $_GET['postId'];
                     if ($postId == null) {
                         $postId = -1;
                     }
                     echo GetPostListTest($_GET['boardName'], $postId, $pageNo, $_GET['postLimit'], json_decode($_GET['tags'], true), $searchParam, $_GET['searchOptions']);
Пример #5
0
function ForgotPassword($name, $email)
{
    $newPwd = GenerateRandomPassword();
    $res = "-1";
    $updatePwd = UpdatePassword($email, $newPwd);
    if ($updatePwd == "A" || $updatePwd == "B" || $updatePwd == "C" || $updatePwd == "D") {
        // write the mail here.
        ForgotPasswordUserMail($email, $name, $newPwd);
        $res = "1";
        // if( == "1") {
        // 	$res = "1";
        // }
        // else {
        // 	$res = "2";
        // }
    } else {
        if ($updatePwd == "-A" || $updatePwd == "-B" || $updatePwd == "-C" || $updatePwd == "-D" || $updatePwd == "0") {
            // could not find the email address in the database.
            $res = "0";
        } else {
            if ($updatePwd == "2") {
                // user has not signed up yet.
                $res = "-2";
            } else {
                // error condition.
                $res = "-1";
            }
        }
    }
    echo $res;
}