I have this function and I want when it is the time equal to 0.I want to make my page change from index.php to gameover.html.
function progress(timeleft, timetotal, $element) {
    var progressBarWidth = timeleft * $element.width() / timetotal;
    $element
        .find('div')
        .animate({ width: progressBarWidth }, 500)
        .html(timeleft + " seconds to go");
    if(timeleft > 0) {
        setTimeout(function() {
            progress(timeleft - 1, timetotal, $element);
        }, 1000);
    }
};
progress(180, 180, $('#progressBar'));
I thought,to that  if(timeleft==0) {//i use much things but i didn't managed } .
the php code I have on the index.php so I will be able to connect with my database
session_start();
include("s/connect.php");
if($_SERVER['REQUEST_METHOD'] == "POST")
{
    
    //something was posted
    $user_name = $_POST['user_name'];
    $password = $_POST['password'];
    if(!empty($user_name) && !empty($password) && !is_numeric($user_name))
    {
        
    $user_id = random_num(20);  
        $query = "insert into users ( user_id,user_name,password) values ('$user_id','$user_name','$password')";
    
    mysqli_query($mysqli, $query);
    header("Location: gameover.html");
    die;
    }
    else{
        echo "Please enter some valid information!";
    }
    
}
