Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    login script not working

    I inherited a game from a friend and have been messing around with it. Her style of PHP coding and mine are different and I just don't understand what is going on in here. When I attempt to login, I go to a blank screen - won't even get an error. Help?

    All the tables are properly named in the code, I just changed them to 'table' here.

    PHP Code:
    <?php include('include/db.php');

    if (!
    $_SESSION["user"]){
    if (isset(
    $_POST['login'])){
     if (!
    $_POST['username'] || !$_POST['password']){
     echo 
    "Please make sure you have entered a username and password.";
     }
     
    $username $_POST['username'];
    $password md5($_POST['password']);

    $getinfo mysql_query("SELECT * FROM table WHERE username='$username' AND password='$password'"
    or die(
    mysql_error());  

      if(
    $log == mysql_fetch_object($getinfo)){
      
    $_SESSION["user"] = $_POST['username'];
      
    $ip=$_SERVER['REMOTE_ADDR'];
      
    $time=date("H:i:s");

      
    $updateip mysql_query("UPDATE table SET ip='$ip' WHERE username='".$_SESSION['user']."'"
      or die(
    mysql_error()); 

      
    $getidd mysql_query("SELECT * FROM table WHERE username='$username'"
      or die(
    mysql_error());  
      
    $getid mysql_fetch_array$getidd );

      
    mysql_query("INSERT INTO table(username, time, id) VALUES('$username', '$time', '".$getid['id']."' ) ");  


      
    header("Location: news.php");
      }
     else
      {
      
    $error "Wrong username or password.";
      }
    }
    }
    ?>

  • #2
    New Coder
    Join Date
    Aug 2010
    Location
    myeik
    Posts
    81
    Thanks
    6
    Thanked 5 Times in 5 Posts
    what error is showing and
    make sure yourdatabasename in db.php

  • #3
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I already said what it was doing: it was going to a blank page.
    I think I got it figured out as it's something to do with my host, not the code.

  • #4
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,389
    Thanks
    8
    Thanked 1,077 Times in 1,068 Posts
    A blank page means you have a PHP script error,
    but you have PHP error reporting turned off.
    You need to enable error reporting to see what
    the error is, and which line is the problem.

    Google: PHP error reporting

    Then tell us what your error says.

  • #5
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts
    header: Location('news.php');
    Do you have any scripts on this page?
    Coding is a challenge, get used to it
    Always remember to debug
    Try the guess & check method
    Break it down into simple steps


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •