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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.