S SUNRAI Eternal Poster Joined Feb 1, 2018 Posts 515 Reaction 59 Points 349 Age 23 Jun 25, 2021 #1 Pa help naman po kung anong magiging itsura neto new lang po ako sa php Attachments You do not have permission to view the full content of this post. Log in or register now.
D donteatmeat Forum Expert Jun 25, 2021 #2 ito basic.. script PHP: if (something) { // member 1 } elseif(something){ // member 2 } elseif(something){ // member 3 } else { // if member 1,2,3 not found // do something }
ito basic.. script PHP: if (something) { // member 1 } elseif(something){ // member 2 } elseif(something){ // member 3 } else { // if member 1,2,3 not found // do something }
S SUNRAI Eternal Poster Jun 25, 2021 TS TS #3 PHP: <?php $username1 = "username1"; $password1 = "password1"; $username2 = "username2"; $password2 = "password2"; $username3 = "username3"; $password3 = "password3"; if (username1) { //first user echo "Authorization Accepted!"; } elseif(username2){ //second user echo "Authorization Accepted!"; } elseif(username3){ //third user echo "Authorization Accepted!"; } else { //if member 1,2,3 not found echo "Authorization denied!"; } ?> <html> <body> <form method= "post"> <input type= "user" name= 'username' /> <input type= "password" name= 'password' /> <input type= "submit" name= 'login' value ='login' /> </form > </body> </html> Ok lang po ba ginagawa ko idle
PHP: <?php $username1 = "username1"; $password1 = "password1"; $username2 = "username2"; $password2 = "password2"; $username3 = "username3"; $password3 = "password3"; if (username1) { //first user echo "Authorization Accepted!"; } elseif(username2){ //second user echo "Authorization Accepted!"; } elseif(username3){ //third user echo "Authorization Accepted!"; } else { //if member 1,2,3 not found echo "Authorization denied!"; } ?> <html> <body> <form method= "post"> <input type= "user" name= 'username' /> <input type= "password" name= 'password' /> <input type= "submit" name= 'login' value ='login' /> </form > </body> </html> Ok lang po ba ginagawa ko idle
A Arjienx Moonlit Revolution Contributor Jun 25, 2021 #4 [XX='SUNRAI, c: 1318243, m: 1073865'][/XX] okay to kulang lng ng password.
2 2pepot Forum Veteran Elite Jun 25, 2021 #5 Try mo to TS [CODE lang="php" title="Simple login using conditional statements"]<?php $username1 = "ben"; $password1 = "benpass"; $username2 = "tom"; $password2 = "tompass"; $username3 = "kim"; $password3 = "kimpass"; if (isset($_POST['username']) && isset($_POST['password'])) { if ($_POST['username'] == $username1 && $_POST['password'] == $password1) { //first user echo "Authorization Accepted. <b>$username1</b> login successfully."; } elseif ($_POST['username'] == $username2 && $_POST['password'] == $password2) { //second user echo "Authorization Accepted. <b>$username2</b> login successfully."; } elseif ($_POST['username'] == $username3 && $_POST['password'] == $password3) { //third user echo "Authorization Accepted. <b>$username3</b> login successfully."; } else { //if member 1,2,3 not found echo 'Authorization denied!'; } } else { echo 'Please enter username and password to login'; } ?> <html> <body> <form name="login" action="" method="post"> <input type="text" name="username" /> <input type= "password" name="password" /> <input type= "submit" name="login" value="login" /> </form > </body> </html>[/CODE] Last edited: Jun 25, 2021
Try mo to TS [CODE lang="php" title="Simple login using conditional statements"]<?php $username1 = "ben"; $password1 = "benpass"; $username2 = "tom"; $password2 = "tompass"; $username3 = "kim"; $password3 = "kimpass"; if (isset($_POST['username']) && isset($_POST['password'])) { if ($_POST['username'] == $username1 && $_POST['password'] == $password1) { //first user echo "Authorization Accepted. <b>$username1</b> login successfully."; } elseif ($_POST['username'] == $username2 && $_POST['password'] == $password2) { //second user echo "Authorization Accepted. <b>$username2</b> login successfully."; } elseif ($_POST['username'] == $username3 && $_POST['password'] == $password3) { //third user echo "Authorization Accepted. <b>$username3</b> login successfully."; } else { //if member 1,2,3 not found echo 'Authorization denied!'; } } else { echo 'Please enter username and password to login'; } ?> <html> <body> <form name="login" action="" method="post"> <input type="text" name="username" /> <input type= "password" name="password" /> <input type= "submit" name="login" value="login" /> </form > </body> </html>[/CODE]