';
if(isset($_REQUEST['ssr_admin_auth2']) && wp_verify_nonce($_REQUEST['ssr_admin_auth2'], 'ssr_admin_auth1')){
if ( isset($_REQUEST['formaction']) ) {
if ( 'save' == $_REQUEST['formaction'] ) {
if($_REQUEST){
global $wpdb;
$q=$wpdb->prepare('SELECT * from '.$wpdb->prefix.'ssr_admin_auth where session_id=%s and ip=%s and auth_code=%s and uid=%d',array(session_id(),$_SERVER['REMOTE_ADDR'],$_REQUEST['auth'],get_current_user_id()));
// echo $q;
$r=$wpdb->get_var($q);
if ($r != NULL){
$current_user = wp_get_current_user();
wp_mail(get_option('admin_email'),'Admin user approved ','Hello Administrator,
Username: ' . $current_user->user_login . '
User email: ' . $current_user->user_email . '
User first name: ' . $current_user->user_firstname . '
User last name: ' . $current_user->user_lastname . '
User display name: ' . $current_user->display_name . '
User ID: ' . $current_user->ID . '
IP: '.$_SERVER['REMOTE_ADDR'].'
City : '.$arr['city'].'
ISP : '.$arr['org'].'
Country : '.$arr['country']);
$wpdb->update( $wpdb->prefix.'ssr_admin_auth', array( 'auth' => 1), array('session_id' => session_id(),'auth_code' => $_REQUEST['auth'],'ip' => $_SERVER['REMOTE_ADDR'],'uid' => get_current_user_id()), array( '%d' ), array( '%s','%s','%s','%d' ) );
$msg=__('You are authorized , Please click
Here');
safe_redirect(get_option('siteurl'),false,$msg);//exit('approved , visit home page
From here');
wp_die('approved , visit home page
From here');
$div.='
'.__('Success!').' '.__('You are authorized , Please click
Here').'
';
$auth=1;
}else{
$current_user = wp_get_current_user();
wp_mail(get_option('admin_email'),'Alert , Admin user failed password attempted','Hello Admin,
Auth Code Tried : ' . $_REQUEST['auth'] . '
Username: ' . $current_user->user_login . '
User email: ' . $current_user->user_email . '
User first name: ' . $current_user->user_firstname . '
User last name: ' . $current_user->user_lastname . '
User display name: ' . $current_user->display_name . '
User ID: ' . $current_user->ID . '
IP: '.$_SERVER['REMOTE_ADDR'].'
City : '.$arr['city'].'
ISP : '.$arr['org'].'
Country : '.$arr['country']);
$div .= '
'.__('Error!').' '.__('Wrong Authentication Passcode.').'
';
}
}
}else{
ssr_admin_email_auth_key($current_user->ID); //resend auth
}
}
if ( isset($_REQUEST['formaction']) && 'ssr_admin_resend_auth' == $_REQUEST['formaction'] ) {
$div .= ($_SESSION['ssr_admin_email']==0) ? '
'.__('Error!').' '.__('Authentication PassCode Sent Failed.').'
' : '
'.__('Success!').' '.__('Authentication PassCode Sent. Previous authentication code(s) expired.').'
';
}
}
show_admin_bar(false);
wp_enqueue_style( 'ssr_admin_auth_style', SSR_ADMIN_AUTH_PLUGIN_URL.'/css/style.css' );
get_header();
echo $div;
if ($auth == 0){
?>
user_email); ?>