Повезло мне! В наследство достался следующий код: PHP: <?php if (!$GLOBALS["_cms_common_contents_sections_operation_error_file_not_uploaded"]) Как думаете, сейчас вешаться или чуть позже?
чепуха PHP: <? // // addslashes to vars if magic_quotes_gpc is off // this is a security precaution to prevent someone // trying to break out of a SQL statement. // if( !get_magic_quotes_gpc() ) { if( is_array($HTTP_GET_VARS) ) { while( list($k, $v) = each($HTTP_GET_VARS) ) { if( is_array($HTTP_GET_VARS[$k]) ) { while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) ) { $HTTP_GET_VARS[$k][$k2] = addslashes($v2); } @reset($HTTP_GET_VARS[$k]); } else { $HTTP_GET_VARS[$k] = addslashes($v); } } @reset($HTTP_GET_VARS); } if( is_array($HTTP_POST_VARS) ) { while( list($k, $v) = each($HTTP_POST_VARS) ) { if( is_array($HTTP_POST_VARS[$k]) ) { while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) ) { $HTTP_POST_VARS[$k][$k2] = addslashes($v2); } @reset($HTTP_POST_VARS[$k]); } else { $HTTP_POST_VARS[$k] = addslashes($v); } } @reset($HTTP_POST_VARS); } if( is_array($HTTP_COOKIE_VARS) ) { while( list($k, $v) = each($HTTP_COOKIE_VARS) ) { if( is_array($HTTP_COOKIE_VARS[$k]) ) { while( list($k2, $v2) = each($HTTP_COOKIE_VARS[$k]) ) { $HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2); } @reset($HTTP_COOKIE_VARS[$k]); } else { $HTTP_COOKIE_VARS[$k] = addslashes($v); } } @reset($HTTP_COOKIE_VARS); } } ?> взято с www . info turis m.ee PHP: <? if (!$GLOBALS["templates_".$language]) { $GLOBALS["templates_".$language] = $GLOBALS["templates_EN"]; } if (!$GLOBALS["temp_desc_".$language]) { $GLOBALS["temp_desc_".$language] = $GLOBALS["temp_desc_EN"]; } // ############################################################## // #### GENERATE SITE PATH $arrow = "»"; $sitepath = "<a href=\"" . $PHP_SELF . "\">" . $data["name"] . "</a> " . $arrow . " "; if ($structure) { $len = strlen($structure); while ($len >= 3) { $qs .= " structure = '" . addslashes(substr($structure,0,$len)) . "' OR"; $len = $len - 3; } $qs = substr($qs,0,-2); $sq->query($db->con, "SELECT structure, title, LENGTH(structure) as len FROM structure WHERE language = '$language' AND LENGTH(structure) <= '" . strlen($structure) . "' AND ($qs) ORDER BY len ASC"); $no = 1; while ($data = $sq->nextrow()) { $sitepath .= "<a href=\"" . $PHP_SELF . "?structure=" . $data["structure"] . "\">" . $data["title"] . "</a>& nbsp;"; if ($sq->numrows != $no) $sitepath .= $arrow . " "; $last_title = $data["title"]; $no++; } $sq->free(); } if ($content && $structure) { if ($last_title != $pagedata["title"]) { $sitepath .= $arrow . "& nbsp;" . $pagedata["title"]; } else { $sitepath .= " "; } } if ($search == true) { $sitepath .= $txtf->display("search_topic") . " - <i>" . $search_query . "</i>"; } www . reis pass . ee
Koc капец эстонцы тормозят. Ты ещё заметь, что проверка у них осуществляется всегда только со стороны клиента на JS, на сервере её не производится. Впрочем, такие сайты делаются разными идиотами, другое дело - порталы: http://www.eesti.ee https://www.swedbank.ee
Есть объектно-ориентированное программирование, есть процедурное. Кажется я открыл для себя "последоватьельное программирование": Это когда любую мысль программист моментально дописывает в конец файла и тут же забывает о ней ЗЫ> PHP: <?php echo " <option value=\"01\"" . ( ($discount_date_month == "01") ? " selected" : "" ) . ">января</option> <option value=\"02\"" . ( ($discount_date_month == "02") ? " selected" : "" ) . ">февраля</option> <option value=\"03\"" . ( ($discount_date_month == "03") ? " selected" : "" ) . ">марта</option> <option value=\"04\"" . ( ($discount_date_month == "04") ? " selected" : "" ) . ">апреля</option> <option value=\"05\"" . ( ($discount_date_month == "05") ? " selected" : "" ) . ">мая</option> <option value=\"06\"" . ( ($discount_date_month == "06") ? " selected" : "" ) . ">июня</option> <option value=\"07\"" . ( ($discount_date_month == "07") ? " selected" : "" ) . ">июля</option> <option value=\"08\"" . ( ($discount_date_month == "08") ? " selected" : "" ) . ">августа</option> <option value=\"09\"" . ( ($discount_date_month == "09") ? " selected" : "" ) . ">сентября</option> <option value=\"10\"" . ( ($discount_date_month == "10") ? " selected" : "" ) . ">октября</option> <option value=\"11\"" . ( ($discount_date_month == "11") ? " selected" : "" ) . ">ноября</option> <option value=\"12\"" . ( ($discount_date_month == "12") ? " selected" : "" ) . ">декабря</option> </select> "; + такое же для чисел месяца ))
Форматирование сохранено: PHP: <?php function concatstr(&$str,$symb) {$par_pos=strpos($str,$symb); if ($par_pos!=false) $str=substr($str,0,$par_pos);} Вопрос: зачем это?
PHP: <?php if ( mysql_num_rows($sql_result_news = mysql_query(" SELECT pop_img FROM products WHERE (id='" . $id . "') LIMIT 0,1" ))) { // ... } else { // ... } mysql_free_result($sql_result_news);
Самое лаконичное обрезание текста: PHP: <?php if (strlen($text)>15) $text = substr($text,0,15) . "..."; else $text = substr($text,0,15); substr вызывается второй раз, прошу заметить, наверное, для надежности
нужно не 15 а 15 - 3 троеточие это как бы 3 символа. Я хочу что б было не больше 15 а мне вернется 18.
PHP: <?php function str_upcase($term) { return strtr($term, "абвгдеёжзийклмнопрстуфхцчшщьыъэюяqwertyuiopasdfghjklzxcvbnm", "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯQWERTYUIOPASDFGHJKLZXCVBNM"); }
Elkaz решил блеснуть? а где ссылка на PHP: <?php setlocale(LC_ALL, array('ru_RU.CP1251','ru_RU', 'rus')); ? А как много многобайтовых кодировок ты знаешь для кирилицы?
я надеюсь вы пошутили PHP: <?php $current_date_for_update_date_field_value=date("d-m-Y"); mysql_query("UPDATE products SET update_date='" . $current_date_for_update_date_field_value . "', dynamics = 0, update_dynamics = '' WHERE (update_dynamics<>'') AND ( TO_DAYS('" . $current_date_for_check_dynamics . "') - TO_DAYS(CONCAT(SUBSTRING(update_dynamics,9,2),SUBSTRING(update_dynamics,4,2),SUBSTRING(update_dynamics,1,2))) > 30 ) "); "d-m-Y" - Гениально!
PHP: <?php if (in_array($cnt, $parent)) $category_show_type=( ( ($GLOBALS["view_by_category"] != $cnt) && (!$GLOBALS["_tree_is_open"][$cnt]) ) ? "<a href=\"products_tree.php?view_by_category=$cnt\"><img src=\"/i/a_p_t_f.gif\" width=\"12\" height=\"10\" border=\"0\" alt=\"Открыть категорию\"></a> " : "<img src=\"/i/a_p_t_f_o.gif\" width=\"16\" height=\"10\" border=\"0\" alt=\"\">" ) . " <b>$item[$cnt]</b>"; else if ($products_exist = check_active_product_in_category($cnt)) $category_show_type="<img src=\"/i/a_p_t_d_a.gif\" width=\"12\" height=\"9\" border=\"0\" alt=\"\"> $item[$cnt]"; Удобное использование тернарного условного оператора