Skip to the content

nano.cat

Snippets of Mălin Cenușă

  • Home
  • Categories
  • Malware Samples
  • mălin.ro
  • blackhat.pm
  • palma.solutions

Adjust excerpt length in WordPress

Date: May 9, 2020
Tags: excerpt length, functions.php, PHP, programming, Wordpress
Categories: CMS, PHP, Programming & Scripting, Wordpress

Add this to functions.php to achieve it:

function mytheme_custom_excerpt_length( $length ) {
return 20;
}
add_filter( ‘excerpt_length’, ‘mytheme_custom_excerpt_length’, 999 );

…

[root@nano.cat]# Check it out!

Enable mail header logging for the PHP mail() function

Date: May 9, 2020
Tags: logging, mail headers, mail(), PHP, php.ini
Categories: Security, php.ini

Add this to php.ini in order to enable logging for the PHP mail() function:

mail.add_x_header = On
mail.log =…

[root@nano.cat]# Check it out!

cURL via PHP

Date: April 28, 2020
Tags: API, cURL, JSON, PHP
Categories: Programming & Scripting, PHP

Pull the result of a cURL query via PHP.

Useful for parsing JSON APIs

$ch = curl_init();curl_setopt($ch,…

[root@nano.cat]# Check it out!

Hide DIV on specific pages

Date: April 24, 2020
Tags: hide content, PHP
Categories: PHP, Programming & Scripting

PHP snippet to hide a specific DIV or content from specific pages:

<?php if (strpos($_SERVER[‘REQUEST_URI’],’/checkout/’) === false ||…

[root@nano.cat]# Check it out!

Error reporting in PHP

Date: April 23, 2020
Tags: error reporting, PHP
Categories: Programming & Scripting, PHP

<?php    
// Turn off error reporting    
error_reporting(0);    

// Report runtime errors    
error_reporting(E_ERROR |…

[root@nano.cat]# Check it out!

Categories



© 2021 nano.cat. All rights reserved. Powered by WordPress.