Advertisement
Guest User

Untitled

a guest
Sep 8th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.99 KB | None | 0 0
  1. <?
  2. /**
  3.  * Main.php
  4.  *
  5.  * This is an example of the main page of a website. Here
  6.  * users will be able to login. However, like on most sites
  7.  * the login form doesn't just have to be on the main page,
  8.  * but re-appear on subsequent pages, depending on whether
  9.  * the user has logged in or not.
  10.  *
  11.  * Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
  12.  * Last Updated: August 26, 2004
  13.  */
  14. include("include/session.php");
  15. ?>
  16.  
  17. <html>
  18. <body>
  19.  
  20. <table>
  21. <tr><td>
  22.  
  23.  
  24. <?
  25. /**
  26.  * User has already logged in, so display relavent links, including
  27.  * a link to the admin center if the user is an administrator.
  28.  */
  29. if($session->logged_in){
  30.    echo "<h1>Logged In</h1>";
  31.    echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
  32.        ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] &nbsp;&nbsp;"
  33.        ."[<a href=\"useredit.php\">Edit Account</a>] &nbsp;&nbsp;";
  34.    if($session->isAdmin()){
  35.       echo "[<a href=\"admin/admin.php\">Admin Center</a>] &nbsp;&nbsp;";
  36.    }
  37.    echo "[<a href=\"process.php\">Logout</a>]";
  38. }
  39. else{
  40. ?>
  41.  
  42. <h1>Login</h1>
  43. <?
  44. /**
  45.  * User not logged in, display the login form.
  46.  * If user has already tried to login, but errors were
  47.  * found, display the total number of errors.
  48.  * If errors occurred, they will be displayed.
  49.  */
  50. if($form->num_errors > 0){
  51.    echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
  52. }
  53. ?>
  54. <form action="process.php" method="POST">
  55. <table align="left" border="0" cellspacing="0" cellpadding="3">
  56. <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>
  57. <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>
  58. <tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
  59. <font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
  60. <input type="hidden" name="sublogin" value="1">
  61. <input type="submit" value="Login"></td></tr>
  62. <tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
  63. <tr><td colspan="2" align="left"><br>Not registered? <a href="register.php">Sign-Up!</a></td></tr>
  64. </table>
  65. </form>
  66.  
  67. <?
  68. }
  69.  
  70. /**
  71.  * Just a little page footer, tells how many registered members
  72.  * there are, how many users currently logged in and viewing site,
  73.  * and how many guests viewing site. Active users are displayed,
  74.  * with link to their user information.
  75.  */
  76. echo "</td></tr><tr><td align=\"center\"><br><br>";
  77. echo "<b>Member Total:</b> ".$database->getNumMembers()."<br>";
  78. echo "There are $database->num_active_users registered members and ";
  79. echo "$database->num_active_guests guests viewing the site.<br><br>";
  80.  
  81. include("include/view_active.php");
  82.  
  83. ?>
  84.  
  85.  
  86. </td></tr>
  87. </table>
  88.  
  89.  
  90. </body>
  91. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement