tweetmonitor/admin/view-tweets.php
2016-02-09 14:23:43 +01:00

75 lines
2.5 KiB
PHP

<?php
include('../config/config.php');
include('html/html.inc.php');
include('includes/functions.php');
checkLoginAdmin();
if ( isset($_GET['event']) && !empty($_GET['event']) ){
mysql_query("DELETE FROM tweets WHERE tweet_id = '".clean(base64_decode($_GET['event']))."'");
$redirectUrl = 'view-tweets.php';
$_SESSION['succesMessage'] = 6;
header("Location: $redirectUrl");
exit;
}
startHtml($title = "View Deleted Tweets");
tophead($title);
leftNav();
?>
<?php
if ( isset($_SESSION['succesMessage']) ){
successMsg($_SESSION['succesMessage']);
unset($_SESSION['succesMessage']);
}
?>
<section id="main" class="column">
<article class="module width_full">
<header>
<h3 class="tabs_involved">Deleted Tweets Management</h3>
</header>
<table class="display data-table" id="myTable">
<thead>
<tr>
<th width="50">Rec.#</th>
<th width="100">User Name</th>
<th width="100">Profile Photo</th>
<th width="150">Tweet</th>
<th width="100">Created At</th>
<th width="100">Deleted At</th>
<th width="90">Action</th>
</tr>
</thead>
<tbody>
<?php
$getRes = mysql_query("SELECT t.tweet_id,t.tweet_text, u.screen_name, u.profile_image_url,t.created_at,t.deleted_at FROM tweets AS t LEFT JOIN users AS u ON u.user_id=t.user_id WHERE t.is_deleted='Y' ORDER BY t.tweet_id DESC");
$count = 1;
while( $row = mysql_fetch_array($getRes) )
{
?>
<tr>
<td align="center"><?php echo $count;?></td>
<td align="center"><?php echo "@".$row['screen_name'];?></td>
<td align="center"><img src="<?php echo $row['profile_image_url']?>"/></td>
<td align="center"><?php echo base64_decode($row['tweet_text']);?></td>
<td align="center"><?php echo date('d-m-y H:m:s',strtotime($row['created_at']))?></td>
<td align="center"><?php echo date('d-m-y H:m:s',strtotime($row['deleted_at']))?></td>
<td align="center">
<a href="<?php ADMIN_URL;?>view-tweets.php?event=<?php echo base64_encode($row['tweet_id']);?>"><img src="images/icn_trash.png" onclick="return confirm('Are you sure you want to delete the selected record?')" /></a>
</td>
</tr>
<?php
$count++;
}
?>
</tbody>
</table>
</article>
<div class="spacer"></div>
</section>
<?php
endHtml();
?>