function draw_login($key = false) { global $title, $menu, $body, $onload; global $error; $page = mqpost('page'); if ($page == 'register') { return draw_register($key); } $menu = ''; $onload = "document.forms[0].passphrase.focus()"; $body = <<<EOT <form method="post" action="./" autocomplete="off"> <input type="hidden" name="cmd" value="login"/> <table> <tr> <td><b>Passphrase:</b></td> <td><input type="password" name="passphrase" size="50"/> <input type="submit" name="login" value="Login"/></td> </tr><tr> <td></td> <td style="color: red">{$error} </td> </tr> </table> <a href="./?cmd=register">Register a new account</a> </form> EOT; }
function do_history() { global $client; // Delete or set nickname values $delete = mqpost('delete'); $deleteolder = mqpost('deleteolder'); $chkcnt = mqpost('chkcnt'); $nickcnt = mqpost('nickcnt'); // Scroller values $top = mqpost('top'); $pageup = mqpost('pageup'); $show = mqpost('show'); $pagedown = mqpost('pagedown'); $bottom = mqpost('bottom'); $start = mqpost('start'); $count = mqpost('count'); $cnt = mqpost('cnt'); if ($delete || $deleteolder) { for ($i = 0; $i < $nickcnt; $i++) { $nick = mqpost("nick{$i}"); if ($nick) { $id = mqpost("nickid{$i}"); $client->addcontact($id, $nick); } } for ($i = 0; $i < $chkcnt; $i++) { $chk = mqpost("chk{$i}"); if ($chk) { $deltime = mqpost("time{$i}"); if ($delete) { $client->removehistoryitem($deltime); } elseif ($deleteolder) { $times = $client->gethistorytimes(); foreach ($times as $time) { if (bccomp($deltime, $time) >= 0) { $found = true; $client->removehistoryitem($time); } } break; } } } } else { if ($top) { $start = 1; } elseif ($pageup) { $start -= $count; } elseif ($pagedown) { $start += $count; } elseif ($bottom) { $start = $cnt - $count + 1; } if ($start < 1) { $start = 1; } elseif ($start > $cnt) { $start = $cnt - $cnt % $count + 1; if ($start > $cnt) { $start = $cnt - $count + 1; } if ($start < 1) { $start = 1; } } $this->historycount($count); } $this->draw_history($start, $count); }