我试图创建一个简单的用户登录系统,但我得到内部服务器错误500。 我查了一下,在我的服务器端,似乎没事。 请检查我的编码中是否有任何错误谢谢:)
<?php
include("config.php");
session_start();
ini_set('display_errors', 1);
if($_SERVER["REQUEST_METHOD"] == "POST") {
// username and password sent from form
$name = $_POST['username']);
$ssn = $_POST['password']);
$query = "SELECT * FROM Login WHERE Username = '$name' and Password =
'$ssn'";
$result = mssql_query($query,$conn);
$num = mssql_num_rows($result);
if($num == 1){
echo "Succesfully Logged in"
}
else{
echo "INVALID";
}
?>
CONFIG.PHP
<?php
$serverName = '';
$uid = '';
$pwd = '';
$databaseName = '';
$connectionInfo = array( "UID"=>$uid,
"PWD"=>$pwd,
"Database"=>$databaseName);
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>