<?php

include('../include/session.php');

date_default_timezone_set('Africa/Gaborone');
$entry_date = date("Y-m-d H:i:s", time()); 
$solved_date = date("d-m-Y H:i:s", strtotime($entry_date));

$error_id = $_GET['error_id'];
$solution = $_GET['solution_text'];

$solution_string=$solution;			
$solution_string = str_replace("'", "-", $solution_string);
$solution_string = htmlentities($solution_string, ENT_QUOTES);

$solution = $solved_date.'<br>'.$solution_string.'<br>';
if (isset($_GET['close_checkbox'])) {$error_solved = 'yes';} else {$error_solved = 'no';}


$table_name = $_SESSION['db_prefix']."_error_log";
$error_solution_query = "SELECT error_solution FROM $table_name WHERE error_id = '".$error_id."' ";
$error_solution_result = mySQL_query($error_solution_query);
$error_solution = mysql_result($error_solution_result, 0, "error_solution");
$error_solution = $error_solution.'<br>'.$solution;

$table_name = $_SESSION['db_prefix']."_error_log";
$update_query = "UPDATE $table_name SET error_solved_date = '".$entry_date."', error_solution =  '".$error_solution."', error_solved =  '".$error_solved."', error_solved_by = '".$_SESSION['username']."' WHERE error_id = '".$error_id."' ";
execsql($update_query);
?>

       <script>
	      window.location="error_report.php?error_id=<?php echo $error_id ?>";
		</script>
   