<?php
function debug_to_console($data) {
$output = $data;
if (is_array($output))
$output = implode(',', $output);
echo "<script>console.log('Debug Objects: " . $output . "' );</script>";
}
?>
<?php
include("config.php");
include("redirect.php");
session_start();
if($_SERVER["REQUEST_METHOD"] == "POST")
{
// username and password sent from form
$fname = mysqli_real_escape_string($db,$_POST['fname']);
$lname = mysqli_real_escape_string($db,$_POST['lname']);
$melli_code = mysqli_real_escape_string($db,$_POST['melli_code']);
$Email = mysqli_real_escape_string($db,$_POST['Email']);
$phone = mysqli_real_escape_string($db,$_POST['phone']);
$Pass1 = mysqli_real_escape_string($db,$_POST['Pass1']);
$Pass2 = mysqli_real_escape_string($db,$_POST['Pass2']);
$mycheckbox = mysqli_real_escape_string($db,$_POST['checkbox']);
$type = mysqli_real_escape_string($db,$_POST['type']);
$Token=rand();
debug_to_console($Token);
if($Pass1 == $Pass2 && $mycheckbox==1)
{
$sql="INSERT INTO Users (Username, Pass) VALUES ('$Email', '$Pass1')";
$result = mysqli_query($db,$sql);
$sql = "INSERT INTO User_info (fname, lname,melli_code,Email,phone ,Token)
VALUES ('$fname', '$lname','$melli_code','$Email','$phone','$Token')";
$result = mysqli_query($db,$sql);
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
$active = $row['active'];
debug_to_console($Email);
$_SESSION['Token']=$Token;
redirect("validation.php");
}
if($Pass1 != $Pass2)
{
$error = "مقدار پسوردها با هم برابر نیستند.!";
redirect("register.php?id=$error");
}
if( $mycheckbox!=1)
{
$error = "باید با قوانین را مطالعه کنید.!";
redirect("register.php?id=$error");
}
}
?>
输入数据时出现问题,它没有转到重定向路径。并在控制台中显示此错误:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
我检查了所有内容,例如名称和配置代码,并且所有内容都可以关联,但是仍然相同。我很确定我的配置具有正确的值。