Пример #1
0
         echo nl2br("\r\nYou will be redirected to the upload page in 5 seconds.");
         header('refresh: 5; url=upload.html');
         // if everything is ok, try to upload file
     } else {
         if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
             echo nl2br("\r\nThe file " . basename($_FILES["fileToUpload"]["name"]) . " has been uploaded.");
             $Query = 'CALL UpdateDocument (?, ?, ?)';
             $Statement = $PDOconn->prepare($Query);
             $Statement->bindParam(1, $filename, PDO::PARAM_STR, 255);
             $Statement->bindParam(2, $Email, PDO::PARAM_STR, 45);
             $Statement->bindParam(3, $Name, PDO::PARAM_STR, 45);
             $Statement->execute();
             $ActivityMSG = "You uploaded " . $Name . "'s document.";
             AddActivity($Email, $ActivityMSG);
             $Action = "Upload";
             $AdminAccounts = FetchAdmins($Action);
             foreach ($AdminAccounts as $AdminEmail) {
                 mail($AdminEmail['Email'], "Pet document uploaded", "The following account: " . $Email . " has uploaded the pet documentation for " . $Name . ".  Pet is awaiting your approval.");
             }
             echo nl2br("\r\nYou will be redirected to the homepage in 5 seconds.");
             header('refresh: 5; url=index.html');
         } else {
             echo nl2br("\r\n Error 65: Sorry, there was an error uploading your file.");
             echo nl2br("\r\nYou will be redirected to the upload page in 5 seconds.");
             header('refresh: 5; url=upload.html');
         }
     }
 } else {
     echo nl2br("\r\n Error 63: Sorry, you don't have a pet named " . $Name . ".");
     echo nl2br("\r\nYou will be redirected to the upload page in 5 seconds.");
     header('refresh: 5; url=upload.html');
Пример #2
0
function AddAccount($Action)
{
    $Email = stripslashes($_POST["D1"]);
    $UserData = FetchUser($Action, $Email);
    if ($Email == $UserData['Email']) {
        if ($UserData['Attempt'] < 5) {
            AddAttempt($Action, $UserData, $Email);
            $ActivityMSG = "Account to be locked due to multiple registration attempts.";
            AddActivity($Action, $Email, $ActivityMSG);
            echo json_encode("notlocked");
            exit;
        } else {
            $ActivityMSG = "Account was locked out due to multiple registration attempts.";
            AddActivity($Action, $Email, $ActivityMSG);
            echo json_encode("locked");
            exit;
        }
    }
    $Password = stripslashes($_POST["D2"]);
    $HashedPassword = HashIt($Password);
    $Disabled = 1;
    $Attempt = 0;
    $AdminCode = 1;
    global $PDOconn;
    $Query = 'CALL AddAccount (?, ?, ?, ?, ?)';
    $Statement = $PDOconn->prepare($Query);
    $Statement->bindParam(1, $Email, PDO::PARAM_STR, 45);
    $Statement->bindParam(2, $HashedPassword, PDO::PARAM_STR, 64);
    $Statement->bindParam(3, $Disabled, PDO::PARAM_INT, 1);
    $Statement->bindParam(4, $Attempt, PDO::PARAM_INT, 1);
    $Statement->bindParam(5, $AdminCode, PDO::PARAM_INT, 1);
    Execute($Action, $Statement);
    $ActivityMSG = "Your account was created.";
    AddActivity($Action, $Email, $ActivityMSG);
    mail($Email, "Your account was created", "The following email: " . $Email . " has been created.  The account will be activated by an Admin.  In the meantime, familiarize yourself with the pet policy. https://petsignin.alibkaba.com/petsignin/petpolicy.pdf");
    $AdminAccounts = FetchAdmins($Action);
    foreach ($AdminAccounts as $AdminEmail) {
        mail($AdminEmail['Email'], "New account created", "The following email: " . $Email . " has been created.  Account is awaiting your approval.");
    }
    echo json_encode("refresh");
    $PDOconn = null;
}