Results 1 to 1 of 1

Thread: Static Javascript PHP

  1. #1
    codename_B's Avatar
    codename_B is offline PHP Coder
    Join Date
    Jan 2011
    Posts
    106
    Thanks
    9
    Thanked 14 Times in 11 Posts

    InPutOutPut - no more hosting static javascript!

    It's basically a php script that allows you to convert your static javascript into an "url".

    This removes the need for having a directory where you host your scripts and allows you to just link to this one file, making things far simpler.

    HOW TO USE:

    • Place ipop.php into the base directory of your site.
    • Go to yoursite.com/ipop.php
    • Open your static javascript in a text editor.
    • CTRL A then CTRL C the whole script.
    • Enter ? after ipop.php then paste the script and hit enter.
    • If all goes well you should be presented with two options, to copy the link to the javascript or a textbox containing the script tags already made up for you to copy/paste into your html.

    Hope you all enjoy my script

    PHP Code:
    <?php
    /*******************************************************************
    Details
    * Author: codename_B
    * Date:    13/01/2011
    * Name:    InPutOutPut
    * Version: 0.8
    * Description: Allows dynamic creation of javascripts from files without having to upload new scripts to the server. Allows for a cleaner folder structure and not having to store javascripts.
    ******************************************************************/
    //Tests to see if we are encoding or decoding a string
    if ($_GET["base"] == "1")
    {
    //Accesses the string, removes the &base=1, decodes it, then outputs it.
    $fullstring $_SERVER['QUERY_STRING'];
    $url preg_replace('/&base=1/i','',$fullstring);
    $rawurl base64_decode($url);
    $baseurl rawurldecode($rawurl);
    echo 
    $baseurl;
    }
    else
    {
    //Accesses everything after the ? and encodes it into a base64 string for decoding.
    $url $_SERVER['QUERY_STRING'];
    $rawurl $url;
    $baseurl base64_encode($rawurl);
    echo 
    "<div style='background-color: SkyBlue; padding: 5px; width: 200px;'><a href='./ipop.php?".$baseurl."&base=1'>Right Click Copy Location</a></div>";
    echo 
    "<br><div style='background-color: SkyBlue; padding: 5px; width: 200px;'><textarea onclick='this.select();'><script src='./ipop.php?".$baseurl."&base=1'></script></textarea>";
    echo 
    "<br>InPutOutPut by codename_B</div>";
    }
    ?>
    New version that provides an automatic redirect to the &base=1 section of the script removing the copy/paste textbox and that whole general page.

    Absolutely no html generated by this script now. You can now just visit ipop.php and remove the &base=1 and paste your script and let it do it's magic.

    Also with this you automatically view your decoded script once you've input it.

    Hope that it's useful to people

    PHP Code:
    <?php
    /*******************************************************************
    Details
    * Author: codename_B
    * Date:    13/01/2011
    * Name:    InPutOutPut
    * Version: 0.9
    * Description: Allows dynamic creation of javascripts from files without having to upload new scripts to the server. Allows for a cleaner folder structure and not having to store javascripts.
    ******************************************************************/
    //Tests to see if we are encoding or decoding a string
    if ($_GET["base"] == "1")
    {
    //Accesses the string, removes the &base=1, decodes it, then outputs it.
    $fullstring $_SERVER['QUERY_STRING'];
    $url preg_replace('/&base=1/i','',$fullstring);
    $rawurl base64_decode($url);
    $baseurl rawurldecode($rawurl);
    echo 
    $baseurl;
    }
    else
    {
    //Accesses everything after the ? and encodes it into a base64 string for decoding.
    $url $_SERVER['QUERY_STRING'];
    $rawurl $url;
    $baseurl base64_encode($rawurl);
    header'Location: /ipop.php?'.$baseurl.'&base=1' ) ;
    }
    ?>
    Last edited by codename_B; 13 January, 2011 at 19:57 PM. Reason: Changed Title
    http://find-new-proxies.com Auto Approval Proxy List
    http://uf6.info Free Text File Hosting

Similar Threads

  1. Replies: 96
    Last Post: 19 October, 2010, 06:32 AM
  2. Static Pages Mod recommend in many ways to forums
    By StephenM in forum Community Software
    Replies: 4
    Last Post: 27 March, 2010, 18:28 PM
  3. Replies: 4
    Last Post: 10 November, 2009, 02:01 AM
  4. Replies: 6
    Last Post: 19 March, 2009, 00:24 AM
  5. Turning static sites into dynamic
    By DomainMagnate in forum Managing
    Replies: 6
    Last Post: 4 March, 2009, 17:41 PM

Tags for this Thread

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
  •