-
Notifications
You must be signed in to change notification settings - Fork 0
/
_LayoutDatabase.php
31 lines (31 loc) · 1.09 KB
/
_LayoutDatabase.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
<?php
header('Content-Type:text/html; charset=UTF-8');
ini_set('mssql.charset', 'utf8_general_ci');
/* initialize variables */
$ErrorMsg = "";
$InfoMsg = "";
$searchphrase = "";
/* read php configuration file */
include "config.php";
/* define urls for link creation */
$thisurl = (isset($_SERVER['HTTPS']) ? "https" : "http")."://$_SERVER[HTTP_HOST]$_SERVER[PHP_SELF]";
$thisurlfull = (isset($_SERVER['HTTPS']) ? "https" : "http")."://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
/* connect to database */
//$DBserver = "MEDDATASERVER\SQLEXPRESS"; //serverName\instanceName
$connectionInfo = array( "Database"=>$DBname );
$conn = sqlsrv_connect( $DBserver, $connectionInfo); //Connect using Windows Authentication.
if( $conn === false ) //Check if connection was successful
{
$ErrorMsg = $ErrorMsg."Unable to connect.<br/>";
die( print_r( sqlsrv_errors(), true));
}else{
$InfoMsg = $InfoMsg."Connection successful.<br/>";
}
/* read info and error message from url */
if (isset($_GET['msg'])){
$InfoMsg = $InfoMsg.$_GET['msg'];
}
if (isset($_GET['err'])){
$ErrorMsg = $ErrorMsg.$_GET['err'];
}
?>