Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("../includes/config.php");
- session_start();
- if(isset($_POST['go'])){
- $username = $_POST['username'];
- $password = $_POST['password'];
- if(empty($username) || empty($password)){
- echo "<center><b>Please Enter Both Fields!</b></center>";
- die();
- }
- $login_info = "SELECT * from users WHERE username = '$username'";
- $run_login_info = mysql_query($login_info);
- $numrow = mysql_num_rows($run_login_info);
- if ($numrow !== 0) {
- while ($row = mysql_fetch_assoc($run_login_info)) {
- $dbusername = $row['username'];
- $dbpassword = $row['password'];
- }
- // check username and password
- if ($username==$dbusername && $password == $dbpassword) {
- $_SESSION['username'] == $username;
- $_SESSION['password'] == $password;
- }
- else{
- die("<b><center>Incorrect Username Or Password!</center></b>");
- }
- }
- else{
- die("<center><b>Invalid Username Or Password!</b></center>");
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement