Results 1 to 2 of 2

Thread: How to alter this script

  1. #1
    Join Date
    Jan 2009
    Posts
    16
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default How to alter this script

    I have a photo website where I sell racing photos. Part of my offering is a subscription for "annual" download. Customer receives a password and this script checks the password and expiration date then if approved, directs to a "secure" folder located in the root directory.

    The way this script is written by the author it only allows me to have a single "secure" folder where I upload all "original" files by original file "name"

    While browsing my flash based photo gallery a "subscribed user" can click on a "down load" icon and is prompted for thier password, they put it in and the script goes to the secure "originals" folder,gets the file and offers it up for download. All works great as is EXCEPT,,,

    I also have writers who want to download "Smaller" size files to use in their Press releases, these files would have a less intrusive watermark and be smaller in size than the "original" files

    I'm looking for a way to add a "else" statement to argue the password
    and if a "certain" password is present direct the script to either the secure "originals" folder at full size, or the secure "press" folder at reduced size and watermarked

    Anyway, here is the original code:
    [CODE]
    Original original_path parameters
    Code:
    // 1. Set full folder path where you've stored the originals.
     $original_path = "/home/lamothe/originals/";
    //   $original_path = "drive:/somefolder/account/yourdomain/database/originals/";


    Original Setting password input parameters
    Code:
    // Below settings (6 & 7) applies when protecteddownload feature is enabled and when the viewer clicks on 'download' icon in FotoPlayer
    // controlpanel
    
    // 6. Protected download password list (includes date of expiry in MM/DD/YYYY format for each password)
       $protect_pass = array("enterpass|11/04/2010" , "somepassword|01/01/2008");

    Original protect_path code
    Code:
    // 7. Protected download image path
       $protect_path  = "home/lamothe/originals/";
    // $protect_path  = "drive:/somefolder/account/yourdomain/database/originals/";

    Original protect_pass code
    Code:
    if ( isset($_GET['login']) && isset($_GET['file']) && $_GET['order'] == "protdown") {
    
    	for ($i=0;$i<sizeof($protect_pass);$i++) {
    		$splitpassexpiry = explode("|", $protect_pass[$i]);



    And this is my attempt at adding a "else" statement:
    I added a 2 on the end of input parameters and then added the "else" statement where I thought the code ended for the download function.
    Then duplicated the code and pasted after the "else" statement and edited the duplicated code to point to the input parameters with the "2" behind it....
    But that didn't work

    Any input or direction would be appreciated..

    Steve
    Code:
    ?php
    
    
    
    
    // Input Parameters starts ******************************************************************************************
    
    
    // 1. Set full folder path where you've stored the originals.
     $original_path = "/home/lamothe/originals/";
     $original_path2 = "home/lamothe/press/";
    
    
    // 1.1  New feature: By default all your site album photos are expected to be in one single folder, which is the above original path. If you want to keep the originals for each 
    //      published album inside a subfolder in above $original_path, then set the below indicator $usealbumname_for_original_path to y.
    //      example1: If you publish album to www.yourdomain.com/album/index.html, then this script will expect the original images in $original_path/album/
    //      example2: If you publish album to www.yourdomain.com/clients/client1/album1/index.html, then this script will expect the original images in $original_path/clients/client1/album1/
    //       If you set the below indicator to "n", all your site albums original images are expected in the same $original_path folder.
    
       $usealbumname_for_original_path = "n";
    
    // 2. Invalid pay status error message.
    
       $invalid_pay_status = "Paypal transaction was successful but the payment is incomplete/pending/unclaimed. File download is temporarily disabled.";
    
    // 3. Maximum download limit for each file.
    
       $max_download_count = 5;
    
    // 4. Error message when download limit exceeded.
    
       $download_exceeded_msg = "File maximum download limit (5) reached. File download is disabled.";
    
    // 5. Allow downloads for payment in 'Pending' status? (Paypal 'echeque' scenario. Buyer used his bank account as source and it may take a week to receive the payment)
       $allow_pending="n";
    
    
    // Below settings (6 & 7) applies when protecteddownload feature is enabled and when the viewer clicks on 'download' icon in FotoPlayer
    // controlpanel
    
    // 6. Protected download password list (includes date of expiry in MM/DD/YYYY format for each password)
       $protect_pass = array("test|11/04/2010" , "ageving10|01/01/2011");
       $protect_pass2 = array("press|11/04/2010" , "sullivan|01/01/2011");
    
    // 7. Protected download image path
       $protect_path  = "home/lamothe/originals/";
       $protect_path2  = "home/lamothe/press/";
    // here is where I added the "else" statement, line 443
    Code:
    	print "&response=Login Incorrect&";
    	//exit();
    }
    	else
    if ( isset($_GET['login']) && isset($_GET['file']) && $_GET['order'] == "protdown") {
    And here is where I changed the script to point to the revised input parameters
    Code:
    if ( isset($_POST['login']) && $_POST['order'] == "validatelogin") {
    
    	for ($i=0;$i<sizeof($protect_pass2);$i++) {
    		$splitpassexpiry = explode("|", $protect_pass2[$i]);
    Did any of that make sense?
    Any input or direction appreciated,
    Steve

  2. #2
    Join Date
    Jan 2009
    Posts
    16
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Solved...
    Not so hard

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •