<?php

	include "library.php";

    $cxn = start_code();


	if (val( $_POST, "password" ) != "IndieHair12$" )
	{
	    echo black( "<br>Incorrect system password<br><br>" );
	}
    else
    {
        for ($i=1; $i <= 7; $i++)
        {
            $day = val( $_POST, 'description'.$i );
            
            $open_time = val( $_POST, 'open_time'.$i );
            
            $close_time = val( $_POST, 'close_time'.$i );
    
    
            $query = "UPDATE hours SET open_time = '".$open_time."', close_time = '".$close_time."' WHERE description = '".$day."'";
            
    		$result = run_query( $query, $cxn );
        }
        
        echo "<br><br>";
        
        echo black( "Changes saved<br><br>" );
    }
    
    echo "<a href='/'>Home page</a>";
    
?>    