Jump to content

Need help! php/html login script


MichaelPerdaens

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
https://forums.phpfreaks.com/topic/292395-need-help-phphtml-login-script/
Share on other sites

Stop right here.  Start over with either mysqli_* functions or the PDO functions.  Do Not User MySQL_* functions.  Read the manual!!!

 

Have you done any research of your own in your attempt to become a programmer?  It would behoove you to do so.

What I Mean Is - Read some and try and learn a bit.  It will help you learn.  Start with the php manual and read about how you are NOT SUPPOSED TO USE MYSQL anymore.  Click here:

 

http://php.net/manual/en/function.mysql-query.php

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.