getByUsername($theuser[1]); if ($row === null) { $renderer->simple("Connexion error", "Invalid cookie data. Please clear cookies and log in again. (Error 1)"); } if ($row["id"] != $theuser[0]) { $renderer->simple("Connexion error", "Invalid cookie data. Please clear cookies and log in again. (Error 2)"); } if (md5($row["password"] . "--" . $db->getSecretWord()) !== $theuser[2]) { $renderer->simple("Connexion error", "Invalid cookie data. Please clear cookies and log in again. (Error 3)"); } // If we've gotten this far, cookie should be valid, so write a new one. $newcookie = implode(" ",$theuser); if ($theuser[3] == 1) { $expiretime = time()+31536000; } else { $expiretime = 0; } setcookie ("dkgame", $newcookie, $expiretime, "/", "", 0); $userRepository->updateOnlineTime($theuser[0]); } return $row; } ?>