forked from root/threadr.lostcave.ddnss.de
msql code looked weird
parent
3b257dd416
commit
a75fc950a5
|
@ -1,15 +1,22 @@
|
|||
<?php
|
||||
%PLEAZE_NO_CACHE%
|
||||
session_start();
|
||||
session_start();
|
||||
%SET_LOGIN_VARIABLE%
|
||||
//Todo: make this a setting for users that use VPNs/Proxies and seem to jump around the world rather quickly...
|
||||
%NO_CHEAP_SESSION_STEALING%
|
||||
//Todo: make this a setting for users that use VPNs/Proxies and seem to jump around the world rather quickly...
|
||||
%NO_CHEAP_SESSION_STEALING%
|
||||
|
||||
$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']));
|
||||
$dbentry = $statement->fetch();
|
||||
$username = $dbentry['name'];
|
||||
$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];
|
||||
}
|
||||
if (!$result) {
|
||||
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
|
||||
}
|
||||
|
||||
$navbar = "home";
|
||||
//ToDo: differentiate between home and userhome (or auto-redirect)
|
||||
|
@ -32,4 +39,4 @@ $navbar = "home";
|
|||
<center><h3><?php echo "Welcome back, $username !";?> </h3></center>
|
||||
</div>
|
||||
</div>
|
||||
</html>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue