-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.php
36 lines (28 loc) · 924 Bytes
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
date_default_timezone_set("Asia/Kuala_Lumpur");
$host = 'localhost';
$user = 'root';
$pass = '';
$dbname = 'wordpressdb';
//$con = mysqli_connect($host,$user,$pass,$dbname);
$dbcon = new mysqli($host,$user,$pass,$dbname);
// Check connection
if ($dbcon->connect_errno)
{
echo "Failed to connect to MySQL: " . $dbcon->connect_error;
} else {
//echo "DB connected";
}
/** Do not delete this script **/
// Allow CORS
if (isset($_SERVER['HTTP_ORIGIN'])) {
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
//header("Content-Type: application/json");
}
// Access-Control headers are received during OPTIONS requests
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
header("Access-Control-Allow-Headers: *");
}
?>