if ($email_old != $email) { if (!eregi("^([[:alnum:]]|_|-|\\.)+@([[:alnum:]]|_|-|\\.)+(\\.([[:alnum:]]|-)+)+\$", $email)) { $_SESSION['message'] = "Неверно указан E-Mail!"; } else { $sql = mysql_query("SELECT count(*) FROM " . TABLE_DELIVERY . " WHERE email='{$email}'") or Error(1, __FILE__, __LINE__); $arr = @mysql_fetch_array($sql); $secret = md5(uniqid(rand(), 1)); if (!$arr[0]) { mysql_query("INSERT INTO " . TABLE_DELIVERY . " SET deliverygroup_id=5, email='{$email}', secret='{$secret}'") or Error(1, __FILE__, __LINE__); } mysql_query("DELETE FROM " . TABLE_DELIVERY . " WHERE deliverygroup_id=5 AND email='{$email_old}'") or Error(1, __FILE__, __LINE__); } } $url = ADMIN_URL . "?p={$part}&corporate_id={$corporate_id}"; if (@$adogovor) { generate_adogovor($corporate_id); } renew_corporates($root_dir); Header("Location: " . $url); exit; } $replace = array(); $left_menu = ' '; if ($corporate_id) { $sql = mysql_query("SELECT * FROM " . TABLE_CORPORATE . " WHERE corporate_id='{$corporate_id}' AND active!=0") or Error(1, __FILE__, __LINE__); if ($corporate = @mysql_fetch_array($sql)) { foreach ($contact_arr as $v) { $corporate[$v] = htmlspecialchars($corporate[$v], ENT_COMPAT, 'cp1251'); } $corporate['active_select'] = array_select('active', array(-1 => 'Заблокирована', 1 => 'Активна'), $corporate['active'], 0, "onchange=\"blockdiv.style.display = (this.value==-1) ? '' : 'none'\""); $corporate['status_select'] = array_select('status', $corporate_type, $corporate['status']);
else { $sql = mysql_query("SELECT count(*) FROM ".TABLE_DELIVERY." WHERE email='$email'") or Error(1, __FILE__, __LINE__); $arr = @mysql_fetch_array($sql); $secret = md5(uniqid(rand(),1)); if(!$arr[0]) mysql_query("INSERT INTO ".TABLE_DELIVERY." SET deliverygroup_id=4, email='$email', secret='$secret'") or Error(1, __FILE__, __LINE__); mysql_query("DELETE FROM ".TABLE_DELIVERY." WHERE deliverygroup_id=4 AND email='$email_old'") or Error(1, __FILE__, __LINE__); } } $url = ADMIN_URL."?p=$part&agency_id=$agency_id"; if(@$adogovor) generate_adogovor($agency_id); renew_agencies($root_dir); Header("Location: ".$url); exit; } $replace = array(); $left_menu = ' '; if(@$bd) { $sql = mysql_query("SELECT name, email FROM ".TABLE_AGENCY." WHERE email!='' ORDER BY name") or Error(1, __FILE__, __LINE__);