ohctech_p8/includes/config/config.php

158 lines
3.0 KiB
PHP
Raw Normal View History

2024-10-16 19:18:52 +05:30
<?php
include_once("includes/cached_functions.php");
$host_name = "localhost";
2024-11-28 10:29:22 +05:30
$database_name = "volvo_live";
2024-10-16 19:18:52 +05:30
$database_user = "root";
2024-11-28 10:29:22 +05:30
$database_password = "Dushant@2611";
2024-11-02 11:02:15 +05:30
$port="3306";
2024-10-16 19:18:52 +05:30
extract($_REQUEST);
extract($_GET);
extract($_POST);
// if(isset($_REQUEST)){
// error_log ( "Start Validating Request Attributes for special character check" );
// $requestStr="";
// foreach ( $_REQUEST as $key => $value ) {
// $requestStr.=$key . " : " . $value . "\n";
// error_log ( $key . " : " . $value . "<br />\r\n" );
// $white_list = str_split('0123456789
// abcdefghijklmnopqrstuvwxyz
// ABCDEFGHIJKLMNOPQRSTUVWXYZ.,?@_-$');
// foreach($_REQUEST as $key => &$val){
// $char_list = str_split($val);
// error_log("evaluating param ".$key." with value as ".$val." for whitelist");
// $val = trim($val);
// if($val==''){
// continue;
// }
// if(trim($val)!=''){
// foreach($char_list as $c){
// error_log("evaluating ".$c."character for whitelist");
// if(!in_array($c,$white_list)){
// error_log("Invalid Request.".$c." is an unsafe character");
// echo "<script>location.replace('index.php?msg=You are successfully logged out. Please login again')</script>";
2024-11-02 18:03:13 +05:30
// die("unsafe request");
2024-10-16 19:18:52 +05:30
// break;
// }
// }
// }
// }
// }
// error_log ( "End Validating Request Attributes" );
// }
2024-11-02 11:02:15 +05:30
try
{
$dbh = new PDO("mysql:host=".$host_name.";port=".$port.";dbname=".$database_name,$database_user,$database_password);
2024-10-16 19:18:52 +05:30
}
2024-11-02 11:02:15 +05:30
catch (PDOException $e)
{
2024-11-02 18:03:13 +05:30
die("Error: " . $e->getMessage());
2024-11-02 11:02:15 +05:30
}
$conn = mysqli_connect($host_name, $database_user, $database_password, $database_name,$port);
2024-10-16 19:18:52 +05:30
$GLOBALS['conn'] = $conn;
if (!$conn) {
error_log("Failed to connect to mysqli:" . mysqli_connect_errno());
}
@session_start();
if (!empty($_POST)) {
reset($_POST);
foreach ($_POST as $k => $v) {
${$k} = $v;
}
}
if (!empty($_GET)) {
reset($_GET);
foreach ($_GET as $k => $v) {
${$k} = $v;
}
}
if (!empty($_SERVER)) {
reset($_SERVER);
foreach ($_SERVER as $k => $v) {
${$k} = $v;
}
}
if (!empty($_COOKIE)) {
reset($_COOKIE);
foreach ($_COOKIE as $k => $v) {
${$k} = $v;
}
}
if (!empty($_SESSION)) {
reset($_SESSION);
foreach ($_SESSION as $k => $v) {
${$k} = $v;
}
}
// if (!empty($_FILES))
// {
// reset($_FILES);
// while (list($k,$v) = each($_FILES))
// {
// ${$k} = $v['tmp_name'];
// ${$k._name} = $v['name'];
// ${$k._type} = $v['type'];
// ${$k._size} = $v['size'];
// ${$k._error} = $v['error'];
// }
// }
2024-11-28 10:29:22 +05:30
//include_once('../../log_entry.php');
// Log all uncaught exceptions
set_exception_handler(function ($e) {
error_log("Uncaught Exception: " . $e->getMessage());
error_log("Stack Trace: " . $e->getTraceAsString());
});
// Log all PHP errors
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
$error = "Error [$errno]: $errstr in $errfile on line $errline";
error_log($error);
return true; // Prevent default error handler
});
?>