Re: munge / obfuscate ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2008-03-27 at 21:10 -0400, Joey wrote:
> Hi All,
> 
>  
> 
> I have written an app to allow a person to go online and see a picture we
> take of them.  When we link to the picture I don't want it to be obvious
> that the URL is 
> 
> Domain.Com/Pix/123.jpg because the next person we take a picture of may be
> 123.jpg, so I am trying to munge/obfuscate the URL to make it less obvious.

<?php

    $sekret = 'the brown cow stomped on the wittle bug';

    $id  = isset( $_GET['id'] ) ? (int)$_GET['id'] : 0;
    $key = isset( $_GET['key'] ) ? (string)$_GET['key'] : '';

    if( $key == sha1( $key.':'.$sekret ) )
    {
        header( 'Content-Type: image/jpg' );
        readfile( "/images/not/in/web/path/$id.jpg" )
        exit();
    }    

    //
    // Failure... tell them to bugger off :)
    //
    header( 'Content-Type: image/jpg' );
    readfile( '/images/wherever/you/please/buggerOff.jpg' );
    exit();

?>

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux