View file public_html/vipadz/wallpost.php

File size: 2.57Kb
<?php

/************************************

Script : Adnetwork
Website : http://facebook.com/pranto007

Script is created and provided by Pranto (http://facebook.com/pranto007)
**************************************/
include '../db.php';
include '../functions.php';

headtag("$SiteName - Admin Panel Beta");

if($adminlog==1){
$act=formget("act");
$id=formget("id");
   echo '<div class="title">Pending Wall Posts</div>';
if($act=="reject")
{

mysql_query('UPDATE forum_question SET status="Rejected" WHERE id="'.$id.'"');
echo '<div class="ok">Post Rejected Successfully!</div>';
}

else if($act=="approve")
{

mysql_query('UPDATE forum_question SET status="Approved" WHERE id="'.$id.'"');
echo '<div class="ok">Post Approved Successfully!</div>';
}
$result=mysql_query('SELECT * FROM forum_question ORDER BY id DESC LIMIT 100');



// OREDER BY id DESC is order result by descending
$result=mysql_query($sql);

// how many rows to show per page
$rowsPerPage = 10;
// by default we show first page
$pageNum = 1;

// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
    $pageNum = $_GET['page'];
}

// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;

$sql = " SELECT * FROM forum_question WHERE status='Pending' ORDER BY id DESC" . 
         " LIMIT $offset, $rowsPerPage ";
$result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){ // Start looping table row

$reply=$rows['id'];
$comments=mysql_num_rows(mysql_query("SELECT * FROM forum_answer WHERE question_id='$reply'"));

  echo '<div class="ad">User: '.$rows["name"].'<br/>Post: '.$rows["detail"].'<br/> <a href="wallpost.php?act=approve&id='.$rows["id"].'">Approve</a> - <a href="wallpost.php?act=reject&id='.$rows["id"].'">Reject</a></div>';
 }
if ($pageNum > 1)
{
   $page  = $pageNum - 1;
   $prev  = " || <a href=\"$self?page=$page\">Prev</a> || ";

   $first = " <a href=\"$self?page=1\">First Page</a> ";
}

else
{
   $prev  = '&nbsp;'; // we're on page one, don't print previous link
   $first = '&nbsp;'; // nor the first page link
}

if ($pageNum < 1000)
{
   $page = $pageNum + 1;
   $next = " <a href=\"$self?page=$page\">Next</a> ";

   $last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> ";
}
else
{
   $next = '&nbsp;'; // we're on the last page, don't print next link
   $last = '&nbsp;'; // nor the last page link
}

// print the navigation link
echo '<div class="ad">'.$first.' '.$prev.' '.$nav.' '.$next.'</div>';
mysql_close();
echo '<a href="index.php?redir=wall"><div class="ua">Home</div></a>';

include '../foot.php';

}
else {

header('Location:/login.php?error=ticket&reason=session');
}

?>