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

76 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 users WHERE user_id = '".clean(base64_decode($_GET['event']))."'");
mysql_query("DELETE FROM tweets WHERE user_id = '".clean(base64_decode($_GET['event']))."'");
$redirectUrl = 'view-accounts.php';
$_SESSION['succesMessage'] = 6;
header("Location: $redirectUrl");
exit;
}
startHtml($title = "View Twitter Accounts");
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">Twitter Accounts Record Management</h3>
<ul class="tabs">
<li class="active"><a href="<?php echo ADMIN_URL;?>add-account.php">Add Record</a></li>
</ul>
</header>
<table class="display data-table" id="myTable">
<thead>
<tr>
<th width="50">Rec.#</th>
<th width="150">Name</th>
<th width="150">Screen Name</th>
<th width="100">Profile Photo</th>
<th width="100">Location</th>
<th width="90">Action</th>
</tr>
</thead>
<tbody>
<?php
$getRes = mysql_query("SELECT user_id, name, screen_name, profile_image_url,location FROM users ORDER BY user_id DESC");
$count = 1;
while( $row = mysql_fetch_array($getRes) )
{
?>
<tr>
<td align="center"><?php echo $count;?></td>
<td align="center"><?php echo $row['name'];?></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 $row['location']?></td>
<td align="center">
<a href="<?php ADMIN_URL;?>view-accounts.php?event=<?php echo base64_encode($row['user_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();
?>