summaryrefslogtreecommitdiff
path: root/user.php
diff options
context:
space:
mode:
Diffstat (limited to 'user.php')
-rw-r--r--user.php28
1 files changed, 7 insertions, 21 deletions
diff --git a/user.php b/user.php
index a5e1d16..8685fcf 100644
--- a/user.php
+++ b/user.php
@@ -1,38 +1,24 @@
<?php
include_once 'includes/db_inc.php';
+include_once 'model/User.php';
session_start();
-$user_name = "Unknown";
-$user_date = 0;
+$current = new User();
if (!isset($_GET['name'])) {
} else {
- $sql = "SELECT user_date FROM users WHERE user_name = '" . $_GET['name'] . "'";
- $result = mysqli_query($dbc, $sql);
-
- if (!$result) {
- die('Error trying to display user page: ' . mysqli_error($dbc));
- }
-
- if (mysqli_num_rows($result) == 0) {
- $user_name = "Unknown";
- } else {
- while ($row = mysqli_fetch_assoc($result)) {
- $user_name = $_GET['name'];
- $user_date = $row['user_date'];
- }
- }
+ $current->get_by_name($_GET['name'], $dbc);
}
?>
<!DOCTYPE html>
<html>
<head>
- <title><?php echo $user_name; ?>'s Profile - cflip.net forum</title>
+ <title><?php echo $current->name; ?>'s Profile - cflip.net forum</title>
</head>
-<body style="width: 720px;margin: auto;">
+<body>
<?php include_once "templates/header.php" ?>
- <h1><?php echo $user_name; ?></h1>
- member since <?php echo $user_date; ?>
+ <h1><?php echo $current->name; ?></h1>
+ member since <?php echo date('M d, Y', strtotime($current->date)); ?>
</body>
</html> \ No newline at end of file