} function emails_load($ads_db) { $emails = ''; $result = userfunc_query($ads_db, 'SELECT id, seller_name, email FROM `ads_authors`'); while ($row = $result->fetch_assoc()) { $emails[$row['id']] = 'Почта: ' . $row['email'] . ' Имя: ' . $row['seller_name']; } return $emails; } //connection $config_arr = config(); $ads_db = dbconnect($config_arr); //filling arrays $categories = categories_load($ads_db); $cities = cities_load($ads_db); $showform_params = array('return_private' => "0", 'namereturn' => "", 'email_return' => "", 'return_send_email' => "1", 'phonereturn' => "", 'city' => "", 'returncategory' => "", 'returntitle' => "", 'returndescription' => "", 'returnprice' => "0", 'notice_field_is_empty' => "", 'return_id' => ""); //button controller if (isset($_POST['main_form_submit'])) { //send button if ($_POST['title'] && ($_POST['seller_name'] && $_POST['email'] || $_POST['saved_email'])) { //если есть (название и (имя+мыло или указано сохраненное) $sent_entry = escape_2dim_arr($ads_db, $_POST); $_POST['author_id'] = author_controller($ads_db, $_POST); adsSQLSave($_POST, $ads_db); } else { $showform_params['notice_title_is_empty'] = 'You must fill Name, Email and Title(or choose email+name from selector) fields to proceed '; } } elseif (isset($_GET['delentry']) && is_numeric($_GET['delentry'])) { //delete button adsSQLDelete($_GET['delentry'], $ads_db);
{ $dropbox_res = mysql_query('SELECT * FROM `categories`') or die('an error occured while making category query: ' . mysql_error()); //теперь категории while ($db_cat_row = mysql_fetch_assoc($dropbox_res)) { $categories[$db_cat_row['cat_name']][$db_cat_row['subcat_id']] = $db_cat_row['subcat_name']; //воссоздаем массив categories в том виде, в котором он будет использоваться } mysql_free_result($dropbox_res); return $categories; } //создаем подключение $config_arr = config(); $ads_db = dbconnect($config_arr); //массивы $showform_params = array('return_private' => "0", 'namereturn' => "", 'email_return' => "", 'return_send_email' => "1", 'phonereturn' => "", 'city' => "", 'returncategory' => "", 'returntitle' => "", 'returndescription' => "", 'returnprice' => "0", 'notice_field_is_empty' => "", 'return_id' => ""); $cities = cities_load(); $categories = categories_load(); //button processing if (isset($_POST['main_form_submit'])) { //send button if ($_POST['title']) { adsSQLSave($_POST); } else { $showform_params['notice_title_is_empty'] = 'Введите название'; } } elseif (isset($_GET['delentry']) && is_numeric($_GET['delentry'])) { //delete button adsSQLDelete($_GET['delentry']); } elseif (isset($_GET['formreturn']) && is_numeric($_GET['formreturn'])) { $showform_params = adsReturn($showform_params, $_GET['formreturn']); }