Файловый менеджер - Редактировать - /home/umudio/public_html/repo/uploadpicnews.php.tar
Назад
home/umudio/public_html/OLD/uploadpicnews.php 0000644 00000026644 14773626450 0015336 0 ustar 00 <?php if(isset($_POST['addnews'])){ $path="picfornews/temp"; $final="picfornews"; $photo=""; $newfilename=1; $handle=@opendir($final); if(!empty($handle)){ while(false!==($file=readdir($handle))){ if(is_file($final . "/" . $file)){ $newfilename++; } } } //closedir($handle); $snn=mysql_insert_id(); include('SimpleImage.php'); $image = new SimpleImage(); //First Picture $input_name="uploader1"; if(isset($_FILES)){ if(is_uploaded_file($_FILES[$input_name]["tmp_name"])){ $maxfilesize=30720000; if($_FILES[$input_name]["size"]>$maxfilesize){ $bb=$bb . " <br>Your picture1 is too large, it cannot be uploaded! It should be below 300kb. "; } else { $file_name=$_FILES[$input_name]["name"]; $ext=(substr($file_name,(strlen($file_name)-3))); $new=$path . "/g" . $newfilename . ".jpg"; if ($ext=="jpg" || $ext=="JPG" || $ext=="peg" || $ext=="PEG"){ move_uploaded_file($_FILES[$input_name]["tmp_name"],$path . "/" . $file_name); rename ($path . "/" . $file_name, $new); copy ($new, $final . "/g" . $newfilename . ".jpg"); unlink ($new); $photo="picfornews/g" . $newfilename . ".jpg"; $image->load($photo); $image->resizeToWidth(350); $image->save($photo); $photo="picfornews/g" . $newfilename . ".jpg"; $sql="insert into newsphotos (photo, whose) VALUES ('$photo', '$snn')"; if (mysql_query($sql)){ $bb=$bb . "<p>Photo1 Successfully added</p>"; } else { $bb=$bb . "<p>Unable to add photo1: " . mysql_error() . "</p>"; } } } } } $newfilename++; //Second Picture $input_name="uploader2"; if(isset($_FILES)){ if(is_uploaded_file($_FILES[$input_name]["tmp_name"])){ $maxfilesize=30720000; if($_FILES[$input_name]["size"]>$maxfilesize){ $bb=$bb . " <br>Your picture2 is too large, it cannot be uploaded! It should be below 300kb. "; } else { $file_name=$_FILES[$input_name]["name"]; $ext=(substr($file_name,(strlen($file_name)-3))); $new=$path . "/g" . $newfilename . ".jpg"; if ($ext=="jpg" || $ext=="JPG" || $ext=="peg" || $ext=="PEG"){ move_uploaded_file($_FILES[$input_name]["tmp_name"],$path . "/" . $file_name); rename ($path . "/" . $file_name, $new); copy ($new, $final . "/g" . $newfilename . ".jpg"); unlink ($new); $photo="picfornews/g" . $newfilename . ".jpg"; $image->load($photo); $image->resizeToWidth(350); $image->save($photo); $photo="picfornews/g" . $newfilename . ".jpg"; $sql="insert into newsphotos (photo, whose) VALUES ('$photo', '$snn')"; if (mysql_query($sql)){ $bb=$bb . "<p>Photo2 Successfully added</p>"; } else { $bb=$bb . "<p>Unable to add photo2: " . mysql_error() . "</p>"; } } } } } $newfilename++; //Third Picture $input_name="uploader3"; if(isset($_FILES)){ if(is_uploaded_file($_FILES[$input_name]["tmp_name"])){ $maxfilesize=30720000; if($_FILES[$input_name]["size"]>$maxfilesize){ $bb=$bb . " <br>Your picture3 is too large, it cannot be uploaded! It should be below 300kb. "; } else { $file_name=$_FILES[$input_name]["name"]; $ext=(substr($file_name,(strlen($file_name)-3))); $new=$path . "/g" . $newfilename . ".jpg"; if ($ext=="jpg" || $ext=="JPG" || $ext=="peg" || $ext=="PEG"){ move_uploaded_file($_FILES[$input_name]["tmp_name"],$path . "/" . $file_name); rename ($path . "/" . $file_name, $new); copy ($new, $final . "/g" . $newfilename . ".jpg"); unlink ($new); $photo="picfornews/g" . $newfilename . ".jpg"; $image->load($photo); $image->resizeToWidth(350); $image->save($photo); $photo="picfornews/g" . $newfilename . ".jpg"; $sql="insert into newsphotos (photo, whose) VALUES ('$photo', '$snn')"; if (mysql_query($sql)){ $bb=$bb . "<p>Photo3 Successfully added</p>"; } else { $bb=$bb . "<p>Unable to add photo3: " . mysql_error() . "</p>"; } } } } } $newfilename++; //Fourth Picture $input_name="uploader4"; if(isset($_FILES)){ if(is_uploaded_file($_FILES[$input_name]["tmp_name"])){ $maxfilesize=30720000; if($_FILES[$input_name]["size"]>$maxfilesize){ $bb=$bb . " <br>Your picture4 is too large, it cannot be uploaded! It should be below 300kb. "; } else { $file_name=$_FILES[$input_name]["name"]; $ext=(substr($file_name,(strlen($file_name)-3))); $new=$path . "/g" . $newfilename . ".jpg"; if ($ext=="jpg" || $ext=="JPG" || $ext=="peg" || $ext=="PEG"){ move_uploaded_file($_FILES[$input_name]["tmp_name"],$path . "/" . $file_name); rename ($path . "/" . $file_name, $new); copy ($new, $final . "/g" . $newfilename . ".jpg"); unlink ($new); $photo="picfornews/g" . $newfilename . ".jpg"; $image->load($photo); $image->resizeToWidth(350); $image->save($photo); $photo="picfornews/g" . $newfilename . ".jpg"; $sql="insert into newsphotos (photo, whose) VALUES ('$photo', '$snn')"; if (mysql_query($sql)){ $bb=$bb . "<p>Photo4 Successfully added</p>"; } else { $bb=$bb . "<p>Unable to add photo4: " . mysql_error() . "</p>"; } } } } } $newfilename++; //Fifth Picture $input_name="uploader5"; if(isset($_FILES)){ if(is_uploaded_file($_FILES[$input_name]["tmp_name"])){ $maxfilesize=30720000; if($_FILES[$input_name]["size"]>$maxfilesize){ $bb=$bb . " <br>Your picture5 is too large, it cannot be uploaded! It should be below 300kb. "; } else { $file_name=$_FILES[$input_name]["name"]; $ext=(substr($file_name,(strlen($file_name)-3))); $new=$path . "/g" . $newfilename . ".jpg"; if ($ext=="jpg" || $ext=="JPG" || $ext=="peg" || $ext=="PEG"){ move_uploaded_file($_FILES[$input_name]["tmp_name"],$path . "/" . $file_name); rename ($path . "/" . $file_name, $new); copy ($new, $final . "/g" . $newfilename . ".jpg"); unlink ($new); $photo="picfornews/g" . $newfilename . ".jpg"; $image->load($photo); $image->resizeToWidth(350); $image->save($photo); $photo="picfornews/g" . $newfilename . ".jpg"; $sql="insert into newsphotos (photo, whose) VALUES ('$photo', '$snn')"; if (mysql_query($sql)){ $bb=$bb . "<p>Photo5 Successfully added</p>"; } else { $bb=$bb . "<p>Unable to add photo5: " . mysql_error() . "</p>"; } } } } } } if(isset($_POST['editnews'])){ $path="picfornews/temp"; $final="picfornews"; $photo=""; $newfilename=1; $handle=@opendir($final); if(!empty($handle)){ while(false!==($file=readdir($handle))){ if(is_file($final . "/" . $file)){ $newfilename++; } } } //closedir($handle); $snn=$_POST['sn']; include('SimpleImage.php'); $image = new SimpleImage(); //First Picture $input_name="uploader1"; if(isset($_FILES)){ if(is_uploaded_file($_FILES[$input_name]["tmp_name"])){ $maxfilesize=30720000; if($_FILES[$input_name]["size"]>$maxfilesize){ $bb=$bb . " <br>Your picture1 is too large, it cannot be uploaded! It should be below 300kb. "; } else { $file_name=$_FILES[$input_name]["name"]; $ext=(substr($file_name,(strlen($file_name)-3))); $new=$path . "/g" . $newfilename . ".jpg"; if ($ext=="jpg" || $ext=="JPG" || $ext=="peg" || $ext=="PEG"){ move_uploaded_file($_FILES[$input_name]["tmp_name"],$path . "/" . $file_name); rename ($path . "/" . $file_name, $new); copy ($new, $final . "/g" . $newfilename . ".jpg"); unlink ($new); $photo="picfornews/g" . $newfilename . ".jpg"; $image->load($photo); $image->resizeToWidth(350); $image->save($photo); $photo="picfornews/g" . $newfilename . ".jpg"; $sql="insert into newsphotos (photo, whose) VALUES ('$photo', '$snn')"; if (mysql_query($sql)){ $bb=$bb . "<p>Photo1 Successfully added</p>"; } else { $bb=$bb . "<p>Unable to add photo1: " . mysql_error() . "</p>"; } } } } } $newfilename++; //Second Picture $input_name="uploader2"; if(isset($_FILES)){ if(is_uploaded_file($_FILES[$input_name]["tmp_name"])){ $maxfilesize=30720000; if($_FILES[$input_name]["size"]>$maxfilesize){ $bb=$bb . " <br>Your picture2 is too large, it cannot be uploaded! It should be below 300kb. "; } else { $file_name=$_FILES[$input_name]["name"]; $ext=(substr($file_name,(strlen($file_name)-3))); $new=$path . "/g" . $newfilename . ".jpg"; if ($ext=="jpg" || $ext=="JPG" || $ext=="peg" || $ext=="PEG"){ move_uploaded_file($_FILES[$input_name]["tmp_name"],$path . "/" . $file_name); rename ($path . "/" . $file_name, $new); copy ($new, $final . "/g" . $newfilename . ".jpg"); unlink ($new); $photo="picfornews/g" . $newfilename . ".jpg"; $image->load($photo); $image->resizeToWidth(350); $image->save($photo); $photo="picfornews/g" . $newfilename . ".jpg"; $sql="insert into newsphotos (photo, whose) VALUES ('$photo', '$snn')"; if (mysql_query($sql)){ $bb=$bb . "<p>Photo2 Successfully added</p>"; } else { $bb=$bb . "<p>Unable to add photo2: " . mysql_error() . "</p>"; } } } } } $newfilename++; //Third Picture $input_name="uploader3"; if(isset($_FILES)){ if(is_uploaded_file($_FILES[$input_name]["tmp_name"])){ $maxfilesize=30720000; if($_FILES[$input_name]["size"]>$maxfilesize){ $bb=$bb . " <br>Your picture3 is too large, it cannot be uploaded! It should be below 300kb. "; } else { $file_name=$_FILES[$input_name]["name"]; $ext=(substr($file_name,(strlen($file_name)-3))); $new=$path . "/g" . $newfilename . ".jpg"; if ($ext=="jpg" || $ext=="JPG" || $ext=="peg" || $ext=="PEG"){ move_uploaded_file($_FILES[$input_name]["tmp_name"],$path . "/" . $file_name); rename ($path . "/" . $file_name, $new); copy ($new, $final . "/g" . $newfilename . ".jpg"); unlink ($new); $photo="picfornews/g" . $newfilename . ".jpg"; $image->load($photo); $image->resizeToWidth(350); $image->save($photo); $photo="picfornews/g" . $newfilename . ".jpg"; $sql="insert into newsphotos (photo, whose) VALUES ('$photo', '$snn')"; if (mysql_query($sql)){ $bb=$bb . "<p>Photo3 Successfully added</p>"; } else { $bb=$bb . "<p>Unable to add photo3: " . mysql_error() . "</p>"; } } } } } $newfilename++; //Fourth Picture $input_name="uploader4"; if(isset($_FILES)){ if(is_uploaded_file($_FILES[$input_name]["tmp_name"])){ $maxfilesize=30720000; if($_FILES[$input_name]["size"]>$maxfilesize){ $bb=$bb . " <br>Your picture4 is too large, it cannot be uploaded! It should be below 300kb. "; } else { $file_name=$_FILES[$input_name]["name"]; $ext=(substr($file_name,(strlen($file_name)-3))); $new=$path . "/g" . $newfilename . ".jpg"; if ($ext=="jpg" || $ext=="JPG" || $ext=="peg" || $ext=="PEG"){ move_uploaded_file($_FILES[$input_name]["tmp_name"],$path . "/" . $file_name); rename ($path . "/" . $file_name, $new); copy ($new, $final . "/g" . $newfilename . ".jpg"); unlink ($new); $photo="picfornews/g" . $newfilename . ".jpg"; $image->load($photo); $image->resizeToWidth(350); $image->save($photo); $photo="picfornews/g" . $newfilename . ".jpg"; $sql="insert into newsphotos (photo, whose) VALUES ('$photo', '$snn')"; if (mysql_query($sql)){ $bb=$bb . "<p>Photo4 Successfully added</p>"; } else { $bb=$bb . "<p>Unable to add photo4: " . mysql_error() . "</p>"; } } } } } $newfilename++; //Fifth Picture $input_name="uploader5"; if(isset($_FILES)){ if(is_uploaded_file($_FILES[$input_name]["tmp_name"])){ $maxfilesize=30720000; if($_FILES[$input_name]["size"]>$maxfilesize){ $bb=$bb . " <br>Your picture5 is too large, it cannot be uploaded! It should be below 300kb. "; } else { $file_name=$_FILES[$input_name]["name"]; $ext=(substr($file_name,(strlen($file_name)-3))); $new=$path . "/g" . $newfilename . ".jpg"; if ($ext=="jpg" || $ext=="JPG" || $ext=="peg" || $ext=="PEG"){ move_uploaded_file($_FILES[$input_name]["tmp_name"],$path . "/" . $file_name); rename ($path . "/" . $file_name, $new); copy ($new, $final . "/g" . $newfilename . ".jpg"); unlink ($new); $photo="picfornews/g" . $newfilename . ".jpg"; $image->load($photo); $image->resizeToWidth(350); $image->save($photo); $photo="picfornews/g" . $newfilename . ".jpg"; $sql="insert into newsphotos (photo, whose) VALUES ('$photo', '$snn')"; if (mysql_query($sql)){ $bb=$bb . "<p>Photo5 Successfully added</p>"; } else { $bb=$bb . "<p>Unable to add photo5: " . mysql_error() . "</p>"; } } } } } } ?>