All pastes #250352 Raw Edit

Someone

public text v1 · immutable
#250352 ·published 2006-11-16 21:49 UTC
rendered paste body
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
  	  	
	  	<title>Test Page of Death</title>
  		
		<?php
		include $_SERVER['DOCUMENT_ROOT'] . '/classes/will/sunshine.php';
					
		?>	
		  		
  	</head>

<body style="font-family: Verdana, sans-serif; background: #222;">

	<div class="main_container" style="padding: 30px; text-align: center; height: 500px; width: 690px; border: 3px dashed #06f; background: #0cf; margin: 100px auto;">
		<form method="post" action="test.php">
			<input type="text" name="text" />
			<input type="text" name="asdf" />
			<input type="submit" name="submit" />
		</form>
		
		<?php
		
			if ($_POST['submit']){
				$asdf = super_sunshine($_POST);
				
				echo $asdf;
			}
							
		?>
		
	</div>

  
</body>
</html>




<!-- HERE'S THE SCRIPT ITSELF -->

<?php

# Codename "Sunshine" #
# Written by WP       #
# Most likely heavily REwritten by DT #
# 06.13.06            #

function sunshine($string, $pattern = '[a-z0-9 ]'){
	$trimmed = trim($string);
	
	if (@!preg_match('/^' . $pattern . '+$/i', $trimmed)){
		return 'Invalid Data Type';
	}
	
	return true;	
}

function super_sunshine($array, $pattern = '[a-z0-9 ]'){
	
	foreach($array as $value){
		
		$trimmed = trim($value);
		
		if (!preg_match('/^' . $pattern . '+$/i', $trimmed)){
			return 'Invalid Data Type';
		}
		
		return true;
		
		
	}
}
	

?>