cordoprod Posted September 25, 2007 Share Posted September 25, 2007 Hi. First of all: THIS IS FLATFILE! I'm developing a big news system. There is just a little problem, in my multi-user suspend function. It won't say "you're suspended", it just log the user in. Here is my code: (If you need more explanation, tell me) $login_user = $_POST['user']; $login_pass = $_POST['pass']; if($_POST['remember'] == "on") set_cookie("ln_username", $login_user, "month"); if($_POST['remember'] == "on") set_cookie("ln_password", $login_pass, "month"); $user_db = file("./data/users.php"); foreach($user_db as $user_db_line) { if(!eregi("<\?",$user_db_line)){ $col = explode("|",$user_db_line); if(strtolower($col[1]) == strtolower($login_user) && $col[2] == $login_pass) { $file = file($UsersFile); $suspended = false; foreach($file as $db) { $a2 = explode("|", $db); $now = time(); if($a2[5] <= $now) { $file = file($UsersFile); $line = 0; while($file[$line]) { $a = explode("|", $file[$line]); if ($a[1] == $user) { $a[5] = ""; $file[$line] = implode($a, "|"); } $line++; } $a = implode($file, ""); $fp = fopen($UsersFile, "w"); fwrite($fp, $a); fclose($fp); $suspended = false; } else { $suspended = true; } } if($suspended) { die("suspended"); break; } else { $_SESSION['logged_in'] = true; $_SESSION['username'] = $col[1]; $_SESSION['level'] = $col[0]; header("Location: index.php"); break; } } else echo("".W_PASS."<br>".BACK.""); } else echo "ERROR"; } Link to comment https://forums.phpfreaks.com/topic/70633-multi-user-system-with-suspend-function-need-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.