我正在尝试将http://www.php-login.net/中的PHP登录脚本实现到我的网页中。 我下载了2-Advanced脚本,我创建了数据库并根据提供的教程对“config.php”进行了配置。 我也在我的网站上插入了表格。
我的问题是为什么表单不起作用?
以下是我正在使用的表单:
<form method="post" action="index.php" name="loginform">
<label for="login_input_username">Username</label>
<input id="login_input_username" class="login_input" type="text" name="user_name" required />
<label for="login_input_password">Password</label>
<input id="login_input_password" class="login_input" type="password" name="user_password" autocomplete="off" required />
<input type="submit" name="login" value="Log in" />
</form>
<a href="register.php">Register new account</a>
<a href="password_reset.php">I forgot my password</a>
表单和按钮不起作用,点击后会显示下一条消息:
<?php
/**
* A simple, clean and secure PHP Login Script
*
* ADVANCED VERSION
* (check the website / GitHub / facebook for other versions)
*
* A simple PHP Login Script.
* Uses PHP SESSIONS, modern password-hashing and salting
* and gives the basic functions a proper login system needs.
*
* @package php-login
* @author Panique
* @link https://github.com/panique/php-login/
* @license http://opensource.org/licenses/MIT MIT License
*/
// load php-login components
require_once("php-login.php");
// create a login object. when this object is created, it will do all login/logout stuff automatically
// so this single line handles the entire login process.
$login = new Login();
// ... ask if we are logged in here:
if ($login->isUserLoggedIn() == true) {
// the user is logged in. you can do whatever you want here.
// for demonstration purposes, we simply show the "you are logged in" view.
include("views/logged_in.php");
} else {
// the user is not logged in. you can do whatever you want here.
// for demonstration purposes, we simply show the "you are not logged in" view.
include("views/not_logged_in.php");
}
欢迎任何帮助和消息,非常感谢您的支持。
答案 0 :(得分:2)
答案很简单。您没有在服务器上激活PHP。这就是为什么它只显示PHP代码并且不执行它。
答案 1 :(得分:0)
你在PHP中保存表单而不是HTML吗?因为它从HTML到php时往往显示或下载php文件,所以HTML无法处理php文件。
答案 2 :(得分:-1)
表格基本行动:
<form action="<?php echo URL; ?>login/login" method="post">
你的表格
<form method="post" action="index.php" name="loginform">
尝试将行动改为
action="<?php echo URL; ?>login/login"