rizmah Posted January 1, 2015 Share Posted January 1, 2015 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 !"); } } } ?> Quote Link to comment Share on other sites More sharing options...
ginerjm Posted January 1, 2015 Share Posted January 1, 2015 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? Quote Link to comment Share on other sites More sharing options...
rizmah Posted January 1, 2015 Author Share Posted January 1, 2015 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. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted January 1, 2015 Share Posted January 1, 2015 As I said - the code you posted does what it does. What is wrong with it? Nothing. Why do you think there is something wrong with it? Quote Link to comment Share on other sites More sharing options...
rizmah Posted January 1, 2015 Author Share Posted January 1, 2015 As I said - the code you posted does what it does. What is wrong with it? Nothing. Why do you think there is something wrong with it? Because it is meant to display the text but it doesn't when a attempt to login. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted January 1, 2015 Share Posted January 1, 2015 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(); } Quote Link to comment Share on other sites More sharing options...
rizmah Posted January 1, 2015 Author Share Posted January 1, 2015 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. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted January 1, 2015 Share Posted January 1, 2015 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. Quote Link to comment Share on other sites More sharing options...
rizmah Posted January 1, 2015 Author Share Posted January 1, 2015 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." Quote Link to comment Share on other sites More sharing options...
ginerjm Posted January 1, 2015 Share Posted January 1, 2015 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? Quote Link to comment Share on other sites More sharing options...
ginerjm Posted January 1, 2015 Share Posted January 1, 2015 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. Quote Link to comment Share on other sites More sharing options...
rizmah Posted January 1, 2015 Author Share Posted January 1, 2015 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. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted January 1, 2015 Share Posted January 1, 2015 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. 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.