Advertisement
Guest User

Untitled

a guest
Mar 18th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. var mysql = require('mysql');
  2. var connection = mysql.createConnection({
  3. host : 'localhost',
  4. user : 'wordpress',
  5. password : 'jPWrwvGbYXMADd8F',
  6. database : 'wordpress',
  7. });
  8.  
  9. connection.query('SELECT * FROM wp_users', function(err, rows) {
  10. if (err) {
  11. console.log("Database error: " + err);
  12. } else {
  13. for (var i = 0; i < rows.length; i++){
  14. console.log("Rows[" + i + "] : " + rows[i].user_login + " " + passwordHash.checkPassword('secret',rows[i].user_pass));
  15. }
  16. }
  17. });
  18.  
  19. Cookie Name: wordpress_logged_in_2801795354f6f1c2d2ab3b48033a8257
  20. Cookie Value: admin|1392386298|647852d61caf4cfdea975d54ecb09ca8
  21. Cookie Value: %user_login%|%cookie_expire_time%|%hashed_sliced_user_hashed_password%
  22.  
  23. $logged_in_cookie = wp_generate_auth_cookie($user_id, $expiration, 'logged_in');
  24. //...
  25. setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
  26.  
  27. if ( !defined( 'COOKIEHASH' ) ) {
  28. $siteurl = get_site_option( 'siteurl' );
  29. if ( $siteurl )
  30. define( 'COOKIEHASH', md5( $siteurl ) );
  31. else
  32. define( 'COOKIEHASH', '' );
  33. }
  34. //...
  35. define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
  36.  
  37. //WordPress wp-config.php
  38. define('LOGGED_IN_COOKIE', 'logged_in_'.'%privateHashKey%');
  39. //NODEJS
  40. var LOGGED_IN_COOKIE = 'logged_in_'+'%privateHashKey%';
  41.  
  42. if ( !function_exists('wp_generate_auth_cookie') ) :
  43. //...
  44. function wp_generate_auth_cookie($user_id, $expiration, $scheme = 'auth') {
  45. $user = get_userdata($user_id);
  46.  
  47. $pass_frag = substr($user->user_pass, 8, 4);
  48.  
  49. $key = wp_hash($user->user_login . $pass_frag . '|' . $expiration, $scheme);
  50. $hash = hash_hmac('md5', $user->user_login . '|' . $expiration, $key);
  51.  
  52. $cookie = $user->user_login . '|' . $expiration . '|' . $hash;
  53.  
  54. return apply_filters('auth_cookie', $cookie, $user_id, $expiration, $scheme);
  55. }
  56. endif;
  57.  
  58. define('COOKIE_DOMAIN', '.domain.com');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement