彼の助けが得られることを願っています。そのシステムにログインしようとすると、セッションレジスタでエラーが発生します: *致命的なエラー: 18 行目の C:\xampp\htdocs\check.php の未定義関数 session_register() への呼び出し* ところで、PHP の学習を始めたばかりです。だから私はそこの初心者です:)
コードRegister.phpがあります:
<?php
include('MySQL.php');
include('password.php');
$Username = $_POST['user'];
$Password = $_POST['password'];
$Re_Password = $_POST['password2'];
if($Username == "")
{
die("You don't enter a username!");
}
if($Password == "" || $Re_Password == "")
{
die("You didn't enter one of your passwords!");
}
if($Password != $Re_Password)
{
die("Your passwords don't match! Try again.");
}
$query = mysql_query("SELECT * FROM users WHERE username='$Username'");
if(mysql_num_rows($query) != 0)
{
echo "Username already exists";
}
else
{
$hash = password_hash($Password, PASSWORD_BCRYPT);
if (password_verify($Password, $hash)) {
if(!mysql_query("INSERT INTO users (username, password)
VALUES ('$Username', '$hash')"))
{
die("Connection problems!");
}
echo "<center>";
echo "Registration was successfull!<br>";
echo "Your user name: $Username<br>";
echo "<a href='login.php'>Login to the system</a>";
echo "</center>";
}
}
?>
Check.php:
<?php
ob_start();
include('MySQL.php');
$username=$_POST['user'];
$password=$_POST['password'];
$query = mysql_query ("SELECT * FROM users WHERE username='$username' AND password='$password'");
if(mysql_num_rows($query) == 1)
{
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("username");
session_register("password");
header("location:success.php");
}
else {
echo "Wrong Username or Password";
}
ob_end_flush();
?>