Skip to content

Instantly share code, notes, and snippets.

View imelgrat's full-sized avatar

Iván Melgrati imelgrat

View GitHub Profile
<?
#Include the class
require_once("iam_backup.php");
# Set the parameters: We only set the Database connection. The connection procedure could be in an include file
# This will dump the database and prompt the user to download it. No compression is applied here.
$conn = @mysql_pconnect("localhost","root","");
if(!$result) // If no connection, return 0
{
echo "An error has occurred. Could not connect to the server";
}
@imelgrat
imelgrat / prevent-jerky-resize.js
Last active August 23, 2017 19:53
Prevent jerky motion upon resizing browser window by waiting until window resizing stops (no external libraries). Full article at: http://imelgrat.me/javascript/debouncing-javascript-events/
$(window).bind('resize', function(e)
{
window.resizeEvt;
$(window).resize(function()
{
clearTimeout(window.resizeEvt);
window.resizeEvt = setTimeout(function()
{
if($(window).width() != previous_width)
{
@imelgrat
imelgrat / .htaccess
Last active August 23, 2017 19:42
Protect .htaccess and .htpasswd files (current and child folders). Full article at: http://imelgrat.me/security/wordpress-htaccess-file-protect/
# Deny access to all .htaccess files
<files ~ "^.*\.([Hh][Tt][Aa])">
order allow,deny
deny from all
satisfy all
</files>
@imelgrat
imelgrat / .htaccess
Last active August 23, 2017 19:42
Use .htaccess to disable execution (and send files to the browser) of CGI-based files. Full article at: http://imelgrat.me/security/wordpress-htaccess-file-protect/
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
Options -ExecCGI
@imelgrat
imelgrat / .htaccess
Last active August 23, 2017 19:42
Disable directory browsing using .htaccess. Full article at: http://imelgrat.me/security/wordpress-htaccess-file-protect/
# Disable directory browsing
Options All -Indexes
@imelgrat
imelgrat / .htaccess
Last active August 23, 2017 19:42
Disable access to all file types except the following (to be placed inside a Wordpress wp-content directory). Full article at: http://imelgrat.me/security/wordpress-htaccess-file-protect/
# Disable access to all file types except the following
Order deny,allow
Deny from all
<Files ~ ".(xml|css|js|jpe?g|png|gif|pdf|docx|rtf|odf|zip|rar)$">
Allow from all
</Files>
@imelgrat
imelgrat / .htaccess
Last active August 23, 2017 19:42
Deny all access to Wordpress' wp-includes directory using .htaccess. Full article at: http://imelgrat.me/security/wordpress-htaccess-file-protect/
# Block wp-includes folder and files
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>
@imelgrat
imelgrat / .htaccess
Last active August 23, 2017 19:31
Deny access to WordPress wp-config.php file using .htaccess. Full article at: http://imelgrat.me/security/wordpress-htaccess-file-protect/
# Deny access to wp-config.php file
<files wp-config.php>
order allow,deny
deny from all
</files>
@imelgrat
imelgrat / Disable PUT and DELETE Apache requests and disable Server signature display
Last active September 27, 2015 13:39
Disable PUT and DELETE Apache requests and disable Server signature display
Disable PUT and DELETE Apache requests and disable Server signature display
@imelgrat
imelgrat / "Rotate-on-Hover" 3D Gallery using CSS3 transforms.markdown
Created September 27, 2015 13:38
"Rotate-on-Hover" 3D Gallery using CSS3 transforms