无法使用“创建信息”&引用;用php编写
我想创建一个注销系统,用户在其中单击注销链接并转到logout.php。注销链接位于注册新用户时使用fwrite创建的用户页面中 我试过换衣服无法使用“创建信息”&引用;用php编写,php,html,Php,Html,我想创建一个注销系统,用户在其中单击注销链接并转到logout.php。注销链接位于注册新用户时使用fwrite创建的用户页面中 我试过换衣服 <a href="logout.php"></a> 到 但这导致链接没有出现 --------------------------------这是我的密码------------------------------------------------------------- $myfile = fopen("user/
<a href="logout.php"></a>
到
但这导致链接没有出现
--------------------------------这是我的密码-------------------------------------------------------------
$myfile = fopen("user/$username.php", "w") or die("Unable to open file!");
$content = "
<!DOCTYPE html>
<?php
session_start();
?>
<html>
<head>
<title>Vurzin</title>
</head>
<body>
<h2>Welcome $username !</h2>
<br><br><br><a href="logout.php"></a>
</body>
</html>";
fwrite($myfile, $content);
fclose($myfile);
header("Location: user/$username.php");
$myfile=fopen(“user/$username.php”,“w”)或die(“无法打开文件!”);
$content=”
武尔津
欢迎$username!
";
fwrite($myfile,$content);
fclose($myfile);
标题(“位置:user/$username.php”);
\“logout.php\”
但是您是否正在为站点的每个用户创建php文件的副本?伙计,你不是这样做的XD更不用说我可以导航到example.com/user/Vack-Guy.php
,然后拿到你的东西。@NiettheDarkAbsol//三件事。1.谢谢你的帮助。2.我尝试过改变,但是链接没有出现。3.我如何才能做到只有登录的用户才能更改其页面的内容?对于2
,您的链接中是否有任何文本?因为没有文本就没有可点击的内容。对于3
,您确实需要重新思考整个项目。你应该有一个数据库,并根据登录者从中提取数据,然后用它来构建你的页面。@NiettheDarkAbsol你的解决方案确实适用于#2。我只是忘了在链接中添加文本。哎呀////////////////#3,所以当用户注册时,我将他们的信息放在数据库中,然后当用户使用与数据库中的用户名和密码组合相匹配的用户名和密码组合登录时,会将他们带到他们的用户配置文件中。我如何才能做到,如果用户登录了他们的个人资料,那么他们就可以编辑他们的个人资料,但是如果没有登录的人进入了他们的个人资料页面,那么他们就不能编辑用户的个人资料页面?
$myfile = fopen("user/$username.php", "w") or die("Unable to open file!");
$content = "
<!DOCTYPE html>
<?php
session_start();
?>
<html>
<head>
<title>Vurzin</title>
</head>
<body>
<h2>Welcome $username !</h2>
<br><br><br><a href="logout.php"></a>
</body>
</html>";
fwrite($myfile, $content);
fclose($myfile);
header("Location: user/$username.php");