<?php

session_start();
$do			= $_GET['action'];
if( $do == 'banners' )
{
	header("location:jse_viewbrokenbanners.php");
}
else if( $do == 'tlinks' )
{
	header("location:jse_viewbrokentlinks.php");
}

include "../header.php";
include "../config.php";
include "../style.php";

$targeturl	= $_POST['targeturl'];
$bannerurl	= $_POST['bannerurl'];
$id 		= $_POST['id'];
$buttonaction = $_POST['button'];

if( isset($_SESSION["alogin"]) ) {
    	?><table>
      	<tr>
        <td width="15%" valign=top><br>
        <? include("adminnavigation.php"); ?>
        </td>
        <td valign="top" align="center"><br><br> <?
    echo "<font size=2 face='$fonttype' color='$fontcolour'><p><b><center>";
	
	if( $buttonaction == 'Ignore' )
	{
		if( $do == 'banners' )
		{
			foreach($id as $each)
			{
				mysql_query("delete from jse_bannerlist where bannerid='".$each."'");
			}
		}
		else if( $do == 'tlinks' )
		{
			foreach($id as $each)
			{
				mysql_query("delete from jse_trafficlinklist where tlinkid='".$each."'");
			}
		}
	}
	if( $buttonaction == 'Delete' )
	{
		if( $do == 'banners' )
		{
			foreach($id as $each)
			{
				mysql_query("delete from banners where id='".$each."'");
				mysql_query("delete from jse_bannerlist where bannerid='".$each."'");
			}
		}
		else if( $do == 'tlinks' )
		{
			foreach($id as $each)
			{
				mysql_query("delete from tlinks where id='".$each."'");
				mysql_query("delete from jse_trafficlinklist where tlinkid='".$each."'");
			}
		}
	}
	
	if( $buttonaction == 'Send Back' )
	{
		if( $do == 'banners' )
		{
			foreach($id as $each)
			{
				mysql_query("update banners set added=0 where id='".$each."'");
				mysql_query("delete from jse_bannerlist where bannerid='".$each."'");
			}
		}
		else if( $do == 'tlinks' )
		{
			foreach($id as $each)
			{
				mysql_query("update tlinks set added=0 where id='".$each."'");
				mysql_query("delete from jse_trafficlinklist where tlinkid='".$each."'");
			}
		}
	}

    echo "</table></td></tr></table>";
    }

else  {
	echo "Unauthorised Access!";
    }

include "../footer.php";
mysql_close($dblink);
?>