Пример #1
0
function get_products()
{
    $query = query("SELECT * FROM products");
    confirm($query);
    while ($row = fetch_array($query)) {
        $product = <<<DELIMITER

<div class="col-sm-4 col-lg-4 col-md-4">
                        <div class="thumbnail">
                            <a href="item.php?id={$row['product_id']}"><img src="{$row['product_image']}" alt=""></a>
                            <div class="caption">
                                <h4 class="pull-right">&#36;{$row['product_price']}</h4>
                                <h4><a href="item.php?id={$row['product_id']}">{$row['product_title']}</a>
                                </h4>
                                <p>See more snippets like this online store item at <a target="_blank" href="http://www.bootsnipp.com">Bootsnipp - http://bootsnipp.com</a>.</p>
                                <a class="btn btn-primary" target="_blank" href="../resources/cart.php?add={$row['product_id']}">Add to Cart</a>
                            </div>

                        </div>
                    </div>

DELIMITER;
        echo $product;
    }
}
Пример #2
0
function saveDjai($djai)
{
    $query = "SELECT * FROM djais d WHERE d.number = '" . $djai->number . "'";
    $result = mysql_query($query);
    $num_results = mysql_num_rows($result);
    $rows = fetch_array($result);
    $obj->successful = false;
    $obj->isNew = false;
    if ($num_results != 0) {
        // update (no fields for the moment to update)
        //		if(mysql_query($update))
        $obj->successful = true;
    } else {
        // insert
        foreach ($djai->cloths as $cloth) {
            $insert = "INSERT INTO djais VALUES ('" . $cloth->djaiId . "', '" . $djai->number . "', curdate(), '" . $cloth->amount . "', '" . $cloth->id . "')";
            if (mysql_query($insert)) {
                $obj->successful = true;
                $obj->isNew = true;
            }
        }
    }
    if ($obj->successful && !$obj->isNew) {
        handleCloths($djai, $rows, $obj);
    }
    $obj->djai = $djai;
    return $obj;
}
Пример #3
0
function saveGroup($group)
{
    $obj->successful = true;
    $obj->isNew = !isset($group->id);
    if ($obj->isNew) {
        $query = "SELECT max(id) as maxid FROM groups";
        $result = mysql_query($query);
        $num_results = mysql_num_rows($result);
        $rows = fetch_array($result);
        if ($num_results > 0) {
            // unique result
            $group->id = $rows[0]['maxid'] + 1;
        }
        // insert new group
        $insert = "INSERT INTO groups VALUES ('" . $group->id . "', '" . $group->name . "')";
        if (!mysql_query($insert)) {
            $obj->successful = false;
            $obj->insert = $insert;
        }
    } else {
        $update = "UPDATE groups SET name = '" . $group->name . "' WHERE id = '" . $group->id . "'";
        if (!mysql_query($update)) {
            $obj->successful = false;
        }
        $obj->update = $update;
    }
    $obj->group = $group;
    return $obj;
}
Пример #4
0
 function index()
 {
     $indexPushType = $this->indexPushType;
     $tid = getgpc("tid");
     $data["tid"] = $tid;
     $data["indexPushType"] = $indexPushType;
     //面包屑导航
     $menuadd = array("name" => $indexPushType[$tid], 'link' => "?mod=indexpush&tid=" . $tid);
     $data['headpagemenu'] = $this->createmenu($menuadd);
     $data['headpagetitle'] = $indexPushType[$tid];
     //左侧菜单
     $data['menumod'] = "indexpush";
     //
     //数据总量
     $count = fetch_one_array("select count(*) as num from " . dbtable("indexpush") . " where tid ='" . $tid . "' and status>=1 ");
     //分页
     $per_page = getgpc("per_page");
     $per_page = $per_page ? $per_page : 0;
     $pnum = 20;
     $this->load->library('pagination');
     $config['base_url'] = 'admin.php?mod=indexpush&tid=' . $tid;
     $config['total_rows'] = $count["num"];
     $config['per_page'] = $pnum;
     $this->pagination->initialize($config);
     $data["page"] = $this->pagination->create_links();
     $list = fetch_array("select * from " . dbtable("indexpush") . " where tid ='" . $tid . "' and status>=1 order by istop desc,displayorder desc, id desc limit {$per_page},{$pnum} ");
     $data["reslist"] = $list;
     $this->load->view('indexpush_index', $data);
 }
Пример #5
0
function display_users()
{
    $category_query = query("SELECT * FROM users");
    confirm($category_query);
    while ($row = fetch_array($category_query)) {
        $user_id = $row['user_id'];
        $username = $row['username'];
        $first_name = $row['first_name'];
        $email = $row['email'];
        $active = $row['active'];
        $type = $row['type'];
        $user = <<<DELIMETER
<tr>
    <td>{$user_id}</td>
    <td>{$username}</td>
    <td>{$first_name}</td>
     <td>{$email}</td>
     <td>{$active}</td>
     <td>{$type}</td>
DELIMETER;
        echo $user;
        $user1 = <<<DELIMETER
\t<td><a class="btn btn-warning" href="/admin?edit_user&id={$row['user_id']}"><span class="glyphicon glyphicon glyphicon-pencil"></span></a></td>
    <td><a class="btn btn-danger" href="html/php/includes/admin/delete_user.php?id={$row['user_id']}"><span class="glyphicon glyphicon-remove"></span></a></td>
</tr>
DELIMETER;
        if ($row['user_id'] != 1) {
            echo $user1;
        }
    }
}
Пример #6
0
function getListOfBuyClicks($dt)
{
    global $mycatid;
    $str = "";
    $lnk = dbConnect('localhost', 'root', 'lyntik');
    $query = "SELECT b.fdate as fdate,b.ip as cip,b.goodid as gid,b.name as sname,b.source as src,b.price as price  FROM buylog b WHERE b.date='{$dt}' AND b.mycat_id={$mycatid} ORDER BY b.ip,b.fdate";
    $res = exec_query($query);
    $ip = "0.0.0.0";
    $i = 0;
    $str .= "<div class=\"all_clicks\">";
    $str .= "<div class=\"click_row_title\">\n             <div class=\"left click_date title\">Дата</div>\n             <div class=\"left click_id title\">ID товара</div>\n             <div class=\"left click_name title\">Наименование</div>\n             <div class=\"left click_id title\">Цена</div>\n             <div class=\"left click_name title\">Источник</div>\n             " . closeFloat() . "\n            </div>";
    if (mysql_num_rows($res) == 0) {
        $str .= "<div>За выбранную дату нажатий не было</div>";
    } else {
        while ($rows = fetch_array($res)) {
            if ($ip != $rows['cip']) {
                $ip = $rows['cip'];
                if ($i != 0) {
                    $str .= "</div>";
                }
                $str .= "<div class=\"ipclicks\">";
                $str .= "<div class=\"client_ip\">Клики с адреса:<b>" . $rows['cip'] . "</b></div>";
            }
            $str .= "<div class=\"click_row\">\n             <div class=\"left click_date\">" . $rows['fdate'] . "</div>\n             <div class=\"left click_id\">" . $rows['gid'] . "</div>\n             <div class=\"left click_name\">" . $rows['sname'] . "</div>\n             <div class=\"left click_id\">" . $rows['price'] . "</div>\n             <div class=\"left click_name\">" . $rows['src'] . "</div>\n             " . closeFloat() . "\n            </div>";
        }
        $str .= "</div>";
    }
    $str .= "</div></div>";
    mysql_free_result($res);
    dbDisconnect($lnk);
    return $str;
}
Пример #7
0
function echoPage($page, $limit)
{
    $dbLink = db_connect_syslog(DBUSER, DBUSERPW);
    if ($limit <= 10) {
        echo " <a href='wres.php?page={$page}&limit=" . ($limit + 10) . "' class='load_more'></a\t";
        $sqllimit = "0,{$limit}";
    } else {
        $sqllimit = "10,{$limit}";
    }
    echo "<div style=\"width: 310px; margin-bottom: 5px; margin-left: 5px; text-align: center; font-size: 5px;\">";
    echo " <table> ";
    if ($page == "tail") {
        if ($limit <= 10) {
            echo "\n\t\t\t   \t<td class=\"wapresultsheader\">HOST</td>\n\t\t\t   \t<td class=\"wapresultsheader\">TIME</td>\n\t\t\t   \t<td class=\"wapresultsheader\">MESSAGE</td>\n\t\t\t   \t";
        }
        $query = "SELECT * FROM logs JOIN (select seq from logs FORCE INDEX(PRIMARY) ORDER BY seq DESC LIMIT {$sqllimit}) as sub USING(seq)";
    }
    if ($page == "topx") {
        if ($limit <= 10) {
            echo "\n\t\t\t   \t<td class=\"wapresultsheader\">HOST</td>\n\t\t\t   \t<td class=\"wapresultsheader\">COUNT</td>\n\t\t\t   \t<td class=\"wapresultsheader\">MESSAGE</td>\n\t\t\t   \t";
        }
        if (defined('SQZ_ENABLED') && SQZ_ENABLED == TRUE) {
            $query = "SELECT host,counter as count,msg from logs WHERE counter>1 ORDER BY counter DESC LIMIT {$sqllimit}";
        } else {
            $query = "SELECT host,count(*) as count,msg from logs GROUP BY host ORDER BY count DESC LIMIT {$sqllimit}";
        }
    }
    $results = perform_query($query, $dbLink);
    $color = "waplighter";
    $today = date('Y-m-d');
    while ($row = fetch_array($results)) {
        if ($color == "wapdarker") {
            $color = "waplighter";
        } else {
            $color = "wapdarker";
        }
        echo "<tr class=\"{$color}\">";
        echo "<td>" . $row['host'] . "</td>";
        if ($page == "tail") {
            $pieces = explode(" ", $row['datetime']);
            echo '<td>';
            if ($pieces[0] != $today) {
                echo $pieces[0] . "&nbsp;";
            }
            echo $pieces[1];
        }
        if ($page == "topx") {
            echo '<td>';
            echo $row['count'] . "&nbsp;";
        }
        echo "</td>\n";
        $row['msg'] = preg_replace('/\\s:/', ':', $row['msg']);
        $row['msg'] = preg_replace('/.*(%.*?:.*)/', '$1', $row['msg']);
        $msg = htmlspecialchars($row['msg']);
        echo "<td>";
        echo "{$msg}</td>\n";
        echo "</tr>\n";
    }
    echo "</div>\n";
}
Пример #8
0
 function index()
 {
     ////面包屑导航
     //        $data['headpagemenu']=array(
     //            0=>array('name'=>'后台','link'=>"admin.php"),
     //            1=>array('name'=>'网站概况','link'=>""),
     //        );
     //        $data['headpagetitle']="网站概况";
     ////左侧菜单
     //        $data['menumod']="index";
     $product_tech = $this->config->item("product_tech");
     $res = array();
     foreach ($product_tech[4] as $key => $row) {
         $list = fetch_array("select p.* from " . dbtable("product_tech") . " t," . dbtable("product") . " p where t.pid=p.id and t.type='{$key}'");
         $res[$key] = $list;
     }
     $data["list"] = $res;
     if (checkmobile()) {
         $this->load->view('mobile/safety', $data);
     } else {
         $data['tech_type'] = "4";
         $data['type_id'] = "4_1";
         $this->load->view('safety', $data);
     }
 }
Пример #9
0
function links($cat = 0, $direction = "asc")
{
    global $linksmessage, $prefix;
    if ($direction != "asc" && $direction != "desc") {
        $direction = "asc";
    }
    $out = "";
    if ($cat) {
        $query = "SELECT * FROM " . $prefix . "linkscat WHERE id=" . $cat . " ORDER BY nome";
    } else {
        $query = "SELECT * FROM " . $prefix . "linkscat ORDER BY nome";
    }
    if (!($cresult = dbquery($query))) {
        die($linksmessage[4]);
    }
    $out .= "\n<div id=\"LNE_show\">\n";
    while ($crow = fetch_array($cresult)) {
        $out .= "<h3>" . decode($crow['descr']) . "</h3>\n";
        $query = "SELECT * FROM " . $prefix . "links where hits=" . $crow[0] . " ORDER BY name " . $direction;
        if (!($result = dbquery($query))) {
            die($linksmessage[5]);
        }
        if (num_rows($result)) {
            $out .= "<ul>\n";
            while ($row = fetch_array($result)) {
                $out .= "<li><a href=\"" . $row['link'] . "\" onclick=\"window.open(this.href,'_blank');return false;\">" . decode($row['name']) . "</a><div>" . decode($row['descr']) . "</div></li>\n";
            }
            $out .= "</ul>\n";
        }
    }
    $out .= "</div>\n";
    return $out;
}
Пример #10
0
function construire_tableau($theme = 0, $pertinence = 0, $diff = 0, $nbQuestions)
{
    $connexion = connect($host, $port, $user, $password, $database);
    //On récupère un recordset correspondant aux critères
    $query = "SELECT Q.noq, Q.question, Q.reponse " . "FROM questions Q";
    /* ", sujets S, themes T, pertinences P, difficultes D ".
    	"WHERE Q.noq = S.noq AND S.theme = T.theme AND ".
    	"S.pertinence = P.pertinence AND S.difficulte = D.difficulte".
    	"AND S.theme = ". $theme ." AND S.pertinence = ". $pertinence ." AND S.difficulte = ". $diff .";";
    */
    $result = exec_query($connexion, $query);
    $Nbr = numrows($result);
    echo "Nombre d'enregistrements : " . $Nbr . "<BR>";
    //Organisation aléatoire des questions
    $ints = range(0, $Nbr - 1);
    srand(time());
    shuffle($ints);
    if ($Nbr < $nbQuestions) {
        $nbQuestions = $Nbr;
    }
    // On construit le tableau permettant de trier aléatoirement
    for ($i = 0; $i < $nbQuestions && ($row = fetch_array($result, $ints[$i])); $i++) {
        echo "libelle Q : " . $row[1] . "<BR>";
        $tabQ[$i][0] = $row[0];
        // recuperation du numero,
        $tabQ[$i][1] = $row[1];
        // du libelle,
        $tabQ[$i][2] = $row[2];
        // de la reponse a la question
    }
    close($connexion);
    return $tabQ;
}
Пример #11
0
function saveCloth($cloth)
{
    global $country;
    $query = "SELECT * FROM cloths c WHERE c.id = '" . $cloth->id . "'";
    $result = mysql_query($query);
    $num_results = mysql_num_rows($result);
    $rows = fetch_array($result);
    $obj->successful = false;
    if ($num_results != 0) {
        // update
        $update = "UPDATE cloths SET name = '" . $cloth->name . "', stockMin = " . $cloth->stockMin . ", groupId = '" . $cloth->groupId . "' WHERE id = '" . $cloth->id . "'";
        if (mysql_query($update)) {
            $obj->successful = true;
        }
    } else {
        // insert
        $groupId = $cloth->groupId ? "'" . $cloth->groupId . "'" : 'null';
        $matchId = uniqid();
        $insert = "INSERT INTO cloths (id, name, stockMin, groupId, matchClothId, country) VALUES ('" . $cloth->id . "', '" . $cloth->name . "', '" . $cloth->stockMin . "', {$groupId}, '{$matchId}', '{$country}')";
        if (mysql_query($insert)) {
            $obj->successful = true;
            $obj->isNew = true;
            $otherCountry = $country == 'ARG' ? 'BRA' : 'ARG';
            $insert = "INSERT INTO cloths (id, name, stockMin, groupId, matchClothId, country) VALUES ('" . uniqid() . "', '" . $cloth->name . "', '" . $cloth->stockMin . "', {$groupId}, '{$matchId}', '{$otherCountry}')";
            if (!mysql_query($insert)) {
                $obj->successful = false;
                $obj->insert = $insert;
            }
        }
    }
    $obj->cloth = $cloth;
    return $obj;
}
Пример #12
0
 function index()
 {
     $pid = $_POST["compareid"];
     //读取所有的床垫的TID
     $mattessTid_t = fetch_array("select id from " . dbtable("product_type") . " where id='2' or upid='2'");
     $mattessType = array();
     foreach ($mattessTid_t as $row) {
         $mattessTid[] = $row["id"];
         $mattessType[$row["tid"]] = $row["tname"];
     }
     $comtype = fetch_array("select * from " . dbtable("product_compare") . " where 1 and status=1 order by  displayorder desc, id asc");
     $data["comtype"] = $comtype;
     foreach ($pid as $row) {
         $res_one = fetch_one_array("select * from " . dbtable("product") . " where id='" . $row . "' ");
         if (in_array($res_one["tid"], $mattessTid)) {
             $resimage = fetch_one_array("select imgurl from " . dbtable("product_img") . " where pid='" . $row . "' and status='1' order by  displayorder limit 1");
             $res_one["compare"] = unserialize($res_one["compare"]);
             $res_one['com_imgurl'] = $resimage['imgurl'];
             $res[] = $res_one;
         }
     }
     $data["mattessType"] = $mattessType;
     $data["reslist"] = $res;
     $this->load->view('compare', $data);
     //dump($res);
 }
Пример #13
0
function getOneDesignSails()
{
    global $country;
    $query = "SELECT sailPrefix as sail FROM onedesign o GROUP BY sailPrefix ORDER BY sailPrefix";
    $result = mysql_query($query);
    return fetch_array($result);
}
Пример #14
0
function executeQuery($query)
{
    $query = str_replace("\\", "", $query);
    if ($result = mysql_query($query)) {
        return fetch_array($result);
    }
    return $query;
}
Пример #15
0
 function rowCount($query)
 {
     $count = 0;
     while ($data = fetch_array($query)) {
         $count++;
     }
     return $count;
 }
Пример #16
0
function fetch_all_array($sql)
{
    $out = array();
    while ($row = fetch_array($sql)) {
        $out[] = $row;
    }
    return $out;
}
Пример #17
0
function lastnews($cat = -1)
{
    global $prefix;
    $quer = "SELECT titulo,data,noticia,autor,email,visto,reg,cat FROM " . $prefix . "noticias";
    if ($cat > -1) {
        $quer .= " WHERE cat=" . $cat;
    }
    $quer .= " ORDER BY reg DESC LIMIT 0,1";
    $query = dbquery($quer);
    if ($row_db = fetch_array($query)) {
        return show_one_news($row_db['0'], $row_db['1'], $row_db['2'], $row_db['3'], $row_db['4']);
    }
}
Пример #18
0
function cart()
{
    $total = 0;
    $item_quantity = 0;
    $item_name = 1;
    $item_number = 1;
    $amount = 1;
    $quantity = 1;
    foreach ($_SESSION as $name => $value) {
        if ($value > 0) {
            if (substr($name, 0, 8) == "product_") {
                $length = strlen($name - 8);
                $id = substr($name, 8, $length);
                $query = query("SELECT * FROM products WHERE product_id = " . escape_string($id) . " ");
                confirm($query);
                while ($row = fetch_array($query)) {
                    $sub = $row['product_price'] * $value;
                    $item_quantity += $value;
                    $product = <<<DELIMETER
<tr>
    <td>{$row['product_title']}</td>
    <td>&#36;{$row['product_price']}</td>
    <td>{$value}</td>
    <td>&#36;{$sub}</td>
    <td>
        <a class='btn btn-warning' href="cart.php?remove={$row['product_id']}"><span class='glyphicon glyphicon-minus'></span></a>
        <a class='btn btn-success' href="cart.php?add={$row['product_id']}"><span class='glyphicon glyphicon-plus'></span></a>
        <a class='btn btn-danger' href="cart.php?delete={$row['product_id']}"><span class='glyphicon glyphicon-remove'></span></a>
    </td>
</tr>

<input type="hidden" name="item_name_{$item_name}" value="{$row['product_title']}">
<input type="hidden" name="item_number_{$item_number}" value="{$row['product_id']}">
<input type="hidden" name="amount_{$amount}" value="{$row['product_price']}">
<input type="hidden" name="quantity_{$quantity}" value="{$row['product_quantity']}">

DELIMETER;
                    echo $product;
                    $total = 0;
                    $item_quantity = 0;
                    $item_name++;
                    $item_number++;
                    $amount++;
                    $quantity++;
                }
                $_SESSION['item_total'] = $total += $sub;
                $_SESSION['item_quantity'] = $item_quantity;
            }
        }
    }
}
Пример #19
0
function cart()
{
    $total = 0;
    $item_quantity = 0;
    $item_name = 1;
    $item_number = 1;
    $amount = 1;
    $quantity = 1;
    foreach ($_SESSION as $name => $value) {
        if ($value > 0) {
            if (substr($name, 0, 8) == "product_") {
                $length = strlen($name - 8);
                $id = sanitize(substr($name, 8, $length));
                $query = query("SELECT * FROM products WHERE p_id = {$id}");
                confirm($query);
                while ($row = fetch_array($query)) {
                    $sub = $row['pprice'] * $value;
                    $item_quantity += $value;
                    $srt = strtoupper(str_replace("_", " ", "{$row['pname']}"));
                    $product = <<<DELIMETER
\t\t\t\t<tr>
\t\t\t\t  <td><div class=row><div class=col-md-3><img width='50' src='{$row['pimage']}'>
\t\t\t\t  </div><div class=col-sm-9><a href="{$row['pname']}"><strong>{$srt}</strong></a><br>
\t\t\t\t  </div>
\t\t\t\t  </div>
\t\t\t\t  </td>
\t\t\t\t  <td>&#8377; {$row['pprice']}</td>
\t\t\t\t  <td>{$value}</td>
\t\t\t\t  <td>&#8377; {$sub}</td>
\t\t\t\t  <td><a class='btn btn-success' href="cart?add={$row['p_id']}"><span class='glyphicon glyphicon-plus'></span></a>   <a class='btn btn-warning' href="cart?remove={$row['p_id']}"><span class='glyphicon glyphicon-minus'></span></a>
\t\t\t\t<a class='btn btn-danger' href="cart?delete={$row['p_id']}"><span class='glyphicon glyphicon-remove'></span></a></td>
\t\t\t\t  </tr>
\t\t\t\t  <input type="hidden" name="item_name_{$item_name}" value="{$srt}">
\t\t\t\t  <input type="hidden" name="item_number_{$item_number}" value="{$row['p_id']}">
\t\t\t\t  <input type="hidden" name="amount_{$amount}" value="{$row['pprice']}">
\t\t\t      <input type="hidden" name="quantity_{$quantity}" value="{$value}">
DELIMETER;
                    echo $product;
                    $item_name++;
                    $item_number++;
                    $amount++;
                    $quantity++;
                }
                $_SESSION['item_total'] = $total += $sub;
                $_SESSION['item_quantity'] = $item_quantity;
            }
        }
    }
}
Пример #20
0
function getall($sql)
{
    $result = query($sql);
    $row = fetch_array($result);
    mysql_free_result($result);
    if ($row) {
        $result = query($sql);
        while ($row = fetch_array($result)) {
            $rowlist[] = $row;
        }
    } else {
        $rowlist = 'no';
    }
    return $rowlist;
}
Пример #21
0
 function getclass()
 {
     $gradeid = getgpc("gradeid");
     $classid = getgpc("classid");
     $res = fetch_array("select * from " . dbtable("class") . " where upid='" . $gradeid . "'");
     $str = '<option value="0">全部班级</option>';
     foreach ($res as $row) {
         if ($classid == $row['id']) {
             $add = " selected";
         } else {
             $add = "";
         }
         $str .= '<option value="' . $row["id"] . '" ' . $add . '>' . $row["name"] . '</option>';
     }
     echo $str;
 }
Пример #22
0
 function index()
 {
     $per_page = getgpc("per_page");
     $per_page = $per_page ? $per_page : 0;
     $pnum = 8;
     $list = fetch_array("select * from " . dbtable("englandstyle") . " where 1  and status=1 order by displayorder desc, id desc limit {$per_page},{$pnum}");
     foreach ($list as $key => $row) {
         $res[intval($key / 4)][] = $row;
     }
     $count = fetch_one_array("select count(*) as num from " . dbtable("englandstyle") . " where 1  and status=1");
     $data['total_num'] = $count['num'];
     $data['per_page'] = $per_page + $pnum;
     $data['pnum'] = $pnum;
     $data["reslist"] = $res;
     $this->load->view('englandstyle', $data);
 }
Пример #23
0
	private function extractName($message) {
        $preges = array();
		$result = perform_query(
			"SELECT preg_name FROM lzecs",
			$this->dbLink, $_SERVER['PHP_SELF']
		);
        while($row = fetch_array($result)) { 
            $preges[] = $row['preg_name'];
        }
        foreach($preges as $preg) {
            preg_match_all("/$preg/", $message, $matches);
        }
        if(! isset($matches[1][0]))
            return "";

		// Modified below for http://code.google.com/p/php-syslog-ng/issues/detail?id=43 
		// $name = $matches[1][0];
		$name = addcslashes($matches[1][0], '\'');

		return $name;
	}
Пример #24
0
 public function lookup($message)
 {
     $name = $this->extractName($message);
     if (empty($name)) {
         return false;
     }
     if (($data = $this->cacheFetch($name)) !== false) {
         return $data;
     }
     $result = perform_query("SELECT message, explanation, action, datetime FROM " . CISCO_ERROR_TABLE . " WHERE name = '{$name}' LIMIT 1", $this->dbLink);
     if (!num_rows($result) > 0) {
         return false;
     }
     $data = array();
     $row = fetch_array($result, "ASSOC");
     array_push($data, $name);
     array_push($data, $row['message']);
     array_push($data, $row['explanation']);
     array_push($data, $row['action']);
     array_push($data, $row['datetime']);
     $this->cacheStore($name, $data);
     return $data;
 }
Пример #25
0
function listOptionsLabel($dataset, $choixdef)
{
    global $database;
    $query = "SELECT * FROM " . $dataset;
    $result = exec_query($database, $query);
    $Nbr = numrows($result);
    for ($i = 0; $i < $Nbr; $i++) {
        $tablo[$i] = fetch_array($result, $i);
    }
    if ($Nbr > 2) {
        sort($tablo);
    }
    echo "<select name=liste_" . $dataset . ">\n";
    for ($i = 0; $i < $Nbr; $i++) {
        list($cle, $label) = $tablo[$i];
        if ($cle == $choixdef) {
            echo "  <option selected>" . $cle . " = " . $label . "</option>\n";
        } else {
            echo "  <option>" . $cle . " = " . $label . "</option>\n";
        }
    }
    echo "</select>\n";
    return 1;
}
Пример #26
0
function translit_translitProds()
{
    global $mycatid;
    // $lnk = dbConnect('','','');
    $query = "ALTER TABLE `ln_product_my` ADD `translit` varchar(500)";
    $res2 = exec_query($query);
    $query = "ALTER TABLE `ln_product_my` ADD INDEX `translit` (translit)";
    $res2 = exec_query($query);
    $query = "SELECT id as pid, name as pname,author as pauthor FROM ln_product_my WHERE mycat_id=" . $mycatid;
    $res = exec_query($query);
    $str = "";
    while ($rows = fetch_array($res)) {
        $str = translit_checkAuthorInName($rows['pname'], $rows['pauthor']);
        translit_prodsProceed($str, $rows['pid']);
    }
    mysql_free_result($res);
    // dbDisconnect($lnk);
    /* $ar = array("Русский язык 5 класс учебник обычный курс","Русский язык 5 класс учебник обычный курс","Русский язык 5 класс учебник обычный курс","Русский язык 5 класс учебник обычный курс","Русский язык 5 класс учебник обычный курс","Русский язык 5 класс учебник обычный курс");
     foreach($ar as $val)
     {
      $str = translit_checkAuthorInName($val,"Иванова");
      translit_prodsProceed($str,1);
     }*/
}
Пример #27
0
function downloads($cat = 0)
{
    global $downloadsmessage, $prefix;
    if ($cat) {
        $query = "SELECT * FROM " . $prefix . "downloadscat WHERE id=" . $cat . " ORDER BY nome";
    } else {
        if (!($crow = fetch_array(dbquery("SELECT * FROM " . $prefix . "downloadscat WHERE nome=\"Uploads\"")))) {
            die($downloadsmessage[2]);
        }
        $query = "SELECT * FROM " . $prefix . "downloadscat WHERE id<>" . $crow['id'] . " ORDER BY nome";
    }
    if (!($cresult = dbquery($query))) {
        die($downloadsmessage[2]);
    }
    $out .= "\n<div id=\"LNE_show\">\n";
    while ($crow = fetch_array($cresult)) {
        $out .= "<h3>" . decode($crow['descr']) . "</h3>";
        $query = "SELECT * FROM " . $prefix . "downloads WHERE ex=" . $crow['id'] . " ORDER BY reg DESC";
        if (!($result = dbquery($query))) {
            die($downloadsmessage[3]);
        }
        if (num_rows($result)) {
            $GETarray = $_GET;
            $out .= "<ul>";
            while ($row = fetch_array($result)) {
                $GETarray['dlid'] = $row[0];
                $out .= "<li><a href=\"addons/downloads/send.php?" . http_build_query($GETarray, '', '&amp;') . "\" rel=\"nofollow\">" . decode($row[1]) . "</a></li>\n";
            }
            $out .= "</ul>";
        } else {
            $out .= "<h3>{$downloadsmessage['100']}</h3>";
        }
    }
    $out .= "</div>\n";
    return $out;
}
Пример #28
0
            //clear switch times
            query("DELETE FROM `plans` WHERE `workload_plan_default_ID_plan`='" . $_POST['defaultplan'] . "';");
            foreach ($data as $key => $item) {
                query("INSERT plans (`switch_time`, `switch_workload`, `workload_plan_default_ID_plan`) VALUES ('" . $item[0] . "', '" . $item[1] . "', '" . $_POST['defaultplan'] . "');");
            }
            go($setup['adm']['www'] . 'plans/show.html?defaultplan=' . $_POST['defaultplan']);
        } else {
            query("UPDATE workload_plan SET `plan_name`='" . $_POST['planname'] . "' WHERE `ID_plan`='" . $_POST['plan'] . "';");
            //clear switch times
            query("DELETE FROM `plans` WHERE `workload_plan_ID_plan`='" . $_POST['plan'] . "';");
            foreach ($data as $key => $item) {
                query("INSERT plans (`switch_time`, `switch_workload`, `workload_plan_ID_plan`) VALUES ('" . $item[0] . "', '" . $item[1] . "', '" . $_POST['plan'] . "');");
            }
            //go($setup['adm']['www'].'plans/show.html?plan='.$_POST['plan']);
        }
    } else {
        $smarty->assign("err", $err);
    }
} else {
    if ($default == 0) {
        $list_sql = query("SELECT plan_name FROM workload_plan WHERE ID_plan=" . $_POST['plan']);
        $planName = fetch_array($list_sql);
    } else {
        $list_sql = query("SELECT plan_name FROM workload_plan_default WHERE ID_plan=" . $_POST['defaultplan']);
        $planName = fetch_array($list_sql);
    }
    $_POST['planname'] = $planName[0]['plan_name'];
}
$smarty->assign("planname", $_POST['planname']);
$smarty->assign("STATUT-DEFAULT", $default);
$smarty->assign("STATUT-NEW", $new);
Пример #29
0
        //清除session
        //session_destroy();
        //跳转到首页
        location('恭喜您修改成功!', 'userzone.php');
    } else {
        //关闭数据库
        close();
        //session_destroy();
        //跳转到首页
        location('修改失败', 'modify.php');
    }
}
//是否登录状态
if (isset($_COOKIE['username'])) {
    //获取数据
    $rows = fetch_array("SELECT bbs_username,bbs_sex,bbs_photo,bbs_email,bbs_url,bbs_qq,bbs_switch,bbs_signature FROM bbs_users WHERE bbs_username='******'username']}'");
    //判断用户是否存在
    if ($rows) {
        $html = array();
        $html['username'] = $rows['bbs_username'];
        $html['sex'] = $rows['bbs_sex'];
        $html['photo'] = $rows['bbs_photo'];
        $html['email'] = $rows['bbs_email'];
        $html['url'] = $rows['bbs_url'];
        $html['qq'] = $rows['bbs_qq'];
        $html['switch'] = $rows['bbs_switch'];
        $html['signature'] = $rows['bbs_signature'];
        $html = html($html);
        //性别
        if ($html['sex'] == '男') {
            $html['sex_html'] = '<label for="man" class="radio"><input type="radio" id="man" name="sex" value="男" checked >男 </label>
    <tr>
        <td colspan="2">
            <?php
            if (getgroup($_SESSION['username']) == "admins") {
                echo "<select class=\"chzn-select\" style=\"width:102%\" id=\"sel_user\">\n";
                $query = "SELECT * FROM ".$_SESSION['TBL_AUTH'] ." WHERE username !='local_noauth'";
                $result = perform_query($query, $dbLink, $_SERVER['PHP_SELF']);
                while($row = fetch_array($result)) {
                    $chpw_user = $row['username'];
                    echo "<option name=\"chpw_user\ value=\"$chpw_user\">".htmlentities($chpw_user)."</option>\n";
                }
                echo "</select>\n";
            } else {
                $query = "SELECT * FROM ".$_SESSION['TBL_AUTH'] ." WHERE username ='******'";
                $result = perform_query($query, $dbLink, $_SERVER['PHP_SELF']);
                while($row = fetch_array($result)) {
                    $chpw_user = $row['username'];
                    echo "<input type=\"hidden\" id=\"inp_user\" value=\"$chpw_user\">\n";
                    echo "Change Password for ".htmlentities($chpw_user)."\n";
                }
            }
            ?>
        </td>
    </tr>
        <?php
        if (getgroup($_SESSION['username']) != "admins") {
        ?>
    <tr>
        <td width="33%">
		    Old password:
		</td>