Page Refresh and Redirect Using HTML meta Tag

Document Refreshing:
You can specify a duration after which your web page will keep refreshing. If you want your
page keep refreshing after every 10 seconds then use the following
<meta http-equiv=”refresh” content=”10″ />
Page Redirection:
You can specify a page redirection using Meta Tag. Following is an example of redirecting
current page to another page. You can specify a duration after which page will b
e redirected.
<meta http-equiv=”refresh” content=”10; url=” />

MySQL database backup and restore using PHP

<!-- MySQL database backup and restore using PHP -->

<!DOCTYPE html>
if(isset($_POST['username']) && isset($_POST['password']) && isset($_POST['databasename'])) {
$username = trim($_POST['username']);
$password = trim($_POST['password']);
$databasename = trim($_POST['databasename']);
$backupRestore = $_POST['backupRestore'];

if ($backupRestore == 'backup'){
$data = $_POST['data'];
$now = str_replace(":", "", date("Y-m-d H:i:s"));
$outputfilename = $databasename . '-' . $now . '.db';
$outputfilename = str_replace(" ", "-", $outputfilename);

//Dump the MySQL database
if ($data == "wd"){
//With data
exec('mysqldump -u '. $username .' -p'. $password .' '. $databasename .' > '. $outputfilename);
//Without data
exec('mysqldump --no-data -u '. $username .' -p'. $password .' '. $databasename .' > '. $outputfilename);

//Download the database file
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($outputfilename));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($outputfilename));

//After download remove the file from server
exec('rm ' . $outputfilename);

else{//Restore the database

$target_path = getcwd();
$databasefilename = $_FILES["databasefile"]["name"];

//Upload the database file to current working directory
move_uploaded_file($_FILES["databasefile"]["tmp_name"], $target_path . '/' . $databasefilename);

//Restore the database
exec('mysql -u '. $username .' -p'. $password .' '. $databasename .' < '. $databasefilename);

//Remove the file from server
exec('rm ' . $databasefilename);
<title>MySQL database backup</title>

$(document).ready(function() {
function checkParameters(){
var username = $.trim($("#username").val());
var password = $.trim($("#password").val());
var databasename = $.trim($("#databasename").val());
if (username == ""){
alert("Plsease enter mysql username.");return false;
else if (password == ""){
alert("Plsease enter mysql password.");return false;
else if (databasename == ""){
alert("Plsease enter mysql database name.");return false;
else if($("#restore").is(':checked')){
var filename = $(".restoreFile").val();
if(filename == ""){
alert("Please choose a file.");return false;
var valid_extensions = /(\.db|\.sql)$/;
if (!valid_extensions.test(filename)){
alert('Invalid file format.');return false;
return true;
function showHide(id){
if (id == "backup"){

<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>" onsubmit="return checkParameters();" enctype="multipart/form-data">
<table border="0" bgcolor="#C0C0C0" align="center" width="40%">
<td colspan="3" align="center"><b>Please enter the following parameters</b></td>
<td>MySQL username*</td>
<td><input type="text" id="username" name="username" /></td>
<td>MySQL password*</td>
<td><input type="text" id="password" name="password" /></td>
<td>MySQL database name*</td>
<td><input type="text" id="databasename" name="databasename" /></td>
<td colspan="2">Backup <input type="radio" name="backupRestore" id="backup" value="backup" checked="true" onclick="showHide(;" /></td>

With data
With out data
<td>Restore <input type="radio" name="backupRestore" id="restore" value="restore" onclick="showHide(;" /></td>
<td><input class="restoreFile" type="file" name="databasefile" /></td>
<td colspan="3" align="center"><input type="submit" value="Submit"/></td>

Background for different browser

background: #f7f7f7; /* Old browsers */
background: -moz-linear-gradient(top,  #f7f7f7 0%, #eeeeee 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f7f7f7), color-stop(100%,#eeeeee)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  #f7f7f7 0%,#eeeeee 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  #f7f7f7 0%,#eeeeee 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  #f7f7f7 0%,#eeeeee 100%); /* IE10+ */
background: linear-gradient(top,  #f7f7f7 0%,#eeeeee 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7f7f7', endColorstr='#eeeeee',GradientType=0 ); /* IE6-9 */

How to use css image Sprites

CSS Sprites is a CSS technique to combine small images into one big image and then access them using the background-position property. It is used to save HTTP requests.

#container .background {
  background: url(/images/sprite-image.png) -xxpx -xxpx;
  width:  25px; /* width and height of the sprite image you want to display */
  height: 25px;
  position: absolute;
  top: 0;
  left: 0;