Advertisement
Guest User

Untitled

a guest
Aug 9th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. function theHeader(){
  2.  
  3. /*
  4. Author: B Hallock
  5. Purpose: The site header
  6. */
  7.  
  8.  
  9. $fonts = array("Times", "Verdana", "Georgia");//array for font setting purposes
  10.  
  11.  
  12. echo '<header><a href="index.php"><img src="images/votewiser.png" width="300" height="150" alt="Logo"/></a>';
  13.  
  14. if($_SESSION['loggedInFlag']!='yes') { // if the user is not logged in, display the login form
  15.  
  16. echo '<form action="functions/action_login.php" method="post"><fieldset><ul class="credentials"><li>';
  17. checkErrors();
  18.  
  19. if(isset($_SESSION['eArray'])) {
  20. if(isset($_SESSION['eArray']['username'])) {
  21. echo $_SESSION['eArray']['username'];
  22. }
  23. } //displays an error div if username is incorrect
  24.  
  25. echo '<label>Username: </label> <input type="text" name="username" /></li>';
  26.  
  27. echo '<li>';
  28.  
  29. if(isset($_SESSION['eArray'])) {
  30. if(isset($_SESSION['eArray']['password'])) {
  31. echo $_SESSION['eArray']['password'];
  32. }
  33. } //displays an error div if the password is incorrect
  34.  
  35.  
  36. echo '<label>Password: </label><input type="password" name="password" /></li><li><label>Font:</label><select name="font">';
  37.  
  38. foreach($fonts as $k => $v){ echo '<option value="'.$v.'">'.$v.'</option>'; }//generates the font selection dropdown from the $fonts array
  39.  
  40. echo '</select></li><li><input name="Login" type="submit" value="Submit" /></li></ul></fieldset></form></header>';
  41.  
  42. } else { //if the user is logged in, display the logout button and navigation
  43.  
  44. echo '<form action="functions/action_logout.php" method="post">'; //logs the user out
  45. echo '<ul><li>&nbsp;</li><li>&nbsp;</li><li><input name="Logout" type="submit" value="Logout" /></li></ul></form>';
  46. theNavigation();
  47. checkErrors();
  48. echo '</header>';
  49. } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement