WEB Hey webmaster crew! v.postcoolshit

Discussion in 'OT Technology' started by m3s3lf, Feb 22, 2007.

  1. m3s3lf

    m3s3lf *Jeep Crew*

    Joined:
    Oct 4, 2001
    Messages:
    5,460
    Likes Received:
    0
    Location:
    Sacramento, CA
    I just signed up for this deal that Jesse posted and thought I'd share some of the scripts and shit I'm hosting. What do you guys have on your space? Post your uploaders, download limiters, or whatever else ya got!
     
  2. m3s3lf

    m3s3lf *Jeep Crew*

    Joined:
    Oct 4, 2001
    Messages:
    5,460
    Likes Received:
    0
    Location:
    Sacramento, CA
    Here's a very simple notes script I wrote so I could quickly and easily share info between computers (without emailing myself)...
    Demo can be seen here: www.slicky.net/ot/notes username is ot, pass is test

    Save the code below as index.php and put it in a directory called 'notes' along with a file called 'notes.txt'. CHMOD 'notes.txt' to 777 and browse to www.yourserver.com/notes

    You can password protect it, like I did, though your control panel if ya want.
    PHP:
    <?php
    $filename 
    "notes.txt";
    $filesize filesize($filename);
    if(isset(
    $_POST['save'])) {
    $content stripslashes($_POST['notes']);
    }elseif(isset(
    $_POST['clear'])) {
    $content NULL;
    }else{
    if (
    $filesize '0'){
    $fp fopen($filename"r");
    $content fread($fp$filesize);
    fclose($fp);
    }else{
    $content NULL;
    }
    }

    echo 
    "<form method='post'>";
    echo 
    "<textarea name='notes' style='width: 100%;height: 90%'>$content</textarea>";
    echo 
    "<p><input type='submit' name='save' value='SAVE'>";
    echo 
    "&nbsp; &nbsp; &nbsp; <input type='submit' name='clear' value='CLEAR'>";
    echo 
    "</form>";

    if(isset(
    $_POST['clear'])) {
    $notes NULL;
    $fp fopen($filename"w");
    fwrite($fp$notes);
    fclose($fp);
    }

    if(isset(
    $_POST['save'])) {
    $notes stripslashes($_POST['notes']);
    $fp fopen($filename"w");
    fwrite($fp$notes);
    fclose($fp);
    }
    ?>
     
  3. m3s3lf

    m3s3lf *Jeep Crew*

    Joined:
    Oct 4, 2001
    Messages:
    5,460
    Likes Received:
    0
    Location:
    Sacramento, CA
    I wrote this script to watermark (on the fly) jpg images that are hotlinked from my site. You can set the placement of the watermark by editing 2 lines (near the top) in watermark.php. Then, add a few lines to your .htaccess file and create a watermark. Name the watermark "watermark.png" and put all 3 items in the directory you want to protect.

    Here is watermark.php:
    PHP:
    <?php
    //Set placement of watermark.
    //$horizontal can be left, right, or center. Default is right.
    //$vertical can be top, bottom, or center. Default is bottom.
    $horizontal 'right';
    $vertical 'bottom';

    header('content-type: image/jpeg');
    $watermark imagecreatefrompng('watermark.png');
    $watermark_width imagesx($watermark);
    $watermark_height imagesy($watermark);
    $src $_GET["src"];
    $image imagecreatefromjpeg($src);
    $size getimagesize($src);

    switch (
    $horizontal) {
    case 
    'left':
    $dest_x 5;
    break;
    case 
    'right':
    $dest_x $size[0] - $watermark_width 5;
    break;
    case 
    'center':
    $dest_x = ($size[0] / 2) - ($watermark_width 2);
    break;
    default:
    $dest_x $size[0] - $watermark_width 5;
    }

    switch (
    $vertical) {
    case 
    'top':
    $dest_y 5;
    break;
    case 
    'bottom':
    $dest_y $size[1] - $watermark_height 5;
    break;
    case 
    'center':
    $dest_y = ($size[1] / 2) - ($watermark_height 2);
    break;
    default:
    $dest_y $size[1] - $watermark_height 5;
    }

    imagecopymerge($image$watermark$dest_x$dest_y00$watermark_width$watermark_height100);
    imagejpeg($image);
    imagedestroy($image);
    imagedestroy($watermark);
    ?>

    Here are the lines to add to your .htaccess file (make sure to configure the domain name and path to watermark.php):
    PHP:
    RewriteEngine On
    RewriteCond 
    %{HTTP_REFERER} !^http://(www\.)?yoursite\.com/ [nc]
    RewriteCond %{HTTP_REFERER} !^$
    RewriteRule (.+).jpg http://www.yoursite.com/watermark.php?src=$1.jpg [nc]
    Here is everything in a .zip with a sample watermark:
    http://www.slicky.net/temp/watermark_hotlinked.zip
     
  4. m3s3lf

    m3s3lf *Jeep Crew*

    Joined:
    Oct 4, 2001
    Messages:
    5,460
    Likes Received:
    0
    Location:
    Sacramento, CA
    Of course, CeleronDude's scripts are always popular...
     
  5. m3s3lf

    m3s3lf *Jeep Crew*

    Joined:
    Oct 4, 2001
    Messages:
    5,460
    Likes Received:
    0
    Location:
    Sacramento, CA
    I'm looking for an easy way to publish content...
    I was using some blog software because it made it quick and easy to publish random stuff... but I really don't want it to be in blog format... just individual pages. Anybody have any ideas?
     
  6. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    phpnuke/postnuke/mondo?
     
  7. MrBrotato

    MrBrotato New Member

    Joined:
    Sep 7, 2005
    Messages:
    5,558
    Likes Received:
    0
    I use Wordpress. www.jrclarity.com doesn't look much like a blog, the entire site is wordpress, all the pages and everything.

    The notes and hotlinking scripts are awesome btw. :cool:
     
  8. jdw

    jdw New Member

    Joined:
    Dec 31, 2005
    Messages:
    4,429
    Likes Received:
    0
    Location:
    ND
    I'm gonna have to shove something like this into the backend of my site once I get it together, could come in handy.

    Also going to have to read through that hotlinking one. I've got a script watermarking on the fly for display on the site but desperately need to work on security and hotlinking protection.
     
  9. m3s3lf

    m3s3lf *Jeep Crew*

    Joined:
    Oct 4, 2001
    Messages:
    5,460
    Likes Received:
    0
    Location:
    Sacramento, CA
    Too complicated. All I need is a text box and whatever I enter into it (including html) gets posted to a new page with a given header/style. I could probably just write something myself... but I don't have the time right now.

    Thanks for the response though.
     
  10. m3s3lf

    m3s3lf *Jeep Crew*

    Joined:
    Oct 4, 2001
    Messages:
    5,460
    Likes Received:
    0
    Location:
    Sacramento, CA
    I'll check that out. I didn't realize you could make wordpress look like that.
    Thanks!
     
  11. m3s3lf

    m3s3lf *Jeep Crew*

    Joined:
    Oct 4, 2001
    Messages:
    5,460
    Likes Received:
    0
    Location:
    Sacramento, CA
    .htaccess is extremely powerful. I'm sure there is a way to do it however you want.
     
  12. Penguin Man

    Penguin Man Protect Your Digital Liberties

    Joined:
    Apr 27, 2002
    Messages:
    21,696
    Likes Received:
    0
    Location:
    Edmonton, AB
  13. m3s3lf

    m3s3lf *Jeep Crew*

    Joined:
    Oct 4, 2001
    Messages:
    5,460
    Likes Received:
    0
    Location:
    Sacramento, CA
  14. jdw

    jdw New Member

    Joined:
    Dec 31, 2005
    Messages:
    4,429
    Likes Received:
    0
    Location:
    ND
    I've gathered as much in the little bit of time I spent working with it. IIRC the issue I was running into is I only wanted to prevent hotlinking on one of my domains (my photography business) but wanted to allow it on my personal side (for putting stuff on here). Wasn't important enough at the time for me to find a solution so I left it as it was.
     
  15. m3s3lf

    m3s3lf *Jeep Crew*

    Joined:
    Oct 4, 2001
    Messages:
    5,460
    Likes Received:
    0
    Location:
    Sacramento, CA
    Oh, that's easy. .htaccess only effects files that reside in the same directory as it or subdirectories of it... so if your stuff is hosted on the same server, just don't put the .htaccess file in the root directory.
     
  16. jdw

    jdw New Member

    Joined:
    Dec 31, 2005
    Messages:
    4,429
    Likes Received:
    0
    Location:
    ND
    That's what I was trying to do actually but was running into an issue. It worked fine (but across all files) if I placed it in the root but if I placed it in the directory for the specific site it wouldn't work. And I actually was thinking I read that it had to be in the root...

    I'll be re-building the business site in the near future and will have to dig through that again and get it set up. My 'security' knowledge is slim to none right now.
     
  17. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0

Share This Page