2016-02-23 87 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