All pastes #200382 Raw Edit

Something

public php v1 · immutable
#200382 ·published 2006-10-13 03:31 UTC
rendered paste body
<?php//require ('users/login.php');//Variables, change these ONLY if you know what they do.$ext_suffix_limit = array(".jpg",".jpeg",".gif",".psd",".png");$q_size_limit = "yes";$size_limit = "200000";$dir_mask = "http://odstrecon.com/area51/upload_user/img/";$dir_absolute = "/home/halo2gli/public_html/odstrecon/area51/upload_user/img/";$home = "index.php";	//If the action is not set, then do not do anything.	if ( !isset ($action) ) {		$action = "";	}	//Define the action[s]	switch ( $_GET['action'] ) {		default: print "<a href=\"{$PHP_SELF}?action=upload\">Upload</a><br />						<a href=\"{$PHP_SELF}?action=download\">Download</a><br />";		break;		case 'download': print "<a href=\"{$PHP_SELF}?action=upload\">Upload</a><br />								<a href=\"{$home}\">Back</a><br /><br /><hr width=\"30\" align=\"left\" /><br />";		//Loop to show download links			$dir = opendir($dir_absolute);				while ( $file = readdir ($dir) ) {					if ( ($file != "..") and ($file != ".") ) {					$list .= "<a href=\"{$dir_mask}/{$file}\">{$file}</a><br />";					}				}						print $list;		break;		case 'upload': print"<a href=\"{$PHP_SELF}?action=download\">Download</a><br />							<a href=\"{$home}\">Back</a>";					//The upload form					print "<form method=\"post\" action=\"{$PHP_SELF}?action=doupload\">								<p>Upload file:<br />								<input type=\"file\" name=\"file\" size=\"20\" /></p>								<p><button name=\"submit\" type=\"submit\">									Upload								</button></p>							</form>";		break;		case 'doupload': $dir = "dir";							//If the file has a name....then [statement]							if ( $file != "" ) {								if ( file_exists ( "{$dir_absolute}/{$file_name}" ) ) {									die ("File already exists, please rename.");								}								if ( ( $q_size_limit == "yes" ) && ( $file_size > $size_limit ) ) {									die ("File exceeds the upload size limit. It's got to be equal to, or less than {$size_limit}.");								}								$extension = strrchr ($file_name,'.');								if ( !in_array ( $extension,$ext_suffix_limit ) ) {									die ("You can't upload that file, it has an invalid extension.");								}																copy ( $file, "{$dir_absolute}/{$file_name}") or die ("Upload has failed to copy completely on the server. Please contact an admin about this, or change the file name and try again.");							} else {								die ("Select a file to upload.");							}												print "{$file_name} was uploaded successfully. <br />							<a href=\"{$PHP_SELF}?action=upload\">Upload</a><br />							<a href=\"{$home}\">Back</a>";		break;	}?>