本文整理汇总了PHP中Check::isUserType方法的典型用法代码示例。如果您正苦于以下问题:PHP Check::isUserType方法的具体用法?PHP Check::isUserType怎么用?PHP Check::isUserType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Check
的用法示例。
在下文中一共展示了Check::isUserType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_main
public function get_main()
{
$type = Check::isUserType();
if ($type == 'admin') {
$sql = 'SELECT * FROM `films-info` WHERE status = \'OK\' ORDER BY date_add DESC';
} elseif ($type == 'user') {
$sql = 'SELECT * FROM `films-info` WHERE permission = \'user\' OR permission = \'all\' AND status = \'OK\' ORDER BY date_add DESC';
} else {
$sql = 'SELECT * FROM `films-info` WHERE permission = \'all\' AND status = \'OK\' ORDER BY date_add DESC';
}
$result = mysql_query($sql);
if ($result) {
$content = '<h1 class="video-title">Новинки мирового кинопроката и блокбастеры</h1>';
while ($film = mysql_fetch_object($result)) {
$genre = explode(',', $film->genre);
$content .= '<div class="video">
<img src="' . $film->image . '">
<div class="video_content">
<p><a class="" href="/film/index/' . $film->href . '">' . $film->name . '</a></p>
<p class="video_info">' . $film->year . ', ' . $film->country . ', ' . $genre[0] . '</p>
</div>
</div>';
}
$json['header'] = 'main';
$json['content'] = $content;
return json_encode($json);
} else {
echo mysql_error();
}
}
示例2: get_films
public function get_films()
{
$type = Check::isUserType();
if ($type == 'admin') {
$sql = 'SELECT * FROM `films-info` WHERE status = \'OK\' AND type = \'film\' ORDER BY date_add DESC';
} elseif ($type == 'user') {
$sql = 'SELECT * FROM `films-info` WHERE permission = \'user\' OR permission = \'all\' AND type = \'film\' AND status = \'OK\' ORDER BY date_add DESC';
} else {
$sql = 'SELECT * FROM `films-info` WHERE permission = \'all\' AND status = \'OK\' AND type = \'film\' ORDER BY date_add DESC';
}
$result = mysql_query($sql);
if ($result) {
return $result;
} else {
echo mysql_error();
}
}