Year: 2018

Php

PHP Code Injection Prevention

Hi, this would be great if you place @ the very first line of your script. if(isset($_GET)){ foreach ($_GET as $key => $value) { $_GET[$key] = cleanInput(strip_tags(rawurldecode(rawurldecode($value)))); } } if(isset($_POST)){ foreach ($_POST as $key => $value) { $_POST[$key] = cleanInput(strip_tags(rawurldecode(rawurldecode($value)))); } } function cleanInput($input) { $search = array( ‘@@si’, ‘@@si’, ‘@@siU’, ‘@@’ ); $output = […]

Linux Nginx

How to install laravel & php 7.2

There are few things we need for this tutorial. PHP 7.2+ REF : https://www.chris-shaw.com/blog/installing-php-7.2-on-debian-8-jessie-and-debian-9-stretch Composer REF : https://getcomposer.org/doc/00-intro.md#downloading-the-composer-executable laravel Okay , so we will start intall for php 7.2 ++ and below are the steps :- #Adding Repo $ sudo apt-get install apt-transport-https lsb-release ca-certificates $ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg $ echo “deb https://packages.sury.org/php/ […]

Apache Nginx Php

Codeigniter Rewrite for nginx & apache

Rewrite Rules for nginx must be added into each domain’s configuration. location /path/to/project{ try_files $uri $uri/ /path/to/project/index.php?/$request_uri; } Rewrite Rules for apache can be added in the project’s .htaccess. RewriteEngine on RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png) RewriteCond %(REQUEST_FILENAME) !-f RewriteCond %(REQUEST_FILENAME) !-d RewriteRule ^(.*)$ ./index.php/$1 [L]

bash Linux

Linux Grep Command

#$ grep -r –exclude-dir={path1,path2,path3,path4} -i –include=\*.php ‘ keyword ‘ /path/to/dir/ Explaination :- -r : recursive –exclude-dir=PATTERN : Exclude specific directory -i, –ignore-case ignore case distinctions –include=FILE_PATTERN : search only files that match FILE_PATTERN #Extras Grep multiple pattern #$ grep ‘keyword1\|keyword2\|keyword3’ /path/to/dir/

Apache Linux Nginx

Prevent Curl Wget for Web server

Nginx ## # Block User Agent (Jorgee Vulnerability scan) ## if ($http_user_agent ~* (Jorgee|curl|wget) ){ return 403; } Apache RewriteEngine On RewriteCond %{HTTP_USER_AGENT} ^$ [OR] RewriteCond %{HTTP_USER_AGENT} ^.*(|’|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^.*(HTTrack|clshttp|archiver|loader|email|nikto|miner|python).* [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^.*(winhttp|libwww\-perl|curl|wget|harvest|scan|grab|extract).* [NC] RewriteRule ^(.*)$ – [F,L]

javascript

Video Autoplay ( when visible)

https://cdnjs.com/libraries/vissense/tutorials/getting-started My Example of making all video using vissense function $(“.video”).each(function () { var myVideo = document.getElementById(this.id); VisSense.VisMon.Builder(VisSense(myVideo, { fullyvisible: 0.75 })) .on(‘fullyvisible’, function(monitor) { myVideo.play(); }) .on(‘hidden’, function(monitor) { myVideo.pause(); }).build().start(); }); Code Explanation 1. For each class video, get their id and set VisSense function to it 2. Set the fullyvisible to desire […]

Linux Php

Cron’s php script pathing issue

Php include/require pathing is related to how you run your script in cron for example you are having a PHP script in /var/www/html/phpscript/project1/index.php , And below is how the scripts include the files <?php include(“../include_1.php”); include(“../include_2.php”); ?> and below is how you run your script in cron. * * * * * php /var/www/html/phpscript/project1/index.php The […]

Linux

Vim Folding ( Marker Method )

Hi, today i’ll be talking about folding for vim. Folding is to fold codes from line to line to have a better view on codes. today i will be demonstrating marker fold method for vim. Firstly , you will need to set your foldmethod to marker code and the default for open and close marker […]

Back To Top