Jump to content

[SOLVED] define issues!


xyn

Recommended Posts

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');
	}
}

Link to comment
https://forums.phpfreaks.com/topic/60096-solved-define-issues/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.