0

Here is my code

I keep getting a 500 internal error meaning it is a sever sided error but not sure what it could be?

<?php include "dbConfig.php";

$msg = "";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $name = $_POST["name"];
    $password = sha1s($_POST["password"]);
     if ($name == '' || $password == '') {
        $msg = "You must enter all fields";
    } else {


        $sql = "SELECT * FROM usrs WHERE username = '$name' AND pw = '$password'";
        $query = mysql_query($sql);

        if ($query === false) {
            echo "Could not successfully run query ($sql) from DB: " . mysql_error();
            exit;
        }

        if (mysql_num_rows($query) > 0) {

            header("Location: http://www.google.com");
            exit;
        }
    }
}
?>
RobertC
  • 123
  • 15

1 Answers1

1

You are calling a function sha1s in line number 6 of your code. If this is not defined in your dbConfig.php this should be the reason for the error. PHP has an inbuilt function sha1 to hash strings if you are looking for it.

Also check your error logs for more errors. Refer this for getting useful error messages in php

Community
  • 1
  • 1
SachinSunny
  • 1,681
  • 1
  • 12
  • 20