xyn Posted July 15, 2007 Share Posted July 15, 2007 hey, I'm having a problem with my define, basicallyon my login page i have defined LOGIN_MESSAGE to say "please login below:" however when the user logs out it says "you have logged out" Well when i do the login if the user fails to login due to incorrect user or pass i wanted to change the LOGIN_MESSAGE with the error messages. but it doesnt display correctly. Either the message is the "please login" or it shows "please login" then the error message! My code: $sql_load_files = mysql_query("SELECT `name`,`value` FROM `panel_templates`"); while(list($name, $value) = mysql_fetch_array($sql_load_files)) { switch($_GET['action']) { case logged_out: $value = "You've successfully logged out!"; break; default: $value = $value; } define(strtoupper($name), nl2br($value)); } if(!isset($_POST['send'])) { include("templates/" . TEMPLATE . "/login.php"); } else { $sql_login = mysql_query("SELECT * FROM `panel_accounts` WHERE `username`='".i_var($_POST['username'])."' AND `password`='".md5(md5(i_var($_POST['password'])))."'"); if(!mysql_num_rows($sql_login)) { $error = "<div id=\"error\">Error:<br>"; $error.= "- Incorrect username / password combination."; $error.= "</div><br>"; define("LOGIN_MESSAGE", $error); include("templates/" . TEMPLATE . "/login.php"); } else { //check users ban //set sessions echo('correct'); } } Quote Link to comment Share on other sites More sharing options...
Oldiesmann Posted July 15, 2007 Share Posted July 15, 2007 Once a constant is defined' date=' it can never be changed or undefined.[/quote'] Your best bet here is to use a session variable ($_SESSION['login_message']). Quote Link to comment Share on other sites More sharing options...
xyn Posted July 15, 2007 Author Share Posted July 15, 2007 True; well i'm trying to avoid sessions atm... I will use your method if i have nothing else. lol thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.