|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/klengineers/klwebsite-controller/config/ |
Upload File : |
<?php
session_start();
error_reporting(E_ERROR);
$isSite = true;
$thisFile = str_replace('\\', '/', __FILE__);
$docRoot = $_SERVER['DOCUMENT_ROOT'];
$webRoot = str_replace(array($docRoot, 'config/config.php'), '', $thisFile);
$srvRoot = str_replace('config/config.php', '', $thisFile);
//echo $thisFile;
define('WEB_ROOT', $webRoot);
define('SRV_ROOT', $srvRoot);
$db="kallen-lemelson";
$hostaddress="localhost";
$username="root";
$password="";
define("db",$db);
define("host",$hostaddress);
define("username",$username);
define("password",$password);
$conn = @mysql_connect($hostaddress, $username, $password) or die("(".mysql_errno().") Error:".mysql_error());
@mysql_select_db($db) or die("(".mysql_errno().") Error:".mysql_error());
// ------function to open the database ---------------
function open_db($db,$hostaddress,$username,$password) {
$conn = mysql_connect($hostaddress,$username,$password);
if ($conn)
{
if (!mysql_select_db($db,$conn)){
$status = mysql_error();
$status = "Error No: ".mysql_errno()." Error: ".mysql_error();
}
else{
$status = 0;
}
return $conn;
}
else
{
$status = "Error No: ".mysql_errno()." Error: ".mysql_error();
}
}
// ------function to close the database ---------------
function close_db($conn) {
if ( mysql_close($conn) ) {
$status = 1;
} else {
$status = 0;
}
return($status);
}
?>