账户系统w/js,html&php

account system w/ js, html & php

本文关键字:html amp php js 系统      更新时间:2023-09-26

我需要帮助在php中创建帐户系统!它将为每个用户创建一个新的文档,其中包含一些数据,以下是我尝试过的:

PHP:

//> Profile Creation <//
if($_CREATEPROFILE) {
$uname = $_CREATEPROFILE['uname'];
$pword = $_CREATEPROFILE['pword'];
$email = $_CREATEPROFILE['email'];
$path = 'profiles/' + $uname + ".txt";
if(file_exists('profiles/' + $uname)) {
    //Run If Profile Already Created
    echo("<script>cantCreate();</script>");
} else {
    //Profile Creation
    $handle = fopen("profiles/" + $uname,"a");
}
}
    //> Profile Logging In <//
    if($_LOGIN) {
}

HTML:

<form action="" method="CREATEPROFILE">
    <input type="text" id="uname" name="uname" placeholder="Username">
    <input type="text" id="pword" name="pword" placeholder="Password">
    <input type="text" id="email" name="email" placeholder="EMail">
    <center><div id="accountStatus-Signup" class="accountStatus-Signup">You Have Not Done A Account Scan Yet!</div></center>
    <input type="submit" id="submit" name="submit" value="Sign Up">
</form>

Javascript:

<script>
function cantCreate() {
document.getElementById("accountStatus-Signup").innerHTML = "<h2 style='"color: red;'">Sorry! But That Username Is Unadvaible!";
}
</script>

请向我解释我的错误!谢谢你帮我!

CREATEPROFILE不是有效的表单方法。我猜你在尝试使用POST方法。相反,使用$_POST[]全局捕获数据。要检查表单是否已提交,请执行if(isset($_POST['uname']))而不是if($_POST)。这是你的主要问题。尽管我建议在尝试单独写东西之前先做一些教程。