• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP num_rows函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中num_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP num_rows函数的具体用法?PHP num_rows怎么用?PHP num_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了num_rows函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: create_account

    function create_account()
    {
        if ($this->user['type'] != 1) {
            return 0;
        }
        if (strlen($_REQUEST['name']) < 2) {
            $this->html['shipon_account_output'] = "Name is too short.";
        } elseif (strlen($_REQUEST['username']) < 4) {
            $this->html['shipon_account_output'] = "Username must be at least 4 characters (" . strlen($_REQUEST['username']) . ").";
        } elseif (strlen($_REQUEST['password']) < 6) {
            $this->html['shipon_account_output'] = "Password must be at least 6 characters.";
        } else {
            $users_result = query("SELECT id FROM `" . $this->user['database'] . "`.accounts WHERE username=?", array($_REQUEST['username']));
            if (num_rows($users_result) < 1) {
                $id = query_r("INSERT INTO `" . $this->user['database'] . "`.accounts\n\t\t\t\t\t\t\t   (\n\t\t\t\t\t\t\t\t\t\tgroup_id, name, phone, ext, email, username, password, type\n\t\t\t\t\t\t\t   )\n\t\t\t\t\t\t\t   VALUES\n\t\t\t\t\t\t\t   (\n\t\t\t\t\t\t\t\t\t'" . $this->user['group'] . "', ?, ?, ?, ?, ?, ?, 2\n\t\t\t\t\t\t\t   )\n\t\t\t\t\t\t\t", array($_REQUEST['name'], $_REQUEST['phone'], $_REQUEST['ext'], $_REQUEST['email'], $_REQUEST['username'], md5($_REQUEST['password'])));
                query("INSERT INTO `" . $this->user['database'] . "`.sessions\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tid, session_id, timestamp\n\t\t\t\t\t\t)\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t'" . $id . "','0','0'\n\t\t\t\t\t\t)\n\t\t\t\t\t");
                $this->html['shipon_account_output'] = '<script type="text/javascript">
                                                                            jQuery("#shipon_account_popup").dialog("close");
                                                                            change_view("manage_accounts");
									</script>';
            } else {
                $this->html['shipon_account_output'] = "User already exists.";
            }
        }
    }
开发者ID:kamalspalace,项目名称:_CORE,代码行数:25,代码来源:account_manager.php


示例2: links

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;
}
开发者ID:squidjam,项目名称:LightNEasy,代码行数:33,代码来源:main.php


示例3: get_news

/**
 * returns $number news items from class $type
 */
function get_news($type, $number)
{
    $news = "SELECT `ID`, `timestamp`, `subject`, `body` FROM `news` WHERE `class`='{$type}' ORDER BY `ID` DESC LIMIT {$number}";
    connect_sql();
    $news = @query($news) or die("Error getting the news.");
    // see if we don't have any news
    if (num_rows($news) == 0) {
        return "No news.";
    } else {
        $to_return = "";
        while ($row = result($news)) {
            $id = $row->ID;
            $timestamp = $row->timestamp;
            $subject = stripslashes($row->subject);
            $body = $row->body;
            // convert line breaks to <br />'s
            $body = str_replace("\\r\\n", "<br />", $body);
            // for windows and IP protocols
            $body = str_replace("\\n", "<br />", $body);
            // for nix
            $body = str_replace("\\r", "<br />", $body);
            // for mac
            $body = stripslashes($body);
            $to_return .= $id . "::::" . $timestamp . "::::" . $subject . "::::" . $body . "_____";
        }
        return $to_return;
    }
    disconnect_sql();
}
开发者ID:kfr2,项目名称:phpmygrades,代码行数:32,代码来源:newslib.php


示例4: get_numrows

function get_numrows($sql)
{
    $result = query($sql);
    $rowlist = num_rows($result);
    mysql_free_result($result);
    return $rowlist;
}
开发者ID:lilili001,项目名称:think,代码行数:7,代码来源:mysql.php


示例5: init

 function init($data)
 {
     $history_xml = file_get_contents($this->user['folder'] . "/templates/history.xml");
     $xml = new SimpleXMLElement($history_xml);
     $req = array();
     $req['entries_per_page'] = 10;
     $req['search_string'] = isset($_REQUEST['search_string']) && $_REQUEST['search_string'] != 'Search' ? $_REQUEST['search_string'] : '';
     $req['sort_column'] = isset($_REQUEST['sort_by']) ? $_REQUEST['sort_by'] : 'id';
     $req['sort_order'] = isset($_REQUEST['sort_order']) ? $_REQUEST['sort_order'] : 'DESC';
     $req['start_row'] = isset($_REQUEST['data']) ? $_REQUEST['data'] * 10 + 1 : 1;
     $req['bill_to_code'] = $this->user['bill_to_code'];
     $search_string = "1";
     $s = "";
     $var_array = array();
     $fieldString = "id,ext_id,cons_name,sent,timestamp";
     if (isset($_REQUEST['search_string']) && $_REQUEST['search_string'] != "Search") {
         $s = $_REQUEST['search_string'];
         $search_string = "(id LIKE ? OR bill_id LIKE ? OR timestamp LIKE ? OR cons_name LIKE ?)";
         $var_array = array("%" . $s . "%", "%" . $s . "%", "%" . $s . "%", "%" . $s . "%");
     }
     $sort_by = 'id';
     if (isset($_REQUEST['sort_by'])) {
         $sort_by = $xml->content->column[(int) $_REQUEST['sort_by']]['key'];
     } else {
         $_REQUEST['sort_by'] = '0';
     }
     if (!isset($_REQUEST['sort_order'])) {
         $_REQUEST['sort_order'] = "DESC";
     }
     $history_result = query("SELECT " . $fieldString . " FROM `" . $this->user['database'] . "`.shipments\n\t\t\t\t\t\t\t\tWHERE group_id='" . $this->user['group'] . "' AND " . $search_string . " AND ext_id > 0 ORDER BY " . $sort_by . " " . $_REQUEST['sort_order'] . " \n\t\t\t\t\t\t\t\t LIMIT " . $data * $xml->entries_per_page . "," . $xml->entries_per_page, $var_array);
     $result_count = num_rows($history_result);
     $num_result = query("SELECT id FROM `" . $this->user['database'] . "`.shipments WHERE group_id='" . $this->user['group'] . "' AND " . $search_string . "  AND ext_id > 0", $var_array);
     $num = num_rows($num_result);
     $pageCount = ceil($num / $xml->entries_per_page);
     //	$titlebar_inputs =  "<input type='text' class='shipon_input' id='shipon_history_search' value='Search'>";
     //	$history = $this->get_field_header('100%', 'history', $titlebar_inputs);
     for ($i = 0; $i < $xml->entries_per_page; $i++) {
         if ($i < $result_count) {
             $shipment[] = fetch($history_result);
         }
     }
     $history .= $this->get_paged_footer("#history", $xml->entries_per_page, $pageCount, $xml->page_numbers);
     if (isset($_REQUEST['search_string'])) {
         $this->return['inputs']['shipon_history_search'] = $_REQUEST['search_string'];
     }
     if (isset($_REQUEST['sort_by'])) {
         $this->return['inputs']['shipon_history_sort_by'] = $_REQUEST['sort_by'];
     } else {
         $this->return['inputs']['shipon_history_sort_by'] = '0';
     }
     if (isset($_REQUEST['sort_order'])) {
         $this->return['inputs']['shipon_history_sort_order'] = $_REQUEST['sort_order'];
     }
     $pagination = $this->get_paged_footer("#history", $xml->entries_per_page, $pageCount, $xml->page_numbers);
     $this->smarty->assign('shipment', $shipment);
     $this->smarty->assign('request', $req);
     $this->smarty->assign('pagination', $pagination);
     $this->html['shipon_content'] = $this->smarty->fetch('history/history.tpl');
 }
开发者ID:kamalspalace,项目名称:_CORE,代码行数:59,代码来源:history.php


示例6: check_mail

/**
 * sees if the user has any new mail
 */
function check_mail()
{
    $user_id = $_SESSION['id'];
    connect_sql();
    $query = @query("SELECT * FROM `mail` WHERE `read`='0' AND `deleted`='0' AND `to`='{$user_id}'") or die("Error checking the database.");
    $number = num_rows($query);
    disconnect_sql();
    return $number;
}
开发者ID:kfr2,项目名称:phpmygrades,代码行数:12,代码来源:maillib.php


示例7: format_address_array

function format_address_array(&$return_array, $query_result, $attribute)
{
    if (num_rows($query_result)) {
        $address = fetch($query_result);
        $keys = array_keys($address);
        for ($i = 0; $i < count($keys); $i++) {
            $new_key = $attribute . $keys[$i];
            $return_array[$new_key] = $address[$keys[$i]];
        }
    }
}
开发者ID:kamalspalace,项目名称:_CORE,代码行数:11,代码来源:functions.php


示例8: Check_Password_Reset

function Check_Password_Reset($id, $code)
{
    $date = date("Y-m-d");
    $daterange = "'" . $date . " 00:00:00' AND '" . $date . " 23:59:59'";
    $query = "SELECT * FROM `users` WHERE `id`='" . $id . "' AND `password_reset_code`='" . $code . "' AND `password_reset_date` BETWEEN " . $daterange . ";";
    $users = query($query);
    if ($users && num_rows($users) === 1) {
        return true;
    } else {
        return false;
    }
}
开发者ID:Alamantus,项目名称:Lexiconga,代码行数:12,代码来源:passwordreset.php


示例9: send_mail_by_userid

function send_mail_by_userid($userid, $subject, $text)
{
    $userid = (int) $userid;
    $sql = "SELECT u.email\n\t\tFROM " . PREF . "users AS u\n\t\tWHERE u.id={$userid}\n\t\tLIMIT 1";
    $result = query($sql);
    $rows = num_rows($result);
    if (!$rows) {
        return;
    }
    $emails = fetch_row($result);
    return send_mail_to_first($emails, $subject, $text);
}
开发者ID:Bodigrim,项目名称:durmstrang,代码行数:12,代码来源:mail.php


示例10: libera_acesso

function libera_acesso($item, $id_conn)
{
    if ($_SESSION['admin'] == '0') {
        $sql = "SELECT tb_usuarioquaisacessos.usuarioquaisacessos_id FROM tb_acesso ";
        $sql .= "INNER JOIN tb_usuarioquaisacessos ON (tb_usuarioquaisacessos.acesso_id = tb_acesso.acesso_id) ";
        $sql .= "WHERE tb_acesso.acesso_nome='%s' ";
        $sql .= "AND tb_usuarioquaisacessos.usuario_id = '%s' LIMIT 1";
        $sql = sprintf($sql, mysql_real_escape_string($item), mysql_real_escape_string($_SESSION['usuario_id']));
        $acessou = execute_query($sql, $id_conn);
        if (!$acessou) {
            $messagem = 'Query Inválida: ' . mysql_error() . "\n";
            $messagem .= 'Pesquisa Inteira: ' . $sql;
            die($messagem);
        }
        if (num_rows($acessou) == 0) {
            header("Location: acesso_proibido.php");
            exit(0);
        }
    }
}
开发者ID:kureshio,项目名称:colecao,代码行数:20,代码来源:funcao.php


示例11: loginbypost

function loginbypost()
{
    global $LU, $attempt;
    $post_get = new GetVarClass();
    $email = $post_get->getemail("email");
    $pw = $post_get->getvar("pw");
    if (!$email || !$pw) {
        return 0;
    }
    $subquery = "u.email='{$email}'";
    $attempt = 1;
    $sql = "SELECT u.id,u.pw\n\t\tFROM " . PREF . "users AS u\n\t\tWHERE {$subquery} AND (u.pwhash=MD5('{$pw}') OR '{$LU["moderid"]}'<>0) AND u.active\n\t\tLIMIT 1";
    $result = query($sql);
    $rows = num_rows($result);
    if ($rows) {
        list($LU["id"], $knownpw) = fetch_row($result);
        if (!ALLOWMULTISESSIONS) {
            dropallsessions($LU["id"]);
        }
    }
    return $rows;
}
开发者ID:Bodigrim,项目名称:durmstrang,代码行数:22,代码来源:login.php


示例12: lookup

	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 * FROM lzecs" .
			" WHERE name = '{$name}' LIMIT 1",
			$this->dbLink, $_SERVER['PHP_SELF']
		);

		if(! num_rows($result) > 0)
			return false;

		$data = array();
		$row  = fetch_array($result, "ASSOC");

		array_push($data, $name);
		array_push($data, $row['preg_msg']);
		array_push($data, $row['explanation']);
		array_push($data, $row['action']);
		array_push($data, $row['si']);
		array_push($data, $row['psr']);
		array_push($data, $row['suppress']);
		array_push($data, $row['trig_amt']);
		array_push($data, $row['trig_win']);
		array_push($data, $row['vendor']);
		array_push($data, $row['type']);
		array_push($data, $row['class']);
		array_push($data, $row['lastupdate']);
		$this->cacheStore($name, $data);

		return $data;
	}
开发者ID:Russell-IO,项目名称:php-syslog-ng,代码行数:38,代码来源:LZECS.class.php


示例13: lookup

 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;
 }
开发者ID:jeroenrnl,项目名称:php-syslog-ng,代码行数:23,代码来源:CEMDB.class.php


示例14: downloads

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;
}
开发者ID:squidjam,项目名称:LightNEasy,代码行数:36,代码来源:main.php


示例15: values

    $msgsave = "Suppression effectuée";
}
if ($_POST["mode"] == "ajout") {
    //vérification des droit du compte
    $sql = "insert into " . __racinebd__ . "categorie_compte (libelle,compte_id) values('" . addquote($_POST["libelle"]) . "'," . $_SESSION["compte_id"] . ")";
    //print $sql."<br>";
    $link = query($sql);
    $msgsave = "ajout";
}
if ($_POST["id"] != "" && $_POST["mode"] == "modif") {
    //vérification des droit du compte
    $sql = "update " . __racinebd__ . "categorie_compte set libelle ='" . addquote($_POST["libelle"]) . "'  where categorie_compte_id=" . $_POST["id"] . " and compte_id=" . $_SESSION["compte_id"];
    //print $sql."<br>";
    $link = query($sql);
    $msgsave = "modif";
}
$sql = "select * from " . __racinebd__ . "categorie_compte where compte_id=" . $_SESSION["compte_id"] . " and supprimer=0 order by libelle";
//$sql="select tlc.*,count(lc.device_id) as nb from ".__racinebd__."categorie_compte tlc left join ".__racinebd__."device lc on tlc.categorie_compte_id=lc.categorie_id and lc.supprimer=0 where tlc.supprimer=0 and lc.compte_id=".$_SESSION["compte_id"]." group by tlc.categorie_compte_id order by libelle";
$link = query($sql);
while ($tbl = fetch($link)) {
    $sql = "select * from " . __racinebd__ . "categorie_compte_device ccd inner join " . __racinebd__ . "device d on d.device_id=ccd.device_id and supprimer=0 and categorie_compte_id=" . $tbl["categorie_compte_id"];
    $link2 = query($sql);
    $tbl["nb"] = num_rows($link2);
    $tbl_list_categorie[] = $tbl;
    //  $key_list_agence[$tbl["categorie_compte_id"]]=$tbl["libelle"];
}
if ($_POST["id"] != "" && $_POST["mode"] == "") {
    $sql = "select * from " . __racinebd__ . "categorie_compte where compte_id=" . $_SESSION["compte_id"] . " and categorie_compte_id=" . $_POST["id"] . " order by libelle";
    $link = query($sql);
    $tbl_modif_categorie = fetch($link);
}
开发者ID:jcmwc,项目名称:fleet,代码行数:31,代码来源:parametre-catveh.php


示例16: Get_Dictionary_Words

function Get_Dictionary_Words($dictionary)
{
    $query = "SELECT `w`.`word_id`, `w`.`name`, `w`.`pronunciation`, `w`.`part_of_speech`, `w`.`simple_definition`, `w`.`long_definition` ";
    $query .= "FROM `words` AS `w` LEFT JOIN `dictionaries` AS `d` ON `w`.`dictionary`=`d`.`id` WHERE `w`.`dictionary`=" . $dictionary . " ";
    $query .= "ORDER BY IF(`d`.`sort_by_equivalent`, `w`.`simple_definition`, `w`.`name`) COLLATE utf8_unicode_ci;";
    $words = query($query);
    $results = "";
    $processed = 0;
    if ($words) {
        if (num_rows($words) > 0) {
            while ($word = fetch($words)) {
                $results .= '{"name":"' . $word['name'] . '",';
                $results .= '"pronunciation":"' . $word['pronunciation'] . '",';
                $results .= '"partOfSpeech":"' . $word['part_of_speech'] . '",';
                $results .= '"simpleDefinition":"' . $word['simple_definition'] . '",';
                $results .= '"longDefinition":"' . $word['long_definition'] . '",';
                $results .= '"wordId":' . $word['word_id'] . '}';
                // If it's the last one, then don't add a comma.
                if (++$processed < num_rows($words)) {
                    $results .= ",";
                }
            }
        }
    }
    return $results;
}
开发者ID:Alamantus,项目名称:Lexiconga,代码行数:26,代码来源:ajax_dictionarymanagement.php


示例17: array

            $retorno[] = array('nome' => utf8_encode($linhas[0]), 'info' => stripslashes(utf8_encode($linhas[1])), 'ativo' => $linhas[2]);
        }
    }
}
if (isset($_GET['familia'])) {
    $sql = 'SELECT ';
    $sql .= 'tb_genero.genero_id, tb_genero.genero_nome ';
    $sql .= 'FROM ';
    $sql .= 'tb_genero ';
    $sql .= 'INNER JOIN tb_familiaquaisgeneros ON (tb_familiaquaisgeneros.genero_id = tb_genero.genero_id) ';
    $sql .= 'WHERE ';
    $sql .= 'tb_familiaquaisgeneros.familia_id=' . $_GET['familia'] . ' ';
    $sql .= 'ORDER BY tb_genero.genero_nome';
    $retorno_banco = execute_query($sql, $id_conn);
    if ($retorno_banco) {
        if (num_rows($retorno_banco) > 0) {
            while ($linhas = fetch_array($retorno_banco)) {
                $retorno[] = array('id' => $linhas[0], 'nome' => utf8_encode($linhas[1]));
            }
        } else {
            $retorno[] = array('id' => '-1', 'sql' => 'Não há gêneros para a família');
        }
    } else {
        $retorno[] = array('id' => '0', 'sql' => $sql);
    }
}
if (isset($_GET['generos'])) {
    $sql = 'SELECT ';
    $sql .= 'genero_id, genero_nome ';
    $sql .= 'FROM tb_genero ';
    $sql .= 'WHERE NOT EXISTS ';
开发者ID:kureshio,项目名称:colecao,代码行数:31,代码来源:genero.php


示例18: and

 if (count($tab_path_info) > 2 && !__showlang__ || count($tab_path_info) >= 2 && __showlang__) {
     //print "ici6";
     //recherche de l'arbre_id
     /*
           for($i=3;$i<count($tab_path_info);$i++){
             $j=$i-2;
             $jointure.=" inner join ".__racinebd__."arbre a".$j." on a".$j.".arbre_id=a".($j-1).".pere inner join ".__racinebd__."contenu c".$j." on a".$j.".arbre_id=c".$j.".arbre_id and c".$j.".langue_id=".$_GET["la_langue"]." and c".$j.".nom='".$tab_path_info[count($tab_path_info)-($i-1)]."'";
           }*/
     for ($i = 2; $i < count($tab_path_info) - 1; $i++) {
         $j = $i - 1;
         $jointure .= " inner join " . __racinebd__ . "arbre a" . $j . " on a" . $j . ".arbre_id=a" . ($j - 1) . ".pere inner join " . __racinebd__ . "contenu c" . $j . " on a" . $j . ".arbre_id=c" . $j . ".arbre_id and c" . $j . ".langue_id=" . $_GET["la_langue"] . " and c" . $j . ".nom='" . $tab_path_info[count($tab_path_info) - $i] . "'";
     }
     $sql = "select a0.*,c.*,nom_fichier from \r\n      " . __racinebd__ . "arbre a0 \r\n      {$jointure} inner join\r\n      " . __racinebd__ . "contenu c on a0.arbre_id=c.arbre_id and c.langue_id=" . $_GET["la_langue"] . " inner join " . __racinebd__ . "gabarit g on g.gabarit_id=a0.gabarit_id \r\n      where c.nom ='" . $tab_path_info[count($tab_path_info) - 1] . "' and a0.etat_id=" . $_GET["etat_id"] . " and a0.supprimer=0 and (a0.root=" . __defaultfather__ . " or a0.root is null) " . $wheresecure2;
     $link = query($sql);
     //print $sql;
     if (num_rows($link) > 0) {
         $tbl_result = fetch($link);
         //print $tbl_result["root"];
         //print "ici";
         if (count($tab_path_info) > 2) {
             //recherche de l'arbre_id root
             $sql2 = "select a.arbre_id,a.pere from " . __racinebd__ . "contenu c inner join " . __racinebd__ . "arbre a on c.arbre_id=a.arbre_id where nom = '" . $tab_path_info[2] . "' and pere is null and supprimer=0 and langue_id=" . $_GET["la_langue"];
             $link2 = query($sql2);
             $tbl_result2 = fetch($link2);
             $_GET["root"] = $tbl_result2["arbre_id"];
             $_GET["ordre_root"] = $tbl_result2["ordre"];
             $_GET["arbre"] = $tbl_result["arbre_id"];
             $_GET["pere"] = $tbl_result["pere"];
             if (count($tab_path_info) > 3 && $_GET["root"] != "") {
                 $sql2 = "select a.arbre_id from " . __racinebd__ . "contenu c inner join " . __racinebd__ . "arbre a on c.arbre_id=a.arbre_id where nom = '" . $tab_path_info[3] . "' and pere =" . $_GET["root"] . " and supprimer=0 and langue_id=" . $_GET["la_langue"];
                 $link2 = query($sql2);
开发者ID:jcmwc,项目名称:fleet,代码行数:31,代码来源:index.php


示例19: uploads

function uploads()
{
    global $uploadsmessage, $prefix, $set;
    if (file_exists("addons/uploads/lang/lang_" . $set['language'] . ".php")) {
        require_once "addons/uploads/lang/lang_" . $set['language'] . ".php";
    } else {
        require_once "addons/uploads/lang/lang_en_US.php";
    }
    require_once "addons/uploads/settings.php";
    if (!($crow = fetch_array(dbquery("SELECT * FROM " . $prefix . "downloadscat WHERE nome=\"Uploads\"")))) {
        dbquery("INSERT INTO " . $prefix . "downloadscat (id, nome, descr) VALUES (null, \"Uploads\", \"Users upload here\")");
        $crow = fetch_array(dbquery("SELECT * FROM " . $prefix . "downloadscat WHERE nome=\"Uploads\""));
    }
    $message = "";
    if ($_POST['submitupload'] == "Add Upload") {
        if ($_POST['secCode'] != $_SESSION['operation']) {
            $message = $uploadsmessage[8];
        } else {
            $succeded = false;
            $message = $_FILES["file"]["error"];
            if ($_FILES['uploadedfile']['name'] != "") {
                $_FILES['uploadedfile']['name'] = str_replace(" ", "_", $_FILES['uploadedfile']['name']);
                $target_path = "./uploads/" . basename($_FILES['uploadedfile']['name']);
                if (file_exists($target_path)) {
                    unlink($target_path);
                }
                if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
                    $succeded = true;
                    $message = $uploadsmessage[12];
                    @chmod($target_path, 0644);
                } else {
                    $message = $uploadsmessage[11];
                }
            } else {
                $message = $uploadsmessage[9];
            }
            if ($succeded) {
                $filenam = basename($_FILES['uploadedfile']['name']);
                $query = "INSERT INTO " . $prefix . "downloads (reg,nome,file,downloads,ex) VALUES (null,\"" . encode(sanitize($_POST['nome'])) . "\",\"{$filenam}\", 0, " . sanitize($_POST['cat']) . ")";
                if (!dbquery($query)) {
                    $message = $uploadsmessage[10];
                }
            }
        }
    } else {
        if ($_SESSION['adminlevel'] >= $adminlevel) {
            $out .= "\n<div id=\"LNE_show\">\n";
            $out .= "<div align=\"center\">\n<h3>{$uploadsmessage['5']}</h3>\n";
            $out .= "<form enctype=\"multipart/form-data\" method=\"post\" action=\"\"><fieldset style=\"border: 0;\"><table>\n";
            $out .= "<tr><td align=\"right\"><input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"{$max_upload_file_size}\" /><b>{$uploadsmessage['13']}:&nbsp;</b></td>";
            $out .= "<td><input type=\"text\" name=\"nome\" style=\"width: 100%;\" /></td></tr>\n";
            $out .= "<tr><td align=\"right\"><b>{$uploadsmessage['5']}:&nbsp;</b></td><td><input style=\" text-align: left;\" name=\"uploadedfile\" type=\"file\" name=\"uploadfile\" />\n</td></tr>\n";
            $out .= "<tr><td align=\"right\"><b>{$uploadsmessage['6']}:&nbsp;</b></td>\n";
            if ($set['catchpa'] == "0") {
                //text catchpa
                srand((double) microtime() * 1000000);
                $a = rand(0, 9);
                $b = rand(0, 9);
                $c = $a + $b;
                $out .= "<td>{$a} + {$b} = ";
                $_SESSION['operation'] = $c;
                $out .= "<input type=\"text\" name=\"secCode\" maxlength=\"2\" style=\"width:20px\" /></td></tr>\n";
            } else {
                // image catchpa
                $out .= "<td>";
                $out .= catchpa();
                /*				$out.="<img src=\"./LightNEasy/seccode.php\" width=\"71\" height=\"21\" align=\"absmiddle\" />"; */
                $out .= "</td></tr>\n";
            }
            $out .= "<tr><td></td><td><input type=\"hidden\" name=\"cat\" value=\"" . $crow['id'] . "\" /><input type=\"hidden\" name=\"submitupload\" value=\"Add Upload\" />\n";
            $out .= "<input type=\"submit\" name=\"aaa\" value=\"{$uploadsmessage['7']}\" />\n";
            $out .= "</td><td>&nbsp</td></tr>\n</table>\n</fieldset>\n</form>\n</div>\n";
        } else {
            $out .= "<h3>{$uploadsmessage['21']}</h3>\n";
        }
    }
    if ($message != "") {
        $out .= "<h3 style=\"color: red;\">{$message}</h3>\n";
    }
    if (!($result = dbquery("SELECT * FROM " . $prefix . "downloads WHERE ex=" . $crow['id'] . " ORDER BY reg DESC"))) {
        die($uploadsmessage[3]);
    }
    $out .= "<h3>{$uploadsmessage['14']}</h3>\n";
    if (num_rows($result)) {
        $GETarray = $_GET;
        $out .= "<ul>";
        while ($row = fetch_array($result)) {
            $GETarray['dlid'] = $row['reg'];
            $out .= "<li>" . decode($row['nome']) . "</li>\n";
        }
        $out .= "</ul>";
    } else {
        $out .= "<h3>{$uploadsmessage['4']}</h3>";
    }
    $out .= "</div>\n";
    return $out;
}
开发者ID:squidjam,项目名称:LightNEasy,代码行数:97,代码来源:main.php


示例20: grant_access

function grant_access($userName, $actionName, $link)
{
    // If ACL is not used then always return TRUE
    if (!defined('USE_ACL') || !USE_ACL || !defined('REQUIRE_AUTH') || !REQUIRE_AUTH) {
        return TRUE;
    }
    // Get user access
    $sql = "SELECT access FROM " . USER_ACCESS_TABLE . " WHERE username='" . $userName . "' \n\t\t\tAND actionname='" . $actionName . "'";
    $result = perform_query($sql, $link);
    $row = fetch_array($result);
    if (num_rows($result) && $row['access'] == 'TRUE') {
        return TRUE;
    } else {
        $sql = "SELECT defaultaccess FROM " . ACTION_TABLE . " WHERE actionname='" . $actionName . "'";
        $result = perform_query($sql, $link);
        $row = fetch_array($result);
        if ($row['defaultaccess'] == 'TRUE') {
            return TRUE;
        } else {
            return FALSE;
        }
    }
}
开发者ID:jeroenrnl,项目名称:php-syslog-ng,代码行数:23,代码来源:common_funcs.php



注:本文中的num_rows函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP number函数代码示例发布时间:2022-05-15
下一篇:
PHP num_rand函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap