Jump to content

Need help! php/html login script


MichaelPerdaens
Go to solution Solved by Ch0cu3r,

Recommended Posts

Hey i need help with my php script.

it need to check the database but now it only check if its not empty

but i don't know what i need to add i hope that us can help me

 <?php 
if ($_SERVER['REQUEST_METHOD'] == 'POST' ) {

$username = trim(htmlentities(mysql_real_escape_string($_POST['username'])));
$password = trim(htmlentities(mysql_real_escape_string($_POST['password'])));
if (!empty($username) && !empty($password)) {
    $_SESSION['username'] = $username;
    echo "<br/> welcome ", $username;
     } else {
    echo "Please enter correct username or password";
     }   
} else {
    echo "please Login";
}
?>
<h1>Login</h1>
<form ACTION="<?php echo $loginFormAction; ?>" METHOD="POST" name="login_form">
<label>Username:<br/></label>
<input type="text" name="username"><br/>
<label>Password:<br/></label>
<input type="password" name="password"><br/>
<input type="submit" value="Login">
<a href="../register">register</a>
</form>
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.