Skip to content

Instantly share code, notes, and snippets.

@trq
Created March 27, 2014 23:40
Show Gist options
  • Save trq/9821666 to your computer and use it in GitHub Desktop.
Save trq/9821666 to your computer and use it in GitHub Desktop.
<?php include 'login-register-header.php'; ?>
<h2>Your Profile</h2>
<p>Have your say, choose your avatar and more.</p>
<h3>Your Avatar</h3>
<?php
require 'connect.php';
var_dump($_SESSION['user']);
// Outputs the avatar based on the SQL entry
if(!empty($_SESSION['user'])){
$result = mysql_query("SELECT avatar FROM `users` WHERE `username` = '{$_SESSION['user']}'") or die(mysql_error());
if ($result && mysql_num_rows($query)){
$row = mysql_fetch_assoc($result);
echo $row['avatar'] . ".jpg";
}
} else {
echo "You are not logged in!";
}
?>
<?php include 'login-register-footer.php'; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment