cookie计数器在2次计数后急剧增加

I have this php code in a servers. It receives a post request and deals with the data. It also sets a cookie if the counter there is no cookie, and counts the number of visits. My problem is that after 2 visits, the cookie counter value changes dramatically. it goes from 2 to 1534014090. It seems the value of my cookie counter variable does not hold its data. It reads the username and password from a text file. My problem occurs only in the first if statement

<?php
setcookie("User", "Razine Bensari");
 $username = $_POST["username"];
 $password = $_POST['password'];
 $done = "The data has not been sent";
 $credsArray;
 $counter = 0;

 //check if cookie exists
if(isset($_COOKIE["counter"])){
  echo "<h1> Welcome Back ".$_COOKIE["User"] ." - " .$username."!!!</h1>";
  $cookieCount = ++$_COOKIE["counter"];
  setcookie('counter', $cookieCount + time() + 60);
  echo "<br> You have visited this page " .$_COOKIE["counter"]. " times";
} else { // starts counting if new visitor
  $cookieCount = 1;
  setcookie('counter', $cookieCount, time() + 60);
  echo "<h1> Welcome new Guest! </h1>";

}
//check if correctly received data through post
  if($username || $password){
    //Note, the validation has already been done in front end (html and javascript)
    $done = "The data has been sent to canvas.php file";
    echo "<h1> <?php $done ?></h1>";
  }
  //open the file that containes the credential to verify the password and username
  $file_key = fopen("key.txt", "r");
  echo "<br>I am now opening the file text...";

  //Even indexes are username, odd indexes are password because of the way the key.txt is set up (first line is usernmae, second line is password - this is one set of crednetials)
  if($file_key){
    while(!feof($file_key)){
      $credsArray[$counter] = fgets($file_key);
      $counter++;
      echo " reading the file... <br>";
    }
    echo "<br> This is the accepted username: <strong>$credsArray[0]</strong>, this is the corresponding password: <strong>$credsArray[1]</strong> <br>";
    echo "The username used is $username, the password used is $password. <br>";
    if(((String)$username == trim((String)$credsArray[0])) && ((String)$password == trim((String)$credsArray[1]))){
      session_start();
      $_SESSION['FirstLogin'] = "true";

      echo  "<h3> <br>You have correctly logged in!!! <br></h3>";
    } else {
      echo "<h4> Incorrect username or password</h4>";
    }
    fclose($file_key);
  } else {
    echo "error openeing the file";
  }
?>
setcookie('counter', $cookieCount + time() + 60); 

you missing comma (,) on value you adding time

setcookie('counter', $cookieCount, time() + 60);

// http://php.net/manual/en/function.setcookie.php
// setcookie("TestCookie", $value, time()+3600);