All pastes #829565 Raw Edit

Anonymous

public text v1 · immutable
#829565 ·published 2007-12-23 07:53 UTC
rendered paste body
<?php 
if ($_POST['post']) { 
          $rand = randl().randl().randl().randl().randl().randl().randl().randl(); 
          $filename = 'file'.$rand.'.txt'; 
          $somecontent = $_POST['post']; 
          if(touch($filename)) { 
               if (!$handle = fopen($filename, 'w')) { 
                    die("Cannot open file ($filename)"); 
               } else { 
                    if (fwrite($handle, $somecontent) === FALSE) { 
                         die("Cannot write to file ($filename)"); 
                    } else { 
                         header("Location: http://www.applebot.gopzap.com/pastebin/pastebin.php?id=".$rand); 
                         fclose($handle); 
                         unset ($e); 
                    } 
               } 
     } 
} 
?> 
<style type="text/css">  
.num {  
float: left;  
color: gray;  
text-align: right;  
margin-right: 6pt;  
padding-right: 6pt;  
background: #e6e1a7;
}  
</style>  
<?php  
function randl() { 
     $a = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"); 
     $r = rand(0,25); 
     return $a[$r]; 
} 
function highlight_num($file) {  
        echo '<code class="num">', implode(range(1, count(file($file))+1), '<br />'), '</code>';  
	highlight_file(htmlentities($file)); 
       echo "<br><br>";
display_form($file);
}  
function display_form($file) {
echo '<script type="text/javascript">
<!--
function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==\'\'&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?\'block\':\'none\';
  vis.display = (vis.display==\'\'||vis.display==\'block\')?\'none\':\'block\';
}
// -->
</script>
'; 
if ($file!==$NULL) { echo '<center><a href="javascript:toggleLayer(\'box\');" title="Show posting box"> Show posting box </a></center>'; }
 echo '
  <div id="box">
  <form method="post" action="pastebin.php">
  <center>';
	if ($file==$NULL) {
		echo '<textarea class="paste_code" name="post" cols="90" rows="25"></textarea>';
	}else {
echo '<textarea class="paste_code" name="post" cols="90" rows="25">'.htmlspecialchars(file_get_contents($file)).'</textarea>';
	}
echo '<br />
    <br />
 <input type=\'submit\' value=\'Paste it\'></center>
</form>';
}

if ($_GET[id]) { 
if ($rand) { $file = 'file'.$rand.'.txt'; unset ($rand); }
    else { $file = 'file'.$_GET[id].'.txt'; }
     if ($file) { 
          highlight_num($file);  
     } 
     else { 
          die("FILE DOESNT EXIST"); 
     } 
} 
else { 
display_form($NULL);
} 
?>