<?php
#  ________         ____________      _____ ________                       ________      
#  ___  __ )____  _____  /___  /_____ __  /____  __ \______________ ______ ___  __/      
#  __  __  |_  / / /__  / __  / _  _ \_  __/__  /_/ /__  ___/_  __ \_  __ \__  /_        
#  _  /_/ / / /_/ / _  /  _  /  /  __// /_  _  ____/ _  /    / /_/ // /_/ /_  __/        
#  /_____/  \__,_/  /_/   /_/   \___/ \__/  /_/      /_/     \____/ \____/ /_/           
#  ________                             _____ _____              ________                
#  __  ___/_____ ___________  _____________(_)__  /______  __    ___  __ \______________ 
#  _____ \ _  _ \_  ___/_  / / /__  ___/__  / _  __/__  / / /    __  /_/ /__  ___/_  __ \
#  ____/ / /  __// /__  / /_/ / _  /    _  /  / /_  _  /_/ /     _  ____/ _  /    / /_/ /
#  /____/  \___/ \___/  \__,_/  /_/     /_/   \__/  _\__, /      /_/      /_/     \____/ 
#                                                   /____/                               
# 42756C6C657450726F6F66 5365637572697479 50726F 
#
/*	The Copyright, AITpro Software Products License Information must remain
	intact or all BulletProof Security Pro warranties, guarantees, liabilities are void.
	
	Copyright (C) Edward Alexander, AIT-pro.com. All rights reserved.

	AITpro Software Products License Information:
	BY DOWNLOADING, INSTALLING, COPYING, ACCESSING, OR USING BulletProof Security Pro YOU AGREE TO THE TERMS OF THIS AGREEMENT. 
	IF YOU 	ARE ACCEPTING THESE TERMS ON BEHALF OF ANOTHER PERSON OR A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT AND WARRANT
	THAT YOU HAVE FULL AUTHORITY TO BIND THAT PERSON, COMPANY, OR LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT AGREE TO THESE TERMS,
	* DO NOT DOWNLOAD, INSTALL, COPY, ACCESS, OR USE BulletProof Security Pro; AND
	* PROMPTLY RETURN BulletProof Security Pro TO THE PARTY FROM WHOM YOU ACQUIRED IT. IF YOU DOWNLOADED BulletProof Security Pro
	FROM THE AITPRO WEBSITE, CONTACT AITPRO FOR A REFUND IF APPLICABLE.
	
	AITpro Software Products License Information continued:
	You agree to keep the AITpro Software Products License for BulletProof Security Pro, unmodified or altered in any way,
	with the original copy of BulletProof Security Pro that you have and any and all copies or partial copies of BulletProof
	Security Pro that You make. 
*/
// Direct calls to this file are Forbidden when core files are not present
if ( ! function_exists('add_action') ) {
		header('Status: 403 Forbidden');
		header('HTTP/1.1 403 Forbidden');
		exit();
}
 
if ( ! current_user_can('manage_options') ) { 
		header('Status: 403 Forbidden');
		header('HTTP/1.1 403 Forbidden');
		exit();
}
?>

<!-- force the vertical scrollbar -->
<style>
#wpwrap{min-height:100.1%};
</style>

<div id="bps-container" class="wrap" style="margin:10px 20px 5px 0px;">

<!-- js no script check removed - triggers ModSecurity CRS Rules -->

<?php 
$ScrollTop_options = get_option('bulletproof_security_options_scrolltop');

if ( isset( $ScrollTop_options['bps_scrolltop'] ) && $ScrollTop_options['bps_scrolltop'] != 'Off' ) {
	
	if ( esc_html($_SERVER['REQUEST_METHOD']) == 'POST' && ! isset( $_POST['Submit-diagnostic-check1'] ) && ! isset( $_POST['Submit-diagnostic-check2'] ) && ! isset( $_POST['bps-ini-find-submit'] ) || isset( $_GET['settings-updated'] ) && @$_GET['settings-updated'] == true ) { 

		bpsPro_Browser_UA_scroll_animation();
	}
}
?>

<?php
// S-Monitor HUD - Heads Up Display - Warnings, Error messages, AutoFix Setup & Whitelist - displayed in BPS Only		
bps_HUD_autofix_setup_bps_only();
bps_HUD_autofix_whitelist_bps_only();
bps_HUD_bps_only();

// S-Monitor BPS Security Status for Root and wp-admin (only if problem) - displayed in BPS Only
bps_security_status_bps_only();
bps_security_status_wpadmin_bps_only();

// S-Monitor & AutoRestore Status display - displayed in  BPS Only 
bps_ARCM_admin_notice_status_bps();

// S-Monitor - MScan Status display - BPS pages ONLY
bps_MScan_admin_notice_status_bps();

// S-Monitor - DB Monitor Status display - BPS pages ONLY
bps_DBM_admin_notice_status_bps();

// S-Monitor - DB Backup Status display - BPS pages ONLY
bps_DBB_admin_notice_status_bps();

// S-Monitor - Plugin Firewall Status display - BPS pages ONLY
bps_PFWAP_admin_notice_status_bps();

// S-Monitor - Uploads Anti-Exploit Guard Status display - BPS pages ONLY
bps_UAEG_admin_notice_status_bps();

// S-Monitor - Login Security Status display - BPS pages ONLY
bps_Login_Security_admin_notice_status_bps();

// S-Monitor - JTC Anti-Spam Status display - BPS pages ONLY
bps_jtc_antispam_admin_notice_status_bps();

// S-Monitor - Idle Session Status display - BPS pages ONLY
bpsPro_isl_notice_status_bps();

// S-Monitor - Auth Cookie Expiration Status display - BPS pages ONLY
bpsPro_ace_notice_status_bps();

// S-Monitor - Login Security Alerts - BPS pages ONLY
bps_smonitor_LoginSecurityResetModTimeDiff_bps();

// S-Monitor - ARQ Alerts - BPS pages ONLY
bps_smonitor_ARQ_alerts_bps();

// S-Monitor PHP Error Log - New PHP Errors - displayed in BPS Only
bps_smonitor_ELogModTimeDiff_bps();

// S-Monitor Security Log - New Log Entry Has Been Logged - displayed in BPS Only
bps_smonitor_SecurityLogModTimeDiff_bps();

// S-Monitor - PHP Error Log Set & valid path, ini_set Options Checks & auto-update wp-config.php - BPS pages ONLY
bps_smonitor_phpini_bps();

// S-Monitor F-Lock - Check if F-Lock options saved - F-Lock Lock / Unlock File Status & actual file permissions 404 or 400
bps_smonitor_flock_bps();
?>

<div id="message" class="updated" style="border:1px solid #999;background-color:#000;">

<?php
$bpsSpacePop = '-------------------------------------------------------------';

// Replace ABSPATH = wp-content/plugins
$bps_plugin_dir = str_replace( ABSPATH, '', WP_PLUGIN_DIR );
// Replace ABSPATH = wp-content
$bps_wpcontent_dir = str_replace( ABSPATH, '', WP_CONTENT_DIR );

$bps_topDiv = '<div id="message" class="updated" style="background-color:#dfecf2;border:1px solid #999;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-topright:3px;-webkit-border-top-right-radius:3px;-khtml-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px -1px rgba(153,153,153,0.7);"><p>';
$bps_bottomDiv = '</p></div>';
$UIoptions = get_option('bulletproof_security_options_theme_skin');

// Get Real IP address - USE EXTREME CAUTION!!!
function bpsPro_get_real_ip_address_psecurity() {
	
	if ( is_admin() && current_user_can('manage_options') ) {
	
		if ( isset( $_SERVER['HTTP_CLIENT_IP'] ) ) {
			$ip = esc_html( $_SERVER['HTTP_CLIENT_IP'] );
			
			if ( ! is_array($ip) ) {
				
				if ( preg_match( '/(\d+\.){3}\d+/', $ip, $matches ) ) {

					return $matches[0];	
				
				} elseif ( preg_match( '/([:\d\w]+\.(\d+\.){2}\d+|[:\d\w]+)/', $ip, $matches ) ) {
				
					return $matches[0];	
		
				} else {
					
					return $ip;
				}
			
			} else {
				
				return current($ip);				
			}
		
		} elseif ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
			$ip = esc_html( $_SERVER['HTTP_X_FORWARDED_FOR'] );
			
			if ( ! is_array($ip) ) {
				
				if ( preg_match( '/(\d+\.){3}\d+/', $ip, $matches ) ) {

					return $matches[0];	
				
				} elseif ( preg_match( '/([:\d\w]+\.(\d+\.){2}\d+|[:\d\w]+)/', $ip, $matches ) ) {
				
					return $matches[0];	
		
				} else {
					
					return $ip;
				}
			
			} else {
				
				return current($ip);				
			}
		
		} elseif ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
			$ip = esc_html( $_SERVER['REMOTE_ADDR'] );
			return $ip;
		}
	}
}

// Create the PHPinfo Deny All .htaccess file with users current IP address on page load
// and send a copy to ARQ backup
function bpsPhpinfoDenyAll() {
	
	if ( is_admin() && wp_script_is( 'bps-accordion', $list = 'queue' ) && current_user_can('manage_options') ) {

		$HFiles_options = get_option('bulletproof_security_options_htaccess_files');
		$Apache_Mod_options = get_option('bulletproof_security_options_apache_modules');
	
		if ( isset( $HFiles_options['bps_htaccess_files'] ) && $HFiles_options['bps_htaccess_files'] == 'disabled' ) {
			return;
		}

	if ( $Apache_Mod_options['bps_apache_mod_ifmodule'] == 'Yes' ) {	
	
		$bps_denyall_content = "# BPS mod_authz_core IfModule BC\n<IfModule mod_authz_core.c>\nRequire ip ". bpsPro_get_real_ip_address_psecurity()."\n</IfModule>\n\n<IfModule !mod_authz_core.c>\n<IfModule mod_access_compat.c>\n<FilesMatch \"(.*)\$\">\nOrder Allow,Deny\nAllow from ". bpsPro_get_real_ip_address_psecurity()."\n</FilesMatch>\n</IfModule>\n</IfModule>";
	
	} else {
		
		$bps_denyall_content = "# BPS mod_access_compat\n<FilesMatch \"(.*)\$\">\nOrder Allow,Deny\nAllow from ". bpsPro_get_real_ip_address_psecurity()."\n</FilesMatch>";		
	}
	
	$denyall_htaccess_file = WP_PLUGIN_DIR . '/bulletproof-security/admin/php/.htaccess';
	
	if ( is_writable($denyall_htaccess_file) ) {
	if ( ! $handle = fopen($denyall_htaccess_file, 'w+b') ) {
         exit;
    }
    if ( fwrite($handle, $bps_denyall_content) === FALSE ) {
		 exit;
    }
    fclose($handle);
	}
	
	$htaccessARQ = WP_CONTENT_DIR . '/bps-backup/autorestore/wp-content/plugins/bulletproof-security/admin/php/.htaccess';
	if ( is_dir($htaccessARQ) && file_exists( $denyall_htaccess_file ) ) {
		copy($denyall_htaccess_file, $htaccessARQ);
	}
	}
}

bpsPhpinfoDenyAll();

// Enable PHPINFO Viewer - writes a new denyall htaccess file with the users current IP address
if ( isset( $_POST['bps-view-phpinfo'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bps-view-phpinfo-check' );

	$HFiles_options = get_option('bulletproof_security_options_htaccess_files');
	$Apache_Mod_options = get_option('bulletproof_security_options_apache_modules');

	if ( $HFiles_options['bps_htaccess_files'] == 'disabled' ) {
		return;
	}

	if ( $Apache_Mod_options['bps_apache_mod_ifmodule'] == 'Yes' ) {	
	
		$bps_denyall_content = "# BPS mod_authz_core IfModule BC\n<IfModule mod_authz_core.c>\nRequire ip ". bpsPro_get_real_ip_address_psecurity()."\n</IfModule>\n\n<IfModule !mod_authz_core.c>\n<IfModule mod_access_compat.c>\n<FilesMatch \"(.*)\$\">\nOrder Allow,Deny\nAllow from ". bpsPro_get_real_ip_address_psecurity()."\n</FilesMatch>\n</IfModule>\n</IfModule>";
	
	} else {
		
		$bps_denyall_content = "# BPS mod_access_compat\n<FilesMatch \"(.*)\$\">\nOrder Allow,Deny\nAllow from ". bpsPro_get_real_ip_address_psecurity()."\n</FilesMatch>";		
	}

	$denyall_htaccess_file = WP_PLUGIN_DIR . '/bulletproof-security/admin/php/.htaccess';
	
	if ( is_writable($denyall_htaccess_file) ) {
	if ( ! $handle = fopen($denyall_htaccess_file, 'w+b') ) {
         exit;
    }
    if ( fwrite($handle, $bps_denyall_content) === FALSE ) {
		 exit;
    }
    
	echo $bps_topDiv;
	$text = '<font color="green"><strong>'.__('PHPINFO File viewing is enabled for your IP address only', 'bulletproof-security').' === ' .bpsPro_get_real_ip_address_psecurity().__(' Your PHPINFO file is htaccess protected.', 'bulletproof-security').'</strong></font><br>';
	echo $text;
    echo $bps_bottomDiv;
	fclose($handle);
	$htaccessARQ = WP_CONTENT_DIR . '/bps-backup/autorestore/wp-content/plugins/bulletproof-security/admin/php/.htaccess';
	@copy($denyall_htaccess_file, $htaccessARQ);
	
	} else {
    
	echo $bps_topDiv;
	$text = '<font color="#fb0101"><strong>'.__('The file ', 'bulletproof-security').$denyall_htaccess_file.__(' is not writable or does not exist. Check folder and file permissions.', 'bulletproof-security').'</strong><br>';
	echo $text;
	echo $bps_bottomDiv;
	}
}

// Create the phpinfo-IP.php file - writes a new phpinfo-IP.php file with the users current IP address
if ( isset( $_POST['bps-create-phpinfo-multi'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bulletproof_security_phpinfo_create' );
	
$bps_get_IP = $_SERVER['REMOTE_ADDR'];
$phpinfoIPContent = "<?php if ".'($_SERVER['."'".'REMOTE_ADDR'."'".']'." == '$bps_get_IP') { 
phpinfo();
} else {
header(".'"Status: 404 Not Found"'.");
header(".'"HTTP/1.0 404 Not Found"'.");
exit();
}
?>";
	$phpinfoIP = WP_PLUGIN_DIR . '/bulletproof-security/admin/php/phpinfo-IP.php';
	$phpinfoIPARQ = WP_CONTENT_DIR . '/bps-backup/autorestore/wp-content/plugins/bulletproof-security/admin/php/phpinfo-IP.php';
	
	if ( is_writable($phpinfoIP) ) {
	if ( ! $handle = fopen($phpinfoIP, 'w+b') ) {
         exit;
    }
    if ( fwrite($handle, $phpinfoIPContent) === FALSE ) {
        exit;
    }
    
	echo $bps_topDiv;
	$text = '<font color="green"><strong>'.__('The phpinfo-IP.php file was created successfully with your current IP address', 'bulletproof-security').' === ' . $bps_get_IP.'</strong></font><br>';
	echo $text;
    echo $bps_bottomDiv;
	fclose($handle);
	@copy($phpinfoIP, $phpinfoIPARQ);
	
	} else {
    
	echo $bps_topDiv;
	$text = '<font color="#fb0101"><strong>'.__('The file ', 'bulletproof-security').$phpinfoIP.__(' is not writable or does not exist.', 'bulletproof-security').'</strong></font><br><strong>'.__('If this is not the problem click', 'bulletproof-security').' <a href="https://www.ait-pro.com/aitpro-blog/2566/bulletproof-security-plugin-support/bulletproof-security-error-messages" target="_blank">'.__('here', 'bulletproof-security').'</a> '.__('for more help info.', 'bulletproof-security').'</strong><br>';
	echo $text;
	echo $bps_bottomDiv;
	}
}

// Form - Copy the phpinfo file for the PHP Multi Viewer to the folder path and file name specified by user
// Pass user entered URL string to PHPinfo Multi Viewer
if ( isset( $_POST['bps-copy-phpinfo-multi'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bulletproof_security_phpinfo_copy' );
	
	$phpinfoIP = WP_PLUGIN_DIR . '/bulletproof-security/admin/php/phpinfo-IP.php';
	$bpsSaveLocPhpinfo = trim( $_POST['bps-phpinfo-save-path'] );
	$bpsViewPhpinfo = trim( $_POST['bps-phpinfo-url-path'] );
	$bpsViewPhpinfoH = $_POST['bpsViewPhpinfoH'];

	//copy($phpinfoIP, $bpsSaveLocPhpinfo);
	
	if ( ! copy($phpinfoIP, $bpsSaveLocPhpinfo) ) {
		echo $bps_topDiv;
		$text = '<font color="#fb0101"><strong>'.__('Failed to copy your phpinfo file to ', 'bulletproof-security').$bpsSaveLocPhpinfo.'<br>'.__('Check that the path you entered is valid and that you have added a valid file name. Minimum folder permissions must be at least 700 in order to copy the file successfully.', 'bulletproof-security').'</strong></font><br>';
		echo $text;
   		echo $bps_bottomDiv;
	
	} else {
	
		echo $bps_topDiv;
		$text = '<font color="green"><strong>'.__('Your phpinfo file was copied successfully to ', 'bulletproof-security').$bpsSaveLocPhpinfo.'</strong></font>';
		echo $text;
		echo $bps_bottomDiv;
	}
}

// Get BPS PHP error log
## 14.1: Adding a View File button instead of displaying the log file contents on page load.
## This allows the page to load if ModSecurity CRS is blocking the contents of the log file or if the log file is huge.
function bps_get_php_error_log() {
	
	if ( isset( $_POST['Submit-View-PHP-Log'] ) && current_user_can('manage_options') ) {
		check_admin_referer( 'bps-view-php-log' );   

		$options = get_option('bulletproof_security_options2');
		$bps_php_error_log = $options['bps_error_log_location'];
	
		if ( file_exists($bps_php_error_log) ) {
			$bps_php_error_log = file_get_contents($bps_php_error_log);
			echo esc_html($bps_php_error_log);
		
		} else {
			
			_e('PHP Error Log File Not Found! Either the PHP Error Log Folder Location has not been set yet or the PHP Error Log Folder Location path that you set is incorrect. Click the Htaccess Protected Secure PHP Error Log Read Me Help button for more info.', 'bulletproof-security');
		}
	}
}

// Get Default BPS PHP error log path
function bps_get_default_php_error_log() {
	
	if ( current_user_can('manage_options') ) {
	$bps_default_php_error_log = WP_PLUGIN_DIR . '/bulletproof-security/admin/php/bps_php_error.log';
	
	if ( file_exists($bps_default_php_error_log) ) {
		echo $bps_default_php_error_log;
	
	} else {
		
		echo $bps_topDiv;
		$text = '<font color="#fb0101"><strong>'.__('The ', 'bulletproof-security').$bps_default_php_error_log.__(' was not found. Check that the file exists and is named correctly.', 'bulletproof-security').'</strong></font>';
		echo $text;
		echo $bps_bottomDiv;
	}
	}
}
	
// Form - php.ini Master File Maker
// CT php.ini file type: copy contents of bpspro-base-phpini.ini to the my-master-phpini.ini file
// SA php.ini file type: copy the servers default php.ini file to the my-master-phpini.ini file
if ( ! isset( $_POST['Submit-MFM'] ) )
    $chosen = array(0);
    
	else
    
	if ( isset( $_POST['Submit-MFM'] ) && current_user_can('manage_options') ) {
		check_admin_referer( 'bulletproof_security_ini_master_maker' );   
	    $chosen = $_POST['iniServerType'];
		
		$bpsServerPath = trim( $_POST['bpsini-server-path'] );
		$newMaster = WP_PLUGIN_DIR . '/bulletproof-security/admin/php/my-master-phpini.ini';
		$newMasterARQ = WP_CONTENT_DIR . '/bps-backup/autorestore/wp-content/plugins/bulletproof-security/admin/php/my-master-phpini.ini';
		$basePhpini = WP_PLUGIN_DIR . '/bulletproof-security/admin/php/bpspro-base-phpini.ini';
		
		if ( $_POST['iniServerType'] == array(1) ) {

		if ( file_exists($bpsServerPath) && file_exists($newMaster) && is_writable($newMaster) ) {
			$Serverdata = file_get_contents($bpsServerPath);

			file_put_contents($newMaster, $Serverdata);
			@copy($newMaster, $newMasterARQ);
		
			echo $bps_topDiv;
			$text = '<font color="green"><strong>'.__('Success! Your new Master custom php.ini file ', 'bulletproof-security').$newMaster.__(' was created successfully.', 'bulletproof-security').'<br><br>'.__('Click on the File Manager tab page, copy and paste the Master custom php.ini file path into any empty available File Manager slot, add this Label/Description: Master custom php.ini file and click the Save Changes button.', 'bulletproof-security').'</strong></font><br>';
			echo $text;
			echo $bps_bottomDiv;
		
		} else {
			
			echo $bps_topDiv;
			$text = '<font color="#fb0101"><strong>'.__('Error: Failed to get the contents of the ', 'bulletproof-security').$bpsServerPath.__(' for the Default Server php.ini file. Check that the path to the Default Server php.ini file is correct. You must enter the full path including the php.ini filename. Example: /usr/local/lib/php.ini. Or the ', 'bulletproof-security').$newMaster.__(' file does not exist or the folder permissions or Ownership for the /bulletproof-security/admin/php/ folder is incorrect. Your Master php.ini file was NOT created successfully.', 'bulletproof-security').'</strong></font><br>';
			echo $text;
			echo $bps_bottomDiv;
		}
		}
		
		if ( $_POST['iniServerType'] == array(2) ) {
		
		if ( file_exists($basePhpini) && file_exists($newMaster) && is_writable($newMaster) ) {
			$Basedata = file_get_contents($basePhpini);

			file_put_contents($newMaster, $Basedata);
			@copy($newMaster, $newMasterARQ);		

			echo $bps_topDiv;
			$text = '<font color="green"><strong>'.__('Success! Your new Master custom php.ini file ', 'bulletproof-security').$newMaster.__(' was created successfully.', 'bulletproof-security').'<br><br>'.__('Click on the File Manager tab page, copy and paste the Master custom php.ini file/folder path into any empty available File Manager slot, add this Label|Description: Master custom php.ini file and click the Save Changes button.', 'bulletproof-security').'</strong></font>';
			echo $text;
			echo $bps_bottomDiv;
		
		} else {

			echo $bps_topDiv;
			$text = '<font color="#fb0101"><strong>'.__('Error: Failed to copy the ', 'bulletproof-security').$basePhpini.__(' file contents to the ', 'bulletproof-security').$newMaster.__(' file. Either the files do not exist or have been renamed or the folder permissions or Ownership for the /bulletproof-security/admin/php/ folder is incorrect. Your Master php.ini file was NOT created successfully.', 'bulletproof-security').'</strong></font>';
			echo $text;
   			echo $bps_bottomDiv;
		}
	}
}

// Dropdown list array for phpini Master Maker form - Server Type		
function bps_showOptionsDropMaster( $array, $active, $echo=true ) {
$string = '';
	
	foreach ( $array as $k => $v ) {
	
		if ( is_array($active) )
			$s = ( in_array($k, $active) ) ? ' selected="selected"' : '';
		else
			$s = ( $active == $k ) ? ' selected="selected"' : '';
			$string .= '<option value="'.$k.'"'.$s.'>'.$v.'</option>'."\n";
	}
	
	if ($echo)
	echo $string;
	else
	return $string;
}

$iniServerType = array(' Select Host Server php.ini File Type:', 'Stand Alone php.ini File Type', 'Combined Total php.ini File Type');

// Form Create php.ini File - Copy the my-master-phpini.ini file to folder location entered by user
// The majority of web hosts use a Single php.ini file in the hosting root folder. Not going to do any ARQ backups for Multiple php.ini file Hosts
if ( isset( $_POST['Submit-IC'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bulletproof_security_ini_creator' );   
	
	$newMaster = WP_PLUGIN_DIR . '/bulletproof-security/admin/php/my-master-phpini.ini';
	$bpsSaveLoc = trim( $_POST['bpsini-save-path'] );
		
	if ( $bpsSaveLoc == $_SERVER['DOCUMENT_ROOT'] . '/php.ini' ) {
		$custom_phpini_ARQ = $_SERVER['DOCUMENT_ROOT'] . '/' . $bps_wpcontent_dir . '/bps-backup/autorestore/root-files/php.ini';
	}
	elseif ( $bpsSaveLoc == $_SERVER['DOCUMENT_ROOT'] . '/php5.ini' ) {
		$custom_phpini_ARQ = $_SERVER['DOCUMENT_ROOT'] . '/' . $bps_wpcontent_dir . '/bps-backup/autorestore/root-files/php5.ini';
	}
	elseif ( $bpsSaveLoc == ABSPATH . 'php.ini' ) {
		$custom_phpini_ARQ = WP_CONTENT_DIR . '/bps-backup/autorestore/root-files/php.ini';
	}

	if ( file_exists($newMaster) ) {
		
		if ( ! copy($newMaster, $bpsSaveLoc) ) {
			echo $bps_topDiv;
			$text = '<font color="#fb0101"><strong>'.__('ERROR: Your custom php.ini file was not created. Failed to copy the Master custom php.ini File to: ', 'bulletproof-security').$bpsSaveLoc.__(' Either the my-master-phpini.ini master file does not exist, the destination folder path you entered is not valid, the file name php.ini was not added in your destination folder/file path /xxxx/xxxx/php.ini or the folder permissions or Ownership for the destination folder are not allowing the file to be copied to that folder.', 'bulletproof-security').'</strong></font>';
			echo $text;
   			echo $bps_bottomDiv;
		
		} else {
			
			echo $bps_topDiv;				
			$text = '<font color="green"><strong>'.__('Success! Your custom php.ini file was created successfully in this folder: ', 'bulletproof-security').$bpsSaveLoc.'<br><br>'.__('Click on the File Manager tab page, copy and paste your custom php.ini file/folder path into any empty available File Manager slot, add this Label|Description: Custom php.ini file and click the Save Changes button.', 'bulletproof-security').'<br<br>'.__('NOTE: Click the Php.ini File Creator Read Me help button for how to check if your new custom php.ini file is being seen as the loaded configuration file for your website now instead of the Server\'s default php.ini file.', 'bulletproof-security').'</strong></font>';

			if ( is_dir( str_replace( array('php.ini', 'php5.ini'), "", $custom_phpini_ARQ ) ) ) {
				copy($newMaster, $custom_phpini_ARQ);
				$text .= '<br><br><font color="green"><strong>'.__('Your custom php.ini file was backed up to this ARQ Backup folder: ', 'bulletproof-security').$custom_phpini_ARQ.'</strong></font>';			
			}
			
			echo $text;
			echo $bps_bottomDiv;
		}
	}
}

// INI Finder - Finds all files with .ini extension in case php.ini file has been renamed
// will result in additional .ini files being displayed but this is a better option
function bpsiniFinder() {
if ( isset( $_POST['bps-ini-find-submit'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bulletproof_security_find_ini_files' );
	
	$path = $_SERVER['DOCUMENT_ROOT'] . '/'; // use ABSPATH instead if you only want to search the current site
	$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
	
	foreach ( $objects as $inifile ) {
		if ( $inifile->isFile() ) {
			$ext = strtolower( @substr( $inifile, strlen($inifile)-3 ) );
			
			if ( $ext == 'ini' ) {
				//$fileinfo->getFilename(); // get file name without path
				$fullpath = $inifile->getPathname(); // get the full path
				echo "<div class=\"iniFinderStyle\">$fullpath</div>";
			}
		}
	}
}
}

// General all purpose "Settings Saved." message for forms - /includes/class.php
if ( current_user_can('manage_options') && wp_script_is( 'bps-accordion', $list = 'queue' ) ) {
if ( isset( $_GET['settings-updated'] ) && @$_GET['settings-updated'] == true ) {
	$text = '<p style="font-size:1em;font-weight:bold;padding:2px 0px 2px 5px;margin:0px -11px 0px -11px;background-color:#dfecf2;-webkit-box-shadow: 3px 3px 5px 0px rgba(153,153,153,0.7);-moz-box-shadow: 3px 3px 5px 0px rgba(153,153,153,0.7);box-shadow: 3px 3px 5px 0px rgba(153,153,153,0.7);"><font color="green"><strong>'.__('Settings Saved', 'bulletproof-security').'</strong></font></p>';
	echo $text;
	} else {
	echo '<font color="#fb0101"><strong>'.bps_cuser_errors().'</strong></font>';
	}
}

require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/php/php-diagnostic-checks.php' );
require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/php/php-help-text.php' );

// Anti-Piracy check - Fallback 10R
$D8 = '42756C6C657450726F6F66';
bpsPro_AP_Check($D8);

?>
</div>

<h2 class="bps-tab-title" style="margin-left:220px"><?php _e('P-Security ~ php.ini Security &amp; Performance', 'bulletproof-security'); ?></h2>

<!-- jQuery UI Tab Menu -->
<div id="bps-tabs" class="bps-menu">
    <div id="bpsHead"><img src="<?php echo plugins_url('/bulletproof-security/admin/images/bps-pro-logo.gif'); ?>" />
    
<style>
<!--
.bps-spinner {
    visibility:visible;
	position:fixed;
    top:7%;
    left:45%;
 	width:240px;
	background:#fff;
	border:4px solid black;
	padding:2px 0px 4px 8px;   
	z-index:99999;
}
-->
</style> 

    <div id="bps-spinner" class="bps-spinner" style="visibility:hidden;">
    	<img id="bps-img-spinner" src="<?php echo plugins_url('/bulletproof-security/admin/images/bps-spinner.gif'); ?>" style="float:left;margin:0px 20px 0px 0px;" />
        <div id="bps-spinner-text-btn" style="padding:20px 0px 26px 0px;font-size:14px;">Processing...<br><button style="margin:10px 0px 0px 10px;" onclick="javascript:history.go(-1)">Cancel</button>
		</div>
    </div> 
    
<script type="text/javascript">
/* <![CDATA[ */
function DiagnosticChecks() {
	
    var r = confirm("Runs a Diagnostic Check for all settings that relate to php.ini files, .user.ini files, php handlers, php error log paths and other settings to troubleshoot any issues or problems.\n\n-------------------------------------------------------------\n\nRecommendations are also given based on your PHP version and your type of Hosting (Shared, VPS or Dedicated Hosting).\n\n-------------------------------------------------------------\n\nNOTE: This Diagnostic Check will display the Loaded Configuration File: that this website is using, but the php.ini and .user.ini file check ONLY searches for actual files under the current website that you are running this Diagnostic Check from. If you have multiple websites and this website is a subfolder website then you should also run this Diagnostic Check on your root website if you would like to check for the actual files. Typically php.ini and .user.ini files will be located in the root folder/root website of your Hosting account.\n\n-------------------------------------------------------------\n\nClick OK to Run the Diagnostic Check or click Cancel.");
	var img = document.getElementById("bps-spinner"); 	
	
	if (r == true) {

		img.style.visibility = "visible";
	
	} else {
	
		history.go(-1);
	}
}
/* ]]> */
</script>    
    
	</div>
	<ul>
		<li><a href="#bps-tabs-1"><?php _e('PHP.ini Options', 'bulletproof-security'); ?></a></li>
        <li><a href="#bps-tabs-2"><?php _e('ini_set Options', 'bulletproof-security'); ?></a></li> 
        <li><a href="#bps-tabs-3"><?php _e('File Manager', 'bulletproof-security'); ?></a></li>
        <li><a href="#bps-tabs-4"><?php _e('File Editor', 'bulletproof-security'); ?></a></li>
		<li><a href="#bps-tabs-5"><?php _e('PHP Error Log', 'bulletproof-security'); ?></a></li>
		<li><a href="#bps-tabs-6"><?php _e('PHP Info Viewer', 'bulletproof-security'); ?></a></li>
        <li><a href="#bps-tabs-7"><?php _e('Php.ini Security Status', 'bulletproof-security'); ?></a></li>
        <li><a href="#bps-tabs-8"><?php _e('Help &amp; FAQ', 'bulletproof-security'); ?></a></li>
	</ul>
            
<div id="bps-tabs-1" class="bps-tab-page">

<?php if ( ! current_user_can('manage_options') ) { _e('Permission Denied', 'bulletproof-security'); } else { ?>

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bps-help_faq_table">
  <tr>
    <td class="bps-table_title"><h2><?php _e('PHP.ini Options ~ ', 'bulletproof-security'); ?><span style="font-size:.75em;"><?php _e('Custom php.ini File Setup & Tools', 'bulletproof-security'); ?></span></h2></td>
  </tr>
  <tr>
    <td class="bps-table_cell_help">

<form name="bpsDiagCheck1" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-1' ); ?>" method="post">
	<?php wp_nonce_field('bps-diagnostic-check1'); ?>

<h3 style="margin:0px 0px 5px 0px;"><?php _e('Diagnostic Checks|Recommendations', 'bulletproof-security'); ?>
	<input type="submit" name="Submit-diagnostic-check1" value="<?php esc_attr_e('Run Check', 'bulletproof-security') ?>" class="button bps-button run-check" onclick="DiagnosticChecks()" />
</h3>
<?php echo bpsPHPDiagCheck1(); ?>
</form>

<h3><?php _e('PHP.ini Overview', 'bulletproof-security'); ?>  <button id="bps-open-modal1" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content1" class="bps-dialog-hide" title="<?php _e('PHP.ini Overview', 'bulletproof-security'); ?>">
	<p>
	<?php
        $text = '<strong>'.__('This Read Me Help window is draggable (top) and resizable (bottom right corner)', 'bulletproof-security').'</strong><br><br>';
		echo $text; 
		// Forum Help Links or of course both
		$text = '<strong><font color="blue">'.__('Forum Help Links: ', 'bulletproof-security').'</font></strong>'; 	
		echo $text;	
	?>
	<strong><a href="https://forum.ait-pro.com/forums/topic/custom-php-ini-file-setup-php5-3-x/" title="Custom php.ini Forum Help Link" target="_blank"><?php _e('Custom php.ini Forum Help Link', 'bulletproof-security'); ?></a></strong><br /><br />	

	<?php echo $bps_modal_content1; ?>
    </p>
</div>

<div id="iniMasterMaker">

<h3><?php _e('Php.ini Master File Maker', 'bulletproof-security'); ?>  <button id="bps-open-modal2" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content2" class="bps-dialog-hide" title="<?php _e('Php.ini Master File Maker', 'bulletproof-security'); ?>">
	<p><?php echo $bps_modal_content2; ?></p>
</div>

<form action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ini_master_maker'); ?>
	<strong><label for="bps-ini-file-creator"><?php $text = '<font color="#2ea2cc">'.__('View the Php.ini Master File Maker Read Me button above FIRST', 'bulletproof-security').'<br>'.__('before Making your new Master php.ini file', 'bulletproof-security').'</font><br>'; echo $text; ?></label></strong><br />
    <strong><label for="bps-ini-file-creator"><?php _e('Choose Your Host Server\'s php.ini File Type:', 'bulletproof-security'); ?> </label></strong><br />
	<select name="iniServerType[]" id="iniServerType">
	
	<?php echo bps_showOptionsDropMaster($iniServerType, $chosen, true); ?>
	
    </select><br /><br />
    <strong><label for="bps-ini-file-creator"><?php $text = __('Add your Server\'s Default php.ini file path: ', 'bulletproof-security').'(<font color="#2ea2cc">'.__('ONLY if your Host Server php.ini File Type is Stand Alone otherwise leave this blank', 'bulletproof-security').'</font>)'; echo $text; ?></label></strong><br />
    <strong><label for="bps-ini-file-creator"><?php $text = '<font color="#2ea2cc">'.__('Click the Php.ini Master File Maker Read Me help button above for how to get the Server\'s Default php.ini file path', 'bulletproof-security').'</font>'; echo $text; ?></label></strong><br />
    <input type="text" name="bpsini-server-path" value="" class="regular-text-medium" />

    <p class="submit">
    <input type="submit" name="Submit-MFM" value="<?php esc_attr_e('Make Master php.ini File', 'bulletproof-security') ?>" class="button bps-button" onclick="return confirm('<?php $text = __('Reminder: Click on the Php.ini Master File Maker Read Me help button to view help info.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click OK to create your Master custom php.ini file or click Cancel.', 'bulletproof-security'); echo $text; ?>')" />
    </p>
</form>
</div>

<div id="inicreator" style="border-bottom:1px solid #999999;border-top:1px solid #999999;">
<h3><?php _e('Php.ini File Creator', 'bulletproof-security'); ?>  <button id="bps-open-modal3" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content3" class="bps-dialog-hide" title="<?php _e('Php.ini File Creator', 'bulletproof-security'); ?>">
	<p><?php echo $bps_modal_content3; ?></p>
</div>

<form action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ini_creator'); ?>
	
    <strong><label for="bps-ini-file-creator"><?php $text = '<font color="#2ea2cc">'.__('View the Php.ini File Creator Read Me button above FIRST', 'bulletproof-security').'<br>'.__('before creating your custom php.ini file', 'bulletproof-security').'</font><br>'; echo $text; ?></label></strong><br />
    <strong><label for="bps-ini-file-creator"><?php $text = __('Add the full path, including the php.ini filename, where your custom php.ini file will be created:', 'bulletproof-security'); echo $text; ?></label></strong><br />
    <strong><label for="bps-ini-file-creator"><?php $text = __('Example: ', 'bulletproof-security').esc_html( $_SERVER['DOCUMENT_ROOT'] ) . '/php.ini'; echo $text; ?></label></strong><br />
    <strong><label for="bps-ini-file-creator"><?php $text = __('Go Daddy Example: ', 'bulletproof-security').esc_html( $_SERVER['DOCUMENT_ROOT'] ) . '/php5.ini'; echo $text; ?></label></strong><br />
    <input type="text" name="bpsini-save-path" value="" class="regular-text-medium" />

    <p class="submit">
   <input type="submit" name="Submit-IC" value="<?php esc_attr_e('Create php.ini File', 'bulletproof-security') ?>" class="button bps-button" onclick="return confirm('<?php $text = __('Reminder: Have you created your Master custom php.ini file FIRST with the Php.ini Master File Maker?', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Reminder: Click on the Php.ini File Creator Read Me help button to view help info.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click OK to create a custom php.ini file or click Cancel.', 'bulletproof-security'); echo $text; ?>')" /></p>
</form>
</div>

<h3><?php _e('Php.ini File Finder', 'bulletproof-security'); ?>  <button id="bps-open-modal4" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content4" class="bps-dialog-hide" title="<?php _e('Php.ini File Finder', 'bulletproof-security'); ?>">
	<p><?php echo $bps_modal_content4; ?></p>
</div>

<form name="bpsiniFinder" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#Ini-Finder' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_find_ini_files'); ?>
<strong><label for="bps-ini-file-finder"><?php _e('Search for existing php.ini files by clicking the Find php.ini Files button: ', 'bulletproof-security'); ?> </label></strong>

<?php echo bpsiniFinder(); ?>

<input type="hidden" name="bpsIF" value="bps-ini-finder" />
<p class="submit">
<input type="submit" name="bps-ini-find-submit" class="button bps-button" style="position:relative;top:5px;left:0px;" value="<?php esc_attr_e('Find php.ini Files', 'bulletproof-security') ?>" /></p>
</form>

      </td>
  </tr>
</table>

<div id="Ini-Finder"></div>

<?php } ?>
</div>
            
<div id="bps-tabs-2" class="bps-tab-page">

<?php 
if ( ! current_user_can('manage_options') ) { 
	_e('Permission Denied', 'bulletproof-security'); 

} else { 
	
if ( isset( $_POST['Submit-iniset-Options'] ) || isset( $_POST['Submit-bps-iniset-wpconfig-remove'] ) ) {	
	require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/php/php-ini-set-options.php' );
}
?>

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bps-help_faq_table">
  <tr>
    <td class="bps-table_title"><h2><?php _e('ini_set Options', 'bulletproof-security'); ?></h2></td>
  </tr>
  <tr>
    <td class="bps-table_cell_help"> 

<form name="bpsDiagCheck2" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-2' ); ?>" method="post">
	<?php wp_nonce_field('bps-diagnostic-check2'); ?>

<h3 style="margin:0px 0px 5px 0px;"><?php _e('Diagnostic Checks|Recommendations', 'bulletproof-security'); ?>
	<input type="submit" name="Submit-diagnostic-check2" value="<?php esc_attr_e('Run Check', 'bulletproof-security') ?>" class="button bps-button run-check" onclick="DiagnosticChecks()" />
	</h3>
<?php echo bpsPHPDiagCheck2(); ?>
</form>

<h3><?php _e('ini_set Options', 'bulletproof-security'); ?>  <button id="bps-open-modal5" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content5" class="bps-dialog-hide" title="<?php _e('ini_set Options', 'bulletproof-security'); ?>">
	<p><?php echo $bps_modal_content5; ?></p>	
</div>

<div id="psecurity-iniset-form">

<form name="bpsIniSet" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-2' ); ?>" method="post">
    <?php wp_nonce_field('bulletproof_security_options_iniSet'); ?>
	<?php $iniset_options = get_option('bulletproof_security_options_iniSet'); 
	$bps_iniSet_ErrorReporting = ! isset($iniset_options['bps_iniSet_ErrorReporting']) ? '' : $iniset_options['bps_iniSet_ErrorReporting'];
	$bps_iniSet_LogErrors = ! isset($iniset_options['bps_iniSet_LogErrors']) ? '' : $iniset_options['bps_iniSet_LogErrors'];
	$bps_iniSet_ErrorLog = ! isset($iniset_options['bps_iniSet_ErrorLog']) ? '' : $iniset_options['bps_iniSet_ErrorLog'];
	$bps_iniSet_LogErrorsMaxLen = ! isset($iniset_options['bps_iniSet_LogErrorsMaxLen']) ? '' : $iniset_options['bps_iniSet_LogErrorsMaxLen'];
	$bps_iniSet_session_cookie_httponly = ! isset($iniset_options['bps_iniSet_session_cookie_httponly']) ? '' : $iniset_options['bps_iniSet_session_cookie_httponly'];
	$bps_iniSet_session_use_only_cookies = ! isset($iniset_options['bps_iniSet_session_use_only_cookies']) ? '' : $iniset_options['bps_iniSet_session_use_only_cookies'];
	$bps_iniSet_session_cookie_secure = ! isset($iniset_options['bps_iniSet_session_cookie_secure']) ? '' : $iniset_options['bps_iniSet_session_cookie_secure'];
	$bps_iniSet_IgnoreRepeatedErrors = ! isset($iniset_options['bps_iniSet_IgnoreRepeatedErrors']) ? '' : $iniset_options['bps_iniSet_IgnoreRepeatedErrors'];
	$bps_iniSet_IgnoreRepeatedSource = ! isset($iniset_options['bps_iniSet_IgnoreRepeatedSource']) ? '' : $iniset_options['bps_iniSet_IgnoreRepeatedSource'];
	$bps_iniSet_AllowUrlInclude = ! isset($iniset_options['bps_iniSet_AllowUrlInclude']) ? '' : $iniset_options['bps_iniSet_AllowUrlInclude'];
	$bps_iniSet_DefineSyslogVar = ! isset($iniset_options['bps_iniSet_DefineSyslogVar']) ? '' : $iniset_options['bps_iniSet_DefineSyslogVar'];	
	$bps_iniSet_DisplayErrors = ! isset($iniset_options['bps_iniSet_DisplayErrors']) ? '' : $iniset_options['bps_iniSet_DisplayErrors'];
	$bps_iniSet_DisplayStartupErrors = ! isset($iniset_options['bps_iniSet_DisplayStartupErrors']) ? '' : $iniset_options['bps_iniSet_DisplayStartupErrors'];	
	$bps_iniSet_ImplicitFlush = ! isset($iniset_options['bps_iniSet_ImplicitFlush']) ? '' : $iniset_options['bps_iniSet_ImplicitFlush'];
	$bps_iniSet_MagicQuotesRuntime = ! isset($iniset_options['bps_iniSet_MagicQuotesRuntime']) ? '' : $iniset_options['bps_iniSet_MagicQuotesRuntime'];	
	$bps_iniSet_MaxExecutionTime = ! isset($iniset_options['bps_iniSet_MaxExecutionTime']) ? '' : $iniset_options['bps_iniSet_MaxExecutionTime'];	
	$bps_iniSet_MysqlConnectTimeout = ! isset($iniset_options['bps_iniSet_MysqlConnectTimeout']) ? '' : $iniset_options['bps_iniSet_MysqlConnectTimeout'];
	$bps_iniSet_MysqlTraceMode = ! isset($iniset_options['bps_iniSet_MysqlTraceMode']) ? '' : $iniset_options['bps_iniSet_MysqlTraceMode'];
	$bps_iniSet_ReportMemleaks = ! isset($iniset_options['bps_iniSet_ReportMemleaks']) ? '' : $iniset_options['bps_iniSet_ReportMemleaks'];	
	?>

    <div id="iniSetOptionsTable">
    
    <table width="100%" class="widefat" style="margin-bottom:20px;">
	<thead>
	<tr>
	<th scope="col" style="" class="iniset-options-col1"><strong><?php _e('ini_set Settings', 'bulletproof-security')?></strong></th>
	<th scope="col" style="" class="iniset-options-col2"><strong><?php _e('Status', 'bulletproof-security')?></strong></th>
    <th scope="col" style="" class="iniset-options-col3"><strong><?php _e('Recommended Setting|Description', 'bulletproof-security')?></strong></th>
	</tr>
	</thead>
	
    <tbody>
	<tr>
    <th scope="row">

<?php _e('Error Reporting:', 'bulletproof-security'); echo '<br>'; ?>
<select name="bps_iniSet_ErrorReporting" style="" class="form-340">
<option value="E_ALL|E_STRICT" <?php selected('E_ALL|E_STRICT', $bps_iniSet_ErrorReporting); ?>><?php _e('E_ALL|E_STRICT', 'bulletproof-security'); ?></option>
<option value="E_ALL" <?php selected('E_ALL', $bps_iniSet_ErrorReporting); ?>><?php _e('E_ALL', 'bulletproof-security'); ?></option>
<option value="E_ERROR" <?php selected('E_ERROR', $bps_iniSet_ErrorReporting); ?>><?php _e('E_ERROR', 'bulletproof-security'); ?></option>
<option value="E_ERROR|E_WARNING" <?php selected('E_ERROR|E_WARNING', $bps_iniSet_ErrorReporting); ?>><?php _e('E_ERROR|E_WARNING', 'bulletproof-security'); ?></option>
<option value="E_ERROR|E_WARNING|E_PARSE" <?php selected('E_ERROR|E_WARNING|E_PARSE', $bps_iniSet_ErrorReporting); ?>><?php _e('E_ERROR|E_WARNING|E_PARSE', 'bulletproof-security'); ?></option>
</select>
    </th>
	<td><strong>
<?php if ( $bps_iniSet_ErrorReporting != '' ) { echo $bps_iniSet_ErrorReporting; } else { _e('Not Set', 'bulletproof-security'); } ?></strong>
    </td>
    <td>
	<?php $text = '<strong>'.__('Recommended Setting: E_ALL|E_STRICT ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('E_ALL logs all errors and warnings, except level E_STRICT. E_STRICT logs errors related to code that does meet the new stricter PHP coding standards. E_ERROR logs Fatal run-time errors. E_WARNING logs Warning run-time errors. E_PARSE logs Compile-time Parse errors.', 'bulletproof-security'); //echo $text; ?>
    </td>
	</tr>
    <tr>
	<th scope="row">
<?php _e('Turn On|Off Log PHP Errors:', 'bulletproof-security'); ?>
<select name="bps_iniSet_LogErrors" style="" class="form-340">
<option value="On" <?php selected('On', $bps_iniSet_LogErrors); ?>><?php _e('PHP Error Logging On', 'bulletproof-security'); ?></option>
<option value="Off" <?php selected('Off', $bps_iniSet_LogErrors); ?>><?php _e('PHP Error Logging Off', 'bulletproof-security'); ?></option>
</select>    
    </th>
	<td>
<?php 
	if ( ini_get('log_errors') == 'On' && isset($iniset_options['bps_iniSet_LogErrors']) && $iniset_options['bps_iniSet_LogErrors'] == 'On' ) { 
		$text = '<font color="green"><strong>'.__('On', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( ini_get('log_errors') == 0 && isset($iniset_options['bps_iniSet_LogErrors']) && $iniset_options['bps_iniSet_LogErrors'] == 'Off' ) { 	
		$text = '<font color="#fb0101"><strong>'.__('Off', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( isset($iniset_options['bps_iniSet_LogErrors']) && $iniset_options['bps_iniSet_LogErrors'] == '' ) { 
		$text = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
		echo $text; 	
	}
?>    
	</td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: On ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('Turn PHP Error Logging On or Off.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
	<th scope="row">
<?php _e('ini_set PHP Error Log Location Set To:', 'bulletproof-security'); ?>
<input type="text" name="bps_iniSet_ErrorLog" value="<?php if ( $bps_iniSet_ErrorLog != '' ) { echo $bps_iniSet_ErrorLog; } else { echo addslashes( WP_CONTENT_DIR.'/bps-backup/logs/bps_php_error.log' ); } ?>" style="padding:2px;margin-left:0px;font-size:11px;" class="form-340" />
    </th>
	<td>
    <strong><?php if ( $bps_iniSet_ErrorLog != '' ) { _e('Set', 'bulletproof-security'); } else { _e('Not Set', 'bulletproof-security'); } ?></strong>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: ', 'bulletproof-security').WP_CONTENT_DIR.'/bps-backup/logs/bps_php_error.log<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('It is recommended that your php error log file location should be in the /bps-backup/logs folder. The BPS Pro logs folder is htaccess protected and can only be accessed by you.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
	<th scope="row">
<?php _e('Log Errors Max Length:', 'bulletproof-security'); ?>
<input type="text" name="bps_iniSet_LogErrorsMaxLen" value="<?php if ( $bps_iniSet_LogErrorsMaxLen != '' ) { echo $bps_iniSet_LogErrorsMaxLen; } else { echo ini_get('log_errors_max_len'); } ?>" style="padding:2px;margin-left:0px;" class="form-340" />    
    </th>
	<td><strong>
<?php if ( $bps_iniSet_LogErrorsMaxLen != '' ) { echo $bps_iniSet_LogErrorsMaxLen; } else { _e('Not Set', 'bulletproof-security'); } ?></strong>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: 1024 ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('Set the maximum length of log_errors in bytes. In error_log information about the source is added. The default is 1024 and 0 allows to not apply any maximum length at all. This length is applied to logged errors, displayed errors and also to $php_errormsg. Your current Log Errors Max Length is displayed by default.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
	<th scope="row">
<?php _e('Memory Limit:', 'bulletproof-security');  echo '<br>';

	$bps_php_memory_limit = get_option('bulletproof_security_options_php_memory_limit');
	$memoryLimit = ! isset($bps_php_memory_limit['bps_php_memory_limit']) ? '' : $bps_php_memory_limit['bps_php_memory_limit'];
	$pos_memory_limit = strpos( $memoryLimit, 'Unable to get the PHP memory_limit value from the server' );
	
	if ( $pos_memory_limit !== false ) {
		$memory_limit_value = '256M';
	} else {
		$memory_limit_value = $memoryLimit;
	}
	
	$bps_iniSet_MemoryLimit = isset( $iniset_options['bps_iniSet_MemoryLimit'] ) ? esc_html( $iniset_options['bps_iniSet_MemoryLimit'] ) : esc_html( $memory_limit_value );
?>
<input type="text" name="bps_iniSet_MemoryLimit" value="<?php echo $bps_iniSet_MemoryLimit; ?>" style="padding:2px;margin-left:0px;" class="form-340" />     
    </th>
	<td><strong>
<?php if ( $bps_iniSet_MemoryLimit != '' ) { echo $bps_iniSet_MemoryLimit; } else { _e('Not Set', 'bulletproof-security'); } ?></strong>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: Read Description', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('Your current memory limit is displayed/selected by default in the text box. The Memory Limit setting sets the maximum amount of memory in bytes that a script is allowed to allocate. Check your Web Host help pages to find the maximum memory limit setting allowed for your particular Web Host.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
    <th scope="row">
<?php _e('Turn On|Off HttpOnly:', 'bulletproof-security'); ?>
<select name="bps_iniSet_session_cookie_httponly" style="" class="form-340">
<option value="On" <?php selected('On', $bps_iniSet_session_cookie_httponly); ?>><?php _e('HttpOnly On', 'bulletproof-security'); ?></option>
<option value="Off" <?php selected('Off', $bps_iniSet_session_cookie_httponly); ?>><?php _e('HttpOnly Off', 'bulletproof-security'); ?></option>
</select>    
    </th>
	<td>
<?php 
	if ( ini_get('session.cookie_httponly') == 'On' && isset($iniset_options['bps_iniSet_session_cookie_httponly']) && $iniset_options['bps_iniSet_session_cookie_httponly'] == 'On' ) { 
		$text = '<font color="green"><strong>'.__('On', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( ini_get('session.cookie_httponly') == 0 && isset($iniset_options['bps_iniSet_session_cookie_httponly']) && $iniset_options['bps_iniSet_session_cookie_httponly'] == 'Off' ) { 	
		$text = '<font color="#fb0101"><strong>'.__('Off', 'bulletproof-security').'</strong></font>';
		echo $text; 
	} 
	if ( isset($iniset_options['bps_iniSet_session_cookie_httponly']) && $iniset_options['bps_iniSet_session_cookie_httponly'] == '' ) { 	 
		$text = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
		echo $text; 	
	}
?>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: On ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('session.cookie_httponly marks the cookie as accessible only through the HTTP protocol. This means that the cookie won\'t be accessible by scripting languages, such as JavaScript. This setting can effectively help to reduce identity theft through XSS attacks (As of 2011, 99% of browsers and most web application frameworks do support httpOnly).', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
    <th scope="row">
<?php _e('Turn On|Off Session Use Only Cookies:', 'bulletproof-security'); ?>
<select name="bps_iniSet_session_use_only_cookies" style="" class="form-340">
<option value="On" <?php selected('On', $bps_iniSet_session_use_only_cookies); ?>><?php _e('Session Use Only Cookies On', 'bulletproof-security'); ?></option>
<option value="Off" <?php selected('Off', $bps_iniSet_session_use_only_cookies); ?>><?php _e('Session Use Only Cookies Off', 'bulletproof-security'); ?></option>
</select>    
    </th>
	<td>
<?php 
	if ( ini_get('session.use_only_cookies') == 'On' && isset($iniset_options['bps_iniSet_session_use_only_cookies']) && $iniset_options['bps_iniSet_session_use_only_cookies'] == 'On' ) { 
		$text = '<font color="green"><strong>'.__('On', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( ini_get('session.use_only_cookies') == 0 && isset($iniset_options['bps_iniSet_session_use_only_cookies']) && $iniset_options['bps_iniSet_session_use_only_cookies'] == 'Off' ) { 	
		$text = '<font color="#fb0101"><strong>'.__('Off', 'bulletproof-security').'</strong></font>';
		echo $text; 
	} 
	if ( isset($iniset_options['bps_iniSet_session_use_only_cookies']) && $iniset_options['bps_iniSet_session_use_only_cookies'] == '' ) { 	 
		$text = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
		echo $text; 	
	}
?>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: On ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('session.use_only_cookies specifies whether the module will only use cookies to store the session id on the client side. Protects against Session Fixation attacks that permit an attacker to hijack a valid user session.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
    <th scope="row">
<?php _e('Turn On|Off Session Cookie Secure:', 'bulletproof-security'); ?>
<select name="bps_iniSet_session_cookie_secure" style="" class="form-340">
<option value="Off" <?php selected('Off', $bps_iniSet_session_cookie_secure); ?>><?php _e('Session Cookie Secure Off', 'bulletproof-security'); ?></option>
<option value="On" <?php selected('On', $bps_iniSet_session_cookie_secure); ?>><?php _e('Session Cookie Secure On', 'bulletproof-security'); ?></option>
</select>    
    </th>
	<td>
<?php 
	if ( ini_get('session.cookie_secure') == 'On' && isset($iniset_options['bps_iniSet_session_cookie_secure']) && $iniset_options['bps_iniSet_session_cookie_secure'] == 'On' ) { 
		$text = '<font color="blue"><strong>'.__('On', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( ini_get('session.cookie_secure') == 0 && isset($iniset_options['bps_iniSet_session_cookie_secure']) && $iniset_options['bps_iniSet_session_cookie_secure'] == 'Off' ) { 	
		$text = '<font color="green"><strong>'.__('Off', 'bulletproof-security').'</strong></font>';
		echo $text; 
	} 
	if ( isset($iniset_options['bps_iniSet_session_cookie_secure']) && $iniset_options['bps_iniSet_session_cookie_secure'] == '' ) { 	 
		$text = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
		echo $text; 	
	}
?>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: Off ', 'bulletproof-security').'<br><font color="#2ea2cc">'.__('Description CAUTION: ', 'bulletproof-security').'</font></strong>'.__('This should ONLY be turned to On if your website is 100% HTTPS/SSL. Turning this to On may interfere with other things on your website that are using SESSION. session.cookie_secure specifies whether cookies should only be sent over secure connections. Protects against Session Hijacking AKA Cookie Hijacking.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
    <th scope="row">
<?php _e('Turn On|Off Ignore Repeated Errors:', 'bulletproof-security'); ?>
<select name="bps_iniSet_IgnoreRepeatedErrors" style="" class="form-340">
<option value="On" <?php selected('On', $bps_iniSet_IgnoreRepeatedErrors); ?>><?php _e('Ignore Repeated Errors On', 'bulletproof-security'); ?></option>
<option value="Off" <?php selected('Off', $bps_iniSet_IgnoreRepeatedErrors); ?>><?php _e('Ignore Repeated Errors Off', 'bulletproof-security'); ?></option>
</select>    
    </th>
	<td>
<?php 
	if ( ini_get('ignore_repeated_errors') == 'On' && isset($iniset_options['bps_iniSet_IgnoreRepeatedErrors']) && $iniset_options['bps_iniSet_IgnoreRepeatedErrors'] == 'On' ) { 
		$text = '<font color="green"><strong>'.__('On', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( ini_get('ignore_repeated_errors') == 0 && isset($iniset_options['bps_iniSet_IgnoreRepeatedErrors']) && $iniset_options['bps_iniSet_IgnoreRepeatedErrors'] == 'Off' ) { 	
		$text = '<font color="#fb0101"><strong>'.__('Off', 'bulletproof-security').'</strong></font>';
		echo $text; 
	} 
	if ( isset($iniset_options['bps_iniSet_IgnoreRepeatedErrors']) && $iniset_options['bps_iniSet_IgnoreRepeatedErrors'] == '' ) { 	 
		$text = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
		echo $text; 	
	}
?>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: On ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('Do not log repeated messages. Repeated errors must occur in the same file on the same line unless ignore_repeated_source is set to true/On. This means ignore duplicated error messages, not ignore the error message if the error occurs again', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
	<th scope="row">
<?php _e('Turn On|Off Ignore Repeated Source:', 'bulletproof-security'); ?>
<select name="bps_iniSet_IgnoreRepeatedSource" style="" class="form-340">
<option value="Off" <?php selected('Off', $bps_iniSet_IgnoreRepeatedSource); ?>><?php _e('Ignore Repeated Source Off', 'bulletproof-security'); ?></option>
<option value="On" <?php selected('On', $bps_iniSet_IgnoreRepeatedSource); ?>><?php _e('Ignore Repeated Source On', 'bulletproof-security'); ?></option>
</select>    
	</th>
	<td>	
<?php 
	if ( ini_get('ignore_repeated_source') == 'On' && isset($iniset_options['bps_iniSet_IgnoreRepeatedSource']) && $iniset_options['bps_iniSet_IgnoreRepeatedSource'] == 'On' ) { 
		$text = '<font color="#fb0101"><strong>'.__('On', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( ini_get('ignore_repeated_source') == 0 && isset($iniset_options['bps_iniSet_IgnoreRepeatedSource']) && $iniset_options['bps_iniSet_IgnoreRepeatedSource'] == 'Off' ) { 	
		$text = '<font color="green"><strong>'.__('Off', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( isset($iniset_options['bps_iniSet_IgnoreRepeatedSource']) && $iniset_options['bps_iniSet_IgnoreRepeatedSource'] == '' ) { 
		$text = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
	}
?>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: Off ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('Ignore source of message when ignoring repeated messages. When this setting is On you will not log errors with repeated messages from different files or sourcelines.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
    <th scope="row">
<?php _e('Turn On|Off Allow URL Include:', 'bulletproof-security'); ?>
<select name="bps_iniSet_AllowUrlInclude" style="" class="form-340">
<option value="Off" <?php selected('Off', $bps_iniSet_AllowUrlInclude); ?>><?php _e('Allow URL Include Off', 'bulletproof-security'); ?></option>
<option value="On" <?php selected('On', $bps_iniSet_AllowUrlInclude); ?>><?php _e('Allow URL Include On', 'bulletproof-security'); ?></option>
</select>
	</th>
	<td>
<?php 
	if ( isset($iniset_options['bps_iniSet_AllowUrlInclude']) && $iniset_options['bps_iniSet_AllowUrlInclude'] == 'On' ) { 
		$text = '<font color="#fb0101"><strong>'.__('On', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( isset($iniset_options['bps_iniSet_AllowUrlInclude']) && $iniset_options['bps_iniSet_AllowUrlInclude'] == 'Off' ) { 	
		$text = '<font color="green"><strong>'.__('Off', 'bulletproof-security').'</strong></font>';
		echo $text; 
	} else { 
		$text = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
		echo $text; 	
	}
?>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: Off ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('Allow or Disallow include and require statements to open URLs like (http:// or ftp://) as files. Allow or Disallow remote file access via the include and require statements. Include and require are the most common attack points for code injection attempts. Does not affect the remote file access capabilities of the standard file functions.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
	<th scope="row">
<?php _e('Turn On|Off Define Syslog Variables:', 'bulletproof-security'); ?>
<select name="bps_iniSet_DefineSyslogVar" style="" class="form-340">
<option value="Off" <?php selected('Off', $bps_iniSet_DefineSyslogVar); ?>><?php _e('Define Syslog Variables Off', 'bulletproof-security'); ?></option>
<option value="On" <?php selected('On', $bps_iniSet_DefineSyslogVar); ?>><?php _e('Define Syslog Variables On', 'bulletproof-security'); ?></option>
</select>
    </th>
	<td>
<?php 
	if ( isset($iniset_options['bps_iniSet_DefineSyslogVar']) && $iniset_options['bps_iniSet_DefineSyslogVar'] == 'On' ) { 
		$text = '<font color="#fb0101"><strong>'.__('On', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( isset($iniset_options['bps_iniSet_DefineSyslogVar']) && $iniset_options['bps_iniSet_DefineSyslogVar'] == 'Off' ) { 	
		$text = '<font color="green"><strong>'.__('Off', 'bulletproof-security').'</strong></font>';
		echo $text; 
	} else { 
		$text = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
		echo $text; 	
	}
?>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: Off ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('Define or not Define the various syslog variables (e.g. $LOG_PID, $LOG_CRON, etc.). Increased performance by turning this directive off. In runtime, you can define these variables by calling define_syslog_variables().', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
    <th scope="row">
<?php _e('Turn On|Off Display Errors:', 'bulletproof-security'); ?>
<select name="bps_iniSet_DisplayErrors" style="" class="form-340">
<option value="Off" <?php selected('Off', $bps_iniSet_DisplayErrors); ?>><?php _e('Display Errors Off', 'bulletproof-security'); ?></option>
<option value="On" <?php selected('On', $bps_iniSet_DisplayErrors); ?>><?php _e('Display Errors On', 'bulletproof-security'); ?></option>
</select>
    </th>
	<td>
<?php 
	if ( isset($iniset_options['bps_iniSet_DisplayErrors']) && $iniset_options['bps_iniSet_DisplayErrors'] == 'On' ) { 
		$text = '<font color="#fb0101"><strong>'.__('On', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( isset($iniset_options['bps_iniSet_DisplayErrors']) && $iniset_options['bps_iniSet_DisplayErrors'] == 'Off' ) { 	
		$text = '<font color="green"><strong>'.__('Off', 'bulletproof-security').'</strong></font>';
		echo $text; 
	} else { 
		$text = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
		echo $text; 	
	}
?>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: Off ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('Allow or Disallow PHP output errors, notices and warnings to remote users. The error message content may expose information about your script, web server or database server that may be exploitable for hacking. Sensitive information such as database usernames and passwords could also be leaked out. BPS logs php errors instead of displaying them to remote users. The BPS php error log is htaccess protected.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
	<th scope="row">
<?php _e('Turn On|Off Display Startup Errors:', 'bulletproof-security'); ?>
<select name="bps_iniSet_DisplayStartupErrors" style="" class="form-340">
<option value="Off" <?php selected('Off', $bps_iniSet_DisplayStartupErrors); ?>><?php _e('Display Startup Errors Off', 'bulletproof-security'); ?></option>
<option value="On" <?php selected('On', $bps_iniSet_DisplayStartupErrors); ?>><?php _e('Display Startup Errors On', 'bulletproof-security'); ?></option>
</select>
    </th>
	<td>
<?php 
	if ( isset($iniset_options['bps_iniSet_DisplayStartupErrors']) && $iniset_options['bps_iniSet_DisplayStartupErrors'] == 'On' ) { 
		$text = '<font color="#fb0101"><strong>'.__('On', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( isset($iniset_options['bps_iniSet_DisplayStartupErrors']) && $iniset_options['bps_iniSet_DisplayStartupErrors'] == 'Off' ) { 	
		$text = '<font color="green"><strong>'.__('Off', 'bulletproof-security').'</strong></font>';
		echo $text; 
	} else { 
		$text = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
		echo $text; 	
	}
?>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: Off ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('Allow or Disallow the display of errors which occur during PHPs startup sequence. Handled separately from the display_errors directive. Useful in debugging configuration problems in a development environment, but should never be set to On for production servers.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
	<th scope="row">
<?php _e('Turn On|Off Implicit Flush:', 'bulletproof-security'); ?>
<select name="bps_iniSet_ImplicitFlush" style="" class="form-340">
<option value="Off" <?php selected('Off', $bps_iniSet_ImplicitFlush); ?>><?php _e('Implicit Flush Off', 'bulletproof-security'); ?></option>
<option value="On" <?php selected('On', $bps_iniSet_ImplicitFlush); ?>><?php _e('Implicit Flush On', 'bulletproof-security'); ?></option>
</select>
    </th>
	<td>
<?php 
	if ( isset($iniset_options['bps_iniSet_ImplicitFlush']) && $iniset_options['bps_iniSet_ImplicitFlush'] == 'On' ) { 
		$text = '<font color="#fb0101"><strong>'.__('On', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( isset($iniset_options['bps_iniSet_ImplicitFlush']) && $iniset_options['bps_iniSet_ImplicitFlush'] == 'Off' ) { 	
		$text = '<font color="green"><strong>'.__('Off', 'bulletproof-security').'</strong></font>';
		echo $text; 
	} else { 
		$text = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
		echo $text; 	
	}
?>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: Off ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('Allow or Disallow PHP to tell the output layer to flush itself automatically after every output block. This is equivalent to calling the PHP function flush() after each and every call to print() or echo() and each and every HTML block. Turning this option On has serious performance implications and is generally recommended for debugging purposes only.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
	<th scope="row">
<?php _e('Turn On|Off Magic Quotes Runtime:', 'bulletproof-security'); ?>
<select name="bps_iniSet_MagicQuotesRuntime" style="" class="form-340">
<option value="Off" <?php selected('Off', $bps_iniSet_MagicQuotesRuntime); ?>><?php _e('Magic Quotes Runtime Off', 'bulletproof-security'); ?></option>
<option value="On" <?php selected('On', $bps_iniSet_MagicQuotesRuntime); ?>><?php _e('Magic Quotes Runtime On', 'bulletproof-security'); ?></option>
</select>
    </th>
	<td>
<?php 
	if ( ini_get('magic_quotes_runtime') == 1 && isset($iniset_options['bps_iniSet_MagicQuotesRuntime']) && $iniset_options['bps_iniSet_MagicQuotesRuntime'] == 'On' ) { 
		$text = '<font color="#fb0101"><strong>'.__('On', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( ini_get('magic_quotes_runtime') == 0 && isset($iniset_options['bps_iniSet_MagicQuotesRuntime']) && $iniset_options['bps_iniSet_MagicQuotesRuntime'] == 'Off' ) { 	
		$text = '<font color="green"><strong>'.__('Off', 'bulletproof-security').'</strong></font>';
		echo $text; 
	} else { 
		$text = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
		echo $text; 	
	}
?>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: Off ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('Allow or Disallow magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
	<th scope="row">
<?php _e('Max Execution Time:', 'bulletproof-security');  echo '<br>'; ?>
<input type="text" name="bps_iniSet_MaxExecutionTime" value="<?php if ( $bps_iniSet_MaxExecutionTime != '' ) { echo $bps_iniSet_MaxExecutionTime; } else { echo ini_get('max_execution_time'); } ?>" style="padding:2px;margin-left:0px;" class="form-340" />    
    </th>
	<td><strong>
<?php if ( $bps_iniSet_MaxExecutionTime != '' ) { echo $bps_iniSet_MaxExecutionTime; } else { _e('Not Set', 'bulletproof-security'); } ?></strong>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: 120 ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. This helps prevent poorly written scripts from tying up the server. The default setting is 120.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
	<th scope="row">
<?php _e('MySQL Connect Timeout:', 'bulletproof-security'); ?>
<input type="text" name="bps_iniSet_MysqlConnectTimeout" value="<?php if ( $bps_iniSet_MysqlConnectTimeout != '' ) { echo $bps_iniSet_MysqlConnectTimeout; } else { echo ini_get('mysql.connect_timeout'); } ?>" style="padding:2px;margin-left:0px;" class="form-340" />    
    </th>
	<td><strong>
<?php if ( $bps_iniSet_MysqlConnectTimeout != '' ) { echo $bps_iniSet_MysqlConnectTimeout; } else { _e('Not Set', 'bulletproof-security'); } ?></strong>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: 30 ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('Connect timeout in seconds. On Linux this timeout is also used for waiting for the first answer from the server. The default setting is 60. If you are debugging code you should set this to 3-5 seconds.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
	<th scope="row">
<?php _e('Turn On|Off MySQL Trace Mode:', 'bulletproof-security'); ?>
<select name="bps_iniSet_MysqlTraceMode" style="" class="form-340">
<option value="Off" <?php selected('Off', $bps_iniSet_MysqlTraceMode); ?>><?php _e('MySQL Trace Mode Off', 'bulletproof-security'); ?></option>
<option value="On" <?php selected('On', $bps_iniSet_MysqlTraceMode); ?>><?php _e('MySQL Trace Mode On', 'bulletproof-security'); ?></option>
</select>
    </th>
	<td>
<?php 
	if ( ini_get('mysql.trace_mode') == 1 && isset($iniset_options['bps_iniSet_MysqlTraceMode']) && $iniset_options['bps_iniSet_MysqlTraceMode'] == 'On' ) { 
		$text = '<font color="#fb0101"><strong>'.__('On', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( ini_get('mysql.trace_mode') == 0 && isset($iniset_options['bps_iniSet_MysqlTraceMode']) && $iniset_options['bps_iniSet_MysqlTraceMode'] == 'Off' ) { 	
		$text = '<font color="green"><strong>'.__('Off', 'bulletproof-security').'</strong></font>';
		echo $text; 
	} else { 
		$text = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
		echo $text; 	
	}
?>
    </td>
    <td>
<?php $text = '<strong>'.__('Recommended Setting: Off ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('Trace mode. When mysql.trace_mode is enabled, warnings for table/index scans, non free result sets, and SQL-Errors will be displayed.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
    <tr>
    <th scope="row">
<?php _e('Turn On|Off Report Memleaks:', 'bulletproof-security'); ?>
<select name="bps_iniSet_ReportMemleaks" style="" class="form-340">
<option value="On" <?php selected('On', $bps_iniSet_ReportMemleaks); ?>><?php _e('Report Memleaks On', 'bulletproof-security'); ?></option>
<option value="Off" <?php selected('Off', $bps_iniSet_ReportMemleaks); ?>><?php _e('Report Memleaks Off', 'bulletproof-security'); ?></option>
</select>    
    </th>
	<td style="border:none">
<?php 
	if ( ini_get('report_memleaks') == 'On' && isset($iniset_options['bps_iniSet_ReportMemleaks']) && $iniset_options['bps_iniSet_ReportMemleaks'] == 'On' ) { 
		$text = '<font color="green"><strong>'.__('On', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( ini_get('report_memleaks') == 0 && isset($iniset_options['bps_iniSet_ReportMemleaks']) && $iniset_options['bps_iniSet_ReportMemleaks'] == 'Off' ) { 	
		$text = '<font color="#fb0101"><strong>'.__('Off', 'bulletproof-security').'</strong></font>';
		echo $text; 
	}
	if ( isset($iniset_options['bps_iniSet_ReportMemleaks']) && $iniset_options['bps_iniSet_ReportMemleaks'] == '' ) { 		 
		$text = '<strong>'.__('Not Set', 'bulletproof-security').'</strong>';
		echo $text; 	
	}
?>
    </td>
    <td style="border:none">
<?php $text = '<strong>'.__('Recommended Setting: On ', 'bulletproof-security').'<br>'.__('Description: ', 'bulletproof-security').'</strong>'.__('Allow or Disallow memory leaks to be logged. This directive only applies to debugging and will only effect a debug compile if error reporting includes E_WARNING in the allowed list.', 'bulletproof-security'); echo $text; ?>
    </td>
	</tr>
</tbody>
</table>
</div>

	<input type="hidden" name="bpsIniSet" value="bps-IniSet" />

<div id="inisetSaveEnable">
    <input type="submit" name="Submit-iniset-Options" value="<?php esc_attr_e('Save|Enable Options', 'bulletproof-security'); ?>" class="button bps-button" style="width:154px;height:auto;white-space:normal" onclick="return confirm('<?php $text = __('Click OK to Save and Enable ini_set Options or click Cancel.', 'bulletproof-security'); echo $text; ?>')" />
</div>
</form>

</div>

<?php
if ( isset($UIoptions['bps_ui_theme_skin']) && $UIoptions['bps_ui_theme_skin'] == 'blue' ) { ?>

<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($) {
	$( "#iniSetOptionsTable tr:odd" ).css( "background-color", "#f9f9f9" );
});
/* ]]> */
</script>

<?php } ?>

<div id="inisetResetRemove">
<form name="bpsIniSetRemove" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-2' ); ?>" method="post">
<?php wp_nonce_field('bps-iniset-wpconfig-remove'); ?>
	<input type="submit" name="Submit-bps-iniset-wpconfig-remove" value="<?php esc_attr_e('Reset|Remove Options', 'bulletproof-security') ?>" class="button bps-button" style="width:154px;height:auto;white-space:normal" onclick="return confirm('<?php $text = __('Reset|Remove Options deletes your Saved Options and also deletes the ini_set code that was added to your wp-config.php file.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click OK to delete your Saved Options and ini_set code or click Cancel.', 'bulletproof-security'); echo $text; ?>')" />
</form>
</div>

	</td>
  </tr>
</table>

<?php } ?>
</div>

<div id="bps-tabs-3" class="bps-tab-page">

<?php require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/php/php-file-manager.php' ); ?>

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bps-help_faq_table">
  <tr>
    <td class="bps-table_title"><h2><?php _e('All Purpose File Manager', 'bulletproof-security'); ?></h2></td>
  </tr>
  <tr>
    <td class="bps-table_cell_help">

<div id="iniDeleter" style="float:right;margin:20px 20px 10px 0px;">

<form name="iniDeleterForm" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-3' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ini_deleter'); ?>
	<strong><label for="bps-ini-file-deleter"><?php _e('Delete Files:', 'bulletproof-security'); ?> </label></strong>
	<select name="iniDeleter[]" id="iniDeleter">
	
	<?php echo bps_showOptionsDrop3($iniDeleter, $chosen3, true); ?>
	
    </select>
	<input type="submit" name="Submit-IDel" value="<?php esc_attr_e('Delete', 'bulletproof-security'); ?>" class="button bps-button" onclick="return confirm('<?php $text = __('Are you sure?', 'bulletproof-security').'\n\n'.__('Click OK to delete the file or click Cancel.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('After deleting the file delete the Label and File Path from the File Manager.', 'bulletproof-security'); echo $text; ?>')" />
</form>
</div>

<h3 style="margin:0px 0px 10px 0px;"><?php _e('All Purpose File Manager', 'bulletproof-security'); ?>  <button id="bps-open-modal6" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content6" class="bps-dialog-hide" title="<?php _e('All Purpose File Manager', 'bulletproof-security'); ?>">
	<p><?php echo $bps_modal_content6; ?></p>
</div>

<?php if ( !current_user_can('manage_options') ) { _e('Permission Denied', 'bulletproof-security'); } else { ?>

<?php
$Master_custom_phpini_file = addslashes( WP_PLUGIN_DIR . '/bulletproof-security/admin/php/my-master-phpini.ini' );
$custom_phpini_file_root = addslashes( $_SERVER['DOCUMENT_ROOT'] . '/php.ini' );
$custom_phpini5_file_root = addslashes( $_SERVER['DOCUMENT_ROOT'] . '/php5.ini' );
$custom_userini_file_root = addslashes( $_SERVER['DOCUMENT_ROOT'] . '/.user.ini' );
$custom_phpini_file_wpdir = addslashes( ABSPATH . 'php.ini' );

	echo '<span class="bps_phpini_paths"><strong><font color="#2ea2cc" style="font-size:1.25em;">'.__('Master custom php.ini file path: ', 'bulletproof-security').'</font>'.$Master_custom_phpini_file.'</strong></span><br>';

	if ( file_exists( $custom_phpini5_file_root ) ) {
		echo '<span class="bps_phpini_paths"><strong><font color="#2ea2cc">'.__('Go Daddy Custom php5.ini file path: ', 'bulletproof-security').'</font>'.$custom_phpini5_file_root.'</strong></span><br>';
	}
	if ( file_exists( $custom_phpini_file_root ) ) {
		echo '<span class="bps_phpini_paths"><strong><font color="#2ea2cc">'.__('Custom php.ini file path: ', 'bulletproof-security').'</font>'.$custom_phpini_file_root.'</strong></span><br>';
	}
	if ( file_exists( $custom_userini_file_root ) ) {
		echo '<span class="bps_phpini_paths"><strong><font color="blue">'.__('Custom .user.ini file path: ', 'bulletproof-security').'</font>'.$custom_userini_file_root.'</strong></span><br>';
	}
	if ( file_exists( $custom_phpini_file_wpdir ) ) {
		echo '<span class="bps_phpini_paths"><strong><font color="#2ea2cc">'.__('Custom php.ini file path: ', 'bulletproof-security').'</font>'.$custom_phpini_file_wpdir.'</strong></span><br>';
	}
?>

<form name="bps-ini-options" action="options.php#bps-tabs-3" method="post">
			<?php settings_fields('bulletproof_security_options'); ?>
			<?php $FM_options = get_option('bulletproof_security_options'); 
			$bpsinifiles_input_1_label = ! isset($FM_options['bpsinifiles_input_1_label']) ? '' : $FM_options['bpsinifiles_input_1_label'];
			$bpsinifiles_input_1 = ! isset($FM_options['bpsinifiles_input_1']) ? '' : $FM_options['bpsinifiles_input_1'];
			$bpsinifiles_input_2_label = ! isset($FM_options['bpsinifiles_input_2_label']) ? '' : $FM_options['bpsinifiles_input_2_label'];
			$bpsinifiles_input_2 = ! isset($FM_options['bpsinifiles_input_2']) ? '' : $FM_options['bpsinifiles_input_2'];
			$bpsinifiles_input_3_label = ! isset($FM_options['bpsinifiles_input_3_label']) ? '' : $FM_options['bpsinifiles_input_3_label'];
			$bpsinifiles_input_3 = ! isset($FM_options['bpsinifiles_input_3']) ? '' : $FM_options['bpsinifiles_input_3'];			
			$bpsinifiles_input_4_label = ! isset($FM_options['bpsinifiles_input_4_label']) ? '' : $FM_options['bpsinifiles_input_4_label'];
			$bpsinifiles_input_4 = ! isset($FM_options['bpsinifiles_input_4']) ? '' : $FM_options['bpsinifiles_input_4'];			
			$bpsinifiles_input_5_label = ! isset($FM_options['bpsinifiles_input_5_label']) ? '' : $FM_options['bpsinifiles_input_5_label'];
			$bpsinifiles_input_5 = ! isset($FM_options['bpsinifiles_input_5']) ? '' : $FM_options['bpsinifiles_input_5'];
			$bpsinifiles_input_6_label = ! isset($FM_options['bpsinifiles_input_6_label']) ? '' : $FM_options['bpsinifiles_input_6_label'];
			$bpsinifiles_input_6 = ! isset($FM_options['bpsinifiles_input_6']) ? '' : $FM_options['bpsinifiles_input_6'];
			$bpsinifiles_input_7_label = ! isset($FM_options['bpsinifiles_input_7_label']) ? '' : $FM_options['bpsinifiles_input_7_label'];
			$bpsinifiles_input_7 = ! isset($FM_options['bpsinifiles_input_7']) ? '' : $FM_options['bpsinifiles_input_7'];
			$bpsinifiles_input_8_label = ! isset($FM_options['bpsinifiles_input_8_label']) ? '' : $FM_options['bpsinifiles_input_8_label'];
			$bpsinifiles_input_8 = ! isset($FM_options['bpsinifiles_input_8']) ? '' : $FM_options['bpsinifiles_input_8'];
			$bpsinifiles_input_9_label = ! isset($FM_options['bpsinifiles_input_9_label']) ? '' : $FM_options['bpsinifiles_input_9_label'];
			$bpsinifiles_input_9 = ! isset($FM_options['bpsinifiles_input_9']) ? '' : $FM_options['bpsinifiles_input_9'];
			$bpsinifiles_input_10_label = ! isset($FM_options['bpsinifiles_input_10_label']) ? '' : $FM_options['bpsinifiles_input_10_label'];
			$bpsinifiles_input_10 = ! isset($FM_options['bpsinifiles_input_10']) ? '' : $FM_options['bpsinifiles_input_10'];
			?>
            
<div id="php-file-manager">

<table class="widefat" style="">
<thead>
	<tr>
	<th scope="col" style="width:25%;"><strong><?php _e('Label|Description', 'bulletproof-security'); ?></strong></th>
	<th scope="col" style="width:75%;"><strong><?php $text = __('Add File|Folder Paths: To Your php.ini File or Other Files', 'bulletproof-security'); echo $text; ?></strong></th>
    </tr>
</thead>
<tbody>
<tr>
	<th scope="row"><input type="text" name="bulletproof_security_options[bpsinifiles_input_1_label]" value="<?php echo $bpsinifiles_input_1_label; ?>" class="regular-text-label" style="padding:2px;" /></th>
	<td><input type="text" name="bulletproof_security_options[bpsinifiles_input_1]" value="<?php echo $bpsinifiles_input_1; ?>" class="regular-text-wide" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bulletproof_security_options[bpsinifiles_input_2_label]" value="<?php echo $bpsinifiles_input_2_label; ?>" class="regular-text-label" style="padding:2px;" /></th>
	<td><input type="text" name="bulletproof_security_options[bpsinifiles_input_2]" value="<?php echo $bpsinifiles_input_2; ?>" class="regular-text-wide" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bulletproof_security_options[bpsinifiles_input_3_label]" value="<?php echo $bpsinifiles_input_3_label; ?>" class="regular-text-label" style="padding:2px;" /></th>
	<td><input type="text" name="bulletproof_security_options[bpsinifiles_input_3]" value="<?php echo $bpsinifiles_input_3; ?>" class="regular-text-wide" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bulletproof_security_options[bpsinifiles_input_4_label]" value="<?php echo $bpsinifiles_input_4_label; ?>" class="regular-text-label" style="padding:2px;" /></th>
	<td><input type="text" name="bulletproof_security_options[bpsinifiles_input_4]" value="<?php echo $bpsinifiles_input_4; ?>" class="regular-text-wide" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bulletproof_security_options[bpsinifiles_input_5_label]" value="<?php echo $bpsinifiles_input_5_label; ?>" class="regular-text-label" style="padding:2px;" /></th>
	<td><input type="text" name="bulletproof_security_options[bpsinifiles_input_5]" value="<?php echo $bpsinifiles_input_5; ?>" class="regular-text-wide" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bulletproof_security_options[bpsinifiles_input_6_label]" value="<?php echo $bpsinifiles_input_6_label; ?>" class="regular-text-label" style="padding:2px;" /></th>
	<td><input type="text" name="bulletproof_security_options[bpsinifiles_input_6]" value="<?php echo $bpsinifiles_input_6; ?>" class="regular-text-wide" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bulletproof_security_options[bpsinifiles_input_7_label]" value="<?php echo $bpsinifiles_input_7_label; ?>" class="regular-text-label" style="padding:2px;" /></th>
	<td><input type="text" name="bulletproof_security_options[bpsinifiles_input_7]" value="<?php echo $bpsinifiles_input_7; ?>" class="regular-text-wide" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bulletproof_security_options[bpsinifiles_input_8_label]" value="<?php echo $bpsinifiles_input_8_label; ?>" class="regular-text-label" style="padding:2px;" /></th>
	<td><input type="text" name="bulletproof_security_options[bpsinifiles_input_8]" value="<?php echo $bpsinifiles_input_8; ?>" class="regular-text-wide" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bulletproof_security_options[bpsinifiles_input_9_label]" value="<?php echo $bpsinifiles_input_9_label; ?>" class="regular-text-label" style="padding:2px;" /></th>
	<td><input type="text" name="bulletproof_security_options[bpsinifiles_input_9]" value="<?php echo $bpsinifiles_input_9; ?>" class="regular-text-wide" /></td>
</tr>
<tr>
	<th scope="row"><input type="text" name="bulletproof_security_options[bpsinifiles_input_10_label]" value="<?php echo $bpsinifiles_input_10_label; ?>" class="regular-text-label" style="padding:2px;" /></th>
	<td style="border:none"><input type="text" name="bulletproof_security_options[bpsinifiles_input_10]" value="<?php echo $bpsinifiles_input_10; ?>" class="regular-text-wide" /></td>
</tr> 
</tbody>
</table>
</div>			

<p class="submit">
<input type="submit" name="bps-ini-options" class="button bps-button" value="<?php esc_attr_e('Save Changes', 'bulletproof-security') ?>" />
</p>
</form>

<?php
if ( isset($UIoptions['bps_ui_theme_skin']) && $UIoptions['bps_ui_theme_skin'] == 'blue' ) { ?>

<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($) {
	$( "#php-file-manager tr:odd" ).css( "background-color", "#f9f9f9" );
});
/* ]]> */
</script>

<?php } ?>

</td>
  </tr>
  <td class="bps-table_cell_help">
</td>
  </tr>
</table>

<?php } ?>
</div>

<div id="bps-tabs-4" class="bps-tab-page">

<?php if ( ! current_user_can('manage_options') ) { _e('Permission Denied', 'bulletproof-security'); } else { 
require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/php/php-file-editor.php' );
$scrolltophp2 = isset( $_REQUEST['scrolltophp2'] ) ? (int) $_REQUEST['scrolltophp2'] : 0;
?>

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bps-help_faq_table">
  <tr>
    <td class="bps-table_title"><h2><?php _e('All Purpose File Editor', 'bulletproof-security'); ?></h2></td>
  </tr>
  <tr>
    <td class="bps-table_cell_help">

<h3 style="margin:0px 0px 5px 0px;"><?php _e('Editing Php.ini Files or Other Files', 'bulletproof-security'); ?>  <button id="bps-open-modal7" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content7" class="bps-dialog-hide" title="<?php _e('All Purpose File Editor', 'bulletproof-security'); ?>">
	<p><?php echo $bps_modal_content7; ?></p>
</div>

<div id="iniselector">
<form name="iniSelectorForm" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-4' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_ini_selector'); ?>
	<select name="iniSelector[]" id="iniSelector">
       
	<?php echo bps_showOptionsDrop2($iniSelector, $chosen2, true); ?>
		
	</select>
	<input type="submit" name="Submit-IS" class="button bps-button" value="<?php esc_attr_e('Select', 'bulletproof-security') ?>" />
</form>
</div>

</td>
  </tr>
  <td class="bps-table_cell_help">

<div id="APfileEditor" style="margin:0px 0px 0px 0px;">
<form name="templatephp2" id="templatephp2" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-4' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_save_settings_php2'); 
	$iniFilename = isset( $_POST['Submit-IS']) ? $iniFilename : '';
?>
<div id="bpsPhpIniEditor">
    <textarea class="bps-text-area-600x700" name="newcontentphp2" id="newcontentphp2" tabindex="1"><?php echo bps_get_php_ini_file(); ?></textarea>
	<input type="hidden" name="iniFilename" value="<?php echo esc_html($iniFilename); ?>" />
    <input type="hidden" name="scrolltophp2" id="scrolltophp2" value="<?php echo esc_html( $scrolltophp2 ); ?>" />
</div>
	
    <input type="submit" name="submit-php2" class="button bps-button" style="margin:10px 0px 15px 10px;" value="<?php esc_attr_e('Update File', 'bulletproof-security') ?>" />
</form>
</div>

<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($){
	$('#templatephp2').submit(function(){ $('#scrolltophp2').val( $('#newcontentphp2').scrollTop() ); });
	$('#newcontentphp2').scrollTop( $('#scrolltophp2').val() ); 
});
/* ]]> */
</script> 

</td>
  </tr>
</table>

<?php } ?>
</div>

<div id="bps-tabs-5" class="bps-tab-page">

<?php if ( ! current_user_can('manage_options') ) { _e('Permission Denied', 'bulletproof-security'); } else { ?>

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bps-help_faq_table">
  <tr>
    <td class="bps-table_title"><h2><?php _e('PHP Error Log ~ ', 'bulletproof-security'); ?><span style="font-size:.75em;"><?php _e('Logs any/all PHP errors that are occurring on your website ~ ', 'bulletproof-security'); $text = '<a href="https://forum.ait-pro.com/forums/topic/how-to-troubleshoot-php-errors-php-errors-in-your-php-error-log/" target="_blank" title="How to Troubleshoot PHP errors">'.__('How to Troubleshoot PHP errors', 'bulletproof-security').'</a>'; echo $text; ?></span></h2></td>
  </tr>
  <tr>
    <td class="bps-table_cell_help">

<h3 style="margin:0px 0px 10px 0px;"><?php _e('PHP Error Log', 'bulletproof-security'); ?>  <button id="bps-open-modal8" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content8" class="bps-dialog-hide" title="<?php _e('PHP Error Log', 'bulletproof-security'); ?>">
	<p>
	<?php
        $text = '<strong>'.__('This Read Me Help window is draggable (top) and resizable (bottom right corner)', 'bulletproof-security').'</strong><br><br>';
		echo $text; 
		// Forum Help Links or of course both
		$text = '<strong><font color="blue">'.__('Forum Help Links: ', 'bulletproof-security').'</font></strong>'; 	
		echo $text;	
	?>
	<strong><a href="https://forum.ait-pro.com/forums/topic/how-to-troubleshoot-php-errors-php-errors-in-your-php-error-log/" title="How to Troubleshoot PHP Errors" target="_blank"><?php _e('How to Troubleshoot PHP Errors', 'bulletproof-security'); ?></a></strong><br /><br />		
	
	
	<?php echo $bps_modal_content8; ?>
    </p>
</div>

<?php //_e('PHP Error Log Location', 'bulletproof-security'); ?>

<?php 

if ( isset( $_POST['Submit-PELL'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bulletproof_security_options_php_error_log' );
	
	$PELL_options = get_option('bulletproof_security_options_iniSet');
	$Elog_options = get_option('bulletproof_security_options2');

	$ini_Set_Options = array(
	'bps_iniSet_ErrorReporting' 			=> $PELL_options['bps_iniSet_ErrorReporting'], 
	'bps_iniSet_LogErrors' 					=> $PELL_options['bps_iniSet_LogErrors'], 
	//'bps_iniSet_ErrorLog' 					=> stripslashes( esc_html($_POST['bps_iniSet_ErrorLog']) ), 
	//bps_error_log_location
	'bps_iniSet_ErrorLog' 					=> stripslashes( esc_html($_POST['bps_error_log_location']) ),
	'bps_iniSet_LogErrorsMaxLen' 			=> $PELL_options['bps_iniSet_LogErrorsMaxLen'], 
	'bps_iniSet_MemoryLimit' 				=> $PELL_options['bps_iniSet_MemoryLimit'], 
	'bps_iniSet_session_cookie_httponly' 	=> $PELL_options['bps_iniSet_session_cookie_httponly'], 
	'bps_iniSet_session_use_only_cookies' 	=> $PELL_options['bps_iniSet_session_use_only_cookies'], 
	'bps_iniSet_session_cookie_secure' 		=> $PELL_options['bps_iniSet_session_cookie_secure'], 
	'bps_iniSet_IgnoreRepeatedErrors' 		=> $PELL_options['bps_iniSet_IgnoreRepeatedErrors'], 
	'bps_iniSet_IgnoreRepeatedSource' 		=> $PELL_options['bps_iniSet_IgnoreRepeatedSource'], 
	'bps_iniSet_AllowUrlInclude' 			=> $PELL_options['bps_iniSet_AllowUrlInclude'], 
	'bps_iniSet_DefineSyslogVar' 			=> $PELL_options['bps_iniSet_DefineSyslogVar'], 
	'bps_iniSet_DisplayErrors' 				=> $PELL_options['bps_iniSet_DisplayErrors'], 
	'bps_iniSet_DisplayStartupErrors' 		=> $PELL_options['bps_iniSet_DisplayStartupErrors'], 
	'bps_iniSet_ImplicitFlush' 				=> $PELL_options['bps_iniSet_ImplicitFlush'], 
	'bps_iniSet_MagicQuotesRuntime' 		=> $PELL_options['bps_iniSet_MagicQuotesRuntime'], 
	'bps_iniSet_MaxExecutionTime' 			=> $PELL_options['bps_iniSet_MaxExecutionTime'], 
	'bps_iniSet_MysqlConnectTimeout' 		=> $PELL_options['bps_iniSet_MysqlConnectTimeout'], 
	'bps_iniSet_MysqlTraceMode' 			=> $PELL_options['bps_iniSet_MysqlTraceMode'], 
	'bps_iniSet_ReportMemleaks' 			=> $PELL_options['bps_iniSet_ReportMemleaks'] 
	);

	foreach( $ini_Set_Options as $key => $value ) {
		update_option('bulletproof_security_options_iniSet', $ini_Set_Options);
	}

	$Elog_SE_log = array(
	'bps_error_log_location' => stripslashes( esc_html($_POST['bps_error_log_location'])) 
	);	 

	foreach( $Elog_SE_log as $key => $value ) {
		update_option('bulletproof_security_options2', $Elog_SE_log);
	}

	$PELL_options = get_option('bulletproof_security_options_iniSet');
	$Flockoptions = get_option('bulletproof_security_options_flock');
	$filename = ABSPATH . 'wp-config.php';
	$permswpconfig = @substr(sprintf('%o', fileperms($filename)), -4);
	$sapi_type = php_sapi_name();
	$wpconfigBackup = WP_CONTENT_DIR . '/bps-backup/autorestore/root-files/wp-config.php';
	$bpsPHPElog = WP_PLUGIN_DIR . '/bulletproof-security/admin/php/bps_php_error.log';
	$bpsPHPElogFolder = WP_CONTENT_DIR . '/bps-backup/logs/bps_php_error.log';
	$subject = file_get_contents($filename);
	$pattern = '/@ini_set\(\'error_log\',\'(.*)add\sthe\spath\sto\syour\sphp\serror\slog/';

	if ( ! file_exists($filename) ) {
		echo $bps_topDiv;
		$text = '<font color="#fb0101"><strong>'.__('A wp-config.php file was NOT found in your root folder.', 'bulletproof-security').'</strong></font><br>'.__('If you have moved your wp-config.php file to a protected Server folder then you will need to add the BPS Pro ini_set coding to your wp-config.php file manually.', 'bulletproof-security').'<br>'.__('The BPS ini_set coding can be found in this file /bulletproof-security/admin/php/php-directives-code-for-wp-config.', 'bulletproof-security');
		echo $text;
		echo $bps_bottomDiv;
	
	} else {

		if ( file_exists($filename) && preg_match($pattern, $subject, $matches) ) {
			
			if ( @substr($sapi_type, 0, 6) != 'apache' || @$permswpconfig != '0666' || @$permswpconfig != '0777') { // Windows IIS, XAMPP, etc
				@chmod($filename, 0644);
			}
			
			$stringReplace = @file_get_contents($filename);
			$stringReplace = preg_replace($pattern, "@ini_set('error_log','".stripslashes( esc_html($_POST['bps_error_log_location']))."'); // add the path to your php error log", $stringReplace);
			file_put_contents($filename, $stringReplace);		
			copy($filename, $wpconfigBackup);	
			copy($bpsPHPElog, $bpsPHPElogFolder);
	
			echo $bps_topDiv;
			$text = '<font color="green"><strong>'.__('The PHP Error Log location has been set to: ', 'bulletproof-security').stripslashes(esc_html($_POST['bps_error_log_location'])).__(' This also sets the PHP Error Log location in ini_set Options and physically in your wp-config.php file and DB as well.', 'bulletproof-security').'</strong></font><br>';
			echo $text;	
			echo $bps_bottomDiv;
	
			$fl_override_options = get_option('bulletproof_security_options_flock_eol');
			
			if ( $fl_override_options['bps_file_lock_override'] == 'On' ) {
	
				if ( $Flockoptions['bps_lock_root_htaccess'] == 'yes' ) {	
					@chmod($filename, 0400);		
				}	
			}
		}
	
		if ( file_exists($filename) && ! preg_match($pattern, $subject, $matches) ) {
			echo $bps_topDiv;
			$text = '<strong><font color="#fb0101">'.__('The BPS Pro ini_set Options code was not found in your wp-config.php file.', 'bulletproof-security').'</font><br>'.__('Go to the ini_set Options tab page, enter the path to your php error log file in the ini_set PHP Error Log Location Set To option setting if the path does NOT already exist and click the Save|Enable Options button. If the path to your php error log file already exists in the ini_set PHP Error Log Location Set To option setting then just click the Save|Enable Options button.', 'bulletproof-security').'</strong>';
			echo $text;
			echo $bps_bottomDiv;			
		}	
	}
}

// 14: Displays the POST Form value if the form is submitted to show the POST value of the Set To text box in real time or displays ini_get value if form is not submitted.
function bpsPro_php_error_log_set_to_server_path() {
	
	if ( isset ( $_POST['Submit-PELL'] ) ) {
		$_POST['Submit-PELL'] = true;
	} else {
		$_POST['Submit-PELL'] = null;
	}

	if ( $_POST['Submit-PELL'] == true ) {
		
		$ini_get_error_log_path = stripslashes(esc_html($_POST['bps_error_log_location']));
		echo $ini_get_error_log_path;
		
	} elseif ( $_POST['Submit-PELL'] != true ) { 
	
		$ini_get_error_log_path = addslashes(ini_get('error_log'));
		echo $ini_get_error_log_path; }
}

?>

<form name="phpErrorLogSetLocation" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-5' ); ?>" method="post">
    <?php wp_nonce_field('bulletproof_security_options_php_error_log'); ?>
	<?php $Elog_options = get_option('bulletproof_security_options2'); 
	$bps_error_log_location = ! isset($Elog_options['bps_error_log_location']) ? '' : $Elog_options['bps_error_log_location'];	
	?>
	
    <label for="phpErrorLog"><strong><?php $text = __('ini_set PHP Error Log Location', 'bulletproof-security').'<font color="#2ea2cc">'.__(' (Recommended): ', 'bulletproof-security').'</font>'; echo $text; ?></strong><?php echo addslashes( WP_CONTENT_DIR.'/bps-backup/logs/bps_php_error.log' ); ?></label><br /><br />
    <label for="phpErrorLog" style="vertical-align:text-top;"><strong><?php _e('PHP Error Log Location Set To: ', 'bulletproof-security'); ?></strong></label>
    <input type="text" name="bps_error_log_location" value="<?php echo $bps_error_log_location; ?>" class="regular-text-save-path" /><br />
    <label for="phpErrorLog" style="margin-right:9px;vertical-align:top;"><strong><?php _e('Error Log Path Seen by Server: ', 'bulletproof-security'); ?></strong></label><span class="php_error_log_path"><?php bpsPro_php_error_log_set_to_server_path(); ?></span><br />
	<div id="PHPSetELogLocation" style="float:left; margin:10px 0px 10px 0px;">
    <input type="submit" name="Submit-PELL" class="button bps-button" value="<?php esc_attr_e('Set Error Log Location', 'bulletproof-security') ?>" /> 
</div>
</form>

<div id="errorLogGeneral2">
<h3><?php _e('PHP Error Log Last Modified Time', 'bulletproof-security'); ?>  <button id="bps-open-modal9" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content9" class="bps-dialog-hide" title="<?php _e('PHP Error Log Last Modified Time', 'bulletproof-security'); ?>">
	<p><?php echo $bps_modal_content9; ?></p>
</div>
</div>

<?php
// Get the Last Modifed Date of the PHP Error Log File
function bps_getPhpELogLastMod() {
$Elog_options = get_option('bulletproof_security_options2');
$filename = ! isset($Elog_options['bps_error_log_location']) ? '' : $Elog_options['bps_error_log_location'];
$gmt_offset = get_option( 'gmt_offset' ) * 3600;

	if ( file_exists($filename) ) {
		$last_modified = date("F d Y H:i:s", filemtime($filename) + $gmt_offset );
	return $last_modified;
	}
}

// String comparison of DB Last Modified Time and Actual File Last Modified Time
function bps_ELogModTimeDiff() {
$options = get_option('bulletproof_security_options_elog');
$last_modified_time = bps_getPhpELogLastMod();
$last_modified_time_db = ! isset($options['bps_error_log_date_mod']) ? '' : $options['bps_error_log_date_mod'];
	
	if ( strcmp( $last_modified_time, $last_modified_time_db ) == 0 ) { // 0 is equal
		$text = '<font color="green" style="padding-right:8px;"><strong>'.__('Last Modified Time in DB: ', 'bulletproof-security').'</strong></font>';
		echo $text;
	} else {
		$text = '<font color="#fb0101" style="padding-right:8px;"><strong>'.__('Last Modified Time in DB: ', 'bulletproof-security').'</strong></font>';
		echo $text;
	}
}

// Get File Size of the PHP Error Log File
function bps_getPHPLogSize() {
$Elog_options = get_option('bulletproof_security_options2');
$filename = ! isset($Elog_options['bps_error_log_location']) ? '' : $Elog_options['bps_error_log_location'];

	if ( file_exists($filename) ) {
		$logSize = filesize($filename);
	
		if ( $logSize < 2097152 ) {
 			$text = '<span style="font-size:13px;"><strong>'.__('PHP Error Log File Size: ', 'bulletproof-security').'<font color="#2ea2cc">'. round($logSize / 1024, 2) .' KB</font></strong></span><br><br>';
			echo $text;
	
		} else {
 		
			$text = '<span style="font-size:13px;"><strong>'. __('PHP Error Log File Size: ', 'bulletproof-security').'<font color="#fb0101">'. round($logSize / 1024, 2) .' KB<br>'.__('The S-Monitor Email Logging options will only send log files up to 2MB in size.', 'bulletproof-security').'</font></strong><br>'.__('Copy and paste the PHP Error Log file contents into a Notepad text file on your computer and save it.', 'bulletproof-security').'<br>'.__('Then click the Delete Log button to delete the contents of this Log file.', 'bulletproof-security').'</span><br><br>';		
			echo $text;
		}
	}
}
bps_getPHPLogSize();
?> 

<form name="phpErrorLogModDate" action="options.php#bps-tabs-5" method="post">
	<?php settings_fields('bulletproof_security_options_elog'); ?> 
	<?php $Elog_mod_options = get_option('bulletproof_security_options_elog'); 
	$bps_error_log_date_mod = ! isset($Elog_mod_options['bps_error_log_date_mod']) ? '' : $Elog_mod_options['bps_error_log_date_mod'];
	?>
    
    <label for="phpErrorLog"><strong><?php _e('PHP Error Log Last Modified Time:', 'bulletproof-security'); ?></strong></label><br />	
    <label for="phpErrorLog"><strong><?php echo bps_ELogModTimeDiff(); ?></strong><?php echo $bps_error_log_date_mod; ?></label><br />
	<label for="phpErrorLog" style="vertical-align:top;"><strong><?php _e('Last Modified Time in File:', 'bulletproof-security'); ?></strong></label>
    <input type="text" name="bulletproof_security_options_elog[bps_error_log_date_mod]" style="color:#2ea2cc;font-size:13px;width:200px;margin-top:-6px;padding-left:4px;font-weight:600;border:none;background:none;outline:none;-webkit-box-shadow:none;box-shadow:none;-webkit-transition:none;transition:none;" value="<?php echo bps_getPhpELogLastMod(); ?>" />

<div id="PHPELogDBReset">
    <input type="submit" name="Submit-PELMD" class="button bps-button" value="<?php esc_attr_e('Reset Last Modified Time in DB', 'bulletproof-security') ?>" />
</div>
</form>

<div id="PHPELogDelete">
<form name="ViewLogForm" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-5' ); ?>" method="post">
<?php wp_nonce_field('bps-view-php-log'); ?>
<input type="submit" name="Submit-View-PHP-Log" value="<?php esc_attr_e('View Log', 'bulletproof-security') ?>" class="button bps-button" onclick="return confirm('<?php $text = __('Clicking OK will display the contents of your PHP Error Log file.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click OK to view the Log file or click Cancel.', 'bulletproof-security'); echo $text; ?>')" />
</form>
</div>

<div id="PHPELogDelete">
<form name="DeleteLogForm" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-5' ); ?>" method="post">
<?php wp_nonce_field('bps-delete-php-log'); ?>
<input type="submit" name="Submit-Delete-PHP-Log" value="<?php esc_attr_e('Delete Log', 'bulletproof-security') ?>" class="button bps-button" onclick="return confirm('<?php $text = __('Clicking OK will delete the contents of your PHP Error Log file.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click OK to Delete the Log file contents or click Cancel.', 'bulletproof-security'); echo $text; ?>')" />
</form>
</div>

<div id="PHPTestLog">
<form name="phpErrorLogTest" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-5' ); ?>" method="post">
<?php wp_nonce_field('bps-error-log-test'); ?>
<input type="hidden" name="filename" value="bps-test-error-log" />
<input type="submit" name="phpErrorLogTest" value="<?php esc_attr_e('Test Error Log', 'bulletproof-security') ?>" class="button bps-button" onclick="return confirm('<?php $text = __('Clicking OK will generate this intentional PHP error below:', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('BPS Pro PHP Error Log Test: Your PHP Error Log is working correctly.', 'bulletproof-security').'\n\n'.$bpsSpacePop.'\n\n'.__('Click OK to Test your Error Log or click Cancel.', 'bulletproof-security'); echo $text; ?>')" />
</form>
</div>

<?php
if ( isset( $_POST['Submit-Delete-PHP-Log'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bps-delete-php-log' );

	$Elog_mod_options = get_option('bulletproof_security_options_elog');
	$Elog_options = get_option('bulletproof_security_options2');
	$last_modified_time_db = $Elog_mod_options['bps_error_log_date_mod'];
	$time = strtotime($last_modified_time_db); 
	$PHPLog = $Elog_options['bps_error_log_location'];
	$PHPLogMaster = WP_PLUGIN_DIR . '/bulletproof-security/admin/php/bps_php_error_master.log';
	
	if ( copy($PHPLogMaster, $PHPLog) ) {
		
		if ( ! touch($PHPLog, $time) ) {
			// no message needed - this is internal
		}

	echo $bps_topDiv;
	$text = '<font color="green"><strong>'.__('Success! Your PHP Error Log file has been deleted and replaced with a new blank PHP Error Log file.', 'bulletproof-security').'</strong></font>';
	echo $text;	
	echo $bps_bottomDiv;

	}
}
?>

<div id="messageinner" class="updatedinner" style="">
<?php
// Form - php.ini Error Log - Perform File Open and Write test - If append write test is successful write to file
function bpsPro_php_error_log_write_check() {

	if ( isset ( $_POST['submit-php1'] ) ) {
		$_POST['submit-php1'] = true;
	} else {
		$_POST['submit-php1'] = null;
	}

	if ( $_POST['submit-php1'] != true ) {

		$Elog_options = get_option('bulletproof_security_options2');
		$php_error_log = ! isset($Elog_options['bps_error_log_location']) ? '' : $Elog_options['bps_error_log_location'];
		
		if ( is_writable($php_error_log) ) {

			$text = '<font color="green" style="font-size:12px;"><strong>'.__('File Open and Write test successful! Your PHP Error Log file is writable. Click the View Log button.', 'bulletproof-security').'</strong></font><br>';
			echo $text;
		
		} else {
				
			$text = '<font color="#fb0101" style="font-size:12px;"><strong>'.__('Cannot write to file: ', 'bulletproof-security').$php_error_log . '</strong></font><br>';
					echo $text;
		}
	}
}

bpsPro_php_error_log_write_check();

	if ( isset( $_POST['submit-php1'] ) && current_user_can('manage_options') ) {
		check_admin_referer( 'bulletproof_security_save_settings_php1' );
		
		$newcontentphp1 = stripslashes( $_POST['newcontentphp1'] );
		$Elog_options = get_option('bulletproof_security_options2');
		$php_error_log = $Elog_options['bps_error_log_location'];

	if ( is_writable($php_error_log) ) {
		$handle = fopen($php_error_log, 'w+b');
		fwrite($handle, $newcontentphp1);
		$text = '<font color="green" style="font-size:12px;"><strong>'.__('Success! Your PHP Error Log file has been updated.', 'bulletproof-security').'</strong></font><br>';
		echo $text;	
	
	echo $bps_topDiv;
	$text = '<font color="green"><strong>'.__('Success! Your PHP Error Log file has been updated.', 'bulletproof-security').'</strong></font>';
	echo $text;	
	echo $bps_bottomDiv;

    fclose($handle);

	$gmt_offset = get_option( 'gmt_offset' ) * 3600;
	$time_now = date("F d Y H:i:s", time() + $gmt_offset );
	$BPS_PHPLog = array( 'bps_error_log_date_mod' => $time_now );	

		foreach( $BPS_PHPLog as $key => $value ) {
			update_option('bulletproof_security_options_elog', $BPS_PHPLog);
		}
	}
}

// Form - PHP Error Log Test
if ( isset( $_POST['phpErrorLogTest'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bps-error-log-test' );

	$text = '<font color="green"><strong>'.__('To Complete the PHP Error Log Test. Click the Refresh Status button below.', 'bulletproof-security').'</strong></font><div style="width:100px;margin:5px 0px 5px 0px;padding:2px 6px 2px 6px;background-color:#e8e8e8;border:1px solid gray;"><a href="'.admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-5' ).'" style="font-size:1.13em;text-decoration:none;" onclick="location.reload(true)">'.__('Refresh Status', 'bulletproof-security').'</a></div>';
	echo $text;
	error_log("BPS Pro PHP Error Log Test: Your PHP Error Log is working correctly.", 0);
	//copy($nothing, $tonothing);
}

$scrolltophp1 = isset( $_REQUEST['scrolltophp1'] ) ? (int) $_REQUEST['scrolltophp1'] : 0;
?>
</div>

<div id="phpErrorLogEditor">
<form name="templatephp1" id="templatephp1" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-5' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_save_settings_php1'); ?>
<div id="bpsPhpErrorLog">
    <textarea class="bps-text-area-600x700" name="newcontentphp1" id="newcontentphp1" tabindex="1"><?php echo bps_get_php_error_log(); ?></textarea>
	<input type="hidden" name="scrolltophp1" id="scrolltophp1" value="<?php echo esc_html( $scrolltophp1 ); ?>" />
    <p class="submit">
	<input type="submit" name="submit-php1" class="button bps-button" value="<?php esc_attr_e('Update File', 'bulletproof-security') ?>" /></p>
</div>
</form>

<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($){
	$('#templatephp1').submit(function(){ $('#scrolltophp1').val( $('#newcontentphp1').scrollTop() ); });
	$('#newcontentphp1').scrollTop( $('#scrolltophp1').val() ); 
});
/* ]]> */
</script>
</div>

</td>
  </tr>
</table>

<?php } ?>
</div>
            
<div id="bps-tabs-6" class="bps-tab-page">

<?php if ( ! current_user_can('manage_options') ) { _e('Permission Denied', 'bulletproof-security'); } else { ?>

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bps-help_faq_table">
  <tr>
    <td class="bps-table_title"><h2><?php _e('PHP Info Viewer ~ ', 'bulletproof-security'); ?><span style="font-size:.75em;"><?php _e('View PHP Server Configuration Information Safely And Securely With htaccess Protected phpinfo()', 'bulletproof-security'); ?></span></h2></td>
  </tr>
  <tr>
    <td class="bps-table_cell_help">

<h3 style="margin:0px 0px 5px 0px;"><?php _e('Phpinfo Viewer', 'bulletproof-security'); ?>  <button id="bps-open-modal10" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content10" class="bps-dialog-hide" title="<?php _e('Phpinfo Viewer', 'bulletproof-security'); ?>">
	<p><?php echo $bps_modal_content10; ?></p>
</div>
    
<form name="bps-view-phpinfo" method="POST" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-6' ); ?>" target="" onSubmit="window.open('<?php echo plugins_url('/bulletproof-security/admin/php/bps-phpinfo.php'); ?>','','scrollbars=yes,menubar=yes,width=800,height=600,resizable=yes,status=yes,toolbar=yes')">
<?php wp_nonce_field('bps-view-phpinfo-check'); ?>
<input type="hidden" name="filename" value="bps-view-phpinfo-secure" />
<p class="submit">
<input type="submit" name="bps-view-phpinfo" class="button bps-button" value="<?php esc_attr_e('View PHPINFO', 'bulletproof-security') ?>" /></p>
</form>

<h2><?php _e('PHP Info Multi Viewer', 'bulletproof-security'); ?></h2>
<div id="phpMultiViewerGeneral" style="border-top:1px solid #999999;border-bottom:1px solid #999999;">

<h3><?php _e('Phpinfo Multi Viewer', 'bulletproof-security'); ?>  <button id="bps-open-modal11" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>
<div id="bps-modal-content11" class="bps-dialog-hide" title="<?php _e('Phpinfo Multi Viewer', 'bulletproof-security'); ?>">
	<p><?php echo $bps_modal_content11; ?></p>
</div>

<h3><?php _e('View your PHP server information safely and securely for specific folders', 'bulletproof-security'); ?></h3>
</div>

<div id="phpInfoCreator" style="border-bottom:1px solid #999999;">
<h3><?php _e('Phpinfo Master File Creator', 'bulletproof-security'); ?>  <button id="bps-open-modal12" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content12" class="bps-dialog-hide" title="<?php _e('Phpinfo Master File Creator', 'bulletproof-security'); ?>">
	<p><?php echo $bps_modal_content12; ?></p>
</div>

<form name="bps-create-phpinfo-multi" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-6' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_phpinfo_create'); ?>
<strong><label for="bps-ini-file-creator"><?php _e('Click the Create Phpinfo File button to create your new secure phpinfo file:', 'bulletproof-security'); ?></label></strong><br />
<label for="bps-ini-file-creator"><strong><?php _e('Phpinfo File: ', 'bulletproof-security'); ?></strong><span style="color:green;font-weight:bold;"><?php if ( isset( $_POST['bps-create-phpinfo-multi'] ) ) { echo $phpinfoIP; } ?></span></label><br />
<input type="hidden" name="bcpms1" value="bps-create-phpinfo-multi-create" />
<p class="submit">
<input type="submit" name="bps-create-phpinfo-multi" class="button bps-button" value="<?php esc_attr_e('Create Phpinfo File', 'bulletproof-security') ?>" /></p>
</form>
</div>

<div id="phpInfoCreatorCopy" style="border-bottom:1px solid #999999;">
<h3><?php _e('Phpinfo File Creator|Copier', 'bulletproof-security'); ?>  <button id="bps-open-modal13" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content13" class="bps-dialog-hide" title="<?php _e('Phpinfo File Creator|Copier', 'bulletproof-security'); ?>">
	<p><?php echo $bps_modal_content13; ?></p>
</div>

<form name="bps-copy-phpinfo-multi" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-6' ); ?>" method="post">
<?php wp_nonce_field('bulletproof_security_phpinfo_copy'); ?>
	<strong><label for="bps-ini-file-creator"><?php _e('Add the folder path where you want your new phpinfo file saved:', 'bulletproof-security'); ?></label></strong><br />
    <label for="bps-ini-file-creator"><strong><?php _e('Name your phpinfo file with a .php file extension. Example:', 'bulletproof-security').' '; ?></strong><?php _e('myphpinfo.php', 'bulletproof-security'); ?></label><br />
    <label for="bps-ini-file-creator"><strong><?php _e('Your Website root folder path is:', 'bulletproof-security').' '; ?></strong><?php echo ABSPATH; ?></label><br />
    <label for="bps-ini-file-creator"><strong><?php _e('File saved to folder:', 'bulletproof-security').' '; ?></strong><span style="color:green; font-weight:bold;"><?php if ( isset( $_POST['bps-copy-phpinfo-multi'] ) ) { echo $bpsSaveLocPhpinfo; } ?></span></label><br />
    <input type="text" name="bps-phpinfo-save-path" value="Example: <?php echo ABSPATH; ?>some-folder-name/some-unique-file-name.php" class="regular-text-mycrypt" /><br /><br />
    <strong><label for="bps-ini-file-creator"><?php _e('Add the URL path to your new phpinfo file:', 'bulletproof-security'); ?></label></strong><br />
    <label for="bps-ini-file-creator"><strong><?php _e('Hint:', 'bulletproof-security').' '; ?></strong><?php _e('Copy a portion of the folder path above to your URL window. Example: /some-folder-name/some-unique-file-name.php', 'bulletproof-security'); ?></label><br />
 <label for="bps-ini-file-creator"><strong><?php _e('Your Website URL is:', 'bulletproof-security').' '; ?></strong><?php echo get_site_url(); ?></label><br />
 <label for="bps-ini-file-creator"><strong><?php _e('File saved to URL:', 'bulletproof-security').' '; ?></strong><span style="color:green; font-weight:bold;"><?php if ( isset( $_POST['bps-copy-phpinfo-multi'] ) ) { echo $bpsViewPhpinfo; } ?></span></label><br />
     <input type="text" name="bps-phpinfo-url-path" value="Example: <?php echo get_site_url(); ?>/some-folder-name/some-unique-file-name.php" class="regular-text-mycrypt" />
    <input type="hidden" name="bcpms2" value="bps-create-phpinfo-multi-copy" />
    <p class="submit">
	<input type="submit" name="bps-copy-phpinfo-multi" class="button bps-button" value="<?php esc_attr_e('Save Phpinfo File', 'bulletproof-security') ?>" /></p>
</form>
</div>

<div id="phpMultiViewer">
<h3><?php _e('Phpinfo Multi Viewer', 'bulletproof-security'); ?>  <button id="bps-open-modal14" class="button bps-modal-button"><?php _e('Read Me', 'bulletproof-security'); ?></button></h3>

<div id="bps-modal-content14" class="bps-dialog-hide" title="<?php _e('Phpinfo Multi Viewer', 'bulletproof-security'); ?>">
	<p><?php echo $bps_modal_content14; ?></p>
</div>

<?php
// Delete the phpinfo file at the same time it is opened
if ( isset( $_POST['bps-view-phpinfo-multi'] ) && current_user_can('manage_options') ) {
	check_admin_referer( 'bps-view-phpinfo-multi' );

	$bpsSaveLocPhpinfo = $_POST['bpsUnlink'];
	
	if ( file_exists($bpsSaveLocPhpinfo) ) {
		$fh = fopen($bpsSaveLocPhpinfo, 'a');
		fwrite($fh, '<h1>Hello world!</h1>');
		fclose($fh);
		unlink($bpsSaveLocPhpinfo);
	}
}
?>

<form name="bps-view-phpinfo-multi" method="POST" action="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/php/php-options.php#bps-tabs-6' ); ?>" target="" onSubmit="window.open('<?php if ( isset( $_POST['bps-copy-phpinfo-multi'] ) ) { echo $bpsViewPhpinfo; } ?>','','scrollbars=yes,menubar=yes,width=800,height=600,resizable=yes,status=yes,toolbar=yes')">
<?php wp_nonce_field('bps-view-phpinfo-multi'); ?>
 <label for="bps-ini-file-creator"><?php _e('If you see a blank popup window after clicking the View PHPINFO Multi button you have not entered a valid URL and / or file name.', 'bulletproof-security'); ?></label><br />
 <input type="hidden" name="bpsUnlink" value="<?php if ( isset( $_POST['bps-view-phpinfo-multi'] ) ) { echo $bpsSaveLocPhpinfo; } ?>" />
 <label for="bps-ini-file-creator"><strong><?php _e('Click the View button to View: ', 'bulletproof-security'); ?></strong><span style="color:green; font-weight:bold;"><?php if ( isset( $_POST['bps-view-phpinfo-multi'] ) ) { echo $bpsViewPhpinfo; } ?></span></label>
<p class="submit">
<input type="submit" name="bps-view-phpinfo-multi" class="button bps-button" value="<?php esc_attr_e('View PHPINFO Multi', 'bulletproof-security') ?>" /></p>
</form>

</div>

</td>
  </tr>
</table>

<?php } ?>
</div>

<div id="bps-tabs-7" class="bps-tab-page">

<?php 
	if ( ! current_user_can('manage_options') ) { _e('Permission Denied', 'bulletproof-security');
	} else { 
	require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/php/php-security-status.php' ); 
	} 
?>

<?php
if ( isset($UIoptions['bps_ui_theme_skin']) && $UIoptions['bps_ui_theme_skin'] == 'blue' ) { ?>

<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($) {
	$( ".widefat tr:odd" ).css( "background-color", "#f9f9f9" );
});
/* ]]> */
</script>

<?php } ?>

</div>

<div id="bps-tabs-8" class="bps-tab-page">

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bps-help_faq_table">
  <tr>
    <td class="bps-table_title"><h2><?php _e('Help &amp; FAQ', 'bulletproof-security'); ?></h2></td>
  </tr>
  <tr>
    <td class="bps-table_cell_help_links">
    <a href="<?php echo admin_url( 'admin.php?page=bulletproof-security/admin/whatsnew/whatsnew.php' ); ?>" target="_blank"><?php _e('Whats New in ', 'bulletproof-security'); echo BULLETPROOF_VERSION; ?></a><br /><br />
    <a href="https://forum.ait-pro.com/forums/topic/custom-php-ini-file-setup-php5-3-x/" target="_blank"><?php _e('Custom php.ini File Setup for PHP 5.3.x, PHP 5.4.x or higher versions', 'bulletproof-security'); ?></a><br /><br />
    <a href="https://forum.ait-pro.com/video-tutorials/" target="_blank"><?php _e('Video Tutorials', 'bulletproof-security'); ?></a><br /><br />
    <a href="https://forum.ait-pro.com/forums/topic/bulletproof-security-pro-version-release-dates/" target="_blank"><?php _e('BPS Pro Features & Version Release Dates', 'bulletproof-security'); ?></a><br /><br />
    <a href="https://forum.ait-pro.com/forums/topic/how-to-troubleshoot-php-errors-php-errors-in-your-php-error-log/" target="_blank"><?php _e('PHP Errors what do they mean and how to troubleshoot them', 'bulletproof-security'); ?></a><br /><br />
    <a href="https://forum.ait-pro.com/forums/topic/plugin-conflicts-actively-blocked-plugins-plugin-compatibility/" target="_blank"><?php _e('Forum: Search, Troubleshooting Steps & Post Questions For Assistance', 'bulletproof-security'); ?></a><br /><br />
    <a href="https://www.ait-pro.com/aitpro-blog/3576/bulletproof-security-pro/custom-php-ini-faq/" target="_blank"><?php _e('Custom php.ini and PHP Errors FAQ', 'bulletproof-security'); ?></a><br /><br />
    <a href="https://www.ait-pro.com/aitpro-blog/3576/bulletproof-security-pro/custom-php-ini-faq#web-hosts-list" target="_blank"><?php _e('php.ini Handler Web Hosts List', 'bulletproof-security'); ?></a>
    </td>
  </tr>
</table>

</div>
   
<div id="AITpro-link">BulletProof Security Pro <?php echo BULLETPROOF_VERSION; ?> Plugin by <a href="https://forum.ait-pro.com/" target="_blank" title="AITpro Website Security">AITpro Website Security</a>
</div>
</div>
<style>
<!--
.bps-spinner {visibility:hidden;}
-->
</style>
</div>