Allow your web site for specific IP addresses using .htaccess

Hello All,
Here is small note, how to allow specific IP addresses to be accessed to your website by using .htaccess,
you may need it while maintenance website.
By assuming your hoster allows using .htaccess
all of you need it is create file named .htaccess
copy paste the code bellow (note some servers want the file be utf-8 encoded otherwise you will get 500 error)
replacing to your actual IPs.


        RewriteEngine on
	RewriteCond %{REMOTE_HOST} !^192\.168\.  #any ip from 192.168.0.0 to 192.168.255.255
	RewriteCond %{REMOTE_HOST} !^192\.190\.1\.86 #just some IP that will be allowed too
	RewriteCond %{REQUEST_URI} /.*$ 
	RewriteCond %{REQUEST_URI} !/maintenance\.html$ #users that aren't allowed will see this page
	RewriteCond %{REQUEST_URI} !(css|png|jpg)$ # if maintenance.html consists images, you have to allow them either.
	RewriteRule .* maintenance.html [R=301,L]


Also you can block users by IP, by changing a little the rules above.

Backup your Mysql databases installed on windows with a batch file and task scheduler

If you have mysql running on windows platform for example for development/testing purposes, you are probably encountered the backing up issue
here are small bat file that can help you.

First of all you will need 7-zip for archiving SQL dumps, you can download it and use for free, from here

Then

( More... )

30+ PHP Best Practices for Beginners – Basix

1. Befriend the PHP Manual
If you're new to PHP, then it's time to get acquainted with the awesomeness that is the PHP manual. The PHP manual is incredibly thorough and has truly helpful comments following each article. Before asking questions or trying to figure out an issue on your own, save some time and just head straight to the manual. Odds are the answer to your question is already nestled in a helpful article at the PHP.net site. Read more..