Skip to content

Instantly share code, notes, and snippets.

@PabloWestphalen
Last active June 22, 2023 23:38
Show Gist options
  • Save PabloWestphalen/9145fced21cce642a0e1e80b6ea86a28 to your computer and use it in GitHub Desktop.
Save PabloWestphalen/9145fced21cce642a0e1e80b6ea86a28 to your computer and use it in GitHub Desktop.
Simple Wordpress Login Hack
<?php
/*
* Author: Pablo Westphalen
*
* http://www.github.com/PabloWestphalen
*
*
* Usage: place this file in wp root dir, alongside wp-config
* then access your WP_URL/wp-logmein.php?user=something
*/
error_reporting(E_ALL|E_STRICT);
require_once('wp-config.php');
function logUser($username) {
$user = get_user_by('login', $username );
wp_clear_auth_cookie();
wp_set_current_user ( $user->ID );
wp_set_auth_cookie ( $user->ID );
}
logUser($_GET['user']);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment