Exemplo n.º 1
0
$doc->InitSecurityHandler();
// Perform some operation on the document. In this case we use low level SDF API
// to replace the content stream of the first page with contents of file 'my_stream.txt'
if (true) {
    echo "Replacing the content stream, use Flate compression...\n";
    // Get the page dictionary using the following path: trailer/Root/Pages/Kids/0
    $page_dict = $doc->GetTrailer()->Get("Root")->Value()->Get("Pages")->Value()->Get("Kids")->Value()->GetAt(0);
    // Embed a custom stream (file mystream.txt) using Flate compression.
    $embed_file = new MappedFile($input_path . "my_stream.txt");
    $mystm = new FilterReader($embed_file);
    $page_dict->Put("Contents", $doc->CreateIndirectStream($mystm, new FlateEncode(new Filter())));
}
//encrypt the document
// Apply a new security handler with given security settings.
// In order to open saved PDF you will need a user password 'test'.
$new_handler = new SecurityHandler();
// Set a new password required to open a document
$user_password = "******";
$new_handler->ChangeUserPassword($user_password);
// Set Permissions
$new_handler->SetPermission(SecurityHandler::e_print, true);
$new_handler->SetPermission(SecurityHandler::e_extract_content, false);
// Note: document takes the ownership of new_handler.
$doc->SetSecurityHandler($new_handler);
// Save the changes.
echo "Saving modified file...\n";
$doc->Save($output_path . "secured.pdf", 0);
$doc->Close();
// Example 2:
// Opens an encrypted PDF document and removes its security.
$doc = new PDFDoc($output_path . "secured.pdf");
Exemplo n.º 2
0
<?php

$mobileLoginPage = false;
$sessionRequired = false;
$sessionAllowed = false;
include "Header.php";
$sessId = '';
$userId = -1;
if (isset($_GET['sessID'])) {
    $sessId = filter_var(trim($_GET['sessID']), FILTER_SANITIZE_STRING);
    $securityHandler = new SecurityHandler();
    $dataAccess = new DataAccess();
    $logger = new Logger($dataAccess);
    $userId = $securityHandler->LookupPasswordRecoverySession($dataAccess, $logger, $sessId);
}
$headerMessage = "<h2>Sorry, Your Password Reset Session Has Expired.</h2><h3>Please Click 'Forgot Password' To Make A New Session.</h3>";
if ($userId > -1) {
    $headerMessage = "<h2>Choose Your New Password</h2>";
}
?>
<!DOCTYPE HTML>
<!--
	Project OGS
	by => Stephen Giles and Paul Morrell
-->
<html>
    <head>
        <?php 
echo $pageHeaderHTML;
?>
        
Exemplo n.º 3
0
 $captchaCode = trim($_POST['captcha_code']);
 try {
     if ($securImage->check($captchaCode) == true) {
         $captchaValidated = true;
     }
 } catch (Exception $e) {
     $logger->LogError("Exception occurred on captcha validation: " . $e->getMessage());
 }
 if (!$captchaValidated) {
     echo "Incorrect Code Entered...Please Try Again";
     exit;
 }
 // Remove Securimage session
 session_unset();
 session_destroy();
 $securityHandler = new SecurityHandler();
 $userEmail = "";
 $encryptedPassword = "";
 $errorOnPOSTRetrieval = false;
 $exceptionMessage = "Email Address and Password must be filled out to create an account";
 $userExceptionMessage = $exceptionMessage;
 // Get login credentials
 try {
     $password = filter_var(trim($_POST["signupPW"]), FILTER_SANITIZE_STRING);
     $userEmail = filter_var(trim($_POST["signupEmail"]), FILTER_SANITIZE_EMAIL);
     if (strlen($password) == 0 || strlen($userEmail) == 0) {
         $errorOnPOSTRetrieval = true;
     }
 } catch (Exception $e) {
     $exceptionMessage = "Could not retrieve signup credentials from POST on Signup. Exception: " . $e->getMessage();
     $userExceptionMessage = "Error: Could Not create Basic Account. Please Try Again Later.";
Exemplo n.º 4
0
$loginErrorDiv = '<div id="loginErr" class="preLogin">&nbsp;</div>';
if ($mobileLoginPage) {
    $pageHeaderLoginForm = "";
    $loginErrorDiv = "";
}
$headerHTML = '<!-- Navigation Wrapper -->' . '<div id="header-wrapper">' . '<div class="container">' . '<div class="row">' . '<div class="12u">' . '<!-- Header -->' . '<header id="header">' . '<!-- Logo -->' . '<h1>' . '<a href="index.php" id="logo">Player Unite</a>' . $pageHeaderLoginForm . '</h1>' . '<!-- Nav -->' . '<nav id="nav" style="display:none;">' . '<ul>' . '<li><a href="MobileLogin.php">Log In</a></li>' . '<li><a href="index.php?action=Signup">Sign Up</a></li>' . '</ul>' . '</nav>' . '</header>' . '</div>' . $loginErrorDiv . '</div>' . '</div>' . '</div>';
// Set PayPal donation button image (appearing in Footer.php) based on whether we are hitting the sandbox or production PayPal environment
$payPalButtonFormUrl = Constants::$isPayPalTest ? Constants::$payPalTestButtonFormUrl : Constants::$payPalProdButtonFormUrl;
$payPalDonationButtonImgUrl = Constants::$isPayPalTest ? Constants::$payPalTestDonationButtonImgUrl : Constants::$payPalProdDonationButtonImgUrl;
$payPalDonationButtonId = Constants::$isPayPalTest ? Constants::$payPalTestDonationButtonId : Constants::$payPalProdDonationButtonId;
$payPalPixelImgUrl = Constants::$isPayPalTest ? Constants::$payPalTestPixelImgUrl : Constants::$payPalProdPixelImgUrl;
$customSessionVars = [];
if ($sessionAllowed) {
    $dataAccess = new DataAccess();
    $logger = new Logger($dataAccess);
    $securityHandler = new SecurityHandler();
    $sessionDataAccess = new DataAccess();
    $sessionHandler = new DBSessionHandler($sessionDataAccess);
    session_set_save_handler($sessionHandler, true);
    session_start();
}
if ($sessionRequired || $sessionAllowed && isset($_SESSION['WebUser'])) {
    $justCreatedSession = false;
    // If user not logged in or unauthorized to view this page, redirect to login page
    if ($securityHandler->UserCanAccessThisPage($dataAccess, $logger, $curPageName, Constants::$authFailureRedirectPage)) {
        $objUser = $_SESSION['WebUser'];
        $_SESSION['lastActivity'] = time();
        if (isset($_SESSION['JustCreatedAccount'])) {
            if ($_SESSION['JustCreatedAccount'] == true) {
                $justCreatedSession = true;
                $_SESSION['JustCreatedAccount'] = false;