저는 PHP에 비교적 익숙하지 않지만 약간 알고 있습니다. 로그인 시스템을 만들려고하는데 로그인 기능이 작동하지 않는 것 같습니다. 나는 check rows 명령을 수행하고 = 1인지 확인하지만 그것은 1이 아니라고 말합니다. "경고 : mysql_num_rows()는 매개 변수 1이 리소스, C : \ xampp에 지정된 객체가 될 것으로 예상합니다. \ htdocs \ message \ login.php 25시에 "PHP/SQL 로그인 폼 문제
나는 이것이 일치하는 값을 찾지 못했지만 데이터베이스를 확인 했으므로 사용자 이름과 비밀번호가 분명히 있음을 알고 있습니다.
도움을 주시면 감사하겠습니다.
코드는 다음과 같습니다 :
<html>
<head>
<title>Login - Messaging</title>
</head>
<body>
<?php include "connect.php"; ?>
<?php include "functions.php"; ?>
<?php include "header.php"; ?>
<div>
<form method="post">
<?php
if(isset($_POST['submit'])){
$username=$_POST['username'];
$password=$_POST['password'];
if($username === '' || $password === ''){
$message="One or more of the fields are empty";
} else {
$password1=md5(hash("sha512",$password));
$checklogin = mysqli_query($con,"SELECT * FROM `users` WHERE `username`='$username' AND `password`='$password1'");
$check2=mysql_num_rows($checklogin);
if($check2==1){
$message="Successful!";
header("location: index.php");
} else {
$message="Incorrect Username or Password";
}
}
echo "<p>$message</p>";
}
?>
Username: <input type="text" name="username" /><br>
Password: <input type="password" name="password" /><br>
<input type="submit" name="submit" value="Login" />
</form>
</div>
</body>
</html>
내 당신이 mysqli_ 및 mysql_로 전환 할거야? – j08691
mysql_ * with mysql_i * –
그게 내가 한 것처럼 보입니다. – poseidon