本文整理汇总了PHP中MyDB::queryA方法的典型用法代码示例。如果您正苦于以下问题:PHP MyDB::queryA方法的具体用法?PHP MyDB::queryA怎么用?PHP MyDB::queryA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyDB
的用法示例。
在下文中一共展示了MyDB::queryA方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
function process($a)
{
$username = 0;
$password = 0;
$out = new stdClass();
$post = json_decode(file_get_contents('php://input'), TRUE);
if (isset($post['username'])) {
$username = $post['username'];
}
if (isset($post['password'])) {
$password = $post['password'];
}
if ($username && $password) {
$db = new MyDB();
$sql = "SELECT * FROM users WHERE username=? AND password=?";
$res = $db->queryA($sql, array($username, $password));
if ($res && count($res)) {
$res = $res[0];
$_SESSION['directories_user'] = $res['username'];
$_SESSION['directories_role'] = $res['role'];
$_SESSION['directories_user_id'] = $res['id'];
//$_SESSION['directories_folder']=$res->folder;
$out->success = 'loggedin';
$out->result = 'Admin';
return $out;
}
$out->error = 'wrong';
if (isset($_GET['debug'])) {
$out->error = $db->errorInfo();
}
$out->message = 'Please check username and password';
return $out;
}
$out->error = 'data empty';
$out->message = 'Please fill the form';
return $out;
}
示例2: stdClass
function email_password($ar)
{
$username = $ar['username'];
if (!$username) {
return 'ERROR,No email';
}
$out = new stdClass();
$db = new MyDB();
$sql = 'SELECT password,email FROM users.sql WHERE username=?';
$res = $db->queryA($sql, array($username));
//return $username;//$db->getRows('SELECT * FROM users.sql');
if ($res && count($res)) {
$res = $res[0];
$password = $res['password'];
$email = $res['email'];
//$password = $this->getValue($pass,$db);//$db->getField("SELECT value FROM extra WHERE index='$pass'");
if (!$password) {
return 'ERROR,no_value_for,' . $username;
}
$to = $email;
$subject = 'Password restore for ' . $username;
$message = 'Your password is: ' . $password;
$headers = 'From: admin@front-desk.ca' . "\r\n" . 'Reply-To: admin@front-desk.ca' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
if ($_SERVER['SERVER_NAME'] !== 'localhost') {
mail($to, $subject, $message, $headers);
}
$out->success = 'password_sent_to';
$out->result = $email . $password;
$out->message = 'Password sent to your email';
$this->log('password_sent_to ' . $email);
return $out;
//'RESULT,'.$password.','.$email;
}
$this->logError('no_user_with_username ' . $username);
$out->error = 'no_user_with_username';
$out->message = 'No user with Username ' . $username;
return $out;
//'ERROR,no_user_with_username,'.$username;
}