|
|
PHP-Quelltext |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
<html>
<head>
<title>Upload</title>
</head>
<body>
<?
if($action){
// --------------------------------
// Diverse Variablen
// --------------------------------
$path = "images/typen/"; // Url zum Speicherordner der großen Bilder
$thumb_path = "images/typen/thumb/"; // Url zum Speicherordner der Vorschaubilder
$config_width = "320"; // Bildbreite max. bei großem Bild
$config_height = "240"; // Bildhöhe max. bei großem Bild
$config_thumb_width = "80"; // Bildbreite max. bei Vorschaubild
$config_thumb_height = "60"; // Bildhöhe max. bei Vorschaubild
$resizequality = "70"; // Bildkompressionsrate 0-100
$deindomain = "http://www.maxrev.de/"; // unsere Domain
if ($HTTP_POST_FILES['userfile']['tmp_name']<> 'none')
{
// --------------------------------
// Get File Upload Info
// --------------------------------
$filename = $HTTP_POST_FILES['pic_file']['name'];
$filetype = $HTTP_POST_FILES['pic_file']['type'];
$filetmp = $HTTP_POST_FILES['pic_file']['tmp_name'];
// --------------------------------
// Check file type
// --------------------------------
switch ($filetype)
{
case 'image/jpeg':
case 'image/jpg':
case 'image/pjpeg':
$pic_filetype = '.jpg';
break;
case 'image/png':
case 'image/x-png':
$pic_filetype = '.png';
break;
case 'image/gif':
$pic_filetype = '.gif';
break;
default:
die("Falsches Dateiformat. Nur JPEG, GIF oder PNG erlaubt!");
}
// --------------------------------
// Generate filename
// --------------------------------
srand((double)microtime()*1000000); // for older than version 4.2.0 of PHP
do
{
$pic_filename = md5(uniqid(rand())) . $pic_filetype;
}
while( file_exists($path . $pic_filename) );
// --------------------------------
// Move this file to upload directory
// --------------------------------
$ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
if ( @$ini_val('open_basedir') != '' )
{
if ( @phpversion() < '4.0.3' )
{
die("open_basedir is set and your PHP version does not allow move_uploaded_file<br /><br />Please contact your server admin");
}
$move_file = 'move_uploaded_file';
}
else
{
$move_file = 'copy';
}
$move_file($filetmp, $path . $pic_filename);
@chmod($path . $pic_filename, 0777);
// --------------------------------
// Well, it's an image. Check its image size
// --------------------------------
$pic_size = getimagesize($path . $pic_filename);
$pic_width = $pic_size[0];
$pic_height = $pic_size[1];
// --------------------------------
// This image is okay, we can cache its thumbnail now
// --------------------------------
if($pic_filetype != '.gif')
{
$gd_errored = FALSE;
switch ($pic_filetype)
{
case '.jpg':
$read_function = 'imagecreatefromjpeg';
break;
case '.png':
$read_function = 'imagecreatefrompng';
break;
}
$src = @$read_function($path . $pic_filename);
if (!$src)
{
$gd_errored = TRUE;
$pic_thumbnail = '';
}
else if( ($pic_width > $config_thumb_width) or ($pic_height > $config_thumb_height) )
{
// Resize it
if ($pic_width > $pic_height)
{
$thumbnail_width = $config_thumb_width;
$thumbnail_height = $config_thumb_width * ($pic_height/$pic_width);
}
else
{
$thumbnail_height = $config_thumb_height;
$thumbnail_width = $config_thumb_height * ($pic_width/$pic_height);
}
$thumbnail = @imagecreatetruecolor($thumbnail_width, $thumbnail_height);
$resize_function = 'imagecopyresampled';
@$resize_function($thumbnail, $src, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $pic_width, $pic_height);
}
else
{
$thumbnail = $src;
}
if (!$gd_errored)
{
$pic_thumbnail = $pic_filename;
// Write to disk
switch ($pic_filetype)
{
case '.jpg':
@imagejpeg($thumbnail, $thumb_path . $pic_thumbnail, $resizequality);
break;
case '.png':
@imagepng($thumbnail, $thumb_path . $pic_thumbnail);
break;
}
@chmod($thumb_path . $pic_thumbnail, 0777);
} // End IF $gd_errored
} // End Thumbnail Cache
// --------------------------------------
// OK lets resize the original picture
// --------------------------------------
if($pic_filetype != '.gif')
{
$gd_errored = FALSE;
switch ($pic_filetype)
{
case '.jpg':
$read_function = 'imagecreatefromjpeg';
break;
case '.png':
$read_function = 'imagecreatefrompng';
break;
}
$src = @$read_function($path . $pic_filename);
if (!$src)
{
$gd_errored = TRUE;
$pic_resize = '';
}
else if( ($pic_width > $config_width) or ($pic_height > $config_height) )
{
// Resize it
if ( (($pic_width / $pic_height) > ($config_width / $config_height)) )
{
$resize_width = $config_width;
$resize_height = $config_width * ($pic_height/$pic_width);
}
else
{
$resize_height = $config_height;
$resize_width = $config_height * ($pic_width/$pic_height);
}
$resize = @imagecreatetruecolor($resize_width, $resize_height);
$resize_function = 'imagecopyresampled';
@$resize_function($resize, $src, 0, 0, 0, 0, $resize_width, $resize_height, $pic_width, $pic_height);
}
else
{
$resize = $src;
}
if (!$gd_errored)
{
$pic_resize = $pic_filename;
// Write to disk
switch ($pic_filetype)
{
case '.jpg':
@imagejpeg($resize, $path . $pic_resize, $resizequality);
break;
case '.png':
@imagepng($resize, $path . $pic_resize);
break;
}
@chmod($path . $pic_resize, 0777);
} // End IF $gd_errored
} // End Picture Resize
echo "Datei ist auf dem Server! <br><br>";
echo "Url des großen Bildes: <a href=\"$deindomain$path$pic_filename\" target=\"_blank\">".$deindomain.$path.$pic_filename;
echo "</a> <br><img src=\"$deindomain$path$pic_filename\"><br><br>";
echo "Url des Vorschaubildes: <a href=\"$deindomain$thumb_path$pic_filename\" target=\"_blank\">".$deindomain.$thumb_path.$pic_filename;
echo "</a> <br><img src=\"$deindomain$thumb_path$pic_filename\">";
}
} else { ?>
<form method="post" enctype="multipart/form-data" action="<?php echo $PHP_SELF ?>">
<input type="hidden" name="MAX_FILE_SIZE" value="4000000">
<br>
<strong>File Upload</strong> <br>
<br>
<input name="pic_file" type="file" size=40>
<br>
<br>
<input type="submit" name="action" value="Speichern">
</form>
<?
}
// -----------------------------------------
// Das Script kann unter Verwendung
// dieses Vermerks uneingeschränkt
// genutzt / verändert werden.
// © www.marc-gutt.de
// -----------------------------------------
?>
</body>
</html>
|
|
|
PHP-Quelltext |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
<html>
<head>
<title>Upload</title>
</head>
<body>
<?
if(isset($_GET['action']) == 'upload') {
// --------------------------------
// Diverse Variablen
// --------------------------------
$path = "images/typen/"; // Url zum Speicherordner der großen Bilder
$thumb_path = "images/typen/thumb/"; // Url zum Speicherordner der Vorschaubilder
$config_width = "320"; // Bildbreite max. bei großem Bild
$config_height = "240"; // Bildhöhe max. bei großem Bild
$config_thumb_width = "80"; // Bildbreite max. bei Vorschaubild
$config_thumb_height = "60"; // Bildhöhe max. bei Vorschaubild
$resizequality = "70"; // Bildkompressionsrate 0-100
$deindomain = "http://localhost/tutorials/upload/"; // unsere Domain
if ($HTTP_POST_FILES['userfile']['tmp_name']<> 'none')
{
// --------------------------------
// Get File Upload Info
// --------------------------------
$filename = $HTTP_POST_FILES['pic_file']['name'];
$filetype = $HTTP_POST_FILES['pic_file']['type'];
$filetmp = $HTTP_POST_FILES['pic_file']['tmp_name'];
// --------------------------------
// Check file type
// --------------------------------
switch ($filetype)
{
case 'image/jpeg':
case 'image/jpg':
case 'image/pjpeg':
$pic_filetype = '.jpg';
break;
case 'image/png':
case 'image/x-png':
$pic_filetype = '.png';
break;
case 'image/gif':
$pic_filetype = '.gif';
break;
default:
die("Falsches Dateiformat. Nur JPEG, GIF oder PNG erlaubt!");
}
// --------------------------------
// Generate filename
// --------------------------------
srand((double)microtime()*1000000); // for older than version 4.2.0 of PHP
do
{
$pic_filename = md5(uniqid(rand())) . $pic_filetype;
}
while( file_exists($path . $pic_filename) );
// --------------------------------
// Move this file to upload directory
// --------------------------------
$ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
if ( @$ini_val('open_basedir') != '' )
{
if ( @phpversion() < '4.0.3' )
{
die("open_basedir is set and your PHP version does not allow move_uploaded_file<br /><br />Please contact your server admin");
}
$move_file = 'move_uploaded_file';
}
else
{
$move_file = 'copy';
}
$move_file($filetmp, $path . $pic_filename);
@chmod($path . $pic_filename, 0777);
// --------------------------------
// Well, it's an image. Check its image size
// --------------------------------
$pic_size = getimagesize($path . $pic_filename);
$pic_width = $pic_size[0];
$pic_height = $pic_size[1];
// --------------------------------
// This image is okay, we can cache its thumbnail now
// --------------------------------
if($pic_filetype != '.gif')
{
$gd_errored = FALSE;
switch ($pic_filetype)
{
case '.jpg':
$read_function = 'imagecreatefromjpeg';
break;
case '.png':
$read_function = 'imagecreatefrompng';
break;
}
$src = @$read_function($path . $pic_filename);
if (!$src)
{
$gd_errored = TRUE;
$pic_thumbnail = '';
}
else if( ($pic_width > $config_thumb_width) or ($pic_height > $config_thumb_height) )
{
// Resize it
if ($pic_width > $pic_height)
{
$thumbnail_width = $config_thumb_width;
$thumbnail_height = $config_thumb_width * ($pic_height/$pic_width);
}
else
{
$thumbnail_height = $config_thumb_height;
$thumbnail_width = $config_thumb_height * ($pic_width/$pic_height);
}
$thumbnail = @imagecreatetruecolor($thumbnail_width, $thumbnail_height);
$resize_function = 'imagecopyresampled';
@$resize_function($thumbnail, $src, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $pic_width, $pic_height);
}
else
{
$thumbnail = $src;
}
if (!$gd_errored)
{
$pic_thumbnail = $pic_filename;
// Write to disk
switch ($pic_filetype)
{
case '.jpg':
@imagejpeg($thumbnail, $thumb_path . $pic_thumbnail, $resizequality);
break;
case '.png':
@imagepng($thumbnail, $thumb_path . $pic_thumbnail);
break;
}
@chmod($thumb_path . $pic_thumbnail, 0777);
} // End IF $gd_errored
} // End Thumbnail Cache
// --------------------------------------
// OK lets resize the original picture
// --------------------------------------
if($pic_filetype != '.gif')
{
$gd_errored = FALSE;
switch ($pic_filetype)
{
case '.jpg':
$read_function = 'imagecreatefromjpeg';
break;
case '.png':
$read_function = 'imagecreatefrompng';
break;
}
$src = @$read_function($path . $pic_filename);
if (!$src)
{
$gd_errored = TRUE;
$pic_resize = '';
}
else if( ($pic_width > $config_width) or ($pic_height > $config_height) )
{
// Resize it
if ( (($pic_width / $pic_height) > ($config_width / $config_height)) )
{
$resize_width = $config_width;
$resize_height = $config_width * ($pic_height/$pic_width);
}
else
{
$resize_height = $config_height;
$resize_width = $config_height * ($pic_width/$pic_height);
}
$resize = @imagecreatetruecolor($resize_width, $resize_height);
$resize_function = 'imagecopyresampled';
@$resize_function($resize, $src, 0, 0, 0, 0, $resize_width, $resize_height, $pic_width, $pic_height);
}
else
{
$resize = $src;
}
if (!$gd_errored)
{
$pic_resize = $pic_filename;
// Write to disk
switch ($pic_filetype)
{
case '.jpg':
@imagejpeg($resize, $path . $pic_resize, $resizequality);
break;
case '.png':
@imagepng($resize, $path . $pic_resize);
break;
}
@chmod($path . $pic_resize, 0777);
} // End IF $gd_errored
} // End Picture Resize
echo "Datei ist auf dem Server! <br><br>";
echo "Url des großen Bildes: <a href=\"$deindomain$path$pic_filename\" target=\"_blank\">".$deindomain.$path.$pic_filename;
echo "</a> <br><img src=\"$deindomain$path$pic_filename\"><br><br>";
echo "Url des Vorschaubildes: <a href=\"$deindomain$thumb_path$pic_filename\" target=\"_blank\">".$deindomain.$thumb_path.$pic_filename;
echo "</a> <br><img src=\"$deindomain$thumb_path$pic_filename\">";
}
} else { ?>
<form method="post" enctype="multipart/form-data" action="?action=upload">
<input type="hidden" name="MAX_FILE_SIZE" value="4000000">
<br>
<strong>File Upload</strong> <br>
<br>
<input name="pic_file" type="file" size=40>
<br>
<br>
<input type="submit" name="action" value="Speichern">
</form>
<?
}
// -----------------------------------------
// Das Script kann unter Verwendung
// dieses Vermerks uneingeschränkt
// genutzt / verändert werden.
// © www.marc-gutt.de
// -----------------------------------------
?>
</body>
</html>
|
|
|
PHP-Quelltext |
1 |
SELECT korn__cola FROM tablett WHERE anzahl__pro__kopf = random__zahl / anzahl__kumpels LIMIT 28
|
Benutzer die sich bedankten:
H1&Bigmisse (04.02.2010)
|
|
PHP-Quelltext |
1 |
Falsches Dateiformat. Nur JPEG, GIF oder PNG erlaubt!
|
|
|
PHP-Quelltext |
1 |
SELECT korn__cola FROM tablett WHERE anzahl__pro__kopf = random__zahl / anzahl__kumpels LIMIT 28
|
|
|
PHP-Quelltext |
1 |
SELECT korn__cola FROM tablett WHERE anzahl__pro__kopf = random__zahl / anzahl__kumpels LIMIT 28
|
Benutzer die sich bedankten:
H1&Bigmisse (04.02.2010)
|
|
PHP-Quelltext |
1 |
SELECT korn__cola FROM tablett WHERE anzahl__pro__kopf = random__zahl / anzahl__kumpels LIMIT 28
|
Benutzer die sich bedankten:
H1&Bigmisse (04.02.2010)
|
|
PHP-Quelltext |
1 |
SELECT korn__cola FROM tablett WHERE anzahl__pro__kopf = random__zahl / anzahl__kumpels LIMIT 28
|
|
|
PHP-Quelltext |
1 |
SELECT korn__cola FROM tablett WHERE anzahl__pro__kopf = random__zahl / anzahl__kumpels LIMIT 28
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »H1&Bigmisse« (4. Februar 2010, 16:59)
|
|
PHP-Quelltext |
1 |
SELECT korn__cola FROM tablett WHERE anzahl__pro__kopf = random__zahl / anzahl__kumpels LIMIT 28
|
|
|
PHP-Quelltext |
1 |
SELECT korn__cola FROM tablett WHERE anzahl__pro__kopf = random__zahl / anzahl__kumpels LIMIT 28
|
Dass ist auf ein Webspasce
Die hast du geändert in
$deindomain = "http://localhost/tutorials/upload/";
|
|
PHP-Quelltext |
1 2 3 4 5 6 7 8 9 10 11 12 |
// --------------------------------
// Diverse Variablen
// --------------------------------
$path = "images/typen/"; // Url zum Speicherordner der großen Bilder
$thumb_path = "images/typen/thumb/"; // Url zum Speicherordner der Vorschaubilder
$config_width = "320"; // Bildbreite max. bei großem Bild
$config_height = "240"; // Bildhöhe max. bei großem Bild
$config_thumb_width = "80"; // Bildbreite max. bei Vorschaubild
$config_thumb_height = "60"; // Bildhöhe max. bei Vorschaubild
$resizequality = "70"; // Bildkompressionsrate 0-100
$deindomain = "http://www.maxrev.de/"; // unsere Domain
|
|
|
PHP-Quelltext |
1 |
SELECT korn__cola FROM tablett WHERE anzahl__pro__kopf = random__zahl / anzahl__kumpels LIMIT 28
|