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

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

$clockin_hour_text = $_GET['clockin_hour_text'];
$clockin_min_text = $_GET['clockin_min_text'];
$clockout_hour_text = $_GET['clockout_hour_text'];
$clockout_min_text = $_GET['clockout_min_text'];
$grace1 = $_GET['grace_min_text'];
$lunch1 = $_GET['lunch_min_text'];

$table_name = $_SESSION['db_prefix']."_presets";
$table_name2 = $_SESSION['db_prefix']."_tracking_admin";

$clockin1_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'clockin1' ";
$clockin1_result = mySQL_query($clockin1_query);
$clockin1_saved = mysql_result($clockin1_result, 0, "preset_value");
$clockin1 = ($clockin_hour_text*60) + $clockin_min_text;
$preset_query = "UPDATE $table_name SET preset_value = '".$clockin1."' WHERE preset_name = 'clockin1' ";
execsql($preset_query);
if ($clockin1!=$clockin1_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '11', '".$clockin1_saved."' ,'".$clockin1."','zone 1','clock in time' )";
$trackingResult = mySQL_query($trackingQuery);
}

$grace1_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'grace1' ";
$grace1_result = mySQL_query($grace1_query);
$grace1_saved = mysql_result($grace1_result, 0, "preset_value");
$preset_query = "UPDATE $table_name SET preset_value = '".$grace1."' WHERE preset_name = 'grace1' ";
execsql($preset_query);
if ($grace1!=$grace1_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '11', '".$grace1_saved."' ,'".$grace1."','zone 1','grace period 1' )";
$trackingResult = mySQL_query($trackingQuery);
}

$lunch1_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'lunch1' ";
$lunch1_result = mySQL_query($lunch1_query);
$lunch1_saved = mysql_result($lunch1_result, 0, "preset_value");
$preset_query = "UPDATE $table_name SET preset_value = '".$lunch1."' WHERE preset_name = 'lunch1' ";
execsql($preset_query);
if ($lunch1!=$lunch1_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '11', '".$grace1_saved."' ,'".$lunch1."','zone 1','lunch period 1' )";
$trackingResult = mySQL_query($trackingQuery);
}

$clockout1_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'clockout1' ";
$clockout1_result = mySQL_query($clockout1_query);
$clockout1_saved = mysql_result($clockout1_result, 0, "preset_value");
$clockout1 = ($clockout_hour_text*60) + $clockout_min_text;
$preset_query = "UPDATE $table_name SET preset_value = '".$clockout1."' WHERE preset_name = 'clockout1' ";
execsql($preset_query);
if ($clockout1!=$clockout1_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '11', '".$clockout1_saved."' ,'".$clockout1."','zone 1','clock out time' )";
$trackingResult = mySQL_query($trackingQuery);
}

$clockin_hour_2_text = $_GET['clockin_hour_2_text'];
$clockin_min_2_text = $_GET['clockin_min_2_text'];
$clockout_hour_2_text = $_GET['clockout_hour_2_text'];
$clockout_min_2_text = $_GET['clockout_min_2_text'];
$grace2 = $_GET['grace_min2_text'];
$lunch2 = $_GET['lunch_min2_text'];

$clockin2 = ($clockin_hour_2_text*60) + $clockin_min_2_text;
$clockout2 = ($clockout_hour_2_text*60) + $clockout_min_2_text;

$clockin2_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'clockin2' ";
$clockin2_result = mySQL_query($clockin2_query);
$clockin2_saved = mysql_result($clockin2_result, 0, "preset_value");
$preset_query = "UPDATE $table_name SET preset_value = '".$clockin2."' WHERE preset_name = 'clockin2' ";
execsql($preset_query);
if ($clockin2!=$clockin2_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '11', '".$clockin2_saved."' ,'".$clockin2."','zone 2','clock in time' )";
$trackingResult = mySQL_query($trackingQuery);
}

$grace2_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'grace2' ";
$grace2_result = mySQL_query($grace2_query);
$grace2_saved = mysql_result($grace2_result, 0, "preset_value");
$preset_query = "UPDATE $table_name SET preset_value = '".$grace2."' WHERE preset_name = 'grace2' ";
execsql($preset_query);
if ($grace2!=$grace2_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '11', '".$grace2_saved."' ,'".$grace2."','zone 1','grace period 2' )";
$trackingResult = mySQL_query($trackingQuery);
}

$lunch2_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'lunch2' ";
$lunch2_result = mySQL_query($lunch2_query);
$lunch2_saved = mysql_result($lunch2_result, 0, "preset_value");
$preset_query = "UPDATE $table_name SET preset_value = '".$lunch2."' WHERE preset_name = 'lunch2' ";
execsql($preset_query);
if ($lunch2!=$lunch2_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '11', '".$grace1_saved."' ,'".$lunch2."','zone 1','lunch period 2' )";
$trackingResult = mySQL_query($trackingQuery);
}

$clockout2_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'clockout2' ";
$clockout2_result = mySQL_query($clockout2_query);
$clockout2_saved = mysql_result($clockout2_result, 0, "preset_value");
$preset_query = "UPDATE $table_name SET preset_value = '".$clockout2."' WHERE preset_name = 'clockout2' ";
execsql($preset_query);
if ($clockout2!=$clockout2_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '11', '".$clockout2_saved."' ,'".$clockout2."','zone 2','clock in time' )";
$trackingResult = mySQL_query($trackingQuery);
}

$high_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Priority high' ";
$high_result = mySQL_query($high_query);
$high_saved = mysql_result($high_result, 0, "preset_value");
$high_text = $_GET['high_select'];
$preset_query = "UPDATE $table_name SET preset_value = '".$high_text."' WHERE preset_name = 'Priority high' ";
execsql($preset_query);
if ($high_text!=$high_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$high_saved."' ,'".$high_text."','','Priority high' )";
$trackingResult = mySQL_query($trackingQuery);
}

$normal_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Priority normal' ";
$normal_result = mySQL_query($normal_query);
$normal_saved = mysql_result($normal_result, 0, "preset_value");
$normal_text = $_GET['normal_select'];
$preset_query = "UPDATE $table_name SET preset_value = '".$normal_text."' WHERE preset_name = 'Priority normal' ";
execsql($preset_query);
if ($normal_text!=$normal_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$normal_saved."' ,'".$normal_text."','','Priority normal' )";
$trackingResult = mySQL_query($trackingQuery);
}

$low_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Priority low' ";
$low_result = mySQL_query($low_query);
$low_saved = mysql_result($low_result, 0, "preset_value");
$low_text = $_GET['low_select'];
$preset_query = "UPDATE $table_name SET preset_value = '".$low_text."' WHERE preset_name = 'Priority low' ";
execsql($preset_query);
if ($low_text!=$low_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$low_saved."' ,'".$low_text."','','Priority low' )";
$trackingResult = mySQL_query($trackingQuery);
}




$diesel_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Diesel' ";
$diesel_result = mySQL_query($diesel_query);
$diesel_saved = mysql_result($diesel_result, 0, "preset_value");
$diesel_text = $_GET['diesel_text'];
$preset_query = "UPDATE $table_name SET preset_value = '".$diesel_text."' WHERE preset_name = 'Diesel' ";
execsql($preset_query);
if ($diesel_text!=$diesel_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$diesel_saved."' ,'".$diesel_text."','','Diesel' )";
$trackingResult = mySQL_query($trackingQuery);
}

$petrol_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Petrol' ";
$petrol_result = mySQL_query($petrol_query);
$petrol_saved = mysql_result($petrol_result, 0, "preset_value");
$petrol_text = $_GET['petrol_text'];
$preset_query = "UPDATE $table_name SET preset_value = '".$petrol_text."' WHERE preset_name = 'Petrol' ";
execsql($preset_query);
if ($petrol_text!=$petrol_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$petrol_saved."' ,'".$petrol_text."','','Petrol' )";
$trackingResult = mySQL_query($trackingQuery);
}

$vat_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'VAT' ";
$vat_result = mySQL_query($vat_query);
$vat_saved = mysql_result($vat_result, 0, "preset_value");
$vat_text = $_GET['vat_text'];
$preset_query = "UPDATE $table_name SET preset_value = '".$vat_text."' WHERE preset_name = 'VAT' ";
execsql($preset_query);
if ($vat_text!=$vat_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$vat_saved."' ,'".$vat_text."','','VAT' )";
$trackingResult = mySQL_query($trackingQuery);
}

$option1_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Earth loops' ";
$option1_result = mySQL_query($option1_query);
$option1_saved = mysql_result($option1_result, 0, "preset_value");
$option1_text = $_GET['option1_text'];
$preset_query = "UPDATE $table_name SET preset_value = '".$option1_text."' WHERE preset_name = 'Earth loops' ";
execsql($preset_query);
if ($option1_text!=$option1_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$option1_saved."' ,'".$option1_text."','','Earth loops' )";
$trackingResult = mySQL_query($trackingQuery);
}

$option2_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Outrigger' ";
$option2_result = mySQL_query($option2_query);
$option2_saved = mysql_result($option2_result, 0, "preset_value");
$option2_text = $_GET['option2_text'];
$preset_query = "UPDATE $table_name SET preset_value = '".$option2_text."' WHERE preset_name = 'Outrigger' ";
execsql($preset_query);
if ($option2_text!=$option2_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$option2_saved."' ,'".$option2_text."','','Outrigger' )";
$trackingResult = mySQL_query($trackingQuery);
}

$option3_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Wash line' ";
$option3_result = mySQL_query($option3_query);
$option3_saved = mysql_result($option3_result, 0, "preset_value");
$option3_text = $_GET['option3_text'];
$preset_query = "UPDATE $table_name SET preset_value = '".$option3_text."' WHERE preset_name = 'Wash line' ";
execsql($preset_query);
if ($option3_text!=$option3_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$option3_saved."' ,'".$option3_text."','','Wash line' )";
$trackingResult = mySQL_query($trackingQuery);
}

$option4_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Strobe' ";
$option4_result = mySQL_query($option4_query);
$option4_saved = mysql_result($option4_result, 0, "preset_value");
$option4_text = $_GET['option4_text'];
$preset_query = "UPDATE $table_name SET preset_value = '".$option4_text."' WHERE preset_name = 'Strobe' ";
execsql($preset_query);
if ($option4_text!=$option4_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$option4_saved."' ,'".$option4_text."','','Strobe' )";
$trackingResult = mySQL_query($trackingQuery);
}

$option5_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Anti lift bar' ";
$option5_result = mySQL_query($option5_query);
$option5_saved = mysql_result($option5_result, 0, "preset_value");
$option5_text = $_GET['option5_text'];
$preset_query = "UPDATE $table_name SET preset_value = '".$option5_text."' WHERE preset_name = 'Anti lift bar' ";
execsql($preset_query);
if ($option5_text!=$option5_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$option5_saved."' ,'".$option5_text."','','Anti lift bar' )";
$trackingResult = mySQL_query($trackingQuery);
}

$option6_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Ace 100 energizer' ";
$option6_result = mySQL_query($option6_query);
$option6_saved = mysql_result($option6_result, 0, "preset_value");
$option6_text = $_GET['option6_text'];
$preset_query = "UPDATE $table_name SET preset_value = '".$option6_text."' WHERE preset_name = 'Ace 100 energizer' ";
execsql($preset_query);
if ($option6_text!=$option6_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$option6_saved."' ,'".$option6_text."','','Ace 100 energizer' )";
$trackingResult = mySQL_query($trackingQuery);
}

$table_name = $_SESSION['db_prefix']."_planning_legend";
$delete_query = "DELETE FROM $table_name WHERE legend_no>0"; 
execsql($delete_query);

$emp_id_1 = $_GET['color_select_1'];
$table_name = $_SESSION['db_prefix']."_planning_legend";
$color1_query = "INSERT INTO $table_name (legend_no, color_code, emp_id ) VALUES ('1', 'ECC680', '".$emp_id_1."'  ) ";
execsql($color1_query);

$emp_id_2 = $_GET['color_select_2'];
$table_name = $_SESSION['db_prefix']."_planning_legend";
$color2_query = "INSERT INTO $table_name (legend_no, color_code, emp_id ) VALUES ('2', 'B5DEA3', '".$emp_id_2."'  ) ";
execsql($color2_query);

$emp_id_3 = $_GET['color_select_3'];
$table_name = $_SESSION['db_prefix']."_planning_legend";
$color3_query = "INSERT INTO $table_name (legend_no, color_code, emp_id ) VALUES ('3', 'FFC6E2', '".$emp_id_3."'  ) ";
execsql($color3_query);

$emp_id_4 = $_GET['color_select_4'];
$table_name = $_SESSION['db_prefix']."_planning_legend";
$color4_query = "INSERT INTO $table_name (legend_no, color_code, emp_id ) VALUES ('4', 'A0CFF1', '".$emp_id_4."'  ) ";
execsql($color4_query);

$emp_id_5 = $_GET['color_select_5'];
$table_name = $_SESSION['db_prefix']."_planning_legend";
$color5_query = "INSERT INTO $table_name (legend_no, color_code, emp_id ) VALUES ('5', 'DFBFFF', '".$emp_id_5."'  ) ";
execsql($color5_query);

$emp_id_6 = $_GET['color_select_6'];
$table_name = $_SESSION['db_prefix']."_planning_legend";
$color6_query = "INSERT INTO $table_name (legend_no, color_code, emp_id ) VALUES ('6', 'B7B7FF', '".$emp_id_6."'  ) ";
execsql($color6_query);

$emp_id_7 = $_GET['color_select_7'];
$table_name = $_SESSION['db_prefix']."_planning_legend";
$color7_query = "INSERT INTO $table_name (legend_no, color_code, emp_id ) VALUES ('7', 'FFFFC6', '".$emp_id_7."'  ) ";
execsql($color7_query);

$emp_id_8 = $_GET['color_select_8'];
$table_name = $_SESSION['db_prefix']."_planning_legend";
$color8_query = "INSERT INTO $table_name (legend_no, color_code, emp_id ) VALUES ('8', '80BFBF', '".$emp_id_8."'  ) ";
execsql($color8_query);

$emp_id_9 = $_GET['color_select_9'];
$table_name = $_SESSION['db_prefix']."_planning_legend";
$color9_query = "INSERT INTO $table_name (legend_no, color_code, emp_id ) VALUES ('9', 'FF9D9D', '".$emp_id_9."'  ) ";
execsql($color9_query);


$table_name = $_SESSION['db_prefix']."_presets";
$residential_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Call out residential' ";
$residential_result = mySQL_query($residential_query);
$residential_saved = mysql_result($residential_result, 0, "preset_value");
$residential_text = $_GET['residential_text'];
$preset_query = "UPDATE $table_name SET preset_value = '".$residential_text."' WHERE preset_name = 'Call out residential' ";
execsql($preset_query);
if ($residential_text!=$residential_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$residential_saved."' ,'".$residential_text."','','Call out residential' )";
$trackingResult = mySQL_query($trackingQuery);
}

$table_name = $_SESSION['db_prefix']."_presets";
$commercial_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Call out commercial' ";
$commercial_result = mySQL_query($commercial_query);
$commercial_saved = mysql_result($commercial_result, 0, "preset_value");
$commercial_text = $_GET['commercial_text'];
$preset_query = "UPDATE $table_name SET preset_value = '".$commercial_text."' WHERE preset_name = 'Call out commercial' ";
execsql($preset_query);
if ($commercial_text!=$commercial_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$commercial_saved."' ,'".$commercial_text."','','Call out commercial' )";
$trackingResult = mySQL_query($trackingQuery);
}

$table_name = $_SESSION['db_prefix']."_presets";
$gate_motor_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Call out gate motor' ";
$gate_motor_result = mySQL_query($gate_motor_query);
$gate_motor_saved = mysql_result($gate_motor_result, 0, "preset_value");
$gate_motor_text = $_GET['gate_motor_text'];
$preset_query = "UPDATE $table_name SET preset_value = '".$gate_motor_text."' WHERE preset_name = 'Call out gate motor' ";
execsql($preset_query);
if ($gate_motor_text!=$gate_motor_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$gate_motor_saved."' ,'".$gate_motor_text."','','Call out gate motor' )";
$trackingResult = mySQL_query($trackingQuery);
}

$table_name = $_SESSION['db_prefix']."_presets";
$month_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Maintenance month' ";
$month_result = mySQL_query($month_query);
$month_saved = mysql_result($month_result, 0, "preset_value");
$month_text = $_GET['month_text'];
$preset_query = "UPDATE $table_name SET preset_value = '".$month_text."' WHERE preset_name = 'Maintenance month' ";
execsql($preset_query);
if ($month_text!=$month_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$month_saved."' ,'".$month_text."','','Maintenance month' )";
$trackingResult = mySQL_query($trackingQuery);
}

$table_name = $_SESSION['db_prefix']."_presets";
$year_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Maintenance year' ";
$year_result = mySQL_query($year_query);
$year_saved = mysql_result($year_result, 0, "preset_value");
$year_text = $_GET['year_text'];
$preset_query = "UPDATE $table_name SET preset_value = '".$year_text."' WHERE preset_name = 'Maintenance year' ";
execsql($preset_query);
if ($year_text!=$year_saved) {
$trackingQuery = "INSERT INTO $table_name2 (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '10', '".$year_saved."' ,'".$year_text."','',''Maintenance year' )";
$trackingResult = mySQL_query($trackingQuery);
}

$table_name = $_SESSION['db_prefix']."_team_planning_legend";
$delete_query = "DELETE FROM $table_name WHERE legend_no>0"; 
execsql($delete_query);

$team_id_1 = $_GET['team_color_select_1'];
$table_name = $_SESSION['db_prefix']."_team_planning_legend";
$color1_query = "INSERT INTO $table_name (legend_no, color_code, team_id ) VALUES ('1', 'ECC680', '".$team_id_1."'  ) ";
execsql($color1_query);

$team_id_2 = $_GET['team_color_select_2'];
$table_name = $_SESSION['db_prefix']."_team_planning_legend";
$color2_query = "INSERT INTO $table_name (legend_no, color_code, team_id ) VALUES ('2', 'B5DEA3', '".$team_id_2."'  ) ";
execsql($color2_query);

$team_id_3 = $_GET['team_color_select_3'];
$table_name = $_SESSION['db_prefix']."_team_planning_legend";
$color3_query = "INSERT INTO $table_name (legend_no, color_code, team_id) VALUES ('3', 'FFC6E2', '".$team_id_3."'  ) ";
execsql($color3_query);

$team_id_4 = $_GET['team_color_select_4'];
$table_name = $_SESSION['db_prefix']."_team_planning_legend";
$color4_query = "INSERT INTO $table_name (legend_no, color_code, team_id ) VALUES ('4', 'A0CFF1', '".$team_id_4."'  ) ";
execsql($color4_query);

$team_id_5 = $_GET['team_color_select_5'];
$table_name = $_SESSION['db_prefix']."_team_planning_legend";
$color5_query = "INSERT INTO $table_name (legend_no, color_code, team_id ) VALUES ('5', 'DFBFFF', '".$team_id_5."'  ) ";
execsql($color5_query);

if (isset($_GET['save_close_button']) )
	   { ?>
       <script>
	 window.location="../admin_module/user_list.php";
		</script>
        <?php		 
	   }
	  if (isset($_GET['save_button']) )
	   { ?>
       <script>
	  window.location="presets.php"
		</script>
        <?php		 
	   }