„threadr/profile/index.php“ ändern

master
Jakob 2020-03-08 16:27:02 +01:00
parent 65ac991632
commit 5023fa34fd
1 changed files with 12 additions and 4 deletions

View File

@ -6,10 +6,18 @@ session_start();
%REQUIRE_LOGIN% %REQUIRE_LOGIN%
$pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!'); $pdo = new PDO('mysql:host=localhost;dbname=web', 'webstuff', 'Schei// auf Pa$$w0rter!');
$statement = $pdo->prepare('SELECT name FROM users WHERE id = :user_id;'); // to be replaced with optional user name off the user data table $error = false;
$result = $statement->execute(array('user_id' => $_SESSION['user_id'])); $error_message = "";
$dbentry = $statement->fetch(); if (!$error) {
$username = $dbentry['name']; $statement = $pdo->prepare("SELECT name FROM users WHERE id=:uid"); // to be replaced with optional user name off the user data table
$statement->execute(array("uid"=>$_SESSION[user_id]));
$dbentry = $statement->fetch();
$username = $dbentry[name];
}
if (!$result) {
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
}
$navbar = "profile"; $navbar = "profile";
?> ?>