<?php
/*
Name: dbcon.php
Description: database addon for pets ( php easy ticket system )
Purpose: to connect and disconnect the sql db
Maker: lee johnstone
Site: www.freakcms.com
Support: http://freakcms.com/contact.php
--------------------------------------------------------------------------------------------------------------------------
YOU MAY NOT
1. Use this for commercial usage
2. Claim the code as your own
3. Remove any copyrights from its original authors
YOU MAY
1. Upgrade, Update, Adjust, Modify this script, providing you keep all original comments.
2. Redistribute this code under the same license and none other.
3. Modify and use this script on your own site as you wish, providing you keep the copyright markings from original authors.
More information here.
http://www.freakcms.com
--------------------------------------------------------------------------------------------------------------------------
*/
function checkdb(){
if(!isset($g_link)){
$g_link = false;
}
}
function OpenDb(){
if($g_link)
return $g_link;
$db_host = "YOURHOST"; //MySQL hostname (default is localhost)
$db_user = "YOUR_USER_NAME"; // MySQL Data Base user name (default is root)
$db_password = "YOUR_PASSWORD";// MySQL Data Base Password
$db_name = "phpticket"; // MySQL Data Base Name (default is phpticket)
$g_link = mysql_connect($db_host, $db_user, $db_password) or die('Could not connect to mysql server.' );
mysql_select_db($db_name) or die('Could not select database.');
return $g_link;
}
function CloseDb(){
if($g_link!=false)
mysql_close($g_link);
$g_link = false;
}
?> |