The bellow PHP script allows you to grab email addresses of a web page.
An important feature of the script is that it can run very well on a local server as EasyPHP or XAMPP. It doesn’t have to run on a hosting server which might has restricted the use of PHP function file_get_contents(). For our records, this resctriction is done editing the php.ini file of the Apache server. More exactly, the following line: allow_url_fopen = Off.
The below PHP script allows you to connect securely to a MySQL database.
<?php
define('SQL_HOST', 'localhost');
define('SQL_USER', 'username');
define('SQL_PASS', 'password');
define('SQL_DB', 'database name');
@mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die('I can`t connect to MySQL server!');
@mysql_select_db(SQL_DB) or die('I can`t connect to database!');
?>
Usually, this script is an include file which is called, mostly above DOCTYPE, whenever a page needs a connection to database.
<?php include("includes/connect_to_db.inc.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">