Login Problems

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Login Problems

    <?php
    //Login To Database
    include("Database.php");
    include("OpenDatabase.php");
    //Get The Functions
    include("Functions.php");
    //The Headers
    header("Content-type: text/html; charset=ISO-8859-1");
    echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
    echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
    ?>

    <?php

    $username=$_GET[&#39;username&#39;];
    $password=$_GET[&#39;password&#39;];

    ////////////////////////////////////////LOGIN!!!

    //Page Title And CSS Theme
    echo FlareXhead($uthm,$stitle);
    echo "<p align=\"center\">";
    echo "".date("D d M y - H:i",time() )."</a>
    ";
    $TimeZone="0"; ////Change the TimeZone accordingly!
    $New_Time = time() + ($TimeZone * 60 * 60);

    $show_date=date("D dS F, Y",$New_Time);
    $show_time=date("H:i",$New_Time);
    $Hour=date("G",$New_Time);
    echo "</p>";
    echo "

    ";
    //Check Password Query
    $check_pass="SELECT Password FROM members WHERE Password=&#39;$password&#39;";
    $check_password=mysql_fetch_array(mysql_query($che ck_pass));
    //Check User Query
    $check_user="SELECT Username FROM members WHERE Username=&#39;$username&#39;";
    $Check_Username=mysql_fetch_array(mysql_query($che ck_user));
    //Sucsessful Login
    if ($username==$check_username)
    {
    if ($password==$check_password)
    {
    echo "==========</a>
    ";
    echo "Username: $username</a>
    ";
    echo "----------</a>
    ";
    echo "Password: $password</a>
    ";
    echo "==========</a>
    ";
    echo "<a href=\"index.php?action=main&username=$username&pa ssword=$password\">Login Now!</a>";
    }
    }else{
    //Incorrect Login
    echo "Your Login Details Are Incorrect";
    echo "</p>";
    //End Page
    echo FlareXfoot();

    }

    ?>


    Its Not Checking If The Login Details Are Correct , Its Just Going To The Else Function And Saying That The Details Is Wrong , Ne1 No Why?

    #2
    <?php
    //Login To Database
    include("Database.php");
    include("OpenDatabase.php");
    //Get The Functions
    include("Functions.php");
    //The Headers
    header("Content-type: text/html; charset=ISO-8859-1");
    echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
    echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
    ?>

    <?php

    $username=$_GET[&#39;username&#39;];
    $password=$_GET[&#39;password&#39;];

    ////////////////////////////////////////LOGIN!!!

    //Page Title And CSS Theme
    echo FlareXhead($uthm,$stitle);
    echo "<p align=\"center\">";
    echo "".date("D d M y - H:i",time() )."</a>
    ";
    $TimeZone="0"; ////Change the TimeZone accordingly!
    $New_Time = time() + ($TimeZone * 60 * 60);

    $show_date=date("D dS F, Y",$New_Time);
    $show_time=date("H:i",$New_Time);
    $Hour=date("G",$New_Time);
    echo "</p>";
    echo "

    ";
    //Check Password Query
    $check_pass="SELECT Password FROM members WHERE Password=&#39;$password&#39;";
    $check_password=mysql_fetch_array(mysql_query($che ck_pass));
    //Check User Query
    $check_user="SELECT Username FROM members WHERE Username=&#39;$username&#39;";
    $Check_Username=mysql_fetch_array(mysql_query($che ck_user));
    //Sucsessful Login
    if ($username==$check_username)
    {
    if ($password==$check_password)
    {
    echo "==========</a>
    ";
    echo "Username: $username</a>
    ";
    echo "----------</a>
    ";
    echo "Password: $password</a>
    ";
    echo "==========</a>
    ";
    echo "<a href=\"index.php?action=main&username=$username&pa ssword=$password\">Login Now!</a>";
    }
    }else{
    //Incorrect Login
    echo "Your Login Details Are Incorrect";
    echo "</p>";
    //End Page
    echo FlareXfoot();

    }

    ?>
    Its Not Checking If The Login Details Are Correct , Its Just Going To The Else Function And Saying That The Details Is Wrong , Ne1 No Why?[/b]

    are your include files correct. ie the database name and passwords etc.
    Wapchat4u


    Topsites4u

    Comment


      #3
      the most likely problem is the name of the database table being incorrect ..
      by the sounds of it, you are able to connect to the database okay, thus indicating that your name+password are correct, but if the name of the database table is correct it would show this kind of error


      woah .. err .. that code is really dodgy :/ try this code but edit a few of the links

      you need to fix your sql codes,
      i also noticed on the script above it said $Check_Username which is different to $check_username
      i also question why your code displays the login boxes if the username and pass DO match??


      the script below counts how many rows in the database have Username = $username
      if the username cant be found, displays an error message saying the username is incorrect
      if the username is found, check if there is an entry with that username AND password combination
      elseif the username and password combination cannot be found, display an error message saying the password is incorrect (the username must exist if they have gotten this far)
      elseif the username + password are correct, show the login successful page


      Code:
      <?php
      //Login To Database
      include("Database.php");
      include("OpenDatabase.php");
      
      //Get The Functions
      include("Functions.php");
      
      //The Headers
      header("Content-type: text/html; charset=ISO-8859-1");
      
      echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
      echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
      
      $username=$_GET[&#39;username&#39;];
      $password=$_GET[&#39;password&#39;];
      
      ////////////////////////////////////////LOGIN!!!
      
      //Page Title And CSS Theme
      echo FlareXhead($uthm,$stitle);
      
      /*
      echo "<p align=\"center\">";
      $TimeZone="0"; ////Change the TimeZone accordingly!
      $New_Time = time() + ($TimeZone * 60 * 60);
      
      $show_date=date("D dS F, Y",$New_Time); 
      $show_time=date("H:i",$New_Time); 
      $Hour=date("G",$New_Time);
      
      echo "[size="1"]".date("D d M y)." - $show_time </a>[/size]
      ";
      echo "</p>";
      */
      
      echo "
      
      ";
      
      // check if the username and password have been filled in, if they havent, then show the login box
      if (($username == "") && ($password == "")){
      
      echo "==========</a>
      ";
      echo "Username: [b]$username[/b]</a>
      ";
      echo "----------</a>
      ";
      echo "Password: [b]$password[/b]</a>
      ";
      echo "==========</a>
      ";
      echo "<a href=\"**LOGIN URL**.php?action=**LOGIN**&username=$username&password=$password\">Login Now!</a>";
      
      }else{
      
      //check the username by counting how many matching rows exist 
      $check_username = mysql_query("SELECT COUNT(*) FROM members WHERE Username=&#39;".$username."&#39;");
      $check_password = mysql_query("SELECT COUNT(*) FROM members WHERE Username=&#39;".$username."&#39; AND Password=&#39;".$password."&#39; ");
      
      // if username does not exist or is blank, then show error output
        if ((!$check_username > 0) || ($username == "")){
      echo "username cannot be found or you have entered a blank input
      ";
        }
      // elseif check whether the username/password combination exist in the database or the password input is blank
        if ((!$check_password == "1") || ($password == "")){
      echo "password is incorrect or you have entered a blank input
      ";
        }
      // elseif double check that the combo does exist .. if the username and pass are in the database, show the successful login page
       elseif($check_password == "1"){
      echo "LOGIN PAGE 
      LOGIN PAGE 
      ";
      echo "you have successfully been logged in
      ";
      echo "<a href=\"**LINK URL**\">LOGIN</a>
      ";
      echo "LOGIN PAGE 
      LOGIN PAGE 
      ";
        }
      // if for some odd reason none of those fit -- should never occur
      else {
      echo "there was an error somewhere - please report this to the site owner including any details about what you may have done to cause this error";
        }
      
      }
      echo "</p>";
      echo "</card>";
      ?>
      </wml>

      Comment


        #4
        Close This Topic , I Fixed The Problem

        Comment


          #5
          sure thing

          Comment

          Working...
          X