Web Analytics Made Easy -
StatCounter A Script I Need... BADLY! - CodingForum

Announcement

Collapse
No announcement yet.

A Script I Need... BADLY!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • A Script I Need... BADLY!

    Hi. I've been looking all over for a certain script, but I just can't find it! I've been pulling my ears out, and I can't learn PHP because I'm so busy with work and my life and my running websites (I'm going to teach myself it over the Summer). So, I was wondering if any of the you guys here can help me.

    I'm looking for a certain script that does this. The script will be called URLshower.php for now. So, say I typed in:

    --------------

    httpsample://www.domain.com/URLshower.php?image=/images/something.gif

    or

    httpsample://www.domain.com/URLshower.php?image=/images/something.swf

    (I added the sample part so it wouldn't turn into a link!)
    --------------

    I would like to be able to customize my PHP page for a background and such, with headers, and everything, but with an image or a Flash file to appear in the middle based on the path that is in the URL. It also might be good if I could somehow customize the size of the displayed file in PIXELS, especially when I'm dealing with Flash files. That way a small cartoon flash file might not appear big and blurry. Maybe like:

    httpsample://www.domain.com/URLshower.php?image=/images/something.swf&size=100x300

    I don't know if this would work better with ASP or PHP, because I know both might work, but I just put it in here because I couldn't make up my mind. I'd love any help out there.


    -cazu
    Bionicle: BIOlogical chroNICLE. If anyone knows a script that will change an image everytime you refresh, contact me.

  • #2
    This reply will consist of two parts. 1 part bashing, and 1 part help.

    nah, no bashing, just some pointers.
    1- Per our TOS, try to give us more....descriptive subject lines in the future
    2- You can uncheck the box "Automatically parse URLS" and then they won't become links...


    As for the code help, PHP is perfect for something like that. Given the url:

    http://www.domain.com/URLshower.php?image=/images/something.gif&height=100&width=200


    you could have:
    PHP Code:
    <?php

    $ext 
    pathinfo($_GET["image"]);
    $ext $ext["extension"];
    if (
    $ext == "swf") {
       
    $code "<embed src=";
    } else {
       
    $code "<img src=";
    }

    print 
    "<html>\n";
    print 
    "<head><title></title></head>\n";
    print 
    "<body>\n\n";
    print 
    "<center>\n";
    print 
    $code "\"" $_GET["image"] . "\" height=\"" $_GET["height"] . "\" width=\"" $_GET["width"] . "\" />";
    print 
    "\n</center>\n";
    print 
    "</body></html>";
    ?>
    Obviously, that doesn't completely do what you want, but it should display the proper image or embed the flash file for you... I haven't tested it, so please forgive me for syntax errors.

    HTH,
    -Celt
    Last edited by Celtboy; Feb 9, 2004, 11:59 PM.

    Comment


    • #3
      I wouldn't store the filename etc inside the querystring like that. What would hapen if i manipulate the querystring a bit ? I could probably browse all files of your application.

      It would be safer to just add
      URLshower.php?page=1
      and then look the fileadress and dimensions up in an aray, or a file or a database or hardcode them inside URLshower.php.

      This way, they can stil manipulate the querystring, but only to other files you have included in your collection.
      Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

      Comment

      Working...
      X