本文整理汇总了PHP中Check类的典型用法代码示例。如果您正苦于以下问题:PHP Check类的具体用法?PHP Check怎么用?PHP Check使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Check类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
function login()
{
if (!empty($_POST)) {
$check = new Check();
$user = new User();
$pdo = new Db();
$db = $pdo->get();
$mapper = new Mapper($db);
//Проверяем входные данные
$user->login = $check->checkInput($_POST['login']);
$password = $check->checkInput($_POST['pass']);
$user->password = md5($password);
//Если пользователь не найден
$this->user = $mapper->select($user);
if (empty($this->user)) {
$this->error = "Пароль или логин не совпадают";
$this->out('login.php');
} else {
$this->out('profile.php');
//Если найден, выводим профиль
}
} else {
$this->out('login.php');
}
}
示例2: edit
/**
* 编辑菜单
*/
public function edit()
{
$id = I('id');
if (IS_POST) {
$data = I('data');
//数据验证
$msg = Check::rule(array(array(Check::must($data['name']), L('namecannotnull')), array(Check::must($data['url']), L('linkcannotnull'))));
//提示信息
if ($msg !== true) {
$this->message($msg, NULL, 'error');
}
/* 更新图标 */
if ($_FILES['pic']['name']) {
$result = $this->ectouchUpload('pic', 'nav');
if ($result['error'] > 0) {
$this->message($result['message'], NULL, 'error');
}
$data['pic'] = substr($result['message']['pic']['savepath'], 2) . $result['message']['pic']['savename'];
}
$this->model->table('touch_nav')->data($data)->where('id=' . $id)->update();
$this->message(L('edit_ok'), url('index'));
}
//查询附表信息
$result = $this->model->table('touch_nav')->where('id=' . $id)->find();
/* 模板赋值 */
$this->assign('info', $result);
$this->assign('ur_here', L('navigator'));
$this->assign('action_link', array('text' => L('go_list'), 'href' => url('index')));
$this->display();
}
示例3: 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();
}
}
示例4: setTags
private function setTags()
{
$this->Tags['Title'] = $this->Data[0];
$this->Tags['Content'] = Check::Words(html_entity_decode($this->Data[1]), 25);
$this->Tags['Link'] = $this->Data[2];
$this->Tags['Image'] = $this->Data[3];
$this->Tags = array_map('strip_tags', $this->Tags);
$this->Tags = array_map('trim', $this->Tags);
$this->Data = null;
//NORMAL PAGE
$this->seoTags = "<title>{$this->Tags['Title']}</title>" . "\n";
$this->seoTags .= "<meta name='description' content='{$this->Tags['Content']}'/>" . "\n";
$this->seoTags .= "<meta name='robots' content='index, fallow'/>" . "\n";
$this->seoTags .= "<link rel='canonical' href='{$this->Tags['Link']}'>" . "\n";
$this->seoTags .= "\n";
//FACEBOOK
$this->seoTags .= "<meta property='og:site_name' content='" . SITENAME . "' />" . "\n";
$this->seoTags .= "<meta property='og:locale' content='pt-BR' />" . "\n";
$this->seoTags .= "<meta property='og:title' content='{$this->Tags['Title']}' />" . "\n";
$this->seoTags .= "<meta property='og:description' content='{$this->Tags['Content']}' />" . "\n";
$this->seoTags .= "<meta property='og:image' content='{$this->Tags['Image']}' />" . "\n";
$this->seoTags .= "<meta property='og:url' content='{$this->Tags['Link']}' />" . "\n";
$this->seoTags .= "<meta property='og:type' content='article' />" . "\n";
$this->seoTags .= "" . "\n";
//Item GROUP (TWITTER)
$this->seoTags .= "<meta itemprop='name' content='{$this->Tags['Title']}' />" . "\n";
$this->seoTags .= "<meta itemprop='description' content='{$this->Tags['Content']}' />" . "\n";
$this->seoTags .= "<meta itemprop='url' content='{$this->Tags['Link']}' />" . "\n";
$this->Tags = null;
}
示例5: Set
function Set($f3)
{
if (!\Check::confirm('POST.password')) {
$this->flash('Konfirmasi Password Tidak Cocok');
$f3->reroute($f3->get('URI'));
}
$post = $f3->get('POST');
$db_host = $post['DB_HOST'];
$db_name = $post['DB_NAME'];
$db_user = $post['DB_USER'];
$db_pass = $post['DB_PASS'];
$dsn = "mysql:host={$db_host};port=3306;dbname={$db_name}";
$db = new \DB\SQL($dsn, $db_user, $db_pass);
try {
$db->begin();
$db->exec(explode(';', $f3->read('installation/install.sql')));
$user = new \DB\SQL\Mapper($db, 'user');
$user->username = $post['username'];
$user->password = \Bcrypt::instance()->hash($post['password']);
$user->type = 1;
$user->save();
$key = bin2hex(openssl_random_pseudo_bytes(32));
$data = "[globals]\nDEBUG=0\nAUTOLOAD=\"controller/;model/\"\nUI=\"view/\"\nAPP_KEY=\"{$key}\"\nDB_SET=\"{$dsn}\"\nDB_USER=\"{$db_user}\"\nDB_PASS=\"{$db_pass}\"";
$f3->write('config/config.ini', $data);
$f3->write('config/route.ini', $f3->read('installation/route.ini'));
$db->commit();
$this->flash('Success... Silahkan Hapus Folder Installation', 'success');
} catch (Exception $e) {
$db->rollback();
$this->flash($e->getMessage());
$f3->reroute('/');
}
$f3->reroute('/');
}
示例6: Buy
function Buy($f3)
{
$server = $this->loadServer();
$account = new \Webmin($server);
if (($saldo = $this->me->saldo) < $server->price) {
$this->flash('Saldo Anda Kurang, Hub Admin utk Deposit');
$f3->reroute($f3->get('URI'));
}
if (!$account->check($f3->get('POST.user'))) {
$this->flash('User Sudah Terdaftar, Coba yang Lain');
$f3->reroute($f3->get('URI'));
}
$account->copyFrom('POST');
$account->real = $this->me->username;
if ($f3->exists('POST.pass', $pass)) {
if (!\Check::Confirm('POST.pass')) {
$this->flash('Konfirmasi Password Tidak Cocok');
$f3->reroute($f3->get('URI'));
}
$account->pass = $account->crypt($pass);
}
$active = date("Y/m/d", strtotime("+30 days"));
$account->expire = \Webmin::exp_encode($active);
if (!$account->save()) {
$this->flash('Gagal, Coba Beberapa Saat Lagi');
$f3->reroute($f3->get('URI'));
}
$this->me->saldo = $this->me->saldo - $server->price;
$this->me->save();
$this->flash('Pembelian Account Berhasil', 'success');
$f3->set('SESSION.uid', $account->uid);
$f3->set('SESSION.pass', $pass);
$f3->reroute($f3->get('URI') . '/success');
}
示例7: setData
private function setData()
{
$this->Data = array_map('strip_tags', $this->Data);
$this->Data = array_map('trim', $this->Data);
$this->Data['category_name'] = Check::Name($this->Data['category_title']);
$this->Data['category_date'] = Check::Data($this->Data['category_date']);
$this->Data['category_parent'] = $this->Data['category_parent'] == 'null' ? null : $this->Data['category_parent'];
}
示例8: correct_password
public function correct_password($string)
{
$correct_hash = $this->get('password');
if (!Check::is_hash($string)) {
$string = $this->encode_password($string);
}
return empty($correct_hash) || $string == $correct_hash;
}
示例9: correct_main_data
protected function correct_main_data($data)
{
if (empty($data['title'])) {
$data['title'] = '';
}
$data['link'] = Check::link(undo_safety($data['link']));
return $data;
}
示例10: smarty_function_task
/**
* get task information for the specified task
*/
function smarty_function_task($params, &$smarty)
{
$t = new Task();
if (!Check::digits($params['task_id'], $empty = false)) {
return;
}
$smarty->assign('task', $t->getone($params['task_id']));
}
示例11: smarty_function_part
/**
* get data for a participant and create a smarty $part variable
*/
function smarty_function_part($params, &$smarty)
{
if (!Check::digits($params['part_id'], $empty = false)) {
return;
}
$p = new Participant();
$smarty->assign('part', $p->getone($params['part_id']));
}
示例12: smarty_function_tasklist2xml
/**
* return the tasklist as an xml document that
* would be used by the drdat app on a phone
*/
function smarty_function_tasklist2xml($params, &$smarty)
{
if (!Check::digits($params['study_id'], $empty = false)) {
return;
}
$s = new Schedule();
return htmlentities($s->tasklist2xml($params['study_id']));
}
示例13: smarty_function_forms
/**
* take our raw form data and make a data structure out of it
* that can be used in templates
*/
function smarty_function_forms($params, &$smarty)
{
if (!Check::digits($params['task_id'], $empty = false)) {
return;
}
$t = new Task();
$smarty->assign('forms', $t->parseforms($params['task_id']));
}
示例14: smarty_function_tasks
/**
* find the tasks for this particular study
*/
function smarty_function_tasks($params, &$smarty)
{
$t = new Task();
if (!Check::digits($params['study_id'])) {
return;
}
$smarty->assign('tasks', $t->tasks($params['study_id'], $_SESSION['user']['researcher_id'], $params['all'] ? true : false));
}
示例15: smarty_function_formhtml
/**
* take our raw form data and make an xml representation of it
* that should be exactly what gets sent to the phones
*/
function smarty_function_formhtml($params, &$smarty)
{
if (!Check::digits($params['task_id'], $empty = false)) {
return;
}
# study_id is needed for the scheduling information for the task
if (!Check::digits($params['study_id'], $empty = false)) {
return;
}
$t = new Task();
if ($params['style'] == 'mobile') {
if ($params['width'] > 0) {
$width = (int) $params['width'];
} else {
$width = 400;
}
$rawhtml = $t->forms2html($params['task_id'], $params['study_id']);
$forms = explode('<!-- split -->', $rawhtml);
$numforms = count($forms) - 1;
foreach ($forms as $block) {
$f++;
if ($f > $numforms) {
break;
}
$spacer = "";
if ($f == 1) {
$prev = "< prev";
$next = "<input type=submit value=\"next >\">";
} else {
if ($f < $numforms) {
$prev = "<input type=submit value=\"< prev\">";
$next = "<input type=submit value=\"next >\">";
} else {
$prev = "<input type=submit value=\"< prev\">";
}
}
if ($f == $numforms) {
$next = "<input type=submit value=\"Save data\">";
$spacer = "<br><br><br>";
}
$html .= <<<HTML
<h4>Form {$f}</h4>
<table cellpadding=2 cellspacing=0 border=1 style="width: {$width}" width={$width} class="nobgcolor">
<tr><td>
{$block}
<br>
{$prev} {$next}
<br><br>
</td></tr>
</table>
{$spacer}
HTML;
}
return $html;
}
return htmlentities($t->forms2html($params['task_id'], $params['study_id']));
}