我正在尝试在 Dreamweaver 中为我的 Login.php 页面执行服务器行为->用户身份验证->登录用户(见下文),但我不能这样做,因为我收到的消息是登录表单必须至少有一个获取用户名或密码值的表单元素。它说我应该添加这个元素但是......我已经在我的代码中......?
<?php require_once('Connections/c1.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_c1, $c1);
$query_Login = "SELECT * FROM users";
$Login = mysql_query($query_Login, $c1) or die(mysql_error());
$row_Login = mysql_fetch_assoc($Login);
$totalRows_Login = mysql_num_rows($Login);mysql_select_db($database_c1, $c1);
$query_Login = "SELECT * FROM users";
$Login = mysql_query($query_Login, $c1) or die(mysql_error());
$row_Login = mysql_fetch_assoc($Login);
$totalRows_Login = mysql_num_rows($Login);
$query_Login = "SELECT * FROM users";
$Login = mysql_query($query_Login, $c1) or die(mysql_error());
$row_Login = mysql_fetch_assoc($Login);
$totalRows_Login = mysql_num_rows($Login);
?>
<!doctype html>
<html>
<head>
<link href="x-Layout.css" rel="stylesheet" type="text/css" />
<link href="x-Menu.css" rel="stylesheet" type="text/css" />
<meta charset="utf-8">
<title>Dokument bez tytułu</title>
</head>
<body>
<div id="Holder">
<div id="Header"></div>
<div id="NavBar">
<nav>
<ul>
<li><a href="#">Login</li>
<li><a href="#">Register</li>
<li><a href="#">Forgot Password</li>
</ul>
</nav>
</div>
<div id="Content">
<div id="PageHeading">
<h1>Technical University of Lodz</h1>
</div>
<div id="ContentLeft">
<h2>Please, log in</h2>
<h6> </h6>
</div>
<div id="ContentRight">
<form id="LoginForm" name="LoginForm" method="POST" action="">
<table width="400" border="0">
<tbody>
<tr>
<td><h6>
<label for="textarea">Username:</label>
<br>
<br>
<textarea name="UserName" class="StyleTxtField" id="UserName"></textarea>
</h6></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><h6>
<label for="textarea">Password:<br>
<br>
</label>
<textarea name="Password" class="StyleTxtField" id="Password"></textarea>
</h6></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><input type="submit" name="submit" id="LoginButton" value="Login"></td>
</tr>
<tr>
<td> </td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<div id="Footer"></div>
</div>
</body>
</html>
<?php
mysql_free_result($Login);
?>
最佳答案
以下是 Adobe 的 Dreamweaver 操作指南页面的节选,用于创建登录页面。如果您没有正确执行第 2 步,这可能是您的问题,尽管如果不知道在添加登录用户行为的过程中它给您的错误消息的位置,则很难准确查明问题出现的位置。不过,请通读下面的链接,希望它能让您走上正确的道路。
In the Server Behaviors panel (Window > Server Behaviors), click the Plus (+) button and select User Authentication > Log In User from the pop‑up menu.
Specify the form and the form objects that visitors use to enter their user name and password.
source: https://helpx.adobe.com/dreamweaver/using/building-login-page.html#verify_the_user_name_and_password
关于php - 无法在 Dreamweaver 中验证登录页面的用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35585351/