Esempio n. 1
0
function if_content($action)
{
    f_mysql_connect();
    $_str = "where action='" . $action . "' and status=1";
    //echo $_str;
    $result = f_mysql_select("content", $_str);
    if (mysql_numrows($result) > 0) {
        // есть
        $_res = 1;
    } else {
        // нет
        $_res = 0;
    }
    return $_res;
}
Esempio n. 2
0
function get_last_add_id($tablename, $condition, $namefield)
{
    f_mysql_connect();
    //echo $condition." order by $namefield desc limit 1";
    $result = f_mysql_select($tablename, $condition . " order by {$namefield} desc limit 1");
    $find = mysql_fetch_array($result);
    $_res = $find[$namefield];
    //	echo "<br>_res-".$_res."<br>";
    return $_res;
}
Esempio n. 3
0
function show_title()
{
    global $action;
    f_mysql_connect();
    if (isset($_GET['action'])) {
        /*
         * специфические разделы для выбора ключей
         */
        if ($_GET['action'] == "news") {
            if (isset($_GET['url'])) {
                // нашли поля
                $_arr = ___findarray('select zag,text from news where url="' . $_GET['url'] . '"');
                $_title = $_arr['zag'] . ' — ' . NAME_FIRMS . ' - Новости';
                $_description = get_stoka($_arr['text'], 50, ' ');
                $_keywords = get_stoka($_arr['zag'], 50, ', ') . _KEYWORDS;
            } else {
                if (TYPE_NEWS == 0 or !isset($_GET['type'])) {
                    // нашли поля
                    $_arr = ___findarray('select title,description,keywords from ceo where id=1');
                    $_title = NAME_FIRMS . ' - ' . $_arr['title'];
                    $_description = $_arr['description'];
                    $_keywords = $_arr['keywords'];
                } else {
                    // нашли поля
                    switch ($_GET['type']) {
                        case 1:
                            $_idd = 6;
                            break;
                        case 2:
                            $_idd = 7;
                            break;
                        default:
                            $_idd = 1;
                            break;
                    }
                    //ищем
                    $_arr = ___findarray('select title,description,keywords from ceo where id=' . $_idd);
                    $_title = NAME_FIRMS . ' - ' . $_arr['title'];
                    $_description = $_arr['description'];
                    $_keywords = $_arr['keywords'];
                }
            }
        } else {
            if ($_GET['action'] == "gallery" or $_GET['action'] == "arhiv") {
                $_arr = ___findarray('select title,description,keywords from ceo where id=2');
                if (isset($_GET['id'])) {
                    // нашли поля
                    $_arr1 = ___findarray('select pole from gallery_grupa where id="' . $_GET['id'] . '"');
                    $_title = $_arr['title'] . ' - ' . $_arr1['pole'] . ' — ' . NAME_FIRMS;
                    if ($_arr1['text'] == '') {
                        $_description = _DESCRIPTION;
                    } else {
                        $_description = get_stoka($_arr1['text'], 50, ' ');
                    }
                    $_keywords = get_stoka($_arr1['pole'], 50, ', ') . _KEYWORDS;
                } else {
                    // нашли поля
                    $_arr = ___findarray('select title,description,keywords from ceo where id=2');
                    $_title = $_arr['title'] . ' - ' . NAME_FIRMS;
                    $_description = $_arr['description'];
                    $_keywords = $_arr['keywords'];
                }
                // раздел каталог
            } else {
                if ($_GET['action'] == "catalog") {
                    // нашли поля
                    $_arr = ___findarray('select title,description,keywords from ceo where id=3');
                    $_title = $_arr['title'];
                    $_description = $_arr['description'];
                    $_keywords = $_arr['keywords'];
                    // если есть Группа
                    if (isset($_GET['grupa'])) {
                        // строим запрос
                        $_sql = 'SELECT * FROM catalog_tree where id=' . $_GET['grupa'];
                        // выполняем запрос + при необходимости выводим сам запрос
                        $result = mysql::query_one($_sql, 0);
                        /*
                         * определяем переменные
                         */
                        $_title .= " - " . $result->title;
                        $_description .= ", " . $result->description;
                        $_keywords .= ", " . $result->keywords;
                        /*
                         * определяем переменные
                         */
                        $_title .= " - " . NAME_FIRMS;
                        $_description .= ", " . NAME_FIRMS;
                        $_keywords .= ", " . NAME_FIRMS;
                    } else {
                        if (isset($_GET['goods'])) {
                            // строим запрос
                            $_sql = 'SELECT name, text_short FROM catalog where id=' . intval($_GET['goods']) . ' and status=1';
                            // выполняем запрос + при необходимости выводим сам запрос
                            $result = mysql::query_one($_sql, 0);
                            /*
                             * определяем переменные
                             */
                            $_title .= " - " . get_stoka($result->name, 50, ' ') . " - " . NAME_FIRMS;
                            $_description .= ", " . get_stoka($result->description, 150, ' ') . ", " . NAME_FIRMS;
                            $_keywords .= ", " . get_stoka($result->keywords, 150, ' ') . ", " . NAME_FIRMS;
                        }
                    }
                    // раздел каталог
                } else {
                    if ($_GET['action'] == "brand") {
                        // нашли поля
                        $_arr = ___findarray('select title,description,keywords from ceo where id=9');
                        $_title = $_arr['title'];
                        $_description = $_arr['description'];
                        $_keywords = $_arr['keywords'];
                        // конкретный бренд
                        if (isset($_GET['id'])) {
                            // строим запрос
                            $_sql = 'SELECT * FROM brand where id=' . $_GET['id'];
                            // выполняем запрос + при необходимости выводим сам запрос
                            $result = mysql::query_one($_sql, 0);
                            /*
                             * определяем переменные
                             */
                            $_title .= " - " . $result->pole;
                            $_description .= ", " . $result->pole;
                            $_keywords .= ", " . $result->pole;
                            /*
                             * определяем переменные
                             */
                            $_title .= " - " . NAME_FIRMS;
                            $_description .= ", " . NAME_FIRMS;
                            $_keywords .= ", " . NAME_FIRMS;
                        }
                        // раздел каталог
                    } else {
                        if ($_GET['action'] == "basket") {
                            // нашли поля
                            $_arr = ___findarray('select title,description,keywords from ceo where id=10');
                            $_title = $_arr['title'];
                            $_description = $_arr['description'];
                            $_keywords = $_arr['keywords'];
                            /*
                             * определяем переменные
                             */
                            $_title .= " - " . NAME_FIRMS;
                            $_description .= ", " . NAME_FIRMS;
                            $_keywords .= ", " . NAME_FIRMS;
                            // раздел каталог
                        } else {
                            if ($_GET['action'] == "mycabinet") {
                                // нашли поля
                                $_arr = ___findarray('select title,description,keywords from ceo where id=11');
                                $_title = $_arr['title'];
                                $_description = $_arr['description'];
                                $_keywords = $_arr['keywords'];
                                /*
                                 * определяем переменные
                                 */
                                $_title .= " - " . NAME_FIRMS;
                                $_description .= ", " . NAME_FIRMS;
                                $_keywords .= ", " . NAME_FIRMS;
                                // раздел каталог
                            } else {
                                if ($_GET['action'] == "filter") {
                                    // имя текущего раздела
                                    $_res = filter::get_name_curent_filter();
                                    $_title = $_res;
                                    $_description = $_res;
                                    $_keywords = $_res;
                                    // конкретный бренд
                                    if (isset($_GET['id'])) {
                                        /*
                                         * определяем переменные
                                         */
                                        $_title .= " - " . NAME_FIRMS;
                                        $_description .= ", " . NAME_FIRMS;
                                        $_keywords .= ", " . NAME_FIRMS;
                                    }
                                } else {
                                    if ($_GET['action'] == "search") {
                                        // нашли поля
                                        $_arr = ___findarray('select title,description,keywords from ceo where id=13');
                                        $_title = NAME_FIRMS . ' - ' . $_arr['title'];
                                        $_description = $_arr['description'];
                                        $_keywords = $_arr['keywords'];
                                    } else {
                                        if ($_GET['action'] == "voting") {
                                            // нашли поля
                                            $_arr = ___findarray('select title,description,keywords from ceo where id=12');
                                            $_title = NAME_FIRMS . ' - ' . $_arr['title'];
                                            if (isset($_GET['arhiv'])) {
                                                $_title .= ' - Архив голосований';
                                            }
                                            $_description = $_arr['description'];
                                            $_keywords = $_arr['keywords'];
                                        } else {
                                            if ($_GET['action'] == "registration") {
                                                // нашли поля
                                                $_arr = ___findarray('select title,description,keywords from ceo where id=8');
                                                $_title = NAME_FIRMS . ' - ' . $_arr['title'];
                                                $_description = $_arr['description'];
                                                $_keywords = $_arr['keywords'];
                                            } else {
                                                $_str = "where action='" . $_GET['action'] . "' and status=1";
                                                //echo "<br>".$_str."<br>";
                                                $result = f_mysql_select("content", $_str);
                                                if (mysql_numrows($result) > 0) {
                                                    $find = mysql_fetch_array($result);
                                                    /*
                                                     * определяем переменные
                                                     */
                                                    $_title = mysql::query_findpole('select title_' . $_GET['lang'] . ' from content where action="' . $_GET['action'] . '"', 'title_' . $_GET['lang']) . ' - ' . NAME_FIRMS;
                                                    $_description = mysql::query_findpole('select description_' . $_GET['lang'] . ' from content where action="' . $_GET['action' . '"'], 'description_' . $_GET['lang']);
                                                    $_keywords = mysql::query_findpole('select keywords_' . $_GET['lang'] . ' from content where action="' . $_GET['action'] . '"', 'keywords_' . $_GET['lang']);
                                                    /*$_title=$find['title'].' - '.NAME_FIRMS;
                                                    		$_description=$find['description'];
                                                    		$_keywords=$find['keywords'];	*/
                                                } else {
                                                    /*$_title=_TITLE.' - '.NAME_FIRMS;
                                                    		$_description=_DESCRIPTION;
                                                    		$_keywords=_KEYWORDS;*/
                                                    $_title = mysql::query_findpole('select title_' . $_GET['lang'] . ' from content where action=' . $_GET['action'], 'title_' . $_GET['lang']) . ' - ' . NAME_FIRMS;
                                                    $_description = mysql::query_findpole('select description_' . $_GET['lang'] . ' from content where action=' . $_GET['action'], 'description_' . $_GET['lang']);
                                                    $_keywords = mysql::query_findpole('select keywords_' . $_GET['lang'] . ' from content where action=' . $_GET['action'], 'keywords_' . $_GET['lang']);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if (!isset($_GET['action']) or $_title == '') {
        //$result=f_mysql_select("title","where id=1");
        //$find=mysql_fetch_array($result);
        /*
         * определяем переменные
         */
        $_title = _TITLE . ' - ' . NAME_FIRMS;
        $_description = _DESCRIPTION;
        $_keywords = _KEYWORDS;
    }
    // массив значений
    $_res = array($_title, $_description, $_keywords);
    //print_r($_res);
    return $_res;
}
Esempio n. 4
0
function f_mysql_select_grupa($table, $what_select)
{
    $r = f_mysql_select($table, $what_select);
    $f = mysql_fetch_row($r);
    return $f[2];
}