„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%
$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
$result = $statement->execute(array('user_id' => $_SESSION['user_id']));
$error = false;
$error_message = "";
if (!$error) {
$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'];
$username = $dbentry[name];
}
if (!$result) {
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
}
$navbar = "profile";
?>