本文整理汇总了PHP中getuser函数的典型用法代码示例。如果您正苦于以下问题:PHP getuser函数的具体用法?PHP getuser怎么用?PHP getuser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getuser函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: shownews
function shownews($id)
{
global $list_prefix, $NEWS, $MAIN;
$sql = "SELECT * FROM " . $list_prefix . "news WHERE id = '" . $id . "';";
$result = db_query($sql);
$rows = db_num_rows($result);
if ($rows != 0) {
$row = db_fetch_array($result);
$postedby = getuser($row['posted_by']);
//lets insert the prayerrequest into our working copy of this template.
$WORK = insert_into_template($NEWS, "{NEWSTITLE}", stripslashes($row['news_title']));
$WORK = insert_into_template($WORK, "{TEASER}", stripslashes($row['teaser']));
$WORK = insert_into_template($WORK, "{NEWSID}", $row['id']);
$WORK = insert_into_template($WORK, "{POSTEDBY}", $postedby);
$WORK = insert_into_template($WORK, "{BYLINE}", $row['byline']);
$WORK = insert_into_template($WORK, "{DATE}", date("m/d/Y", $row['date']));
$WORK = insert_into_template($WORK, "{CATEGORY}", getcatname($row['category']));
$WORK = insert_into_template($WORK, "{NEWS}", stripslashes($row['news']));
$i++;
//now lets add this request to the CONTENT.
$WORK = insert_into_template($MAIN, "{CONTENT}", $WORK);
$WORK = filltemplate($WORK, striphtml($row['news_title']));
printf("%s", striptemplate($WORK));
}
}
开发者ID:BackupTheBerlios,项目名称:fishcms-svn,代码行数:25,代码来源:news_item.php
示例2: forum_notify
function forum_notify()
{
global $form, $db, $tab, $login, $threadid, $postid, $thisthread, $thisboard, $httpurl, $sendmail;
$userq = $db->query_str("SELECT * FROM {$tab['forum_notify']} WHERE threadid='{$threadid}' AND userid!='{$login['id']}'");
while ($notify = $db->fetch_array($userq)) {
$user = getuser($notify[userid]);
eval("\$mail[header] = \"" . gettemplate("forum.notify.mail.header") . "\";");
eval("\$mail[subject] = \"" . gettemplate("forum.notify.mail.subject") . "\";");
eval("\$mail[body] = \"" . gettemplate("forum.notify.mail.body") . "\";");
$sendmail->mail($user[user_email], $mail[subject], $mail[body], $mail[header]);
}
}
开发者ID:BackupTheBerlios,项目名称:swora,代码行数:12,代码来源:f_forum.php
示例3: all_action
function all_action()
{
global $session;
$uid = $session->get('uid');
//前20个推荐的采集
$pins = bidcms_encode(getallpins());
$userinfo = array();
if ($uid > 0) {
$userinfo = getuser($uid, 0, 1);
}
include template('index_all');
}
开发者ID:Tolecen,项目名称:YouthFundWebSite,代码行数:12,代码来源:index.class.php
示例4: getarticles
function getarticles($perpage)
{
global $list_prefix;
$ARTICLES = loadtmplate("articles.mod");
$CONTENT = "";
//lets calculate our query
$sql = "SELECT * FROM " . $list_prefix . "articles ORDER BY `date` DESC LIMIT 0," . $perpage . ";";
//now lets show the prayerlist entries.
$result = db_query($sql);
if ($result) {
$rows = db_num_rows($result);
} else {
$rows = 0;
}
if ($rows != 0) {
$j = 0;
while ($j < $rows) {
//lets fetch our prayer request from the database.
$row = db_fetch_array($result);
$postedby = getuser($row['posted_by']);
//lets insert the prayerrequest into our working copy of this template.
$WORK = insert_into_template($ARTICLES, "{ARTICLETITLE}", stripslashes($row['article_title']));
$WORK = insert_into_template($WORK, "{TEASER}", stripslashes($row['teaser']));
$WORK = insert_into_template($WORK, "{ARTICLEID}", $row['id']);
$WORK = insert_into_template($WORK, "{POSTEDBY}", $postedby);
$WORK = insert_into_template($WORK, "{BYLINE}", $row['byline']);
$WORK = insert_into_template($WORK, "{DATE}", date("m/d/Y", $row['date']));
$WORK = insert_into_template($WORK, "{CATEGORY}", getcatname($row['category']));
$j++;
//now lets add this request to the CONTENT.
$CONTENT .= $WORK;
}
} else {
$CONTENT .= "There are no active articles at this time.<BR>\r\n";
}
//when we output this lets make sure that the output is stripped of any template elements that are not used.
return striptemplate($CONTENT);
}
开发者ID:BackupTheBerlios,项目名称:fishcms-svn,代码行数:38,代码来源:articles.mod.php
示例5: getuser
<?php
include "../lib/mainfunc.php";
$bid = @$_GET['bid'];
$tid = @$_GET['tid'];
$page = @$_GET['p'];
$see_lz = @$_GET['see_lz'];
$users = getuser();
$currentuser = $users['username'];
if (!$page) {
$page = 1;
}
if (!$bid) {
$bid = 1;
}
if (!$tid) {
$tid = 1;
}
$data = mainfunc(array("bid" => $bid, "tid" => $tid, "p" => $page, "see_lz" => $see_lz), null);
$tdata = mainfunc(array("bid" => $bid, "tid" => $tid, "ask" => "tidinfo"));
$floordata = "";
if ($see_lz != "") {
$floordata = mainfunc(array("bid" => $bid, "tid" => $tid, "ask" => "getlznum"));
$floordata = $floordata[0];
}
if (count($tdata) == 0) {
$tdata = null;
} else {
$tdata = $tdata[0];
}
if ($floordata != "") {
开发者ID:hun-tun,项目名称:CAPUBBS,代码行数:31,代码来源:index.php
示例6: getuser
include 'function.php';
?>
<?php
include 'header.php';
?>
<div class='container'>
<?php
$pid = $_GET['pid'];
if (isset($_GET['uid']) && !empty($_GET['uid'])) {
$uid = $_GET['uid'];
} else {
$uid = $_SESSION['myid'];
}
$myid = $_SESSION['myid'];
$username = getuser($uid, 'user_name');
?>
<h3><?php
echo $username;
?>
</h3>
<?php
$query = "select location from pins where pid = '{$pid}'";
$result = $conn->query($query);
$run = $result->fetch_array();
$location = $run['location'];
?>
<h4>Pin from: <a href='locphoto.php?location=<?php
echo $location;
?>
'><?php
开发者ID:Gaaralmn,项目名称:myPinterest,代码行数:31,代码来源:viewphoto.php
示例7: mysql_query
<?php
include 'connect.php';
?>
<?php
include 'functions.php';
?>
<?php
include 'header.php';
?>
<div class="container">
<h3>Friends</h3>
<?php
$my_id = $_SESSION['user_id'];
$req_query = mysql_query("SELECT user_one, user_two FROM friends WHERE user_one='{$my_id}' OR user_two='{$my_id}'");
while ($run_req = mysql_fetch_array($req_query)) {
$user_one = $run_req['user_one'];
$user_two = $run_req['user_two'];
if ($user_one == $my_id) {
$user = $user_two;
} else {
$user = $user_one;
}
$username = getuser($user, 'username');
echo "<a class='box' style='display: block;' href='profile.php?user={$user}'>{$username}</a>";
}
?>
</div>
</body>
</html>
开发者ID:romanchelsea,项目名称:php-practice,代码行数:31,代码来源:friends.php
示例8: getuser
?>
<div class="container">
<div class="row">
<div class=" col-sm-8 col-sm-offset-2">
<div class="panel panel-primary">
<div class="panel-heading" >
<?php
echo $post['title'];
?>
by
<a href="user.php?id=<?php
echo $post['user_id'];
?>
">
<?php
$c = getuser($post['user_id']);
echo $c['username'];
?>
</a>
<span style="float:right">
<?php
echo " posted on " . $post['created'];
?>
</span>
</div>
<div class="panel-body" style="color:#191970">
<p class="text-center">
<?php
$a = getimage($post['image_id']);
if ($a) {
echo '<img class="panel" src="images/' . $a['filename'] . '">';
开发者ID:k0hei000,项目名称:connect_new,代码行数:31,代码来源:university.php
示例9: isset
<?php
require_once '../inc/common.php';
$type = isset($_GET['type']) ? (int) $_GET['type'] : 0;
$user = getuser('mid,name,headimgurl');
$user['headimgurl'] = empty($user['headimgurl']) ? '../images/touxiang.png' : $user['headimgurl'];
$pageSize = 5;
$sql = "SELECT count(1) as count FROM m_comment WHERE mid = '{$user['mid']}' AND type = 0";
$sth = $db->prepare($sql);
$sth->execute();
$count = $sth->fetchColumn();
$pageTotal = ceil($count / $pageSize);
if (isset($_GET['aj_comm'])) {
if ($type == 0) {
$table = 'm_goods';
} elseif ($type == 1) {
$table = 'm_activites';
}
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
//获取请求的页数
$start = ($page - 1) * $pageSize;
$sql = "SELECT c.cid,c.pid,c.ctime,c.nice,c.imgs,c.content,g.name FROM m_comment as c\r\n\t\t\t\tLEFT JOIN {$table} as g ON c.pid = g.gid\r\n\t\t\t\tWHERE c.mid = '{$user['mid']}' AND c.type = '{$type}' ORDER BY c.ctime DESC LIMIT {$start}, {$pageSize}";
$sth = $db->prepare($sql);
$sth->execute();
$data = $sth->fetchAll(PDO::FETCH_ASSOC);
foreach ($data as $k => $v) {
$data[$k]['ctime'] = date('Y-m-d', $v['ctime']);
$data[$k]['imgs'] = explode('|', $v['imgs']);
}
die(json_encode($data));
//转换为json数据输出
开发者ID:noikiy,项目名称:meilala,代码行数:31,代码来源:my_comment.php
示例10: mysql_query
href="#collapseOne">
<span class="glyphicon glyphicon-chevron-down"></span>
</a>
</div>
</div>
<div class="panel-collapse collapse" id="collapseOne">
<div class="panel-body" >
<?php
require_once 'include/db_connect.php';
if (isset($_GET['user']) and isset($_GET['hash'])) {
$hash = $_GET['hash'];
$user = $_GET['user'];
$ext = mysql_query("select * from conversation where chash='{$hash}' ");
while ($row = mysql_fetch_array($ext)) {
$cfrom = $row['cfrom'];
$cfrom1 = getuser($cfrom, 'user_name');
$msg = $row['msg'];
echo "<ul class='chat'>\n <li class='left clearfix'><span class='chat-img pull-left'>\n <img src='img/user.png' height='50' width='50' alt='User Avatar' class='img-circle' />\n </span>\n <div class='chat-body clearfix'>\n <div class='header'>\n <strong class='primary-font'>" . $cfrom1 . "</strong> <small class='pull-right text-muted'>\n <span class='glyphicon glyphicon-time'></span></small>\n </div>\n <p>\n " . $msg . "\n </p>\n </div>\n </li>\n </ul>";
}
}
?>
</div>
<form action="chatupdate.php" method="post">
<div class="panel-footer">
<div class="input-group">
<input id="btn-input" type="text" class="form-control input-sm" name="message" placeholder="Type your message
here..." />
<input type="hidden" name="user" value="<?php
echo $user;
?>
开发者ID:syed-mudasir,项目名称:social-network,代码行数:31,代码来源:chatbox.php
示例11: getavatar
$ava1 = getavatar($row['user_id'], 'avatar');
$ava = "<img src='{$ava1}' height='30' width='30' class=>";
$tim = $row['time'];
$hash = $row['ghash'];
echo "<div class='post'><div class='panel panel-default'>\n <div class='panel-heading'>" . $ava . $postn . "</div>\n <div class='panel-body'>" . $row['message'] . "\n \n </div><div class='panel-footer'>Posted at  " . $tim . "</div>\n</div>\n </div></div>";
}
if ($type == 'image') {
$postn = getuser($row['user_id'], 'fname');
$ava1 = getavatar($row['user_id'], 'avatar');
$ava = "<img src='{$ava1}' height='30' width='30'>";
$pim = $row['pimage'];
$pim1 = "<img src='{$pim}' class='img-responsive center-block'>";
echo "<div class='post'><div class='panel panel-default'>\n <div class='panel-heading'>" . $ava . $postn . "</div>\n <div class='panel-body'>" . $row['message'] . $pim1 . "\n \n </div>\n </div></div>";
}
if ($type == 'video') {
$postn = getuser($row['user_id'], 'fname');
$ava1 = getavatar($row['user_id'], 'avatar');
$ava = "<img src='{$ava1}' height='30' width='30'>";
$url = $row['url'];
$vi = " <iframe src='{$url}'\n frameborder='0' width='476' height='400'\n allowfullscreen ></iframe >";
echo "<div class='post'><div class='panel panel-default'>\n <div class='panel-heading'>" . $ava . $postn . "</div>\n <div class='panel-body'>" . $row['message'] . $vi . "\n \n </div>\n </div></div>";
}
if ($type == 'location') {
$postn = getuser($row['user_id'], 'fname');
$ava1 = getavatar($row['user_id'], 'avatar');
$ava = "<img src='{$ava1}' height='30' width='30'>";
$pla = $row['place'];
echo "<div class='post'><div class='panel panel-default'>\n <div class='panel-heading'>" . $ava . $postn . "</div>\n <div class='panel-body'>" . $row['message'] . "<br>" . $pla . "\n \n </div>\n </div></div>";
}
}
require_once 'footer.php';
开发者ID:syed-mudasir,项目名称:social-network,代码行数:31,代码来源:y.php
示例12: mysql_query
<?php
require_once 'header.php';
?>
<div id="bo">
<?php
require_once 'include/db_connect.php';
require_once 'include/essential.php';
?>
<?php
require_once 'include/db_connect.php';
require_once 'functions.php';
require_once 'include/essential.php';
echo "<h1>Chat List</h1><br>";
$fr = mysql_query("select user_one,user_two from frnd where user_one='{$pid1}' or user_two='{$pid1}'");
while ($frn = mysql_fetch_array($fr)) {
if ($frn['user_one'] == $pid1) {
$frnid = $frn['user_two'];
} else {
$frnid = $frn['user_one'];
}
$frname = getuser($frnid, 'user_name');
echo "<a href='chatbox.php?user={$frnid}'class='btn btn-default btn-lg'style=margin:5px;>{$frname}</a><br><br>";
}
?>
</div>
</body>
<?php
require_once 'footer.php';
?>
</html>
开发者ID:syed-mudasir,项目名称:social-network,代码行数:30,代码来源:chat.php
示例13: t_fanli
function t_fanli($uid, $money)
{
global $_G;
$org_money = $money;
if ($uid == $this->user['uid']) {
$user = $this->user;
} else {
$user = getuser($uid, 'uid');
}
//if($user['uid'] == $this->user[uid]) return $money;
//if($user['t_uid'] && $user['t_uid'] == $this->user[uid]) return $money; //防止死循环
//4,3,1,1,2
$rank = $user['rank'];
if (!$rank || !$_G['rank'][$rank]) {
return $money;
}
$group = $_G['rank'][$rank];
$bili = intval($group['bili']);
//当前推荐者所在推荐的返利比例
if ($bili <= 0) {
return $money;
}
$yongjin = fix($money * ($bili / 100), 2);
$money = $money - $yongjin;
//给佣金表,增加记录,供用户查询
$log = array();
//第'.($k+1).'级
if (!$this->order['price'] || $yongjin <= 0) {
return $money;
}
$log['desc'] = '您推荐的用户' . $this->user['username'] . '购物消费,您获得:' . $yongjin . '元(' . $bili . '%)';
$add_money = $user['money'] + $yongjin;
update_member(array('money' => $add_money), $user['uid']);
$log['org_money'] = $user['money'];
$log['money'] = $yongjin;
$log['status'] = 1;
$log['uid'] = $user['uid'];
$log['username'] = $user['username'];
$this->write_log($log);
//无限上级推荐人返利
/*if($user['t_uid']>0){
if($user['t_uid'] == $this->user['uid'] || $user['t_uid'] == $user['uid'])continue; //防止死循环
$money = $this->t_fanli($user['t_uid'],$org_money);
}*/
return $money;
}
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:46,代码来源:fanliBase.class.php
示例14: connect
<div id="wrap">
<div id="header"></div>
<div id="main"><p>
<p><span class="pagetitle">User Account</span></p>
<?php
connect();
//printf('<br />roleid: '.$_SESSION['role_id'].'');
if ($_SESSION['role_id'] == 1) {
printf('Only editors may view this page.');
printf('<script type="text/javascript">
location.replace("author.php");
</script>');
}
$uid = $_GET['perid'];
$arruser = getuser($uid);
$fname = $arruser['fname'];
$lname = $arruser['lname'];
$street = $arruser['street'];
$city = $arruser['city'];
$province = $arruser['province'];
$postal = $arruser['postal'];
$email = $arruser['email'];
$uid = $arruser['per_id'];
$active = $arruser['active'];
printf('<span class="edituser">');
printf('<form name="reg" action="updateuser.php" onsubmit="return validateForm();" method="post" >');
printf('<table>');
printf('<tr><td></td><td><input type=hidden name="uid" value="' . $uid . '"></td></tr>');
printf('<tr><td>Username:</td><td>' . $arruser['uname'] . '</td></tr>');
printf('<tr><td>First name:</td><td><input type=text name="ufname" value="' . $fname . '" size="50"></td></tr>');
开发者ID:bamzy,项目名称:newest-press,代码行数:31,代码来源:viewauthor.php
示例15: delete_account
function delete_account($usrid)
{
// ------------------ DELETE ACCOUNT ---------------
$usr = @getuser($usrid);
if ($usr !== false) {
$c = $usr['cluster'];
if ($c != '') {
$c = @mysql_num_rows(@db_query('SELECT * FROM users WHERE cluster=' . mysql_escape_string($c)));
if ($c < 2) {
deletecluster($c, true);
} else {
$r = db_query('SELECT id FROM users WHERE cluster=' . mysql_escape_string($usr['cluster']) . ' AND clusterstat=' . CS_ADMIN . ';');
$admins = @mysql_num_rows($r);
if ($usr['clusterstat'] == CS_ADMIN && $admins < 2) {
$r = db_query('SELECT * FROM users WHERE cluster=' . mysql_escape_string($usr['cluster']) . ';');
db_query('UPDATE users SET clusterstat=' . CS_ADMIN . ' WHERE id=' . mysql_result($r, 0, 'id') . ';');
}
}
}
db_query('DELETE FROM mails WHERE user=\'' . mysql_escape_string($usrid) . '\';');
db_query('DELETE FROM sysmsgs WHERE user=\'' . mysql_escape_string($usrid) . '\';');
db_query('DELETE FROM users WHERE id=\'' . mysql_escape_string($usrid) . '\';');
db_query('DELETE FROM abooks WHERE user=\'' . mysql_escape_string($usrid) . '\';');
return $usr;
} else {
return false;
}
}
开发者ID:dergriewatz,项目名称:htn-original,代码行数:28,代码来源:gres.php
示例16: getuser
<?php
require_once 'include/essential.php';
?>
<?php
require_once 'include/db_connect.php';
require_once 'functions.php';
if (isset($_GET['user']) && !empty($_GET['user'])) {
$lid = $_GET['user'];
} else {
$lid = $pid1;
}
$my_id = $pid1;
$luser = getuser($lid, 'user_name');
echo '<h2>' . $luser . '</h2>';
?>
<?php
if ($lid != $my_id) {
$checkfriends = mysql_query("select id from frnd where(user_one='{$my_id}' and user_two='{$lid}') or (user_one='{$lid}' and user_two='{$my_id}')");
if (mysql_num_rows($checkfriends) == 1) {
echo "<a href='#'class='btn btn-primary btn-lg'style=margin:5px;>already friends</a>   " . "<a href='action.php?action=unfriend&user={$lid}'class='btn btn-primary btn-lg'style=margin:5px;>unfriend</a>";
} else {
$from = mysql_query("select id from frnd_req where from1='{$lid}' and to1='{$my_id}'");
$to = mysql_query("select id from frnd_req where from1='{$my_id}' and to1='{$lid}'");
if (mysql_num_rows($from) == 1) {
echo "<a href='action.php?action=accept&user={$lid}'class='btn btn-primary btn-lg'style=margin:5px;>accept</a>   <a href='action.php?action=reject&user={$lid}'class='btn btn-primary btn-lg'style=margin:5px;>decline</a>";
} elseif (mysql_num_rows($to) == 1) {
echo "<a href='action.php?action=cancel&user={$lid}'class='btn btn-primary btn-lg'style=margin:5px;>cancel request</a>";
} else {
开发者ID:syed-mudasir,项目名称:social-network,代码行数:30,代码来源:profile.php
示例17: duihuan_main
function duihuan_main()
{
global $_G, $assign;
$and = '';
//if($assign[goods][tag]) $and .=' AND `tag` ='.$assign[goods][tag];
if ($assign[goods][id]) {
$and .= ' AND id != ' . $assign[goods][id];
$duihuan_success = D(array('and' => ' AND duihuan_id = ' . $assign[goods][id] . " AND status=4", 'order' => 'id DESC ', 'table' => 'duihuan_apply', 'limit' => 80, 'key' => 'duihuan_main_' . $assign[goods][id]));
foreach ($duihuan_success as $k => $v) {
$duihuan_success[$k][user] = getuser($v[uid], 'uid');
}
}
$and_time .= " AND start_time < " . TIMESTAMP;
$and_time .= " AND ( end_time = 0 or end_time > " . TIMESTAMP . ")";
$and .= ' AND `hide`=0 ' . $and_time;
$duihuan_goods = D(array('and' => $and, 'order' => ' `sort` DESC,id DESC ', 'table' => 'duihuan', 'limit' => 4, 'key' => 'duihuan_goods'));
return array('duihuan_goods' => $duihuan_goods, 'duihuan_success' => $duihuan_success);
}
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:18,代码来源:data_api.php
示例18: mysql_query
require_once '../functions.php';
$tab = mysql_query("select * from frnd_req");
echo " <table class='table'>\r\n <caption><h1>Pending Requests Table</h1></caption>\r\n <tr>\r\n <th>From</th>\r\n <th>To</th>\r\n \r\n </tr>";
while ($row = mysql_fetch_array($tab)) {
$user = getuser($row['from1'], 'user_name');
$pas = getuser($row['to1'], 'user_name');
echo "<tr>";
echo " <td>{$user}</td>";
echo " <td>{$pas}</td>";
echo "</tr>";
}
?>
<hr style="background: black; color: black; height: 1px;">
<?php
require_once '../include/db_connect.php';
require_once '../functions.php';
$tab = mysql_query("select * from frnd");
echo " <table class='table'>\r\n <caption><h1>Friends Table</h1></caption>\r\n <tr>\r\n <th>User</th>\r\n <th>User</th>\r\n \r\n </tr>";
while ($row = mysql_fetch_array($tab)) {
$user = getuser($row['user_one'], 'user_name');
$pas = getuser($row['user_two'], 'user_name');
echo "<tr>";
echo " <td>{$user}</td>";
echo " <td>{$pas}</td>";
echo "</tr>";
}
?>
<hr style="background: black; color: black; height: 1px;">
</body>
</html>
开发者ID:syed-mudasir,项目名称:social-network,代码行数:30,代码来源:table.php
示例19: shownews
function shownews($category)
{
global $HTTP_GET_VARS, $NEWS, $list_prefix, $MAIN;
$CONTENT = "";
if (isset($HTTP_GET_VARS['perpage']) && is_numeric($HTTP_GET_VARS['perpage'])) {
$perpage = $HTTP_GET_VARS['perpage'];
} else {
$perpage = 3;
}
//lets see if the user has specified to show all requests on a single page.
if (isset($HTTP_GET_VARS['onepage'])) {
$onepage = 1;
} else {
$onepage = 0;
}
//lets see what page we are on
if (!isset($HTTP_GET_VARS['page']) || !is_numeric($HTTP_GET_VARS['page'])) {
$page = 1;
} else {
$page = $HTTP_GET_VARS['page'];
}
//lets calculate our start position for our query if needed.
$start = ($page - 1) * $perpage;
//lets calculate our query
$sql = "SELECT * FROM " . $list_prefix . "news";
if ($category != 0) {
$sql .= " WHERE category = '" . $category . "'";
}
if ($onepage == 0) {
$sql .= " ORDER BY `date` DESC LIMIT " . $start . "," . $perpage . ";";
} else {
$sql .= " ORDER BY `date` DESC;";
}
//now lets show the prayerlist entries.
$result = db_query($sql);
$rows = db_num_rows($result);
if ($rows != 0) {
$i = 0;
while ($i < $rows) {
//lets fetch our prayer request from the database.
$row = db_fetch_array($result);
$postedby = getuser($row['posted_by']);
//lets insert the prayerrequest into our working copy of this template.
$WORK = insert_into_template($NEWS, "{NEWSTITLE}", stripslashes($row['news_title']));
$WORK = insert_into_template($WORK, "{TEASER}", stripslashes($row['teaser']));
$WORK = insert_into_template($WORK, "{NEWSID}", $row['id']);
$WORK = insert_into_template($WORK, "{POSTEDBY}", $postedby);
$WORK = insert_into_template($WORK, "{BYLINE}", $row['byline']);
$WORK = insert_into_template($WORK, "{DATE}", date("m/d/Y", $row['date']));
$WORK = insert_into_template($WORK, "{CATEGORY}", getcatname($row['category']));
$i++;
//now lets add this request to the CONTENT.
$CONTENT .= $WORK;
}
$sql = "SELECT * FROM " . $list_prefix . "news;";
$result = db_query($sql);
$rows = db_num_rows($result);
$pages = ($rows - $rows % $perpage) / $perpage;
//this is the number of complete pages.
if ($rows % $perpage > 0) {
$pages++;
}
//this will take care of incomplete pages.
//lets list a previous page link if needed.
if ($pages > 1 && $onepage == 0) {
$i = 0;
if ($page != 1) {
$CONTENT .= "<a href='news.php?page" . ($page - 1) . "'>prev</a> \r\n";
}
//lets list all pages a user can click on.
while ($i < $pages) {
$i++;
if ($i != $page) {
$CONTENT .= "<a href='news.php?page=" . $i . "'>" . $i . "</a> \r\n";
} else {
$CONTENT .= $i . " ";
}
}
//lets create a next page link if needed
if ($page != $pages) {
$CONTENT .= "<a href='news.php?page=" . ($page + 1) . "'>next</a>\r\n";
}
$CONTENT .= "<div align=\"right\"><a href='news.php?onepage=1'>Show all requests on one page.</a></div><br />\r\n";
}
} else {
$CONTENT .= "There are no active news at this time.<BR>\r\n";
}
$WORK = insert_into_template($MAIN, "{CONTENT}", $CONTENT);
$WORK = filltemplate($WORK, "News");
//when we output this lets make sure that the output is stripped of any template elements that are not used.
printf("%s", striptemplate($WORK));
}
开发者ID:BackupTheBerlios,项目名称:fishcms-svn,代码行数:92,代码来源:news.php
示例20: COUNT
$blocked = "blocked";
}
if (!$news[activated]) {
$activated = "inactiv";
}
$countcoms = $db->query("SELECT COUNT(*) FROM {$tab['news_comment']} WHERE newsid='{$news['id']}'");
$comments = $countcoms[0];
eval("\$inc[newsselect] .= \"" . gettemplate("news.edit.selectnews.bit") . "\";");
}
eval("\$inc[action] = \"" . gettemplate("news.edit.selectnews") . "\";");
}
############################
if ($adminaction == "news_new" || $fail_new) {
if (!$login) {
eval("\$inc[action] = \"" . gettemplate("fail.access.notloggedin") . "\";");
} else {
$fail = $fail_new;
$user = getuser($login[id]);
$smilies = getsmiliesbit("news.newsform.smilie.bit");
$user_name = mkuser("user_name", 0, $login);
$thisaction = "new_new_save";
eval("\$admin \t= \"" . gettemplate("news.newsform.admin") . "\";");
eval("\$inc[action] = \t\"" . gettemplate("news.admin.newsform") . "\";");
}
}
################
if ($adminaction == "news_config" || $fail_config) {
$fail = $fail_config;
eval("\$inc[action] = \"" . gettemplate("news.admin.config.main") . "\";");
}
################
开发者ID:BackupTheBerlios,项目名称:swora,代码行数:31,代码来源:admin.php
注:本文中的getuser函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论