|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
What's wrong with this code?
PHP Code:
I don't understand why this won't work. I type in the correct password but I only get the "Invalid password" response. |
|
#2
|
|||
|
|||
|
Well, $pass must not equal $code1 -- and I don't mean that as glibly as it sounds. An important step in debugging (and not always an easy one) is narrowing the problem.
So the next thing to do is find out what the values of $pass and $code actually are, because they must not be what you think. Before your if check, echo $pass and $code and see which one isn't being set correctly. Then we'll know what piece of code to examine. |
|
#3
|
|||
|
|||
|
Thanks for your reply Madpawn. Ok I echoed $pass and $code1 but they both return the same value "24" (my test password).
The code works when I replace: PHP Code:
with: PHP Code:
I don't understand, it's supposed to work but it doesn't lol. |
|
#4
|
|||
|
|||
|
I can't test this, 'coz I'm not on 4.3, but my guess is you're getting a newline or some such character along with your password from file_get_contents. Try
PHP Code:
before running it through your if. |
|
#5
|
|||
|
|||
|
Hey, I tried the trim command you suggested and it WORKS!
Thanks a bunch Madpawn. ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > What's wrong with this code? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|