本文整理汇总了PHP中UserClass::loadByData方法的典型用法代码示例。如果您正苦于以下问题:PHP UserClass::loadByData方法的具体用法?PHP UserClass::loadByData怎么用?PHP UserClass::loadByData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserClass
的用法示例。
在下文中一共展示了UserClass::loadByData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LoginForm
<?php
include_once './common/base.php';
$title = "login";
include_once './common/header.php';
include_once './forms/form.login.php';
$login_form = new LoginForm();
if ($login_form->read()) {
//login form is submitted
if ($login_form->isValid()) {
//do some session setting here
$data = $login_form->getArray();
//username and password
include_once './models/class.users.php';
$user = new UserClass();
$user->loadByData($data);
//load by username and password
$_SESSION['loggedin'] = 'true';
$data2 = $user->getArray();
$_SESSION['userid'] = $data2['id'];
echo "Congratulations, you are logged in";
} else {
//invalid form submitted, do sth here
$login_form->display();
}
} else {
//form is not submitted at all.
$login_form->display();
}
$footer = "copyright © 2012 reserved to rajan prasad upadhyay.";
include_once "./common/footer.php";