Help figure out why in this form, when you click on a picture with a captcha (to download a new picture), it gives:
Fatal error: Maximum execution time of 30 seconds exceeded in /home/spravkab/public_html/useradd.php on line 66? And it gives out when the form is completed, and when it is clean, everything works fine.
<? session_start(); //echo $_SESSION['captcha_keystring']; include("config.php"); $dbh = mysql_connect($host, $user, $pswd) or die("Не могу соединиться с MySQL."); mysql_select_db($database) or die("Не могу подключиться к базе."); mysql_query("SET NAMES cp1251"); $name = $_POST["nameshort"]; $fullname = $_POST["namefull"]; $orgform = $_POST["type"]; $phones = mysql_real_escape_string($_POST["phone"]); $faxes = mysql_real_escape_string($_POST["fax"]); $add_phones = mysql_real_escape_string($_POST["morephones"]); $address = $_POST["address"]; $category = mysql_real_escape_string($_POST["category"]); $efforts = mysql_real_escape_string($_POST["Comments"]); $email = mysql_real_escape_string($_POST["email"]); $website = mysql_real_escape_string($_POST["site"]); $skype = mysql_real_escape_string($_POST["skype"]); $icq = mysql_real_escape_string($_POST["icq"]); $lon = mysql_real_escape_string($_POST["lon"]); $lat = mysql_real_escape_string($_POST["lat"]); $mapp = $_POST["mapp"]; $refresh = $_POST["refresh"]; $URL="index.php"; $accept = 1; if ($refresh == '1') { $URL = "userreg.php?r=1&nameshort=$name&namefull=$fullname&type=$orgform&phone=$phones&fax=$faxes&morephones=$add_phones&address=$address&category=$category&Comments=$efforts&email=$email&site=$website&skype=$skype&icq=$icq&lon=$lon&lat=$lat&mapp=$mapp"; $accept = 0; } elseif (($name == '') or ($fullname == '') or ($orgform = '') or ($phones == '') or ($address == '')) { $URL = "userreg.php?nameshort=$name&namefull=$fullname&type=$orgform&phone=$phones&fax=$faxes&morephones=$add_phones&address=$address&category=$category&Comments=$efforts&email=$email&site=$website&skype=$skype&icq=$icq&lon=$lon&lat=$lat&mapp=$mapp"; $accept = 0; } elseif(isset($_SESSION['captcha_keystring']) && $_SESSION['captcha_keystring'] !== $_POST['captcha']){ $URL = "userreg.php?e=1&nameshort=$name&namefull=$fullname&type=$orgform&phone=$phones&fax=$faxes&morephones=$add_phones&address=$address&category=$category&Comments=$efforts&email=$email&site=$website&skype=$skype&icq=$icq&lon=$lon&lat=$lat&mapp=$mapp"; $accept = 0; } elseif(preg_match('/http:\/\//', $address)) { // spam protection $accept = 0; } elseif(preg_match('/http:\/\//', $efforts)) { // spam protection $accept = 0; } unset($_SESSION['captcha_keystring']); $sort_name = preg_replace("/^[«\'\"“]/", "", $name); if ($mapp != 'on') { $lon=''; $lat=''; } $pattern = '/"([^a-zA-Z].*)"/'; $replacement = '«$1»'; while (preg_match($pattern, $name)) { $name = preg_replace($pattern, $replacement, $name); } while (preg_match($pattern, $fullname)) { $fullname = preg_replace($pattern, $replacement, $fullname); } while (preg_match($pattern, $address)) { $name = preg_replace($pattern, $replacement, $address); } $pattern = '/»»/'; $replacement = '»'; while (preg_match($pattern, $name)) { $name = preg_replace($pattern, $replacement, $name); } while (preg_match($pattern, $fullname)) { $fullname = preg_replace($pattern, $replacement, $fullname); } $website = preg_replace("/^http:\/\//", "", $website); $website = preg_replace("/\/$/", "", $website); $query = "INSERT INTO `wp_organisations` (`o_name`, `o_fullname`, `o_orgform`, `o_phones`, ". "`o_faxes`, `o_add_phones`, `o_address`, `o_category`, `o_email`, `o_website`, `o_skype`, ". "`o_icq`, `o_efforts`, `lon`, `lat`, `pending`, `created`, `sort_name`) VALUES ". "('$name', '$fullname', '$orgform', '$phones', '$faxes', '$add_phones', '$address', ". "'$category', '$email', '$website', '$skype', '$icq', '$efforts', '$lon', '$lat', '1', NOW(), '$sort_name')"; //echo ($query); if ($accept) { $res = mysql_query($query); } mysql_close($dbh); header ("Location: $URL"); ?>