<?php
// $Id: brokenlink.php,v 1.1 2004/07/11 10:28:20 Farsus Exp $
// -------------------------------------------------------------------------//
//			                 RUNCMS                                         //
//                                                                          //
//	 reliable - Unique - Nocost &  Simplicity & ease off use                //
//                       < http://www.runcms.org >                          //
// -------------------------------------------------------------------------//
// Original Author: James Knickelbein
// Author Website : http://www.journeymilwaukee.com
// License Type   : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //

include_once("header.php");

if ($HTTP_POST_VARS[submit]) {
	if (!$xoopsUser) {
		$sender = 0;
		} else {
			$sender = $xoopsUser->uid();
		}

$lid = intval($HTTP_POST_VARS['lid']);
$ip  = _REMOTE_ADDR;

$result = $db->query("SELECT COUNT(*) FROM ".$db->prefix("mylinks_broken")." WHERE lid=$lid");
list($count) = $db->fetch_row($result);
if ($count > 0) {
	redirect_header("index.php", 2, _MD_ALREADYREPORTED);
	exit();
}

$newid = $db->genId($db->prefix("mylinks_broken")."_reportid_seq");
$query = "INSERT INTO ".$db->prefix("mylinks_broken")." SET reportid=$newid, lid=$lid, sender=$sender, ip='$ip'";

$db->query($query);
redirect_header("index.php", 2, _MD_THANKSFORINFO);
exit();

} else {
include_once(XOOPS_ROOT_PATH."/header.php");

$lid = intval($HTTP_GET_VARS['lid']);
OpenTable();
mainheader();

echo "
<h4>"._MD_REPORTBROKEN."</h4>
<form action='brokenlink.php' method='POST'>
<input type='hidden' name='lid' value='$lid' />
"._MD_THANKSFORHELP."
<br />"._MD_FORSECURITY."<br /><br />
<input type='submit' class='button' name='submit' value='"._MD_REPORTBROKEN."' />
<input type='button' class='button' value='"._CANCEL."' onclick='javascript:history.go(-1)' />
</form>";

CloseTable();
}

include_once("footer.php");
?>
