CMS WordPress

Programmatically Sign-on a WordPress User, the true way!

function rsf_programmatic_login( $username ) { if ( is_user_logged_in() ) { wp_logout(); } add_filter( ‘authenticate’, ‘allow_programmatic_login’, 10, 3 ); // hook in earlier than other callbacks to short-circuit them $user = wp_signon( array( ‘user_login’ => $username ) ); remove_filter( ‘authenticate’, ‘allow_programmatic_login’, 10, 3 ); if ( is_a( $user, ‘WP_User’ ) ) { wp_set_current_user( $user->ID, $user->user_login ); […]

Uncategorized

Useful tools for obfuscated code

HTML/Oct/Hex Decoder : This tool will attempt to revert any type of encoding (including Hex, html, Oct, etc). UnPHP: A free online service to decode obfuscated PHP code. A good chance to solve your issue. PHP Decoder: The same as above and still useful (if UnPHP was not successful). Eval base64_decode: also useful for PHP […]

CentOS Linux OS

Telegram self-signed certificate on CentOS + Nginx

Simply create cert via Openssl as described here: https://core.telegram.org/bots/self-signed after that, configure the nginx : https://www.digitalocean.com/community/tutorials/how-to-create-an-ssl-certificate-on-nginx-for-ubuntu-14-04 jump to step 2… good luck!

CMS PHP WordPress

Buffering WordPress rendered page

if( current_user_can(‘manage_options’) ) { add_action(‘template_redirect’, ‘YOURPLUGIN_buffer_start’, 0); } function YOURPLUGIN_buffer_start() { add_action(‘shutdown’, ‘YOURPLUGIN_buffer_stop’, PHP_INT_MAX); ob_start(‘YOURPLUGIN_modify_content’); } function YOURPLUGIN_buffer_stop() { ob_end_flush(); } function YOURPLUGIN_modify_content($content) { $dom = new DomDocument(); $dom->loadHTML($content); $styles=array(); foreach ($dom->getElementsByTagName(‘link’) as $node) { if($node->hasAttribute(‘rel’) && $node->getAttribute(‘rel’)==’stylesheet’ ) { $styles[]=$node->getAttribute(“href”); } } //modify $content return serialize($styles).$content; }

Uncategorized

PHP.ini Common Settings

php_value max_input_vars 4500 php_value upload_max_filesize 40M ini_set(‘post_max_size’, ’64M’); max_allowed_packet=100M define(‘WP_MEMORY_LIMIT’, ’64M’); ==== ini_set(‘max_execution_time’, 300); set_time_limit(0); ini_get(‘max_execution_time’); ignore_user_abort(true);