Jump to content

Incorrect password message


rizmah

Recommended Posts

So I am trying to make an incorrect password message but the message never appears.

My code:

<?
require "./includes/config.php";
$LS->init();
if(isset($_POST['act_login'])){
 $user=$_POST['login'];
 $pass=$_POST['pass'];
 if($user=="" || $pass==""){
   $msg=array("Error", "Username / Password Wrong !");
 }
 else
 {
  if(!$LS->login($user, $pass)){
   $msg=array("Error", "Username / Password Wrong !");
  }
 }
}
?>
Link to comment
Share on other sites

How are we supposed to help you with this smattering of code? This code will produce a value in $msg if the user or password is missing (not invalid). It will also give you a message if the LS method returns a false value. All of this based on the assumption that something named act_login in your form exists.

 

What do you want US to do? You haven't given us anything to analyze for you.

 

PS - Why are you storing your error message as an array anyway?

Link to comment
Share on other sites

How are we supposed to help you with this smattering of code? This code will produce a value in $msg if the user or password is missing (not invalid). It will also give you a message if the LS method returns a false value. All of this based on the assumption that something named act_login in your form exists.

 

What do you want US to do? You haven't given us anything to analyze for you.

 

PS - Why are you storing your error message as an array anyway?

SOrry I am a newb, what other code do you want?

 

This is a pre-made login system that I am modifying.

Link to comment
Share on other sites

Silly question perhaps.

 

Are you seriously just asking us to tell you why "the message never appears"? Answer: because you never output it.

 

Add this to your code:

if ($msg <> '')
{
   echo $msg;
   exit();
}

With the code you provided, I got a white screen with "Array" on it.

Link to comment
Share on other sites

Oops. Forgot that you created $msg as an array. Why did you do that (as I asked before)?

 

Change your $msg text to something more appropriate such as $msg = "my new message" and then you'll get the message. Unless you have some real reason for creating the $msg as an array.

Link to comment
Share on other sites

Oops. Forgot that you created $msg as an array. Why did you do that (as I asked before)?

 

Change your $msg text to something more appropriate such as $msg = "my new message" and then you'll get the message. Unless you have some real reason for creating the $msg as an array.

"This is a pre-made login system that I am modifying."

Link to comment
Share on other sites

So?? The code you posted is certainly not "pre-made". Perhaps the call to that LS class method is "pre-made" but you're not showing us that so I'm assuming that you are not tampering with that. So - you have some code that YOU written to create and display an error message. And YOU needed to display it, so I showed you how to output it. Since YOU have added this new code and since YOU are trying to display it, why are YOU creating this new $msg as an array?

Link to comment
Share on other sites

Hey - nice language. At least you know how to speak foul language and don't need help with that. Now put your brains to use and TELL US WHAT YOU EXPECT US TO DO FOR YOU!

 

Or I could just go away instead of trying to help a guy who doesn't know how to ask or answer a question properly.

 

Ball's in your court. Play it smart.

Link to comment
Share on other sites

Hey - nice language. At least you know how to speak foul language and don't need help with that. Now put your brains to use and TELL US WHAT YOU EXPECT US TO DO FOR YOU!

 

Or I could just go away instead of trying to help a guy who doesn't know how to ask or answer a question properly.

 

Ball's in your court. Play it smart.

You can go away.

Link to comment
Share on other sites

Perhaps you should too. Re-think what you are asking for help with and then tell the next person what your perceived coding problem is and show them the code that 'doesn't work'. You certainly didn't do that with this post.

 

Forums can only help those who can communicate (in respectable language) their problem(s). Good luck to you young man.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.