Read database connection from config file
This commit is contained in:
12
index.php
12
index.php
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user