Jump to content

Recommended Posts

Hello.

The first page works, but when form actioning to the next i just get a white screen.

 

This is the white screen page:

 

<?php

session_start();

include 'details.php';

$username = $_POST['username'];
$password = $_POST['password'];

$pwswdrd = md5($password);



if(!empty($_POST['username']))
{
    $query = mysqli_query($con, "SELECT * FROM users where name = '$username' AND pass = '$pwswdrd'") or die(mysqli_connect_error());
        $row = mysqli_fetch_array($query);

if(!empty($row['name']) AND !empty($row['pass']))
    {
$_SESSION['username'] = $row['username'];
$_SESSION['id'] = $row['id'];
                header('Location: index.php');
                                   }



    }
    else
    {
        echo "You failed to log in.";    
}

?>

-

details.php

 

<?php
$one=mysqli_connect('.......webhost.com','aee','aaa') or die("Failed to connect to MySQL: " . mysqli_error() );

$db=mysqli_select_db($one,'aee') or die("Failed to connect to MySQL: " . mysqli_error() );
?>

--

What can possibly be wrong?!

Link to comment
https://forums.phpfreaks.com/topic/292326-white-screen/
Share on other sites

I wouldn't be surprised if you've been attacked in all kinds of ways. You have no security whatsoever. That small code snippet alone already contains two SQL injection vulnerabilities, a completely broken hash algorithm, a completely broken session logic and finally disclosure of database internals through error messages.

 

No, it's not a good idea to just restore the tables whenever some script kiddie has dropped them. The next attacker may actually know what he's doing and take over your entire server. So you need to learn how to write proper PHP code and then fix the vulnerabilities.

Link to comment
https://forums.phpfreaks.com/topic/292326-white-screen/#findComment-1495965
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.