All pastes #359482 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-02-16 21:27 UTC
rendered paste body
<?

if(empty($edit)){
	$fp5 = opendir('.');
	while (false !== ($file = readdir($fp5))) {
       echo "<a href='".$PHP_SELF."?edit=$file'>$file</a><br>";
   }
} else {
	$fp4 = fopen("$edit","a+"); //w+ istllet fr a
	fclose($fp4);

	$fp = fopen("$edit","a+"); //w+ istllet fr a
	//$code = fgets($fp);
	if(isset($_POST['new_code']) and $spara == "ja"){
		$fp6 = fopen("$edit","w+"); //w+ istllet fr a
		fwrite($fp6, $new_code);
		$spara="nej";
		//header("Location: index.php?sida=admin&edit=$edit");
	}
	fclose($fp);
?>
<table width="2865" border="0">
  <tr>
    <td align="right" valign="top"><form method="post" action="<?=$PHP_SELF ?>?sida=admin&edit=<?=$edit ?>&spara=ja">
<textarea name="new_code" cols="174" rows="30"><?
//cols 47
//rows 29
$fp2 = fopen($edit, "r");
while(!feof($fp2)) {
	$code = fgets($fp2);
	echo $code;
}
fclose($fp2);
?></textarea>
<br>
<input type="submit" name="Spara">
    </form>
</td>
    <td width="1440" valign="top"><?
echo highlight_string($_POST['new_code'], true);
?></td>
  </tr>
</table>

<?
}
?>