index.php
Kód:
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<table align="center" border="0" bordercolor="#cccccc" cellpadding="5" width="760">
<tbody>
<tr>
<td valign="top">
<form method="post" enctype="multipart/form-data" action="upload.php"><div align="center"><label><input name="radiobutton" type="hidden" value="radiobutton" checked></label><input name="userfile" type="file" size="30" value="Vyber"><br><br><input name="upload" type="submit" value="Upload"></div></form>
<input name="MAX_FILE_SIZE" value="3145728" type="hidden"><input name="refer" value="" type="hidden"><input name="brand" value="" type="hidden">
</td>
</tr>
</tbody>
</table>
</body>
</html>
upload.phpKód:
<html>
<body>
<?php $domain = "http://www"; $max_size = 153600000000000000000000000000000000000; $max_size_mb = "1,5"; $tsize = "300"; $path = "images/"; $tpath = "thumbs/"; if (!isset($HTTP_POST_FILES['userfile'])) exit; if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) { if ($HTTP_POST_FILES['userfile']['size']>$max_size) { echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">File Size too Big!</font><br>\n"; exit; } if (($HTTP_POST_FILES['userfile']['type']=="image/gif") || ($HTTP_POST_FILES['userfile']['type']=="image/pjpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/jpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/png")) { if (file_exists("./".$path . $HTTP_POST_FILES['userfile']['name'])) { echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">A File with that name exists, please rename your file.</font><br>\n"; exit; } $zufall = rand(123,999999); $fupl = "$zufall"; $res = copy($HTTP_POST_FILES['userfile']['tmp_name'], "./".$path .$fupl .$HTTP_POST_FILES['userfile']['name']); if (!$res) { echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">Upload Failed, please try again</font><br>\n"; exit; } else { $domst = ""; $drecks = "/"; $imgf = $fupl.$HTTP_POST_FILES['userfile']['name']; $thbf = $tpath.$imgf; $urlf = $domst .$domain .$drecks .$path .$imgf; function createthumb($name,$filename,$new_w,$new_h) { $system=explode('.',$name); if (preg_match('/jpg|jpeg|JPG/',$system[1])) { $src_img=imagecreatefromjpeg($name); } if (preg_match('/png|PNG/',$system[1])) { $src_img=imagecreatefrompng($name); } if (preg_match('/gif|GIF/',$system[1])) { $src_img=imagecreatefromgif($name); } $old_x=imageSX($src_img); $old_y=imageSY($src_img); if ($old_x > $old_y) { $thumb_w=$new_w; $thumb_h=$old_y*($new_h/$old_x); } if ($old_x < $old_y) { $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } if ($old_x == $old_y) { $thumb_w=$new_w; $thumb_h=$new_h; } $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); if (preg_match("/png/",$system[1])) { imagepng($dst_img,$filename); } if (preg_match("/gif/",$system[1])) { imagegif($dst_img,$filename); } else { imagejpeg($dst_img,$filename); } imagedestroy($dst_img); imagedestroy($src_img); } createthumb($path.$imgf,$tpath.$imgf,$tsize,$tsize); } } else { echo "Sorry we dont allow that file type.\n"; exit; } } ?>
<body>
<center>
<table border='0' bgcolor='white'>
<FORM action="nowhere" method="post">
<center>
<tr>
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="760">
<tbody>
<tr>
<td>
<p><a href="<? echo $domain; ?>"><b>Upload</b></a> another image.</p>
<br>
<center><img src='<? echo $thbf ?>' border="0"></center>
<br>
<br>
<input name="thetext" type="text" id="thetext" style="width: 500px;" value="[url=<? echo $urlf; ?>][img]<? echo $domst.$domain.$drecks.$tpath.$imgf; ?>[/img][/url]" size="70"> Thumbnail for forums
<br>
<input name="thetext" type="text" id="thetext" style="width: 500px;" value="[url=http://localhost][img]<? echo $urlf; ?>[/img][/url]" size="70"> Hotlink for forums
<br>
<input name="thetext" type="text" id="thetext" style="width: 500px;" value="<? echo $urlf; ?>" size="70"> Direct link to image
</td>
</tr>
</tbody>
</table>
</body>
</html>
</tr>
</table>
</body>
</html>