Hide DB from Mysql PHPmyadmin

To hide the database from the phpmyadmin follow the below steps,

  1. Go to xampp folder  , open phpmyadmin folder
  2. open the file named “config.inc.php”
  3. paste the below code  ”   $cfg[‘Servers’][$i][‘hide_db’] = ‘^DatabaseName$’; “
  4. Specify the database name which you want to hide after ^ symbol
  5. That’s it.

 

Advertisements

Encrypt password on client side and Decrypt on server side using jquery and php

jQuery:
https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js
http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/md5.js

function encrypt()
{
var key = CryptoJS.enc.Hex.parse(“0123456789abcdef0123456789abcdef”);
var iv = CryptoJS.enc.Hex.parse(“abcdef9876543210abcdef9876543210″);

var pass=document.getElementById(‘new_pwd’).value;
var hide=document.getElementById(‘hide’).value;
if(pass==””)
{
document.getElementById(‘err’).innerHTML=’Error:Password is missing’;
return false;
}
else
{
document.getElementById(“hide”).value = document.getElementById(“new_pwd”).value;
//var hash = CryptoJS.MD5(pass);

var hash = CryptoJS.AES.encrypt(pass, key, {iv:iv});

document.getElementById(‘new_pwd’).value=hash;
return true;
}
}

PHP:


$key = pack(“H*”, “0123456789abcdef0123456789abcdef”);
$iv = pack(“H*”, “abcdef9876543210abcdef9876543210”);
$encrypted = base64_decode($this->input->post(‘new_pwd’));
$shown = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encrypted, MCRYPT_MODE_CBC, $iv);
echo $shown;

Virtualhost in Xampp localhost windows machine

Steps to follow

  1. Open c:\Windows\System32\drivers\etc\hosts file
  2. Uncomment the 127.0.01  localhost and add new domain names which you would like to add example ( 127.0.0.1  domain1 , 127.0.0.1 site2 )
  3.  Now open c:\xampp\apache\conf\extra\httpd-vhosts.conf file
  4.  Add the below code in the httpd-vhosts.conf file
  1. <VirtualHost *:80>
  2. DocumentRoot “C:/xampp/htdocs/site1”
  3. ServerName site1
  4. </VirtualHost>

5. Now open c:\xampp\apache\conf\httpd.conf file

  6. Remove # comment this line “Include conf/extra/httpd-vhosts.conf”
  7.  Restart Apache server
  8. Create folder name site1 or any domain which you created in the host file and test it using any sample code by running the url using your domain name “http://site1 or http://domain etc”