2016-02-23 43 views
0

我在服务器行为 - >用户验证 - >登录用户在Dreamweaver中为我的Login.php页面(见下文),我不能像我一样得到消息:“登录表单”必须至少有一个获取用户名或密码值的表单元素。它说我应该添加这个元素,但是...我已经在我的代码中了...?无法在Dreamweaver中验证用户的登录页面

<?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>&nbsp;</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>&nbsp;</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>&nbsp;</td> 
      </tr> 
      <tr> 
      <td><input type="submit" name="submit" id="LoginButton" value="Login"></td> 
      </tr> 
      <tr> 
      <td>&nbsp;</td> 
      </tr> 
     </tbody> 
     </table> 
     </form> 
    </div> 
</div> 
<div id="Footer"></div> 
</div> 

</body> 
</html> 
<?php 
mysql_free_result($Login); 
?> 
+0

1。此外,出于好奇,有没有你不使用的形式为“行动=”的一部分,做这一切内嵌理由吗? 2.从PHP 5开始不推荐使用mysql_free_result(),这让我不知道您正在使用哪种PHP版本。如果你使用的是PHP7,你应该选择一个替代方案,比如本页顶部所述的方法之一:http://php.net/manual/en/function.mysql-free-result.php – GreekQuestionMark

回答

0

下面是Adobe的Dreamweaver创建登录页面的操作指南页面的摘录。如果您没有正确地执行第2步,这可能是您的问题,但很难准确指出问题出现的位置,而不知道在添加登录用户行为的过程中它会给出错误消息。不过,请在下面给出链接,并希望它能让您走上正轨。

  1. 在服务器行为面板(窗口>服务器行为),单击加号(+)按钮并选择用户身份验证>登录用户从弹出菜单中。

  2. 指定访问者用于输入其用户名和密码的表单和表单对象。

来源:https://helpx.adobe.com/dreamweaver/using/building-login-page.html#verify_the_user_name_and_password