html - php set username and password -


i've been trying set login system, can't set username , password.

<?php session_start(); $user = “u1”; $password = “p1”; if ($_post[‘username’] == $user ) &&     ($_post[‘password’] == $password) {     echo welcome.php; } else echo have entered wrong credentials. ?> 

this illustrative purposes , answer question, understand not secure system , should not used anywhere ever near production environment!

i think might issue how you've set if , else statements, having syntax error echo statement. try this:

<?php session_start(); $user = 'u1'; $password = 'p1'; if ($_post['username'] == $user  && $_post['password'] == $password) {   echo 'successfully logged in'; // changed show successful message } else {   echo 'you have entered wrong credentials.'; // placed quotes around echo statement } ?> 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -