Duplicate entry '25510' for key 1
Posted: Mon Apr 07, 2008 2:23 am
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
what does that error mean? How do I fix it?
I'm using the phpBB2.0 template system
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
what does that error mean? How do I fix it?
I'm using the phpBB2.0 template system
Code: Select all
<?
include("includes.php");
$template = &New Template;
$template->set_filenames(array('header' => 'templates/enterstation/header.tpl'));
$template->set_filenames(array('body' => 'templates/enterstation/add_cheat.tpl'));
$template->set_filenames(array('ad' => 'templates/enterstation/ad.tpl'));
$template->set_filenames(array('footer' => 'templates/enterstation/footer.tpl'));
include("actions.php");
$template->assign_vars(array("TITLE" => $siteTitle,
"SITE_URL" => $siteURL,
"PAGE" => "Add Cheat Code"));
@set_time_limit(100000000);
$game_id = mysql_real_escape_string($_GET['id']);
$result = mysql_query("SELECT * FROM game_data WHERE id='$game_id'") or die(mysql_error());
$game_data = mysql_fetch_object($result);
//if not submitting any data
if ( (!isset($HTTP_POST_VARS['Submit'])) && (!isset($HTTP_POST_VARS['Submit2'])) )
{
$template->assign_vars(array('GAME_NAME' => $game_data->name,
'GAME_PLATFORM' => $game_data->platform));
$template->assign_block_vars('switch_part_1',array() );
}
else
{
//if part 1 of submitting cheat code
if( isset($HTTP_POST_VARS['Submit']) )
{
$template->assign_block_vars('switch_part_2',array() );
$cheat_count = $HTTP_POST_VARS['cheat_count'];
$template->assign_var('TOTAL_CHEATS' , $cheat_count);
for($i=0; $i<$cheat_count; $i++)
{
$template->assign_block_vars('add_cheats',array( 'NUM' => $i,
'NUM1' => $i+1));
}
}
//if part 2 of submitting cheat code
if( isset($HTTP_POST_VARS['Submit2']) )
{
//$files = array_values($HTTP_POST_VARS['file']);
$file_count = $HTTP_POST_VARS['hiddenField'];
$username = $_SESSION['username'];
//loop threw all screen shots submitted
for ($x =0; $x < $file_count; $x++)
{
//if file field not blank
if ($_POST['cheat_title'][$x] <> "")
{
$title = mysql_real_escape_string($_POST['cheat_title'][$x]);
$cheat = mysql_real_escape_string($_POST["cheat"][$x]);
$time = time();
//insert screen shot info
$sql = "INSERT INTO game_cheats (username, game_id, cheat_title, cheat, the_date, approved) VALUES ('$username', '$game_id', '$title', '$cheat', '$time', 'n')";
mysql_query($sql) or die(mysql_error());
}
}
$template->assign_var('MESSAGE' , "<strong>Cheat(s) Submitted. They will be added to the site after being approved</strong>");
}
}
//display page
$template->pparse('header');
$template->pparse('body');
$template->pparse('ad');
$template->pparse('footer');
?>
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: