Getting Permission error while Uninstalling Software from cPanel

  1. Go to command line and type
  • > regedit (Press Enter)
  • Pick required software
  • Delete values from REGISTRY EDITOR
  1. After completion uninstall software from cPanel

What is the Difference Between mysql and mysqli?

“mysqli” extension is an improvement over the old “mysql” extension. In fact, the “i” in mysqli stands for “improved”.

mysqli was developed to take advantage of the new features available in MySQL since version 4.1.3. Also, you can use it since PHP 5. So, if you code with PHP5 with a newer version of MySQL, it’s strongly recommended for you to use the extension “mysqli” over “mysql”.

Key benefits of mysqli over mysql extension

  • Object-oriented interface. You can still use the “old procedural” way of calling the mysql extension but the OO version groups the functions by their purpose.
  • Prepared Statements. Those are useful to prevent SQL injections and are executed faster.
  • Multiple Statements. With this “feature”, you can execute multiple SQL queries inside only one “mysqli” call. This reduces the round trips between the database server and the PHP server.
  • Support for Transactions. This is really useful to write robust applications. It gives you the ability to write a group of SQL statements that will either be executed or all rolled back (usually if there is an error somewhere in the process).
  • Enhanced debugging capabilities. As an example, you can use “mysqli_debug(…)” to save debugging information into a file.
  • Embedded server support. Since MySQL 4.0, there is a library available that can be used to run a complete MySQL server embedded inside a program, usually a desktop application.

sql injection

SQL injection is a code injection technique, used to attack data-driven applications, in which malicious SQL statements are inserted into an entry field for execution (e.g. to dump the database contents to the attacker).

More serious sql injection attacks

$name_evil = "'; DELETE FROM customers WHERE 1 or username = '"; 

// our MySQL query builder really should check for injection
$query_evil = "SELECT * FROM customers WHERE username = '$name_evil'";

// the new evil injection query would include a DELETE statement
echo "Injection: " . $query_evil;

injection prevention - mysql_real_escape_string()

//NOTE: you must be connected to the database to use this function!
// connect to MySQL

$name_bad = "' OR 1'"; 

$name_bad = mysql_real_escape_string($name_bad);

$query_bad = "SELECT * FROM customers WHERE username = '$name_bad'";
echo "Escaped Bad Injection: <br />" . $query_bad . "<br />";

$name_evil = "'; DELETE FROM customers WHERE 1 or username = '"; 

$name_evil = mysql_real_escape_string($name_evil);

$query_evil = "SELECT * FROM customers WHERE usernam


jQuery basic things

jQuery noConflict()

Many JavaScript libraries use $ as a function or variable name, just as jQuery does. In jQuery’s case, $ is just an alias for jQuery, so all functionality is available without using $.

Difference b/w document.ready() & window.load()

$(document).ready is jQuery event that is fired when DOM is loaded, so it’s fired when the document structure is ready.

$(window).load event is fired after whole content (including css, images etc..) is loaded.


The Document Object Model (DOM) is a programming API for HTML and XML documents. It defines the logical structure of documents and the way a document is accessed and manipulated. In the DOM specification, the term “document” is used in the broad sense – increasingly, XML is being used as a way of representing many different kinds of information that may be stored in diverse systems, and much of this would traditionally be seen as data rather than as documents.

How to Put Drupal 7 in Maintenance Mode

Here’s how to turn on Maintenance Mode in Drupal 7:

Step 1

  • Go to “Configuration” then “Maintenance mode”.

Step 2

  • Make sure the “Put site into maintenance mode” box is checked
  • Enter the message you want visitors to see during the interruption.
  • Click “Save configuration”.

Step 3

  • You’ll now see a message saying “The configuration options have been saved”.

Step 4

  • You will be able to browse around your site without problems but visitors who aren’t logged in will see the message above.
  • If you log yourself and can’t get back in, just add /?q=user after your site address and you’ll be back to the user login page.

Reset password in Drupal 6 & 7 from database

For drupal6

UPDATE users SET name='admin', pass=md5('drupal') WHERE uid = 1;

For drupal7
define(‘DRUPAL_ROOT’, getcwd());
require_once DRUPAL_ROOT . ‘/includes/’;
require_once ‘includes/’;
$pwd = user_hash_password(‘NewPassword‘);

UPDATE users SET name=’admin’, pass=’$pwd’ WHERE uid = 1;