MichaelPerdaens Posted November 10, 2014 Share Posted November 10, 2014 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> Quote Link to comment https://forums.phpfreaks.com/topic/292395-need-help-phphtml-login-script/ Share on other sites More sharing options...
Solution Ch0cu3r Posted November 10, 2014 Solution Share Posted November 10, 2014 it need to check the database Then you need to connect to your database and run an sql query to fetch the data you require Do you know how to do that? Quote Link to comment https://forums.phpfreaks.com/topic/292395-need-help-phphtml-login-script/#findComment-1496261 Share on other sites More sharing options...
MichaelPerdaens Posted November 10, 2014 Author Share Posted November 10, 2014 (edited) No sorry can u help with that? Edited November 10, 2014 by MichaelPerdaens Quote Link to comment https://forums.phpfreaks.com/topic/292395-need-help-phphtml-login-script/#findComment-1496265 Share on other sites More sharing options...
ginerjm Posted November 10, 2014 Share Posted November 10, 2014 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. Quote Link to comment https://forums.phpfreaks.com/topic/292395-need-help-phphtml-login-script/#findComment-1496278 Share on other sites More sharing options...
MichaelPerdaens Posted November 10, 2014 Author Share Posted November 10, 2014 Ginerjm what do u mean?? Quote Link to comment https://forums.phpfreaks.com/topic/292395-need-help-phphtml-login-script/#findComment-1496280 Share on other sites More sharing options...
Strider64 Posted November 10, 2014 Share Posted November 10, 2014 A good place to start -> http://php.net/manual/en/pdo.prepared-statements.php Quote Link to comment https://forums.phpfreaks.com/topic/292395-need-help-phphtml-login-script/#findComment-1496281 Share on other sites More sharing options...
MichaelPerdaens Posted November 11, 2014 Author Share Posted November 11, 2014 Then you need to connect to your database and run an sql query to fetch the data you require Do you know how to do that? no can u help me with that? Quote Link to comment https://forums.phpfreaks.com/topic/292395-need-help-phphtml-login-script/#findComment-1496305 Share on other sites More sharing options...
ginerjm Posted November 11, 2014 Share Posted November 11, 2014 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 Quote Link to comment https://forums.phpfreaks.com/topic/292395-need-help-phphtml-login-script/#findComment-1496317 Share on other sites More sharing options...
MichaelPerdaens Posted November 11, 2014 Author Share Posted November 11, 2014 Ok my friend (game designer) have fixed ut but thanks for ur help guys Quote Link to comment https://forums.phpfreaks.com/topic/292395-need-help-phphtml-login-script/#findComment-1496353 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.