Kod
Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/upload/class.upload_0.26/class.upload.php on line 4047
Tutaj jest kod skryptu który wykombinowałem:
<? include('./setting.php'); include('./class.upload_0.26/class.upload.php'); try { $pdo = new PDO('mysql:host=localhost;dbname=images', 'images', '******'); $pdo -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch(PDOException $e) { } $stm = $pdo -> query("SELECT `img_max_upload` FROM `config` LIMIT 1"); foreach ($stm as $rzad) { for($i = 1; $i < $rzad['0']+2; $i++){ if($_FILES['image'.$i]['error']==0) { $foo = new Upload($_FILES['image'.$i]); if ($foo->uploaded) { // save uploaded image with a new name $foo->file_new_name_body = 'img'; if($_POST['resize'.$i]!='org') { $foo->image_resize = true; $foo->image_y = $_POST['resize'.$i]; $foo->image_ratio_x = true; } $foo->Process('./img'); if ($foo->processed) { $img_name = $foo->file_dst_name; } else { } // save uploaded image with a new name, // resized to thumb wide $foo->file_new_name_body = 'img_thumb'; $foo->image_resize = true; $st = $pdo -> query("SELECT `thumb_size` FROM `config` LIMIT 1"); foreach($st as $row) { $foo->image_y = $row['thumb_size']; } $foo->image_ratio_x = true; $foo->Process('./img'); if ($foo->processed) { $thmb_name = $foo->file_dst_name; $foo->Clean(); $stmt = $pdo -> prepare("INSERT INTO images (id, name_img, name_thmb, date) VALUES (NULL, :name_img, :name_thmb, :date)"); $stmt -> bindValue(':name_img', $img_name, PDO::PARAM_STR); $stmt -> bindValue(':name_thmb', $thmb_name, PDO::PARAM_STR); $stmt -> bindValue(':date', $date, PDO::PARAM_STR); $ilosc = $stmt -> execute(); if($ilosc > 0) { // echo 'Zauktualizowano: '.$ilosc.' rekordow'; <div id="link" style="text-align:right;">Link do obrazka: <input type="text" name="y" value="'.HTTP.'img/'.$img_name.'"> <a href="#" onclick="copy()">kopiuj</a></div> <div id="form1" style="text-align:right;">Pełny rozmiar na forum: <a href="#" onclick="copy2()">kopiuj</a></div> <div id="form1" style="text-align:right;">Pełny rozmiar na www: <input readonly name="link" type="text" size="30" value="<a href="'.HTTP.'my.php?img='.$img_name.'"><img src="'.HTTP.'img/'.$img_name.'" border="0" alt="xxx"/></a>"> <input name="copy" type="button" value="Skopiuj"></div> <div id="form1" style="text-align:right;">Mianiaturka na forum: <input name="copy" type="button" value="Skopiuj"></div> <div id="form1" style="text-align:right;">Miniaturka na www: <input readonly name="link" type="text" size="30" value="<a href="'.HTTP.'my.php?img='.$img_name.'"><img src="'.HTTP.'img/'.$thmb_name.'" border="0" alt="xxx"/></a>"> <input name="copy" type="button" value="Skopiuj"></div> </div> </form>'; } else { } } else { } } } } } ?>
Tu jest strona z przykładami tej klasy:
http://www.verot.net/php_class_upload.htm
Jak się pozbyć tego błędu?