2016-06-12 18:19:52 +01:00
|
|
|
<div class="container">
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-body">
|
|
|
|
<?php
|
2016-06-16 16:33:16 +01:00
|
|
|
include_once "config/config.php";
|
2016-06-12 18:19:52 +01:00
|
|
|
include_once "includes/user.php";
|
2016-06-16 16:33:16 +01:00
|
|
|
$conn = GetConnectionToDB();
|
2016-06-12 18:19:52 +01:00
|
|
|
if(GetUsersIDBySession($_COOKIE["pp_sid"],$_COOKIE["pp_skey"]) == -1){
|
|
|
|
printf('<h2>You must be loged in to see your pastes!</h2>');
|
|
|
|
$conn = null;
|
|
|
|
echo '</div></div></div>';
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
$stmt = $conn->prepare('SELECT * FROM pastes WHERE owner=:own');
|
|
|
|
$stmt->bindParam(':own', GetUsersIDBySession($_COOKIE["pp_sid"],$_COOKIE["pp_skey"]));
|
|
|
|
$stmt->execute();
|
|
|
|
if($stmt->rowCount()>0){
|
|
|
|
echo "<table id=\"tablepastes\" class=\"table table-striped\" style=\"width:100%\">";
|
|
|
|
printf('<thead><th data-dynatable-column="name" style="text-align: left;">Title</th>
|
|
|
|
<th style="text-align: left;">Added</th>
|
2016-06-16 15:34:00 +01:00
|
|
|
<th style="text-align: left;">Expires</th>
|
2017-03-12 14:51:40 +00:00
|
|
|
<th style="text-align: left;">ID</th>
|
|
|
|
<th style="text-align: left;">Actions</th></thead>');
|
2016-06-12 18:19:52 +01:00
|
|
|
printf('<tbody>');
|
|
|
|
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
|
|
|
$title = $row['title'];
|
2017-03-12 14:51:40 +00:00
|
|
|
//Paste title
|
2016-06-13 13:49:13 +01:00
|
|
|
printf('<tr><td style="text-align: left;">'.htmlspecialchars($row["title"], ENT_QUOTES, 'UTF-8').'</td>');
|
2017-03-12 14:51:40 +00:00
|
|
|
//Creation date
|
2016-06-12 18:19:52 +01:00
|
|
|
printf('<td style="text-align: left;">'.date('Y-m-d',$row["created"]).'</td>');
|
2017-03-12 14:51:40 +00:00
|
|
|
//Expire date
|
2016-06-16 15:34:00 +01:00
|
|
|
if($row["expire"]==0) printf('<td style="text-align: left;">Never</td>');
|
|
|
|
else{
|
|
|
|
$expire = ($row["expire"]-time())/3600;
|
|
|
|
if($expire>24){
|
|
|
|
printf('<td style="text-align: left;">'.round($expire/24).' days from now</td>');
|
|
|
|
} else if($expire>=1)
|
|
|
|
printf('<td style="text-align: left;">'.round($expire).' hours from now</td>');
|
|
|
|
else printf('<td style="text-align: left;">'.round($expire*60).' minutes from now</td>');
|
|
|
|
}
|
2017-03-12 14:51:40 +00:00
|
|
|
//Paste url
|
|
|
|
printf('<td style="text-align: right;"><a href="'.htmlspecialchars($row["uid"], ENT_QUOTES, 'UTF-8').'">'.htmlspecialchars($row["uid"], ENT_QUOTES, 'UTF-8').'</a></td>');
|
|
|
|
//Actions
|
2017-04-02 12:49:39 +01:00
|
|
|
printf('<td style="text-align: right;">');
|
|
|
|
//delete paste
|
|
|
|
printf('<a href="delete/'.htmlspecialchars($row["uid"], ENT_QUOTES, 'UTF-8').'"><span class="glyphicon glyphicon-trash" title="Delete paste" aria-hidden="true"></span>');
|
|
|
|
//edit paste
|
|
|
|
printf('<a href="edit/'.htmlspecialchars($row["uid"], ENT_QUOTES, 'UTF-8').'"><span class="glyphicon glyphicon-edit" title="Edit paste" aria-hidden="true"></span>');
|
|
|
|
printf('</td></tr>');
|
2016-06-12 18:19:52 +01:00
|
|
|
}
|
|
|
|
printf('</tbody></talbe>');
|
|
|
|
} else {
|
|
|
|
printf('<h2>You havent made any pastes yet!</h2>');
|
|
|
|
}
|
|
|
|
$conn = null;
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|