Read database connection from config file

This commit is contained in:
root
2019-02-27 17:39:20 +01:00
parent 1e0cec945c
commit 2040b7be39
5 changed files with 31 additions and 14 deletions

View File

@@ -3,12 +3,11 @@ ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL & ~E_NOTICE );
// start session
$cfg = include('accred_config.php');
if (session_status() == PHP_SESSION_NONE) {
session_start();
$userid = $_SESSION['uid'];
}
// If we are logged-in, redirect to the list page.
if($userid) {
header("location: accred_list");
@@ -58,13 +57,20 @@ function onSignIn(googleUser) {
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
console.log('Token: ' + id_token);
console.log("Preparing to call tokensignin");
var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://ml.caribana.ch/accred/tokensignin');
xhr.open('POST', 'https://accred.caribana-festival.ch/tokensignin');
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onload = function() {
console.log('Signed in as: ' + xhr.responseText);
self.location = 'accred_list';
};
xhr.onerror = function() {
console.log("ERROR");
alert("Error");
};
console.log(xhr);
xhr.send('idtoken=' + id_token);
}
</script>