本文整理汇总了PHP中user_pass_ok函数的典型用法代码示例。如果您正苦于以下问题:PHP user_pass_ok函数的具体用法?PHP user_pass_ok怎么用?PHP user_pass_ok使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_pass_ok函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mt_getpost
function mt_getpost($params)
{
// ($postid, $user, $pass)
$xpostid = $params->getParam(0);
$xuser = $params->getParam(1);
$xpass = $params->getParam(2);
$post_ID = $xpostid->scalarval();
$username = $xuser->scalarval();
$password = $xpass->scalarval();
// Check login
if (user_pass_ok(addslashes($username), $password)) {
$postdata = get_postdata($post_ID);
if ($postdata['Date'] != '') {
// why were we converting to GMT here? spec doesn't call for that.
//$post_date = mysql2date('U', $postdata['Date']);
//$post_date = gmdate('Ymd', $post_date).'T'.gmdate('H:i:s', $post_date);
$post_date = strtotime($postdata['Date']);
$post_date = date('Ymd', $post_date) . 'T' . date('H:i:s', $post_date);
$catids = wp_get_post_cats('1', $post_ID);
logIO('O', 'Category No:' . count($catids));
foreach ($catids as $catid) {
$catname = get_cat_name($catid);
logIO('O', 'Category:' . $catname);
$catnameenc = new xmlrpcval(mb_conv($catname, 'UTF-8', $GLOBALS['blog_charset']));
$catlist[] = $catnameenc;
}
$post = get_extended($postdata['Content']);
$allow_comments = 'open' == $postdata['comment_status'] ? 1 : 0;
$allow_pings = 'open' == $postdata['ping_status'] ? 1 : 0;
$resp = array('link' => new xmlrpcval(post_permalink($post_ID)), 'title' => new xmlrpcval(mb_conv($postdata['Title'], 'UTF-8', $GLOBALS['blog_charset'])), 'description' => new xmlrpcval(mb_conv($post['main'], 'UTF-8', $GLOBALS['blog_charset'])), 'dateCreated' => new xmlrpcval($post_date, 'dateTime.iso8601'), 'userid' => new xmlrpcval($postdata['Author_ID']), 'postid' => new xmlrpcval($postdata['ID']), 'content' => new xmlrpcval(mb_conv($postdata['Content'], 'UTF-8', $GLOBALS['blog_charset'])), 'permalink' => new xmlrpcval(post_permalink($post_ID)), 'categories' => new xmlrpcval($catlist, 'array'), 'mt_keywords' => new xmlrpcval("{$catids[0]}"), 'mt_excerpt' => new xmlrpcval(mb_conv($postdata['Excerpt'], 'UTF-8', $GLOBALS['blog_charset'])), 'mt_allow_comments' => new xmlrpcval($allow_comments, 'int'), 'mt_allow_pings' => new xmlrpcval($allow_pings, 'int'), 'mt_convert_breaks' => new xmlrpcval('true'), 'mt_text_more' => new xmlrpcval(mb_conv($post['extended'], 'UTF-8', $GLOBALS['blog_charset'])));
$resp = new xmlrpcval($resp, 'struct');
return new xmlrpcresp($resp);
} else {
return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 3, "No such post #{$post_ID}");
}
} else {
return new xmlrpcresp(0, $GLOBALS['xmlrpcerruser'] + 3, 'Wrong username/password combination ' . $username . ' / ' . starify($password));
}
}
示例2: user_login
function user_login($username, $password)
{
$res_arr = array();
if (empty($username) || empty($password)) {
$res_arr['errormsg'] = 'Required field is missing';
return $res_arr;
//return $errors;
}
$user_id = username_exists($username);
$user = user_pass_ok($username, $password);
if (!empty($user_id)) {
$user_data = get_userdata($user_id);
if ($user == 1) {
$res_arr['Id'] = $user_id;
$res_arr['username'] = $username;
return $res_arr;
} else {
$res_arr['errormsg'] = 'Invalid password';
return $res_arr;
}
} else {
$res_arr['errormsg'] = 'Invalid username';
return $res_arr;
}
}
示例3: check_current_pass
public function check_current_pass($user_login, $user_password)
{
if (!user_pass_ok($user_login, $user_password)) {
return json_encode(false);
}
return json_encode(true);
}
示例4: login_pass_ok
function login_pass_ok($user_login, $user_pass)
{
if (!user_pass_ok($user_login, $user_pass)) {
$this->error = new IXR_Error(403, 'Bad login/pass combination.');
return false;
}
return true;
}
示例5: loginCheck
function loginCheck($args)
{
$username = $args[0];
$password = $args[1];
if (!user_pass_ok($username, $password)) {
//an error occurred, the username and password supplied were not valid
return false;
}
// no errors occurred, the U&P are good, return true
return true;
}
示例6: _verify_admin
private function _verify_admin()
{
global $json_api;
extract($_REQUEST);
if (!current_user_can('administrator')) {
if (isset($u) and isset($p)) {
if (!user_pass_ok($u, $p)) {
$json_api->error(__("Your username or password was incorrect."));
}
} else {
$json_api->error(__("You must either provide the 'u' and 'p' parameters or login as an administrator."));
}
}
}
示例7: jobman_login
function jobman_login()
{
global $wp_query, $jobman_login_failed;
$username = $wp_query->query_vars['jobman_username'];
$password = $wp_query->query_vars['jobman_password'];
if (user_pass_ok($username, $password)) {
$creds = array('user_login' => $username, 'user_password' => $password, 'remember' => true);
wp_signon($creds);
wp_redirect(jobman_current_url());
exit;
} else {
$jobman_login_failed = true;
}
}
示例8: wuw_init
function wuw_init()
{
if (isset($_POST['whatsupwordpressusername']) && isset($_POST['whatsupwordpresspassword'])) {
$post_user = sanitize_user(trim($_POST['whatsupwordpressusername']));
$post_pass = trim($_POST['whatsupwordpresspassword']);
$results = '';
if (user_pass_ok($post_user, $post_pass)) {
$user_data = get_userdatabylogin($post_user);
set_current_user($user_data->ID);
if (current_user_can('whats_up_wordpress')) {
if (!function_exists('get_preferred_from_update_core')) {
require_once ABSPATH . 'wp-admin/includes/update.php';
}
$cur = get_preferred_from_update_core();
$upgrade = isset($cur->response) && $cur->response === 'upgrade' ? 1 : 0;
if (!function_exists('get_plugins')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$all_plugins = get_plugins();
$active_plugins = 0;
foreach ((array) $all_plugins as $plugin_file => $plugin_data) {
if (is_plugin_active($plugin_file)) {
$active_plugins++;
}
}
$update_plugins = get_transient('update_plugins');
$update_count = 0;
if (!empty($update_plugins->response)) {
$update_count = count($update_plugins->response);
}
$num_posts = wp_count_posts('post', 'readable');
$num_comm = wp_count_comments();
header('Content-Type: application/json');
exit(json_encode(array('site_name' => (string) get_option('blogname'), 'site_url' => (string) site_url(), 'site_admin_url' => (string) admin_url(), 'wordpress_version' => (string) $GLOBALS['wp_version'], 'core_update_available' => (int) $upgrade, 'active_plugins' => (int) $active_plugins, 'updatable_plugins' => (int) $update_count, 'total_posts' => (int) array_sum((array) $num_posts) - $num_posts->trash, 'total_posts_categories' => (int) wp_count_terms('category', 'ignore_empty=true'), 'published_posts' => (int) $num_posts->publish, 'draft_posts' => (int) $num_posts->draft, 'pending_posts' => (int) $num_posts->pending, 'scheduled_posts' => (int) $num_posts->future, 'trashed_posts' => (int) $num_posts->trash, 'total_comments' => (int) $num_comm->total_comments, 'approved_comments' => (int) $num_comm->approved, 'pending_comments' => (int) $num_comm->moderated, 'spam_comments' => (int) $num_comm->spam, 'trashed_comments' => (int) $num_comm->trash)));
}
}
}
}
示例9: emw_intercept_login
function emw_intercept_login($username)
{
global $sitepress_settings;
if (user_pass_ok($username, $_POST['pwd'])) {
wp_set_auth_cookie(get_profile('ID', $username), $_POST['rememberme'], is_ssl());
$domains = $sitepress_settings['language_domains'];
if ($domains) {
$time = floor(time() / 10);
$_languages = icl_get_languages('skip_missing=0');
foreach ($_languages as $l) {
$languages[] = $l;
}
$next_domain = $domains[$languages[1]['language_code']];
$parts = parse_url($next_domain);
$options['nonce'] = md5($parts['scheme'] . '://' . $parts['host'] . "-{$username}-{$time}");
$options['redirect'] = $_REQUEST['redirect_to'];
$options['remember'] = $_POST['rememberme'];
$options['language_number'] = 1;
update_option('emw_login', $options);
wp_redirect($next_domain . "?emw-login&user={$username}&nonce={$options['nonce']}");
die;
}
}
}
示例10: mt_getpost
function mt_getpost($params)
{
// ($postid, $user, $pass)
global $xmlrpcerruser;
$xpostid = $params->getParam(0);
$xuser = $params->getParam(1);
$xpass = $params->getParam(2);
$post_ID = $xpostid->scalarval();
$username = $xuser->scalarval();
$password = $xpass->scalarval();
// Check login
if (user_pass_ok($username, $password)) {
$postdata = get_postdata($post_ID);
if ($postdata["Date"] != "") {
// why were we converting to GMT here? spec doesn't call for that.
//$post_date = mysql2date("U", $postdata["Date"]);
//$post_date = gmdate("Ymd", $post_date)."T".gmdate("H:i:s", $post_date);
$post_date = strtotime($postdata['Date']);
$post_date = date("Ymd", $post_date) . "T" . date("H:i:s", $post_date);
$catids = wp_get_post_cats('1', $post_ID);
logIO("O", "CateGory No:" . count($catids));
foreach ($catids as $catid) {
$catname = get_cat_name($catid);
logIO("O", "CateGory:" . $catname);
$catnameenc = new xmlrpcval(mb_conv($catname, "UTF-8", "auto"));
$catlist[] = $catnameenc;
}
$post = get_extended($postdata['Content']);
$allow_comments = 'open' == $postdata['comment_status'] ? 1 : 0;
$allow_pings = 'open' == $postdata['ping_status'] ? 1 : 0;
$resp = array('link' => new xmlrpcval(post_permalink($post_ID)), 'title' => new xmlrpcval(mb_conv($postdata["Title"], "UTF-8", "auto")), 'description' => new xmlrpcval(mb_conv($post['main'], "UTF-8", "auto")), 'dateCreated' => new xmlrpcval($post_date, 'dateTime.iso8601'), 'userid' => new xmlrpcval($postdata["Author_ID"]), 'postid' => new xmlrpcval($postdata["ID"]), 'content' => new xmlrpcval(mb_conv($postdata["Content"], "UTF-8", "auto")), 'permalink' => new xmlrpcval(post_permalink($post_ID)), 'categories' => new xmlrpcval($catlist, 'array'), 'mt_keywords' => new xmlrpcval("{$catids[0]}"), 'mt_excerpt' => new xmlrpcval(mb_conv($postdata['Excerpt'], "UTF-8", "auto")), 'mt_allow_comments' => new xmlrpcval($allow_comments, 'int'), 'mt_allow_pings' => new xmlrpcval($allow_pings, 'int'), 'mt_convert_breaks' => new xmlrpcval('true'), 'mt_text_more' => new xmlrpcval(mb_conv($post['extended'], "UTF-8", "auto")));
$resp = new xmlrpcval($resp, 'struct');
return new xmlrpcresp($resp);
} else {
return new xmlrpcresp(0, $xmlrpcerruser + 3, "No such post #{$post_ID}");
}
} else {
return new xmlrpcresp(0, $xmlrpcerruser + 3, 'Wrong username/password combination ' . $username . ' / ' . starify($password));
}
}
示例11: remotesignin
public function remotesignin()
{
$result = 0;
// fail by default
// add multiple locations here in the future
$location = 1;
$this->load->model("members/membermodel");
$member = $this->membermodel->authMacAddr($this->input->post('mac'));
if ($member) {
// the macaddress was found belonging to a user
$result = $this->membermodel->checkin($location, SignInMethod::WIFI) ? 1 : 0;
error_log("check result" . $result, 0);
if (!$result) {
$result = 4;
echo $result;
return $result;
} else {
$result = 1;
echo $result;
return $result;
}
} else {
//do we have a username and password
$username = $this->input->post("u");
// test if the username we have is the dummy username
// we use a dummy username in the transparent authentication
if ($username == "mactest") {
// the mac wasn't recognized and we don't have a real userid
// fail back to radius
$result = 2;
echo $result;
return $result;
}
// now we assume we have a real username
if (!user_pass_ok($this->input->post('u'), $this->input->post('p'))) {
// user authentication with password failed.
error_log("Invalid user login:" . $this->input->post('u'), 0);
$result = 3;
echo $result;
return $result;
}
// initialize a member object
$member = $this->membermodel->get_basicMemberData($this->input->post('u'), UserIdType::WORDPRESSLOGIN);
if ($this->membermodel->checkin($location, SignInMethod::WIFI)) {
// we don't add the auto sign in until after we are sure the checkin works
if (!$this->membermodel->addMacAddr($this->input->post('mac'))) {
// this process isn't dire (they are just going to get asked to log in again
// we log the issue to the front desk
issue_log($member->id, "issue adding mac address during checkin");
}
$result = $member->id;
// success
error_log("signin checkin success!", 0);
$result = 1;
echo $result;
return $result;
} else {
// for some reason we could not checkin the user
error_log("signin checkin failure!", 0);
$result = 4;
echo $result;
return $result;
}
error_log("checkin success!", 0);
// if we made it this far we have checked in and all good. Give users access to WIFI
$result = 1;
}
}
示例12: wp_mail_receive
//.........这里部分代码省略.........
}
}
$contentfirstline = $blah[1];
} else {
echo "<p><b>Use Phone Mail:</b> No</p>\n";
$userpassstring = strip_tags($firstline);
$contentfirstline = '';
}
$flat = 999.0;
$flon = 999.0;
$secondlineParts = explode(':', strip_tags($secondline));
if (strncmp($secondlineParts[0], "POS", 3) == 0) {
echo "Found POS:<br />\n";
// echo "Second parts is:".$secondlineParts[1];
// the second line is the postion listing line
$secLineParts = explode(',', $secondlineParts[1]);
$flatStr = $secLineParts[0];
$flonStr = $secLineParts[1];
// echo "String are ".$flatStr.$flonStr;
$flat = floatval($secLineParts[0]);
$flon = floatval($secLineParts[1]);
// echo "values are ".$flat." and ".$flon;
// ok remove that position... we should not have it in the final output
$content = str_replace($secondline, '', $content);
}
$blah = explode(':', $userpassstring);
$user_login = trim($blah[0]);
$user_pass = $blah[1];
$content = $contentfirstline . str_replace($firstline, '', $content);
$content = trim($content);
// Please uncomment following line, only if you want to check user and password.
// echo "<p><b>Login:</b> $user_login, <b>Pass:</b> $user_pass</p>";
echo "<p><b>Login:</b> {$user_login}, <b>Pass:</b> *********</p>";
if (!user_pass_ok($user_login, $user_pass)) {
echo "<p><b>Error: Wrong Login.</b></p></div>\n";
continue;
}
$userdata = get_userdatabylogin($user_login);
$user_level = $userdata->user_level;
$post_author = $userdata->ID;
if ($user_level > 0) {
$post_title = xmlrpc_getposttitle($content);
if ($post_title == '') {
$post_title = $subject;
}
echo "Subject : " . mb_conv($post_title, $GLOBALS['blog_charset'], $sub_charset) . " <br />\n";
$post_category = get_settings('default_category');
if (preg_match('/<category>(.+?)<\\/category>/is', $content, $matchcat)) {
$post_category = xmlrpc_getpostcategory($content);
$content = xmlrpc_removepostdata($content);
}
if (empty($post_category)) {
$post_category = get_settings('default_post_category');
}
echo "Category : {$post_category} <br />\n";
$post_category = explode(',', $post_category);
if (!get_settings('emailtestonly')) {
$content = preg_replace('|\\n([^\\n])|', " \$1", trim($content));
$content_before = "";
$content_after = "";
for ($i = 0; $i < count($attaches); $i++) {
$create_thumbs = $attaches[$i]['type'] == 'mix' ? 1 : 0;
list($file_name, $is_img, $orig_name) = wp_getattach($attaches[$i]['body'], "user-" . trim($post_author), $create_thumbs);
if ($file_name) {
if ($attaches[$i]['type'] == 'relate') {
$content = preg_replace("/cid:" . preg_quote($attaches[$i]['id']) . "/", get_settings('fileupload_url') . '/' . $file_name, $content);
示例13: is_correct_password
/**
* @see IdentityProvider_Driver::is_correct_password.
*/
public function is_correct_password($user, $password)
{
return user_pass_ok($user->name, $password);
}
示例14: imap_fetchbody
break;
}
}
} else {
// single part
$strbody = imap_fetchbody($mbox, $index, 1);
}
// process body
$a_body = split(chr(13), $strbody, 2);
$a_authentication = split(':', $a_body[0]);
$content = $a_body[1];
$user_login = trim($a_authentication[0]);
$user_pass = @trim($a_authentication[1]);
echo_message('•<b>' . T_('Authenticating User') . ":</b> {$user_login} ");
// authenticate user
if (!user_pass_ok($user_login, $user_pass)) {
echo_message('[ ' . T_('Fail') . ' ]<br />', 'orange');
echo_message('• ' . T_('Wrong login or password.') . ' ' . T_('First line of text in email must be in the format "username:password"') . '<br />', 'orange');
continue;
} else {
echo_message('[ ' . T_('Pass') . ' ]<br />', 'green');
}
$subject = trim(str_replace($Settings->get('eblog_subject_prefix'), '', $subject));
// remove content after terminator
$eblog_terminator = $Settings->get('eblog_body_terminator');
if (!empty($eblog_terminator)) {
$os_terminator = strpos($content, $Settings->get($eblog_terminator));
if ($os_terminator) {
$content = substr($content, 0, $os_terminator);
}
}
示例15: wp_mail_receive
//.........这里部分代码省略.........
}
$contentfirstline = $blah[1];
} else {
echo "<p><b>Use Phone Mail:</b> No</p>\n";
$userpassstring = strip_tags($firstline);
$contentfirstline = '';
}
$flat = 999.0;
$flon = 999.0;
$secondlineParts = explode(':', strip_tags($secondline));
if (strncmp($secondlineParts[0], "POS", 3) == 0) {
echo "Found POS:<br>\n";
// echo "Second parts is:".$secondlineParts[1];
// the second line is the postion listing line
$secLineParts = explode(',', $secondlineParts[1]);
$flatStr = $secLineParts[0];
$flonStr = $secLineParts[1];
// echo "String are ".$flatStr.$flonStr;
$flat = floatval($secLineParts[0]);
$flon = floatval($secLineParts[1]);
// echo "values are ".$flat." and ".$flon;
// ok remove that position... we should not have it in the final output
$content = str_replace($secondline, '', $content);
}
$blah = explode(':', $userpassstring);
$user_login = $blah[0];
$user_pass = $blah[1];
$user_login = mb_conv(trim($user_login), $GLOBALS['blog_charset'], $charset);
$content = $contentfirstline . str_replace($firstline, '', $content);
$content = trim($content);
// Please uncomment following line, only if you want to check user and password.
// echo "<p><b>Login:</b> $user_login, <b>Pass:</b> $user_pass</p>";
echo "<p><b>Login:</b> {$user_login}, <b>Pass:</b> *********</p>";
if (!user_pass_ok($user_login, $user_pass)) {
echo "<p><b>Wrong Login.</b></p></div>\n";
continue;
}
$userdata = get_userdatabylogin($user_login);
$user_level = $userdata->user_level;
$post_author = $userdata->ID;
if ($user_level > 0) {
$post_title = xmlrpc_getposttitle($content);
if ($post_title == '') {
$post_title = $subject;
}
$post_category = get_settings('default_category');
if (preg_match('/<category>(.+?)<\\/category>/is', $content, $matchcat)) {
$post_category = xmlrpc_getpostcategory($content);
}
if ($post_category == '') {
$post_category = get_settings('default_post_category');
}
echo "Subject : " . mb_conv($subject, $GLOBALS['blog_charset'], $sub_charset) . " <br />\n";
echo "Category : {$post_category} <br />\n";
if (!get_settings('emailtestonly')) {
// Attaching Image Files Save
if ($att_boundary != "") {
$attachment = wp_getattach($contents[2], "user-" . trim($post_author), 1);
}
if ($boundary != "" && $hatt_boundary != "") {
for ($i = 2; $i < count($contents); $i++) {
$hattachment = wp_getattach($contents[$i], "user-" . trim($post_author), 0);
if ($hattachment) {
if (preg_match("/Content-Id: \\<([^\\>]*)>/i", $contents[$i], $matches)) {
$content = preg_replace("/(cid:" . preg_quote($matches[1]) . ")/", wp_siteurl() . "/attach/" . $hattachment, $content);
}