本文整理汇总了PHP中Sql::pSelectRowToObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Sql::pSelectRowToObject方法的具体用法?PHP Sql::pSelectRowToObject怎么用?PHP Sql::pSelectRowToObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sql
的用法示例。
在下文中一共展示了Sql::pSelectRowToObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getExact
/**
* Used by SessionHandler::login() and others
*/
public static function getExact($type, $id, $name, $pwd)
{
$q = 'SELECT * FROM tblUsers' . ' WHERE id = ? AND name = ? AND type = ? AND time_deleted IS NULL';
$obj = Sql::pSelectRowToObject(__CLASS__, array($q, 'isi', $id, $name, $type));
if (!$obj) {
return false;
}
$x = explode(':', $obj->password);
if (count($x) == 2) {
$algo = $x[0];
$pwd2 = $x[1];
} else {
// auto fallback to old default (sha1)
$algo = 'sha1';
$pwd2 = $obj->password;
}
$session = SessionHandler::getInstance();
$expected = $algo . ":" . $pwd2;
if (Password::encrypt($id, $session->getEncryptKey(), $pwd, $algo) != $expected) {
return false;
}
return $obj;
}
示例2: getByField
public static function getByField($val, $tblname, $classname, $field_name)
{
if (!is_alphanumeric($tblname)) {
throw new \Exception('tblname should be alphanumeric, isnt: ' . $tblname);
}
if (!is_alphanumeric($field_name)) {
throw new \Exception('field_name should be alphanumeric, isnt: ' . $field_name);
}
$form = self::stringForm($val);
$q = 'SELECT * FROM ' . $tblname . ' WHERE ' . $field_name . ' = ?';
return Sql::pSelectRowToObject($classname, array($q, $form, $val));
}