PHP ﺭﺩ ﺱﺮﭘﺩﺭﻭ ﻦﯿﻣﺩﺍ ﺭﺎﮐﺩﻮﺧ ﺩﻭﺭﻭ


:ﺪﯾﻮﮔ ﯽﻣ ﻪﮐ ﺪﻫﺩ ﯽﻣ ﻥﺎﺸﻧ ﺍﺭ ﯼﺍ ﻪﯿﻣﻼﻋﺍ ﯽﮔﺩﺎﺳ ﻪﺑ ﻩﺪﻨﺴﯾﻮﻧ ،ﺕﺎﻗﻭﺍ ﺮﺘﺸﯿﺑ .ﺪﻨﻨﮐ ﯼﺯﺎﺑ

USERNAME: ﯽﺸﯾﺎﻤﻧ ﻪﺨﺴﻧ

.ﺩﺮﮐ ﻝﺎﻌﻓ ﻭ ﻩﺩﺍﺩ ﺭﺍﺮﻗ ﺩﻮﺧ ﻪﻧﻭﺰﻓﺍ ﻞﯾﺎﻓ ﺭﺩ ﺍﺭ ﻥﺁ ﻥﺍﻮﺗ ﯽﻣ ﺎﯾ ،ﺩﻮﺷ ﺎﻫﺭ ﺎﻤﺷ ﻢﺗ ﻊﺑﺍﻮ

؛ﺮﮔﺍ ﺪﺷﺎﺑ ﺪﯿﻔﻣ ﺪﻧﺍﻮﺗ ﯽﻣ ﻦﯾﺍ

  • .ﺖﺳﺍ ﺱﺎﻨﺷﺎﻧ ﻥﺍﺮﺑﺭﺎﮐ ﺩﻭﺭﻭ ﯼﺍﺮﺑ ﯽﻣﻮﻤﻋ ﺏﺎﺴﺣ ﮏﯾ ﯼﺍﺭﺍﺩ ﺎﻤﺷ ﺖﯾﺎﺳ
  • .ﺪﯿﻫﺍﻮﺧ ﯽﻣ ﮏﯿﻠﮐ ﮏﯾ ﺎﺑ ﺩﻭﺭﻭ ﮏﻨﯿﻟ ﮏﯾ ﺎﻤﺷ
  • .ﺪﯿﻧﺎﺳﺮﺑ ﻞﻗﺍﺪﺣ ﻪﺑ ﺍﺭ ﻡﺯﻻ ﻞﺣﺍﺮﻣ ﻭ ﺪﯿﻧﺎﺳﺮﺑ ﺮﺜﮐﺍﺪﺣ ﻪﺑ ﺍﺭ ﻝﻮﺼﺤﻣ ﯽﺸﯾﺎﻣﺯﺁ ﻪﺨﺴﻧ ﻞﯾﺪﺒﺗ
  • .(ﺕﺎﻤﯿﻈﻨﺗ ﻪﺤﻔﺻ ﻼًﺜﻣ) ﺪﯿﻨﮐ ﺖﯾﺍﺪﻫ ﻪﻃﻮﺑﺮﻣ ﻥﺎﮑﻣ ﻪﺑ ﺎًﻤﯿﻘﺘﺴﻣ ﺍﺭ ﻥﺎﮔﺪﻨﻨﮐﺪﯾﺩﺯﺎﺑ ﺪﯿﻫﺍﻮﺧu

ﻢﻬﻣ: ﺏﺎﺴﺣ ﻪﺑ ﺩﻭﺭﻭ ﯼﺍﺮﺑ ﻦﯾﺍ ﺯﺍ ﺰﮔﺮﻫﺏﺎﺴﺣ .ﻝﺎﺜﻣ ﻥﺍﻮﻨﻋ ﻪﺑ .ﺪ

.ﺖﺳﺍ ﻩﺪﺷ ﯽﻫﺩ ﻞﯾﺎﺘﺳﺍ (ﻦﻣ ﯽﺼﺨﺷ ﺢﯿﺟﺮﺗ) ﻞﻘﺘﺴﻣ ﻪﻧﻭﺰﻓﺍ ﮏﯾ ﺐﻟﺎﻗ ﺭﺩ ﺮﯾﺯ ﻪﻌﻄﻗ .ﺪﻧﺯﺍﺩﺮﭙﺑ

/*
Plugin Name: Auto Login
Plugin URI: http://hbt.io/
Version: 1.0.0
Author: Harri Bell-Thomas
Author URI: http://hbt.io/
*/

function autologin() {
	// PARAMETER TO CHECK FOR
	if ($_GET['autologin'] == 'demo') {
		
		// ACCOUNT USERNAME TO LOGIN TO
		$creds['user_login'] = 'demo';
		
		// ACCOUNT PASSWORD TO USE
		$creds['user_password'] = 'demo';
		
		$creds['remember'] = true;
		$autologin_user = wp_signon( $creds, false );
		
		if ( !is_wp_error($autologin_user) ) 
			header('Location: wp-admin'); // LOCATION TO REDIRECT TO
	}
}
// ADD CODE JUST BEFORE HEADERS AND COOKIES ARE SENT
add_action( 'after_setup_theme', 'autologin' );

ﻩﺩﺎﻔﺘﺳﺍ

http://example.com/wp-login.php?autologin=demo .ﺪﯿﻨﮐ ﻪﻌﺟﺍﺮﻣ ﺖ

.ﺪﯿﻨﯿﺒﺑ ﺖﺳﺍ ﯼﺩﺎﻋ ﻪﮐ ﺭﻮﻄﻧﺎﻤﻫ ﺍﺭ ﻢﺘﺴﯿﺳ ﻪﺑ ﺩﻭﺭﻭ ﻡﺮﻓ ﺪﯾﺎﺑ ﻂﻘﻓ ،ﺖﺳﺍ ﻩﺎﺒﺘﺷﺍ ﻪﻣﺎﻧﺭﺎﺒﺘ

ﯼﺯﺎﺳ ﯽﺼﺨﺷ

(ﻞﻣﺎﮐ ﺪﮐ 17 ﺎﺗ 11 ﻁﻮﻄﺧ) ﺪﻧﻮﺷ ﺩﺎﺠﯾﺍ ﺮﯾﺯ ﺪﮐ ﮎﻮﻠﺑ ﺭﺩ ﺪﯾﺎﺑ ﺕﺍﺮﯿﯿﻐﺗ ﻦﯾﺍ ﻪﻤﻫ ﻭ ،ﺪﯿﻨﮐ

if ($_GET['login'] == 'dummy_account') {

        // ACCOUNT USERNAME TO LOGIN TO
        $creds['user_login'] = 'dummy';

        // ACCOUNT PASSWORD TO USE
        $creds['user_password'] = 'pa55word';

wp-login.php?login=dummy_account .ﺩﻮﺷ ﯽﻣ ﯽﺳﺭﺮﺑ ﻻﺎﺑ ﺪﮐ ﮎﻮﻠﺑ .ﺩ

!ﺪﯿﺷﺎﺑ ﻩﺩﺎﻣﺁ ﺪﯾﺎﺑ ﻭ ﺪﯿﻨﮐ ﺮﭘ ﺍﺭ ﺮﯾﺩﺎﻘﻣ ﻦﯾﺍ .ﺖﺳﺍ "pa55word" ﻕﻮﻓ ﺭﻮﺒﻋ ﺰﻣﺭ .ﺪﯿﻨﮐ ﯽ

ﯽﻧﺩﻭﺰﻓﺍ ﯼﺎﻫ ﻪﻣﺎﻧﺮﺑ

.ﺪﯾﺯﺍﺪﻨﯿﺑ ﯽﻫﺎﮕﻧ ﺮﯾﺯ ﺭﺩ ﻦﻣ ﻞﺣ ﻩﺍﺭ ﻪﺑ .ﺪﯿﻨﮐ ﺭﺍﺮﮑﺗ ﺎﻫﺭﺎﺑ ﻭ ﺎﻫﺭﺎﺑ ﺍﺭ ﻪﻌﻄﻗ ﻞﮐ ﻪﮐ ﺖﺴ

/*
Plugin Name: Auto Login
Plugin URI: http://hbt.io/
Description: Create convenient auto-login links to quickly login to generic accounts. Configure source code to make changes.
Version: 1.0.0
Author: Harri Bell-Thomas
Author URI: http://hbt.io/
*/

// Declare global var's
global $login_parameter, $accounts;

// THE PARAMETER TO CHECK FOR
// eg. http://exmaple.com/wp-login.php?param_name=account
$login_parameter = "autologin";

// ACCOUNT CODE BLOCK
$accounts[] = array(
				"user" => "demo",
				"pass" => "demo",
				"location" => "wp-admin",
			  );
// END ACCOUNT CODE BLOCK

// EDIT AND REPEAT CODE BLOCK FOR AS MANY ACCOUNTS AS NEEDED

// Another example iteration
$accounts[] = array(
				"user" => "tcwp",
				"pass" => "demo",
				"location" => "wp-admin/?tcwp-sent-me",
			  );


// SEE PREVIOUS EXAMPLE FOR DETAILS ABOUT THIS FUNCTION
function autologin() {
	global $login_parameter, $accounts;
	foreach ($accounts as $account) {
		if ($_GET[$login_parameter] == $account['user']) {
			$creds['user_login'] = $account['user'];
			$creds['user_password'] = $account['pass'];
			$creds['remember'] = true;
			$autologin_user = wp_signon( $creds, false );
			if ( !is_wp_error($autologin_user) ) 
				header('Location: ' . $account['location']); 
		}
	}
}
add_action( 'after_setup_theme', 'autologin' );

.ﺪﯿﻨﮐ ﻪﻓﺎﺿﺍ ﻭ ﻩﺩﺮﮐ ﯽﺷﺭﺎﻔﺳ ﺍﺭ ﺮﯾﺯ ﺪﮐ ﯼﺎﻫﮎﻮﻠﺑ ﺯﺍ ﺩﺍﺪﻌﺗ ﺮﻫ ﺖﺳﺍ ﯽﻓﺎﮐ ،ﯽﻓﺎﺿﺍ ﯼ

// ACCOUNT CODE BLOCK
$accounts[] = array(
				"user" => "anotheraccount",
				"pass" => "public_password",
				"location" => "http://YouCanPutURLsHereToo.com/",
			  );
// END ACCOUNT CODE BLOCK

.ﻢﻨﮐ ﻑﺬﺣ()autologin ﻊﺑﺎﺗ ﺯﺍ ﺍﺭ ﺖﺨﺳ ﻩﺪﺷ ﯼﺭﺍﺬﮔﺪﮐ ﺮﯾﺩﺎﻘﻣ ﻡﺎﻤﺗ ﺎﺗ ﻡﺩﺍﺩ ﻡﺎﺠﻧﺍ ﯽﮔﺩﺎ

ﻪﺠﯿﺘﻧ

!ﺪﯿﻫﺪﺑ ﺮﻈﻧ ﺮﯾﺯ ﺕﺍﺮﻈﻧ ﺶﺨﺑ ﺭﺩ ﺪﯾﺭﺍﺩ ﯼﺍ ﻩﺪﯾﺍ/ﺩﺎﻬﻨﺸﯿﭘ/ﺩﺭﻮﺧﺯﺎﺑ ﺮﮔﺍ .ﺪﯿﻨﮐ ﺖﯿﯾﻮﺗ ﻦﻣ ﯼ