0

我有一个 2 文件 PHP 脚本,它允许用户提交带有单个文本区域的表单。该脚本创建一个新的 PHP 页面并将用户重定向到该页面。我想将文本回显给提交表单的用户,而不是其他人。你能帮忙提供一个代码示例吗?

4

1 回答 1

1

如果这不是您要查找的内容,请告诉我并相应地对其进行编辑:

HTML:

<input type = "text" name = "input">

PHP:

<?php
//user input
$userInput = $_POST['input'];

//not sure how you are getting the email adress but however youre getting it it goes here
$email = "placeholder@123.com";

//create the filename
$myFile = $userInput . ".php";

//create the file
$fh= fopen($myFile, 'w');

//write to the file
fwrite($fh, $email);

//redirect to the new file
header("location:". $userInput .".php");
?>

基本上,它会根据您的用户输入的内容创建一个新页面,并向他们显示一个电子邮件地址。我想它只允许用户看到它,因为它是基于他们输入的内容。否则,最好的方法是在用户系统上存储一个 cookie(就安全性而言)

于 2013-02-18T20:19:29.587 回答