Hi kennt ihr ein programm mitdem mann den php code optimieren kann`?
Oder wisst ihr vieleicht so wie man den code besser machen könnte?
Oder wisst ihr vieleicht so wie man den code besser machen könnte?
PHP Code:
<?php
ob_start("ob_gzhandler");
$admin_username = ("123"); ## Username for the admin-area ##
$admin_password = ("123"); ## Password for the admin-area ##
$maxfilesize = ("200000"); ## Max filesize in bytes ##
$uploadpath = ("files"); ## Path for the files ##
$title = ("File Uploader"); ## Title for the page ##
$name = ("xxx"); ## Your name for the searchmachine ##
$stylesheet = ("main.css"); ## Stylesheet ##
$bgcolor = ("#FFFFFF"); ## Background color ##
$textcolor = ("#636563"); ## Text color ##
$linkcolor = ("#004DA5"); ## Link color ##
$vlinkcolor = ("#006DDE"); ## Hover link color ##
$alinkcolor = ("#006DDE"); ## Active link color ##
DEFINE ("EXTENSION", "(bmp|jpg|jpeg|gif|png|tga|swf|exe|zip|rar|ace|txt|cfg|mp3)");
$maxsize = ($maxfilesize / 1024);
$header = ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n \"http://www.w3.org/TR/html4/transitional.dtd\">\n<html><head><title>$title</title><meta name=author content=\"$name\"><link href=$stylesheet rel=stylesheet type=\"text/css\"><meta http-EQUIV=pragma content=\"private, no-cache\"><meta http-equiv=expires content=0></head><body bgcolor=\"$bgcolor\" text=\"$textcolor\" link=\"$linkcolor\" vlink=\"$vlinkcolor\" alink=\"$alinkcolor\">");
$mainbody = ("<b>Maxfilesize: </b> $maxsize kb<br><b>Extensions: </b>bmp, jpg, jpeg, gif, png, tga, swf, exe, zip, rar, ace, txt, cfg, mp3<form action=\"$PHP_SELF\" method=POST enctype=\"multipart/form-data\"><input type=hidden name=\"MAX_FILE_SIZE\" value=\"$maxfilesize\"><br><b>Upload:</b><br><input name=\"userfile[]\" type=file size=20 ><br><p><input type=submit name=upload value=Upload></p><b>A list of previously uploaded files can be found <a href=\"$PHP_SELF?files=1\">HERE</a></b><p><b><a href=\"$PHP_SELF?admin=1\">ADMIN-AREA</a></b></p></form>");
$footer = ("</body></html>\n<!-- GaLLo's file uploader -->\n<!-- [email][/email] -->");
$banned_ip = array();
$banned_ip[] = '1.1.1.1'; ## Banned IP 1 ##
$banned_ip[] = '2.2.2.2'; ## Banned IP 2 ##
foreach($banned_ip as $banned) {$ip = $_SERVER['REMOTE_ADDR'];
if($ip == $banned){
print("$header");
print("<b><p align=center>YOU HAVE BEEN BANNED!<b><p>");
exit("$footer");}}
if(($delete == 1)){
unlink("$del");
print("$header");
print("<b>$del</b> was deleted</p>");
exit("$footer");}
if(($files == 1)){
print("$header");
print("<a href=$PHP_SELF>Upload</a><hr color=#000000 size=0>");
include("files.txt");
exit("$footer");}
if(($admin == 1)){
if(isset($username) && isset($password)) {
if ($username == $admin_username && $password == $admin_password) {
print("$header");
print("<a href=\"$PHP_SELF\">Upload</a><hr color=#000000 size=0><iframe height=20 width=400 name=delete scrolling=no src=about:blank marginwidth=1 marginheight=0 align=center border=0 frameborder=0></iframe><script language=JavaScript>function allowDelete() {return window.confirm(\"DELETE THE FILE?\")}</script>");
include("files_admin.txt");
exit("$footer");}
else{
print("$header");
print("<b><p align=center>ACCESS DENIED!<p></b>");
exit("$footer");}}
print("$header");
print("<form action=\"$PHP_SELF?admin=1\" method=post enctype=\"multipart/form-data\"><div align=center><center><table width=222><tr><td width=160><b><font face=Verdana size=1>Username:</font></b></td><td width=150><input type=text name=username size=20></td></tr><tr><td width=160><b><font face=Verdana size=1>Password:</font></b></td><td width=150><font face=Verdana><b><input type=password name=password size=20></b></font></td></tr><tr><td width=314 colspan=2><p align=center><input type=submit value=Login></p></td></tr></table></center></div></form>");
exit("$footer");}
print("$header");
print("$mainbody");
print("$footer");
function load($admin) {
$uploadpath = ("files"); ## Active link color #
for ($i = 0; $i < 1 ;$i++) {
$target = $_FILES['userfile']['name'][$i];
$size = $_FILES['userfile']['size'][$i];
if (eregi(EXTENSION . "$", $_FILES['userfile']['name'][$i])) {
srand ((double)microtime() * 1000000);
$randval = rand(1, 1000000);
if (file_exists($_FILES['userfile']['name'][$i])) {$target = $randval . '.' . $target;}
if(!is_dir($uploadpath)){mkdir("$uploadpath",0777);}
if (copy($_FILES['userfile']['tmp_name'][$i], "$uploadpath/$target")) {
$date = date("D, d M Y, H:i:s");
$getIP = getenv("HTTP_X_FORWARDED_FOR");
$Public = "<div><table width=689 height=16><tr><td width=355 height=12><b><font size=2><a href=\"$target\">$target</a> </font></b></td><td width=389 height=12><b><font size=2>Date: $date</font></b></td><td width=241 height=12><font size=2><b>Size: $size bytes</b></font></td></tr></table></div>";
$Admin = "<div><table width=849 height=20><tr><td width=193><font><b><a target=_self href=\"$target\">$target</a></b></font></td><td width=178><b><font size=2>IP: <a href=http://www.ripe.net/perl/whois?form_type=full_query_string=&searchtext=$getIP>$getIP</a></font></b></td> <td width=273><b><font size=2>Date: $date</font></b></td><td width=161><font size=2><b>Size: $size bytes</b></font></td><td width=69><b><font size=2><a target=delete href=\"$PHP_SELF?delete=1&del=$target\" onClick='return allowDelete()'>DELETE</a></font></b></td></tr></table></div>";
$post_data = "files.txt";
$data = fopen($post_data, "a");
fwrite($data, "$Public");
fclose($data);
$post_data = "files_admin.txt";
$data = fopen($post_data, "a");
fwrite($data, "$Admin");
fclose($data);
exit("<p><b><font size=1>Your file was successfully uploaded and can be found <a href=\"$target\">HERE</a></font></b></p>");}
else{
$error = $_FILES['userfile']['error'][$i];
switch ($error) {
case 1: $upload_info = "<b>Sorry the max file size is to great.</b> ";
break;
case 2: $upload_info = "<b>Sorry the max file size is to great.</b> ";}
print("$upload_info");
exit("<b>Your file was not uploaded!</b>");}}}}
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {if (isset($_POST['upload'])) {load($admin);} else load($admin);}
exit;
?>
Comment