<?php
// $Id: brokenfile.php,v 1.1 2004/07/11 10:28:17 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();
		}

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

$result = $db->query("SELECT COUNT(*) FROM ".$db->prefix("mydownloads_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("mydownloads_broken")."_reportid_seq");
$query = "INSERT INTO ".$db->prefix("mydownloads_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='brokenfile.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");
?>
