本文整理汇总了PHP中Db::result方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::result方法的具体用法?PHP Db::result怎么用?PHP Db::result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db
的用法示例。
在下文中一共展示了Db::result方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public static function get($vars)
{
$op = Db::result("SELECT `value` FROM `options` WHERE `name` = '{$vars}' LIMIT 1");
if (Db::$num_rows > 0) {
return $op[0]->value;
} else {
return false;
}
}
示例2: array
$where .= "AND `date` >= '{$_GET['from']}' ";
$qpage .= "&from={$_GET['from']}";
}
if (isset($_GET['to']) && $_GET['to'] != '') {
$where .= "AND `date` <= '{$_GET['to']}' ";
$qpage .= "&to={$_GET['to']}";
}
if (isset($_GET['status']) && $_GET['status'] != '') {
$status = Typo::int($_GET['status']);
$where .= "AND `status` LIKE '%%{$status}%%' ";
$qpage .= "&status={$status}";
}
$max = "15";
if (isset($_GET['paging'])) {
$paging = Typo::int($_GET['paging']);
$offset = ($paging - 1) * $max;
} else {
$paging = 1;
$offset = 0;
}
$data['posts'] = Db::result("SELECT * FROM `posts` \n WHERE `type` = 'page' {$where} \n ORDER BY `date` DESC \n LIMIT {$offset},{$max}");
$data['num'] = Db::$num_rows;
Theme::admin('header', $data);
System::inc('pages', $data);
Theme::admin('footer');
$page = array('paging' => $paging, 'table' => 'posts', 'where' => "`type` = 'page'" . $where, 'max' => $max, 'url' => 'index.php?page=pages' . $qpage, 'type' => 'pager');
echo Paging::create($page);
break;
}
/* End of file pages.control.php */
/* Location: ./inc/lib/Control/Backend/pages.control.php */
示例3: existParam
public static function existParam($param, $post_id)
{
$sql = "SELECT * FROM `posts_param` WHERE `post_id` = '{$post_id}' AND `param` = '{$param}' LIMIT 1";
$q = Db::result($sql);
if (Db::$num_rows > 0) {
return true;
} else {
return false;
}
}
示例4: array
* @copyright 2014-2015 Puguh Wijayanto
* @license http://www.opensource.org/licenses/mit-license.php MIT
*
*/
$post = "";
$data['max'] = Options::get('post_perpage');
if (isset($_GET['paging'])) {
$paging = Typo::int($_GET['paging']);
if ($paging > 0) {
$offset = ($paging - 1) * $data['max'];
} else {
$offset = 0;
}
$pagingtitle = " - Page {$paging}";
} else {
$offset = 0;
$paging = 1;
$pagingtitle = "";
}
//echo $paging;
$data['sitetitle'] = Site::$slogan . $pagingtitle;
$data['posts'] = Db::result(sprintf("SELECT * FROM `posts` \n WHERE `type` = 'post' \n AND `status` = '1'\n ORDER BY `date` \n DESC LIMIT %d, %d", $offset, $data['max']));
$data['num'] = Db::$num_rows;
$url = SMART_URL ? Site::$url : Site::$url . '/index.php?';
$paging = array('paging' => $paging, 'table' => 'posts', 'where' => '`type` = \'post\'', 'max' => $data['max'], 'url' => $url, 'type' => Options::get('pagination'));
$data['paging'] = Paging::create($paging, SMART_URL);
Theme::theme('header', $data);
Theme::theme('index', $data);
Theme::footer();
/* End of file default.control.php */
/* Location: ./inc/lib/Control/Frontend/default.control.php */
示例5: sprintf
if (!isset($alertred)) {
/*check if username is exist or not */
$username = Typo::cleanX(Typo::strip($_POST['username']));
$sql = sprintf("SELECT `userid`,`status`,`activation` FROM `user` WHERE `userid` = '%s'", $username);
$usr = Db::result($sql);
$c = Db::$num_rows;
//echo $c;
//print_r($usr);
if ($c == "1") {
//$alertgreen = "";
// check if user is active
if ($usr[0]->status == '1') {
/* get user password */
$pass = User::randpass($_POST['password']);
$sql = "SELECT `pass`,`group` FROM `user` WHERE `userid` = '{$username}'";
$l = Db::result($sql);
$c = Db::$num_rows;
foreach ($l as $v) {
# code...
//print_r($v);
$p = $v->pass;
$g = $v->group;
}
//echo $p;
if ($p == $pass) {
$vars = array('username' => $username, 'loggedin' => true, 'group' => $g);
Session::set_session($vars);
/*
$_SESSION['username'] = $_POST['username'];
$_SESSION['login'] = "true";
$_SESSION['group'] = $group;
示例6: slug
/**
* URL Slug Function.
* This will load the url slug from the database according to the posts id.
*
* @author Puguh Wijayanto (www.metalgenix.com)
* @since 0.0.1
*/
public static function slug($vars)
{
$s = Db::result("SELECT `slug` FROM `posts` WHERE `id` = '{$vars}' LIMIT 1");
$s = $s[0]->slug;
return $s;
}
示例7: type
public static function type($id)
{
$id = sprintf('%d', $id);
if (isset($id)) {
$cat = Db::result("SELECT `type` FROM `cat` \n WHERE `id` = '{$id}' LIMIT 1");
//print_r($cat);
if (isset($cat['error'])) {
return '';
} else {
return $cat[0]->type;
}
} else {
echo "No ID Selected";
}
//print_r($cat);
}
示例8:
}
if (isset($_POST['token'])) {
Token::remove($_POST['token']);
}
break;
default:
# code...
break;
}
if (isset($_GET['act']) == 'del') {
if (!isset($_GET['token']) || !Token::isExist($_GET['token'])) {
// VALIDATE ALL
$alertred[] = TOKEN_NOT_EXIST;
}
if (isset($alertred)) {
$data['alertred'] = $alertred;
} else {
Categories::delete($_GET['id']);
$data['alertgreen'][] = MSG_CATEGORY_REMOVED;
}
if (isset($_GET['token'])) {
Token::remove($_GET['token']);
}
}
$data['cat'] = Db::result("SELECT * FROM `cat` WHERE `type` = 'post' ORDER BY `id` DESC");
$data['num'] = Db::$num_rows;
Theme::admin('header', $data);
System::inc('categories', $data);
Theme::admin('footer');
/* End of file categories.control.php */
/* Location: ./inc/lib/Control/Backend/categories.control.php */
示例9: array
if (isset($_GET['from']) && $_GET['from'] != '') {
$where .= "AND `join_date` >= '{$_GET['from']}' ";
$qpage .= "&from={$_GET['from']}";
}
if (isset($_GET['to']) && $_GET['to'] != '') {
$where .= "AND `join_date` <= '{$_GET['to']}' ";
$qpage .= "&to={$_GET['to']}";
}
if (isset($_GET['status']) && $_GET['status'] != '') {
$where .= "AND `status` LIKE '%%{$_GET['status']}%%' ";
$qpage .= "&status={$_GET['status']}";
}
$max = "10";
if (isset($_GET['paging'])) {
$paging = Typo::int($_GET['paging']);
$offset = ($paging - 1) * $max;
} else {
$paging = 1;
$offset = 0;
}
$data['usr'] = Db::result("SELECT * FROM `user` WHERE {$where} ORDER BY `userid` ASC LIMIT {$offset}, {$max}");
$data['num'] = Db::$num_rows;
$page = array('paging' => $paging, 'table' => 'user', 'where' => $where, 'max' => $max, 'url' => 'index.php?page=users' . $qpage, 'type' => 'pager');
$data['paging'] = Paging::create($page);
Theme::admin('header', $data);
System::inc('user', $data);
Theme::admin('footer');
break;
}
/* End of file users.control.php */
/* Location: ./inc/lib/Control/Backend/users.control.php */
示例10: totalUser
public static function totalUser($vars)
{
$posts = Db::result("SELECT `id` FROM `user`");
$npost = Db::$num_rows;
return $npost;
}
示例11: avatar
public static function avatar($id)
{
$usr = Db::result(sprintf("SELECT * FROM `user_detail` WHERE `id` = '%d' OR `userid` = '%s' LIMIT 1", Typo::int($id), Typo::cleanX($id)));
return $usr[0]->avatar;
}
示例12: die
die("Direct Access Not Allowed!");
}
/**
* GeniXCMS - Content Management System
*
* PHP Based Content Management System and Framework
*
* @package GeniXCMS
* @since 0.0.1 build date 20141006
* @version 0.0.6
* @link https://github.com/semplon/GeniXCMS
* @link http://genixcms.org
* @author Puguh Wijayanto (www.metalgenix.com)
* @copyright 2014-2015 Puguh Wijayanto
* @license http://www.opensource.org/licenses/mit-license.php MIT
*
*/
$post = $_GET[$vars];
$data['posts'] = Db::result(sprintf("SELECT * FROM `posts` \n WHERE `id` = '%d' \n AND `type` = 'post'\n AND `status` = '1' \n LIMIT 1", $post));
if (Db::$num_rows > 0) {
Theme::theme('header', $data);
Theme::theme('single', $data);
Theme::footer();
Stats::addViews($post);
exit;
} else {
Control::error('404');
exit;
}
/* End of file post.control.php */
/* Location: ./inc/lib/Control/Frontend/post.control.php */
示例13: switch
* @link https://github.com/semplon/GeniXCMS
* @link http://genixcms.org
* @author Puguh Wijayanto (www.metalgenix.com)
* @copyright 2014-2015 Puguh Wijayanto
* @license http://www.opensource.org/licenses/mit-license.php MIT
*
*/
switch ($_GET['page']) {
case 'sitemap':
# code...
Sitemap::create();
exit;
break;
default:
# code...
$page = Typo::cleanX(Typo::strip($_GET['page']));
$data['posts'] = Db::result(sprintf("SELECT * FROM `posts` \n WHERE (`id` = '%d' OR `slug` = '%s')\n AND `type` = 'page'\n AND `status` = '1'\n LIMIT 1", $page, $page));
if (Db::$num_rows > 0) {
Theme::theme('header', $data);
Theme::theme('page', $data);
Theme::footer();
Stats::addViews($page);
exit;
} else {
Control::error('404');
exit;
}
break;
}
/* End of file page.control.php */
/* Location: ./inc/lib/Control/Frontend/page.control.php */
示例14: str_replace
$msg = str_replace('{{siteurl}}', Site::$url, $msg);
$msg = str_replace('{{sitemail}}', Site::$email, $msg);
if ($_POST['recipient'] == '') {
$usr = Db::result("SELECT * FROM `user`");
foreach ($usr as $u) {
# code...
$msgs = str_replace('{{userid}}', $u->userid, $msg);
$vars = array('to' => $u->email, 'to_name' => $u->userid, 'message' => $msgs, 'subject' => $subject, 'msgtype' => $_POST['type']);
$mailsend = Mail::send($vars);
if ($mailsend !== null) {
$alertmailsend[] = $mailsend;
}
sleep(3);
}
} elseif ($_POST['recipient'] != '') {
$usr = Db::result("SELECT * FROM `user` WHERE `group` = '{$_POST['recipient']}'");
foreach ($usr as $u) {
# code...
$msgs = str_replace('{{userid}}', $u->userid, $msg);
$vars = array('to' => $u->email, 'to_name' => $u->userid, 'message' => $msgs, 'subject' => $subject, 'msgtype' => $_POST['type']);
$mailsend = Mail::send($vars);
if ($mailsend !== null) {
$alermailsend[] = $mailsend;
}
sleep(3);
}
}
if (isset($alertmailsend)) {
$data['alertred'] = $alertmailsend;
} else {
$data['alertgreen'][] = "Success Sending Email";
示例15: define
define('GX_MOD', GX_PATH . '/inc/mod/');
define('GX_THEME', GX_PATH . '/inc/themes/');
define('GX_ASSET', GX_PATH . '/assets/');
require "autoload.php";
try {
new System();
} catch (Exception $e) {
echo $e->getMessage();
}
if (isset($_POST['forgotpass'])) {
// Check token first
if (isset($_POST['token']) && Token::isExist($_POST['token'])) {
/*check if username is exist or not */
$username = Typo::cleanX(Typo::strip($_POST['username']));
$sql = sprintf("SELECT `userid`,`email`,`status`,`activation` FROM `user` WHERE `userid` = '%s'", $username);
$usr = Db::result($sql);
$c = Db::$num_rows;
//echo $c;
//print_r($usr);
if ($c == "1") {
//$alertgreen = "";
// check if user is active
if ($usr[0]->status == '1') {
/* get user password */
$newpass = User::generatePass();
$id = User::id($username);
$pass = User::randpass($newpass);
$vars = array('id' => $id, 'user' => array('pass' => $pass));
User::update($vars);
$date = Date::format(date("Y-m-d H:i:s"));
$msg = "\n\t\tHello {$usr[0]->userid},\n\n\t\tYou are requesting Password Reset at " . Site::$name . " on {$date}. \n\t\tBelow are your new Password :\n\n\t\t{$newpass}\n\n\t\tNow you can login with your new Password at " . Site::$url . "\n\n\n\t\tBest Regards,\n\n\n\t\t" . Site::$name . "\n\t\t" . Site::$email . "\n\t\t\t\t";