printFooter(); } } else { dump("HOBA: No HOBA session found"); printLoginFailure(); } } elseif (isset($_COOKIE['YEOLDE'])) { dump("HOBA: Got YEOLDE cookie for " . $_COOKIE['YEOLDE']); $err = true; $user = dbGetUserByCookie($_COOKIE['YEOLDE']); if ($user) { //TODO: Refresh session if it's old if (isset($_POST['uPass'])) { $err = dbSetUserPass($user['uid'], $_POST['uPass']); } elseif (isset($_POST['msg'])) { $err = dbAddMsg($user['uid'], $_POST['msg']); } printHeader(); if ($err !== true) { dump($err); printMeat($user['uName'], false, $err); } else { printMeat($user['uName'], false, ""); } printFooter(); } else { dump("HOBA: No YEOLDE session found"); printLoginFailure(); } } else { dump("HOBA: No cookie set");
dump("HOBA: Got cookie login failed"); printLoginFailure(); exit(1); } } dbLogin(); // Test for cookies if (isset($_COOKIE['HOBA'])) { dump("HOBA: Got cookie for " . $_COOKIE['HOBA']); $err = true; $dev = dbGetDeviceByCookie($_COOKIE['HOBA']); if ($dev) { if (isset($_POST['uName'])) { $err = dbSetUserName($dev['uid'], $_POST['uName']); } elseif (isset($_POST['msg'])) { $err = dbAddMsg($dev['uid'], $_POST['msg']); } elseif (isset($_POST['bondAttempt'])) { $err = dbRequestBond($dev['did'], $_POST['bondAttemptTarget']); } elseif (isset($_POST['bondConfirm'])) { if ($_POST['bondMe'] === "false") { $err = dbDeleteBond($_POST['bondConfirmSource'], $dev['uid']); } elseif ($_POST['bondMe'] === "true") { $err = dbConfirmBond($_POST['bondConfirmSource'], $dev['uid']); } } printHeader(); if ($err !== true) { dump($err); printMeat($dev['did'], $err); } else { printMeat($dev['did'], "");