Jump to content

login sample script


dannyd

Recommended Posts

    <?PHP

   

    if (isset($_POST['submit']) && isset($_POST['username']) && $_POST['username']=="admin" && isset($_POST['password']) && $_POST['password']=="admin") {

   

      echo 'success';

    }

    ?>

    <html><body>

    <table width="980" height="500"><tr valign="middle"><td align="center">

  <form method="post" action="http://zenit.senecac.on.ca/~php701_081sa20/assn1/login.php"><b>User Name:</b>        

  <input type="text" name="username" size="20">

  <b>Password:</b>        <input type="text" name="password" size="20"></form>

  <input type="submit" value="submit" name="submit"></td></tr></table>

  </body></html>

 

 

This doesnt seem to work. Its just a script that if the user enters their login and pass as admin it says success. Just trying to practice some PHP .. any help ?

Link to comment
https://forums.phpfreaks.com/topic/93388-login-sample-script/
Share on other sites

<?php
$submit = $_REQUEST['Submit'];
if($submit == "Login")
{

if ((!$_POST[username]) ||  (!$_POST[password]))
{
            echo "Please fill-up all the required fields!";
        }
        elseif (($_REQUEST['username'] == "admin") && ($_REQUEST['password'] == "password"))
        {
            echo"Success! You may proceed!";
        }
        else
        {
            echo"Invalid username / password!";
        }
}
?>

Link to comment
https://forums.phpfreaks.com/topic/93388-login-sample-script/#findComment-478644
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.