Public paste
Sletjes
By: Hoer | Date: Aug 1 2007 19:20 | Format: None | Expires: never | Size: 1.09 KB | Hits: 1236

  1. Function LoggedIn() { // TRUE or FALSE method for  checking is person exists and is active.
  2.                 $Query = @Mysql_Query("SELECT User,Password FROM `members` WHERE User='".$_SESSION['User']."' AND password='".$_SESSION['Password']."' LIMIT 1");
  3.                     $dbQ = mysql_fetch_object($Query);
  4.                     // For ipcheck
  5.                                 $ip = $_SERVER["REMOTE_ADDR"];
  6.                                 $ipc = $_SESSION['IP'];        
  7.                 If(Mysql_Num_Rows($Query) == 1){
  8.                         return TRUE;
  9.                 } ElseIf($ip == $ipc) {
  10.                         return TRUE;   
  11.                 } Else {
  12.                         return FALSE;
  13.                 }
  14.  
  15.         }
  16. Function LogInCheck() { // Put LogInCheck(); on every page that you want to close for members (like signup, activate)
  17.  If(LoggedIn() != TRUE){
  18.                 Top("Error");
  19.                         echo "U bent al ingelogd. U wordt teruggestuurd naar de index pagina.";
  20.                 Bottom();
  21.                                 echo '<meta http-equiv="refresh" content="5;url=index.php">';
  22.                         exit();
  23.  }
  24. }
  25. Function LogInCheckElse() {
  26.  If(LoggedIn()){
  27.                 Top("Error");
  28.                         echo "U bent al ingelogd. U wordt teruggestuurd naar de index pagina.";
  29.                 Bottom();
  30.                                 echo '<meta http-equiv="refresh" content="5;url=index.php">';
  31.                         exit();
  32.  }
  33. }