Added hidden credentials
diff --git a/ajax/getusers.php b/ajax/getusers.php
index 4973cf7..2f36f84 100644
--- a/ajax/getusers.php
+++ b/ajax/getusers.php
@@ -1,9 +1,10 @@
<option>Selecciona usuari...</option>
<?php
+ require '../credentials.php';
require '../php/utils.php';
-
$users = get_users(0);
+
foreach ($users as $user) {
$nopassword = $user->md5password == "" ? "nopassword" : "";
echo "<option class='".$nopassword."' value='".$user->id."'>".$user->nomcomplet."</option>\n";
diff --git a/ajax/userinfo.php b/ajax/userinfo.php
index 6a36742..b75a3ff 100644
--- a/ajax/userinfo.php
+++ b/ajax/userinfo.php
@@ -1,4 +1,5 @@
<?php
+ require '../credentials.php';
require '../php/utils.php';
$user = get_users($_POST['id']);
diff --git a/main.php b/main.php
index 4f1ed3f..1726e0d 100644
--- a/main.php
+++ b/main.php
@@ -19,6 +19,7 @@
<script src="./js/animations.js"></script>
<?php
+ require './credentials.php';
require './php/utils.php';
$user = get_users($_COOKIE['user']);
$victim = get_users($user->quimata);
diff --git a/php/change_password.php b/php/change_password.php
index ce157f7..82ffcde 100644
--- a/php/change_password.php
+++ b/php/change_password.php
@@ -1,4 +1,5 @@
<?php
+ require '../credentials.php';
require 'utils.php';
// Check if confirmation is the same
diff --git a/php/login.php b/php/login.php
index 3ebd0c5..4219e2c 100644
--- a/php/login.php
+++ b/php/login.php
@@ -1,4 +1,5 @@
<?php
+ require '../credentials.php';
require 'utils.php';
// Set the 'user' POST and COOKIE variable
diff --git a/php/request.php b/php/request.php
index aca3540..58201ae 100644
--- a/php/request.php
+++ b/php/request.php
@@ -1,4 +1,5 @@
<?php
+ require '../credentials.php';
require 'utils.php';
// Do the query
diff --git a/php/utils.php b/php/utils.php
index 084c41c..ae0cb5b 100644
--- a/php/utils.php
+++ b/php/utils.php
@@ -13,14 +13,9 @@
}
function query($query) {
- // Define MySQL login variables
- $servername = "localhost"; // "andreuhuguet78654.ipagemysql.com";
- $username = "root"; // "andreu";
- $password = ""; // "1234";
- $dbname = "pastanaga"; // "fme_2019";
-
// Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
+ $credentials = new Credentials();
+ $conn = new mysqli($credentials->servername, $credentials->username, $credentials->password, $credentials->dbname);
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
$conn->set_charset("utf8");