Jump to content

Recommended Posts

No errors, but it doesn't actually start the login session for some reason.

 

<?php

    echo "<a href=\"./login.php\">Login</a> | <a href=\"./register.php\">Register</a>\n";

?>

 

<html>

<head>

<title>Zoofu.net | Login</title>

<center>

<img src="http://roquarters.usersboard.com/users/a4/41/84/33/album/zooful10.png" />

</center>

</head>

<body>

 

<style type="text/css">

body {

    background-color:#EEE;

    color:#000;

    font-family:Tahoma;

    font-size:10pt;

</style>

 

</body>

</html>

<?php

echo "<center><a href=\"./home.php\" >Home</a></center>"

?>

 

<?php

include "global.php";

 

if($_SESSION['uid']){

  echo "<center>You are already logged in, <a href=\"./logout.php\">logout</a>?</center>\n";

}else {

 

if(!$_POST['submit']){//1

      echo "<center><table border=\"0\" cellspacing=\"3\" cellpadding=\"3\"></center>\n";

        echo "<center><form method=\"post\" action=\"./login.php\"></center>\n";

        echo "<center><tr><td>Username</td><td><input type=\"text\" name=\"username\"></td></tr></center>\n";

        echo "<center><tr><td>Password</td><td><input type=\"password\" name=\"password\"></td></tr></center>\n";

        echo "<center><tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"submit\"></td></tr></center>\n";

        echo "<center></form></table></center>\n";

  }else {

      $user = mss($_POST['username']);

      $pass = $_POST['password'];

     

        if($user && $pass){

            $sql = "SELECT id FROM `users` WHERE `username`='".$user."'";

            $res = mysql_query($sql) or die(mysql_error());

            if(mysql_num_rows($res) > 0) {

              $sql2 = "SELECT id FROM `users` WHERE `username`='".$user."' AND `password` ='".md5($pass)."'";

              $res2 = mysql_query($sql2) or die(mysql_error());

              if(mysql_num_rows($res2) > 0){

                  $row = mysql_fetch_assoc($res2);

                  $_SESSION['uid'] = $row['id'];

                 

                  echo "<center>You have logged in successfully! <a href=\"./home.php\">Return To Home</a></center>\n";

              }else {

                  echo "<center>Username or password are incorrect! <a href=\"./login.php\">Retry?</a></center>\n";

              }

        }else {

            echo "<center>The Username you supplied does not exist! <a href=\"./login.php\">Retry?</a></center>\n";

        }

  }else {

      echo "<center>You must fill in all fields! <a href=\"./login.php\">Retry?</a></center>";

  }

 

  }

 

}//1

 

?>

Link to comment
https://forums.phpfreaks.com/topic/168216-login-failure/
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.