2016-06-08 22:15:30 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<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>
|
2016-06-12 18:19:52 +01:00
|
|
|
<script type="text/javascript" src="js/jquery.dynatable.js"></script>
|
|
|
|
<link href="css/jquery.dynatable.css" rel="stylesheet">
|
2016-06-13 16:50:59 +01:00
|
|
|
|
|
|
|
<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>
|
|
|
|
|
|
|
|
<script>$(document).ready(function(){
|
|
|
|
$('#tablepastes').dynatable();
|
|
|
|
$(".chosen-select").chosen();
|
|
|
|
});</script>
|
2016-06-13 16:17:14 +01:00
|
|
|
|
|
|
|
<!-- Highlight scripts -->
|
|
|
|
<?php include "includes/highlight.php"; ?>
|
2016-06-08 22:15:30 +01:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!-- NavBar -->
|
|
|
|
<nav class="navbar navbar-inverse">
|
2016-06-12 16:32:25 +01:00
|
|
|
<div class="container">
|
2016-06-08 22:15:30 +01:00
|
|
|
<div class="navbar-header">
|
|
|
|
<a class="navbar-brand" href="index.php">Palm-Paste</a>
|
|
|
|
</div>
|
|
|
|
<ul class="nav navbar-nav">
|
|
|
|
<li class="active"><a href="index.php">Home</a></li>
|
|
|
|
<li><a href="#">Page 1</a></li>
|
|
|
|
<li><a href="#">Page 2</a></li>
|
|
|
|
</ul>
|
|
|
|
<ul class="nav navbar-nav navbar-right">
|
2016-06-12 10:57:55 +01:00
|
|
|
<?php
|
|
|
|
include "includes/user.php";
|
|
|
|
$userID = -1;
|
|
|
|
if(isset($_COOKIE["pp_sid"]) && isset($_COOKIE["pp_skey"]))
|
|
|
|
$userID = GetUsersIDBySession($_COOKIE["pp_sid"],$_COOKIE["pp_skey"]);
|
|
|
|
if($userID == -1){
|
2016-06-12 16:32:25 +01:00
|
|
|
echo "<li><a href=\"signup\"><span class=\"glyphicon glyphicon-user\"></span> Sign Up</a></li>";
|
2016-06-12 10:57:55 +01:00
|
|
|
echo "<li><a data-toggle=\"modal\" data-target=\"#LoginPopup\" href=\"#\"><span class=\"glyphicon glyphicon-log-in\"></span> Login</a></li>";
|
|
|
|
} else {
|
2016-06-12 16:32:25 +01:00
|
|
|
$user = GetUserByID($userID);
|
|
|
|
echo '
|
|
|
|
<li class="dropdown">
|
2016-06-13 13:49:13 +01:00
|
|
|
<a class="dropdown-toggle glyphicon glyphicon-user" data-toggle="dropdown" href="#"> '.htmlspecialchars($user[1], ENT_QUOTES, 'UTF-8').'<span class="caret"></span></a>
|
2016-06-12 16:32:25 +01:00
|
|
|
<ul class="dropdown-menu">
|
2016-06-12 18:19:52 +01:00
|
|
|
<li><a href="mypastes">My pastes</a></li>
|
2016-06-12 16:32:25 +01:00
|
|
|
<li><a href="logout">Logout</a></li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
';
|
2016-06-12 10:57:55 +01:00
|
|
|
}
|
|
|
|
?>
|
2016-06-08 22:15:30 +01:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</nav>
|
2016-06-12 10:57:55 +01:00
|
|
|
<!-- LoginPopup -->
|
|
|
|
<div id="LoginPopup" class="modal fade" role="dialog">
|
|
|
|
<div class="modal-dialog">
|
|
|
|
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
|
|
<h4 class="modal-title">Login</h4>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<!-- Login form -->
|
|
|
|
<form role="form" method="POST" action="login">
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="user">Username:</label>
|
|
|
|
<input type="user" class="form-control" id="user" name="user">
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="pwd">Password:</label>
|
|
|
|
<input type="password" class="form-control" id="pwd" name="pwd">
|
|
|
|
</div>
|
|
|
|
<div class="checkbox">
|
|
|
|
<label><input type="checkbox" name="remember"> Remember me</label>
|
|
|
|
</div>
|
|
|
|
<input type='hidden' name='type' value='login'></input>
|
|
|
|
<button type="submit" class="btn btn-default">Submit</button>
|
|
|
|
</form>
|
|
|
|
<!-- END Login form -->
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-06-08 22:15:30 +01:00
|
|
|
<!-- Content -->
|
|
|
|
<?php
|
|
|
|
if (isset($_GET["page"])){
|
|
|
|
if($_GET["page"] == "create"){
|
|
|
|
include "NewPaste.php";
|
2016-06-12 18:19:52 +01:00
|
|
|
} else if($_GET["page"] == "mypastes"){
|
|
|
|
include "MyPastes.php";
|
2016-06-12 10:57:55 +01:00
|
|
|
} else if($_GET["page"] == "login"){
|
|
|
|
include "login.php";
|
2016-06-12 16:32:25 +01:00
|
|
|
} else if($_GET["page"] == "logout"){
|
|
|
|
header("Location: login.php?logout=1");
|
|
|
|
die();
|
|
|
|
} else if($_GET["page"] == "signup"){
|
|
|
|
include "signup.php";
|
2016-06-08 22:15:30 +01:00
|
|
|
} else {
|
2016-06-11 17:32:49 +01:00
|
|
|
$uid = $_GET["page"];
|
|
|
|
include "ViewPaste.php";
|
2016-06-08 22:15:30 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
include "NewPaste.php";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</body>
|
|
|
|
</html>
|