Server : Apache System : Linux profile 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64 User : apache ( 48) PHP Version : 8.0.28 Disable Function : NONE Directory : /var/www/html/venkat/aviral/aviral/ |
<?php
// Please place this file in the php root's outer directory and change permission to 751 to
// disallow others to read credentials in this file.
include('check_auth_ldap.php');
function connectdb(){
check_auth_ldap();
$host = "host = 127.0.0.1";
$port = "port = 5432";
$dbname = "dbname = db1";
$credentials = "user = postgres password= ";
// echo 'Trying to connect to postgres...';
$db = pg_connect( "$host $port $dbname $credentials");
if(!$db) {
// echo "Error : Unable to open database\n";
return false;
} else {
// echo "Opened database successfully\n";
return $db;
}
}
?>