我是<?php
session_start();
$dbHost = "localhost";
$dbUser = "root";
$dbPass = "";
$dbName = "product";
$connection = new mysqli($dbHost, $dbUser, $dbPass, $dbName);
// Check connection
if ($connection->connect_error)
{
header("location:maintenance.php");
exit();
// or for debugging, activate following line
//die("Connection failed: " . $connection->connect_error);
}
$username = $_POST['username'];
$password = $_POST['password'];
//if username and password empty stop login
if (!$username || !$password)
{
//do something, die is only example
die ("Not all the fields were filled in");
} else
{
login_check($username, $password);
}
function login_check($username, $password)
{
global $connection;
//sql statements is corrected, change field name to username
$sql = "SELECT * FROM `members` WHERE `username` = ? AND `password` = ?";
$stmt = $connection->prepare($sql);
$stmt->bind_param("ss", $username, $password);
$stmt->execute();
$output = $stmt->get_result();
$row = $output->fetch_array(MYSQLI_NUM);
$stmt->close();
//print what comes out in $row
//print_r($row);
//check if $row has data
if ($row)
{
echo "success do something";
$_SESSION['member'] = $username;
} else
{
echo "fail do something";
}
}
的新手,我正在尝试制作“一对一聊天”应用程序。我使用以下代码定义了聊天连接:
Signalr
其相关方法位于var chatHub = $.connection.chatHub;
文件中。不知道为什么它显示错误ChatHub.cs
。请帮我解决这个问题。
我将TypeError: chatHub is undefined
与Signalr 1.0
一起使用。
答案 0 :(得分:0)
即使您没有可用的模板,也可以创建Startup
课程,只需添加新课程并粘贴代码即可。
如果您坚持使用Visual Studio 2010
,请have a look at this tutorial。
希望这会有所帮助,即使这个问题在提供连接的客户端代码时会更明确,正如我在评论中提出的那样。
祝你好运!