使用docker和xampp构建注册页面并获取:
错误404
在此服务器上找不到请求的URL。引用页面上的链接似乎是错误的或过时的。
我已经查看了每个相关的论坛页面,并查看了我可以找到的每个Google搜索结果和教程,但仍然没有运气。在验证PHP并挖掘撰写文件后,我现在卡住了。
我的猜测是我在PHP上犯了一个错误,或者它与我错过的Docker镜像移植有关。我是这方面的初学者。
使用的Docker镜像:
https://hub.docker.com/r/tomsik68/xampp/
docker run --name myXampp -p 41061:22 -p 41062:80 -d -v ~/my_web_pages:/www tomsik68/xampp
使用的表格:
<div class="fieldset">
<form method="post" action="includes/test.php">
<fieldset>
<h2>Create Login</h2>
<p><label for="Company_name">Company Name * </label><input type="text" id="company_name" name="company_name" /></p>
<p><label for="pass">Password * </label><input type="password" id="pass" name="company_name"/></p>
<!--<p><label for="pass2">Confirm Password * </label><input type="password" id="pass2" /></p>-->
<p><label for="email">Email * </label><input type="email" id="email" name="email" /></p>
<p><label for="telephone">Telephone </label><input type="text" id="telephone" name="telephone"/></p>
<p class="required">* Required</p>
<p><input type="submit" value="Submit" id="submit-regestration" name="submit-regestration"/></p>
PHP页面:
<?php
if (isset($post['submit'])) {
include_once 'db_connect.php';
$company_name = mysqli_real_escape_string($conn, $_POST['company_name']);
$pass= mysqli_real_escape_string($conn, $_POST['pass']);
$email = mysqli_real_escape_string($conn, $_POST['email']);
if (empty($company_name) || empty($pass) || empty($email)) {
header("Location: ../test.php?signup=empty");
exit();
}else{
if (!preg_match("/^[a-zA-Z]*$/", $company_name) || !preg_match("/^[a-zA-Z]*$/",$pass)){
header("Location: ../test.php?invalid");
exit();
} else {
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
header("Location: ../test.php?invalidemail");
exit();
} else {
$sql = "SELECT * FROM company_reg WHERE company_name='$company_name'";
$result= mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result);
if($resultCheck >0){
header("Location: ../test.php?User_taken");
exit();
} else {
$hashedPwd =Password_hash($Pass, PASSWORD_DEFAULT);
$sql = "INSERT INTO company_reg (company_name,pass,email) VALUES ('$company_name', '$hashedPwd','$email');";
mysqli_query($conn,$sql);
header("Location: ../mreg3.html");
}
}
}
}
} else {
header("Location: ../test.php");
exit();
}
?>