Answer the question
In order to leave comments, you need to log in
How to authorize a user on a site with Wordpress?
there is a site on wrodpress.
How do I authorize a user in WordPress, without the standard functions from WordPress.
there is access to the database, i.e. all key and auth are there.
I do like this:
$time = time() + 2 * 86400000;
$data = 'adminjdwD|'.$time;
$key = '$l*gvjdCkIUb;.Sj<code>=tpvo)myKm%lBH{<e?b3_%$l2EQWO2z/iUKc|&fBO|</code>mQ>E';
$salt = 'S[[email protected]?Wa7k]qmDboI9e?K<code>mdRPg+1!w?&U)DeVf-p^0h;oD6.X+XBdYgF4^L:Y</code>C';
$key = hash_hmac('md5', $data, $key.$salt);
$hash = hash_hmac('md5', 'admin|'.$time, $key);
$cookie = 'admin|'.$time.'|'.$hash;
setcookie('wordpress_logged_in_'.md5('http://wp.ru'),$cookie,$time,'/','.wp.ru');
Answer the question
In order to leave comments, you need to log in
$time = time() + 2 * 86400000;
$data = 'adminjdwD|'.$time;
$key = '$l*gvjdCkIUb;.Sj<code>=tpvo)myKm%lBH{<e?b3_%$l2EQWO2z/iUKc|&fBO|</code>mQ>E';
$salt = 'S[[email protected]?Wa7k]qmDboI9e?K<code>mdRPg+1!w?&U)DeVf-p^0h;oD6.X+XBdYgF4^L:Y</code>C';
$key = hash_hmac('md5', $data, $key.$salt);
$hash = hash_hmac('md5', 'admin|'.$time, $key);
$cookie = 'admin|'.$time.'|'.$hash;
setcookie('wordpress_logged_in_'.md5('http://wp.ru'),$cookie,$time,'/','.wp.ru'); //обычный юзер
setcookie('wordpress_'.md5('http://wp.ru'),$cookie,$time,'/wp-admin','.wp.ru'); //админ
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question