Tuesday, September 23, 2014

// // Leave a Comment

Sanitize Inputs in PHP

1) Function for stripping out malicious bits

<?php
function cleanInput($input) {
 
  $search = array(
    '@@si',   // Strip out javascript
    '@<[\/\!]*?[^<>]*?>@si',            // Strip out HTML tags
    '@@siU',    // Strip style tags properly
    '@<![\s\S]*?--[ \t\n\r]*>@'         // Strip multi-line comments
  );
 
    $output = preg_replace($search, '', $input);
    return $output;
  }
?>

2) Sanitization function

Uses the function above, as well as adds slashes as to not screw up database functions.
<?php
function sanitize($input) {
    if (is_array($input)) {
        foreach($input as $var=>$val) {
            $output[$var] = sanitize($val);
        }
    }
    else {
        if (get_magic_quotes_gpc()) {
            $input = stripslashes($input);
        }
        $input  = cleanInput($input);
        $output = mysql_real_escape_string($input);
    }
    return $output;
}
?>

Usage

<?php
  $bad_string = "Hi! <script src='http://www.evilsite.com/bad_script.js'>< /script> It's a good day!";
  $good_string = sanitize($bad_string);

  $_POST = sanitize($_POST);
  $_GET  = sanitize($_GET);
?>

Reference URL
Read More
// // Leave a Comment

Auto-FFmpeg-cPanel :: Auto FFMpeg Installer for cPanel

Auto FFMpeg Installer for cPanel

Auto FFMpeg Installer for cPanel w/CentOS 6+

Requirements:

  • CentOS 6+
  • PuTTY
  • cPanel
That's all! Did you expected more?

Why use this ?

Installation of FFMPEG is treated as the toughest installations as it has many dependencies. So I made this script, to simply the issues. Check with the below steps for easy installation.

Installation:

$> yum update -y
$> yum install wget -y
$> wget --no-check-certificate "https://raw.githubusercontent.com/itseasy21/auto-ffmpeg-cpanel/master/install-ffmpeg.sh" -O /root/install-ffmpeg.sh
$> cd /root
$> chmod +x install-ffmpeg.sh
$> ./install-ffmpeg.sh

Read More
// // Leave a Comment

Auto-FFmpeg :: Auto FFMpeg Installer for CentOS 6+

auto-ffmpeg






Build Status
Auto FFMpeg Installer for CentOS 6+ and other Control Panel that support CentOS 6+ (eg Kloxo, ZPanel etc)

Requirements:

  • CentOS 6+
  • PuTTY
That's all! Did you expected more?

Why use this ?

Installation of FFMPEG is treated as the toughest installations as it has many dependencies. So I made this script, to simply the issues. Check with the below steps for easy installation.

Installation:

$> yum update -y
$> yum install wget -y
$> wget --no-check-certificate "https://raw.githubusercontent.com/itseasy21/auto-ffmpeg/master/install-ffmpeg.sh" -O /root/install-ffmpeg.sh
$> cd /root
$> chmod +x install-ffmpeg.sh
$> ./install-ffmpeg.sh

Read More
// // Leave a Comment

W3tools-Varnish : Varnish Cache Inegration in cPanel

w3tools-varnish

Varnish Cache Integration in cPanel

Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents.

Installation:

$> yum update -y
$> yum install wget -y
$> wget "https://raw.githubusercontent.com/itseasy21/w3tools-varnish/master/install.sh" -O /root/varnish-install.sh
$> cd /root
$> chmod +x varnish-install.sh
$> ./varnish-install.sh

Read More

Monday, September 22, 2014

// // Leave a Comment

ApacheBooster v2.3

ApacheBooster

NOTE: This is the only working version of ApacheBooster found on GitHub :D
Current Release: V2.3
Nginx Version : 1.6.2
Varnish Version : 3.0.5
ApacheBooster is a integration of nginx and varnish, this Plugin will reduce the server load spike and memory usage. Also the plugin will provide the maximum performance of your websites.

Varnish

Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents. Varnish Cache is really, really fast. It typically speeds up delivery with a factor of 300 – 1000x, depending on your architecture. A high level overview of what Varnish does can be seen in the video attached to this web. Varnish performs really, really well. It is usually bound by the speed of the network, effectivly turning performance into a non-issue. We’ve seen Varnish delivering 20 Gbps on regular off-the-shelf hardware.

Nginx

Nginx is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.
Unlike traditional servers, Nginx doesn’t rely on threads to handle requests. Instead it uses a much more scalable event-driven (asynchronous) architecture. This architecture uses small, but more importantly, predictable amounts of memory under load.

Installation/Upgrade instructions

  1. Clone the installation folder onto your CPanel server:
$> git clone https://github.com/itseasy21/ApacheBooster.git
              OR
$> wget https://github.com/itseasy21/ApacheBooster/archive/master.zip -O ApacheBooster.zip
$> unzip ApacheBooster.zip
  1. Change the working directory to cloned or extracted folder:
$> cd ApacheBooster/apachebooster
              OR
$> cd ApacheBooster-master/apachebooster
  1. Execute installation script and wait for it to finish:
$> sh install.sh

Uninstallation instructions:

1. Clone the ApacheBooster files onto your server.
2. Change the working directory to cloned folder.
3  execute uninstall script.
 $> sh uninstall
Read More