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
Post a Comment