2 /* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
5 require ("./inc/errors.php");
6 require ("./inc/settings.php");
7 require ("./inc/db/mysql.php");
8 require ("./inc/utils.php");
11 $cookie_name = sprintf ("%sauth", DBPREFIX);
12 if (isset ($_COOKIE [$cookie_name])) {
13 setcookie ($cookie_name, "", time () - 3600, "" , "",false, true);
14 header ('Location: index.php');
19 function main ($con) {
20 $pwd = unquote ($_POST["user_pwd"]);
25 $con->connect (DBHOST, DBUSER, DBPWD, DBNAME, DBPREFIX);
26 if ($con->checkpwdmd5 ("admin", md5 ($pwd))) {
27 // cookie will be valid for 2 weeks. I've chosen that value
28 // arbitrarily, and it may change in the future.
29 $time = time () + 14 * 60 * 24 * 60;
30 $cookie_name = sprintf ("%sauth", DBPREFIX);
31 setcookie ($cookie_name, md5 ($pwd), $time, "" , "", false, true);
38 if ($_GET ["logout"] == "true" || $_GET ["logout"] == "1") {
44 } catch (Exception $e) {