All pastes #559703 Raw Edit

Someone

public text v1 · immutable
·published 2007-06-11 21:17 UTC
rendered paste body
<?php

	/**
	* Clean Posts To Prevent Attacks
	*/
	function PostClean($String, $nlbr = false) {
		if (get_magic_quotes_gpc()) {
			$String = stripslashes($String);
		}
		if ($nlbr) {
			$String = nl2br($String);
		}
		return htmlspecialchars($String);
	}

	/*
	* Validate Post Variables
	*/
	$User = PostClean(trim($_POST['user']));
	$Project = PostClean(trim($_POST['project']));
	$Title = PostClean(trim($_POST['title']));
	$FileType = PostClean(trim($_POST['filetype']));
	$EscapedCode = PostClean(trim($_POST['code']));
	
	echo $User;
	exit;

	/*
	* Create/Overwrite File
	*/
	$string = "users/" . $User . "/" . $Project . "/" . $Title "." . $FileType;
	$File = fopen(, "w") or die("Can't create file.");
	$Code = htmlspecialchars_decode($EscapedCode);
	$WriteFile = fwrite($File, $Code);
	$CloseFile = fclose($File);

?>