Jump to content

Need help! php/html login script


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
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

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.