Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mysql = require('mysql');
- var connection = mysql.createConnection({
- host : 'localhost',
- user : 'wordpress',
- password : 'jPWrwvGbYXMADd8F',
- database : 'wordpress',
- });
- connection.query('SELECT * FROM wp_users', function(err, rows) {
- if (err) {
- console.log("Database error: " + err);
- } else {
- for (var i = 0; i < rows.length; i++){
- console.log("Rows[" + i + "] : " + rows[i].user_login + " " + passwordHash.checkPassword('secret',rows[i].user_pass));
- }
- }
- });
- Cookie Name: wordpress_logged_in_2801795354f6f1c2d2ab3b48033a8257
- Cookie Value: admin|1392386298|647852d61caf4cfdea975d54ecb09ca8
- Cookie Value: %user_login%|%cookie_expire_time%|%hashed_sliced_user_hashed_password%
- $logged_in_cookie = wp_generate_auth_cookie($user_id, $expiration, 'logged_in');
- //...
- setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
- if ( !defined( 'COOKIEHASH' ) ) {
- $siteurl = get_site_option( 'siteurl' );
- if ( $siteurl )
- define( 'COOKIEHASH', md5( $siteurl ) );
- else
- define( 'COOKIEHASH', '' );
- }
- //...
- define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
- //WordPress wp-config.php
- define('LOGGED_IN_COOKIE', 'logged_in_'.'%privateHashKey%');
- //NODEJS
- var LOGGED_IN_COOKIE = 'logged_in_'+'%privateHashKey%';
- if ( !function_exists('wp_generate_auth_cookie') ) :
- //...
- function wp_generate_auth_cookie($user_id, $expiration, $scheme = 'auth') {
- $user = get_userdata($user_id);
- $pass_frag = substr($user->user_pass, 8, 4);
- $key = wp_hash($user->user_login . $pass_frag . '|' . $expiration, $scheme);
- $hash = hash_hmac('md5', $user->user_login . '|' . $expiration, $key);
- $cookie = $user->user_login . '|' . $expiration . '|' . $hash;
- return apply_filters('auth_cookie', $cookie, $user_id, $expiration, $scheme);
- }
- endif;
- define('COOKIE_DOMAIN', '.domain.com');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement