Commit final.
[CLab.git] / main.php
blobf7a32c3f6029286ddac66e51364ef5771a4a41bd
1 <?
2 /**
3 * Main.php
4 */
5 include("include/session.php");
6 ?>
8 <html>
9 <title>Jpmaster77's Login Script</title>
10 <body>
12 <table>
13 <tr><td>
17 /**
18 * User has already logged in, so display relavent links, including
19 * a link to the admin center if the user is an administrator.
21 if($session->logged_in){
22 echo "<h2>Logged In</h2>";
23 echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
24 ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] &nbsp;&nbsp;"
25 ."[<a href=\"useredit.php\">Edit Account</a>] &nbsp;&nbsp;";
26 if($session->isAdmin()){
27 echo "[<a href=\"admin/admin.php\">Admin Center</a>] &nbsp;&nbsp;";
29 echo "[<a href=\"process.php\">Logout</a>]";
31 else{
34 <h2>Login</h2>
36 /**
37 * User not logged in, display the login form.
38 * If user has already tried to login, but errors were
39 * found, display the total number of errors.
40 * If errors occurred, they will be displayed.
42 if($form->num_errors > 0){
43 echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
46 <form action="process.php" method="POST">
47 <table align="left" border="0" cellspacing="0" cellpadding="3">
48 <tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
49 <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
50 <tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
51 <font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
52 <input type="hidden" name="sublogin" value="1">
53 <input type="submit" value="Login"></td></tr>
54 <tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
55 <tr><td colspan="2" align="left"><br>Not registered? <a href="register.php">Sign-Up!</a></td></tr>
56 </table>
57 </form>
62 /**
63 * Just a little page footer, tells how many registered members
64 * there are, how many users currently logged in and viewing site,
65 * and how many guests viewing site. Active users are displayed,
66 * with link to their user information.
68 echo "</td></tr><tr><td align=\"center\"><br><br>";
69 echo "<b>Member Total:</b> ".$database->getNumMembers()."<br>";
70 echo "There are $database->num_active_users registered members and ";
71 echo "$database->num_active_guests guests viewing the site.<br><br>";
73 include("include/view_active.php");
78 </td></tr>
79 </table>
82 </body>
83 </html>