Users now have their own profile pages

This commit is contained in:
pikami
2016-06-20 15:13:59 +00:00
parent 8690bd730c
commit 713198629c
5 changed files with 105 additions and 21 deletions

View File

@@ -3,31 +3,41 @@
<head>
<title>Palm-Paste Index</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.dynatable.js"></script>
<link href="css/jquery.dynatable.css" rel="stylesheet">
<?php
echo '<meta name="viewport" content="width=device-width, initial-scale=1">';
$dir = "";
if (isset($_GET["user"]))$dir="../";
<link href="css/chosen.css" rel="stylesheet">
<script src="js/chosen.jquery.js" type="text/javascript"></script>
<script src="js/chosen.proto.js" type="text/javascript"></script>
echo '<link rel="stylesheet" href="'.$dir.'css/bootstrap.min.css">';
echo '<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>';
<script>$(document).ready(function(){
echo '<script src="'.$dir.'js/bootstrap.min.js"></script>';
echo '<script type="text/javascript" src="'.$dir.'js/jquery.dynatable.js"></script>';
echo '<link href="'.$dir.'css/jquery.dynatable.css" rel="stylesheet">';
echo '<link href="'.$dir.'css/chosen.css" rel="stylesheet">';
echo '<script src="'.$dir.'js/chosen.jquery.js" type="text/javascript"></script>';
echo '<script src="'.$dir.'js/chosen.proto.js" type="text/javascript"></script>';
echo "<script>$(document).ready(function(){
$('#tablepastes').dynatable();
$(".chosen-select").chosen();
});</script>
$('.chosen-select').chosen();
});</script>";
<!-- Highlight scripts -->
<?php include_once "includes/highlight.php"; ?>
//<!-- Highlight scripts -->
include_once "includes/highlight.php";
?>
</head>
<body>
<!-- NavBar -->
<nav class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.php">Palm-Paste</a>
<?php
$dir = "";
if (isset($_GET["user"]))$dir="../";
echo '<a class="navbar-brand" href="'.$dir.'index.php">Palm-Paste</a>';
?>
</div>
<ul class="nav navbar-nav">
<li class="active"><a href="index.php">Home</a></li>
@@ -36,12 +46,14 @@
</ul>
<ul class="nav navbar-nav navbar-right">
<?php
include_once "includes/user.php";
include_once "includes/user.php";
$dir = "";
if (isset($_GET["user"]))$dir="../";
$userID = -1;
if(isset($_COOKIE["pp_sid"]) && isset($_COOKIE["pp_skey"]))
$userID = GetUsersIDBySession($_COOKIE["pp_sid"],$_COOKIE["pp_skey"]);
if($userID == -1){
echo "<li><a href=\"signup\"><span class=\"glyphicon glyphicon-user\"></span> Sign Up</a></li>";
echo "<li><a href=\"".$dir."signup\"><span class=\"glyphicon glyphicon-user\"></span> Sign Up</a></li>";
echo "<li><a data-toggle=\"modal\" data-target=\"#LoginPopup\" href=\"#\"><span class=\"glyphicon glyphicon-log-in\"></span> Login</a></li>";
} else {
$user = GetUserByID($userID);
@@ -49,8 +61,8 @@
<li class="dropdown">
<a class="dropdown-toggle glyphicon glyphicon-user" data-toggle="dropdown" href="#"> '.htmlspecialchars($user[1], ENT_QUOTES, 'UTF-8').'<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="mypastes">My pastes</a></li>
<li><a href="logout">Logout</a></li>
<li><a href="'.$dir.'mypastes">My pastes</a></li>
<li><a href="'.$dir.'logout">Logout</a></li>
</ul>
</li>
';
@@ -70,7 +82,9 @@
</div>
<div class="modal-body">
<!-- Login form -->
<form role="form" method="POST" action="login">
<?php
echo'<form role="form" method="POST" action="'.$dir.'login">';
?>
<div class="form-group">
<label for="user">Username:</label>
<input type="user" class="form-control" id="user" name="user">
@@ -112,6 +126,8 @@ if (isset($_GET["page"])){
$uid = $_GET["page"];
include_once "ViewPaste.php";
}
} else if (isset($_GET["user"])){
include_once "UserPage.php";
} else {
include_once "NewPaste.php";
}