Advertisement
Guest User

Untitled

a guest
May 7th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. @@Here's the login page ...
  2.  
  3. <?php
  4. ob_start();
  5.  
  6. // stop errors on multiple session_start()
  7. if(session_id() == '') session_start();
  8.  
  9. header("Cache-control: private"); // IE 6 Fix.
  10. require_once 'functions.php';
  11. require_once 'lang.php';
  12. $config = SXConfig();
  13. include 'header.php';
  14.  
  15. ?>
  16. <div id="content" class="login">
  17. <form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
  18. <p><label for="username">Username:</label> <input type="text" name="username" id="username" /></p>
  19. <p><label for="password">Password:</label> <input type="password" name="password" id="password" /></p>
  20. <p><input type="submit" class="submit button" value="Login" /></p>
  21. </form>
  22. <p class="request"><a href="pwd-request.php">Request new password</a></p>
  23. <?php
  24. $auth=0;
  25.  
  26. if($_POST) {
  27. $error = SXLoginCheck($_POST,$config['prefix']);
  28. if (trim($error)=='') {
  29. list($_SESSION['member_id'],$_SESSION['username'],$_SESSION['full_name'],$_SESSION['super_user']) = SXUserLogin($_POST,$config['prefix']);
  30. header("Location: ".$config['uri'].$config['path']."admin/add.php");
  31. exit;
  32. }
  33. else {
  34. echo '<p class="error">'.$error.'</p>';
  35. $_POST['password'] = '';
  36. include 'footer.php';
  37. exit;
  38. }
  39. }
  40. include 'footer.php';
  41. ob_end_flush();
  42.  
  43. ?>
  44.  
  45. @@Then on any other pages, SXAuthenticate is called to make sure the user is logged in, which is where I think the problem is.
  46.  
  47. function SXAuthenticate() {
  48. global $txt;
  49. if (!isset($_SESSION['member_id']) || ($_SESSION['member_id'] == '')) {
  50. echo $txt[11];
  51. exit;
  52. }
  53. }
  54.  
  55. @@This is from Saxon News if anybody uses it, by the way.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement