MySQL函数不起作用

Thanks For Answers! I got lots of feedback and I have an answer and I fixed it. Thanks!

I am working on making a user login system for my website. I want the updates to be faster so I moved the exact files to my local server, (Apache/2.2.22 (Ubuntu)), and it suddenly does not work. The Database is external so it does not need the hostname changed. Any ideas? I get no errors, it just does not parse the MySQL bit.

Connect File:

<?php
    $host = "xxxxxxx.xxxxxxxxx.xx.xx";
    $user = "sh0u_xxxxxx";
    $pass = "xxxxx";
    $db   = "sh0u_1xxxxx_store";
    mysql_connect($host,$user,$pass) or die("Unable To Connect To Database");
    mysql_select_db($db)
?>

Login File:

<?php
    session_start();
    session_destroy();
    include('connect.php');
    $email = $_POST['email'];
    $pass = md5($_POST['password']);
    $query = mysql_query("SELECT * FROM users WHERE email='".$email."' AND password='".$pass."'");
    $numrows = mysql_num_rows($query);
    if($numrows === 1) {
        session_start();
        $_SESSION['sid'] = "".$email.":".$pass."";
        header('Location:../index.php');
    }else {
        include('../login.php');
        echo "<script>alert('Incorrect Username and/or Password');</script>";
    }
?>

Most hosting providers do not allow external access to the databases they include with their plans. Not only that, most of them use localhost as a database server so as to force a socket connection (so that they can even disable network connections to their DBs altogether).

To test your script and site locally you will need to download a dump of your database and create a local version of it on your own.

Other issues with your code

As mentioned in comments you are:

  • You should be using the MySQL Improved Extension, instead of the old (and deprecated) MySQL extension
  • You are not sanitizing data you use for your queries (use prepared statements)
  • MD5 is not secure for passwords, you should be using the new password_hash instead