commented profile.php
This commit is contained in:
parent
05b9ad12fa
commit
998f4331ae
21
profile.php
21
profile.php
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start(); //start a session
|
||||||
if(!isset($_SESSION['userid'])) {
|
if(!isset($_SESSION['userid'])) { //if there isnt a session print a please login page and go to login page
|
||||||
die('<div class="alert alert-primary" role="alert">Please <a href="login.php">login</a></div><meta http-equiv="refresh" content="2; URL=login.php">');
|
die('<div class="alert alert-primary" role="alert">Please <a href="login.php">login</a></div><meta http-equiv="refresh" content="2; URL=login.php">');
|
||||||
}
|
}
|
||||||
|
//for easier use we shove some of the session array into variables.
|
||||||
$userid = $_SESSION['userid'];
|
$userid = $_SESSION['userid'];
|
||||||
$username = $_SESSION['username'];
|
$username = $_SESSION['username'];
|
||||||
$useremail = $_SESSION['email'];
|
$useremail = $_SESSION['email'];
|
||||||
@ -13,6 +13,8 @@ $userln = $_SESSION['lastName'];
|
|||||||
$activated = $_SESSION['activated'];
|
$activated = $_SESSION['activated'];
|
||||||
$isadmin = $_SESSION['isadmin'];
|
$isadmin = $_SESSION['isadmin'];
|
||||||
$profilepicture = $_SESSION['profilepicture'];
|
$profilepicture = $_SESSION['profilepicture'];
|
||||||
|
|
||||||
|
//lets build a page:
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@ -33,9 +35,10 @@ $profilepicture = $_SESSION['profilepicture'];
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
//print a info bar with the username
|
||||||
echo '<div class="alert alert-info" role="alert">Profile of '.$username.'</div>';
|
echo '<div class="alert alert-info" role="alert">Profile of '.$username.'</div>';
|
||||||
echo "<br/>";
|
echo "<br/>";
|
||||||
|
//lets build a table with infos:
|
||||||
echo '<table class="table table-dark table-striped" style="width:30%">';
|
echo '<table class="table table-dark table-striped" style="width:30%">';
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo "<td>";
|
echo "<td>";
|
||||||
@ -82,16 +85,17 @@ echo "</tr>";
|
|||||||
<br /> <br /><br />
|
<br /> <br /><br />
|
||||||
<table class="table table-dark table-striped" style="width:30%">
|
<table class="table table-dark table-striped" style="width:30%">
|
||||||
<?php
|
<?php
|
||||||
|
//another table just for "activated" & "isadmin"
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo "<td>";
|
echo "<td>";
|
||||||
echo "User Status:";
|
echo "User Status:";
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
echo "<td>";
|
echo "<td>";
|
||||||
if ($activated == 0) {
|
if ($activated == 0) { //if not activated print it in red and render a activation link
|
||||||
echo '<p class="text-danger">Not Activated!</p><br>';
|
echo '<p class="text-danger">Not Activated!</p><br>';
|
||||||
echo 'Click <a href="activation.php">here</a> to activate';
|
echo 'Click <a href="activation.php">here</a> to activate';
|
||||||
}
|
}
|
||||||
if ($activated == 1) {
|
if ($activated == 1) { //if activated print so, but in green
|
||||||
echo '<p class="text-success">Activated!</p>';
|
echo '<p class="text-success">Activated!</p>';
|
||||||
}
|
}
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
@ -101,14 +105,15 @@ echo "<td>";
|
|||||||
echo "User Level:";
|
echo "User Level:";
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
echo "<td>";
|
echo "<td>";
|
||||||
if ($isadmin == 0) {
|
if ($isadmin == 0) { //if not admin, print "User" in green
|
||||||
echo '<p class="text-success">User</p><br>';
|
echo '<p class="text-success">User</p><br>';
|
||||||
}
|
}
|
||||||
if ($isadmin == 1) {
|
if ($isadmin == 1) { //if admin, print so but in red
|
||||||
echo '<p class="text-danger">Admin</p>';
|
echo '<p class="text-danger">Admin</p>';
|
||||||
}
|
}
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
|
//some html:
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user