[操作疑難] dreamweaver網頁

本帖最後由 henryfung1515 於 2015-9-22 22:37 編輯

https://drive.google.com/open?id=0B7gQpYDdhs9VMUh5S0ktdnJYVlE
網頁code
<?php require_once('Connections/conndb.php'); ?>
<?php require_once('Connections/conndb.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;
}
}

$currentPage = $_SERVER["PHP_SELF"];

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO wp_gbook (gname, gweb, gemail, gcomment) VALUES (%s, %s, %s, %s)",
                       GetSQLValueString($_POST['gname'], "text"),
                       GetSQLValueString($_POST['gweb'], "text"),
                       GetSQLValueString($_POST['gemail'], "text"),
                       GetSQLValueString($_POST['gcomment'], "text"));

  mysql_select_db($database_conndb, $conndb);
  $Result1 = mysql_query($insertSQL, $conndb) or die(mysql_error());

  $insertGoTo = "index.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_conndb, $conndb);
$query_Recordset1 = "SELECT * FROM wp_gbook ORDER BY gid DESC";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $conndb) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset1") == false &&
        stristr($param, "totalRows_Recordset1") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
  <table width="600" border="1">
    <tr>
      <td>暱稱</td>
      <td><label for="gname"></label>
      <input type="text" name="gname" id="gname" /></td>
    </tr>
    <tr>
      <td>首頁</td>
      <td><label for="gweb"></label>
      <input type="text" name="gweb" id="gweb" /></td>
    </tr>
    <tr>
      <td>電子信箱</td>
      <td><label for="gemail"></label>
      <input type="text" name="gemail" id="gemail" /></td>
    </tr>
    <tr>
      <td>回應表情</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>回應內容</td>
      <td><label for="gcomment"></label>
      <input type="text" name="gcomment" id="gcomment" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1" />
  <input type="submit" name="送出" id="送出" value="提交" />
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<?php do { ?>
  <?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?>
    <table width="600" border="1">
      <tr>
        <td><img src="HiAppHere_com_kov.theme.lumos.png" /><?php echo $row_Recordset1['gname']; ?><img src="083432-high-resolution-dark-blue-denim-jeans-icon-business-www-search-ps.png" /><img src="mail_2.png" width="128" height="128" /></td>
      </tr>
      <tr>
        <td><?php echo $row_Recordset1['gdate']; ?></td>
      </tr>
      <tr>
        <td><p>留言:<?php echo $row_Recordset1['gcomment']; ?></p>
          <p>&nbsp;</p></td>
      </tr>
    </table>
    <table border="0">
      <tr>
        <td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">第一页</a>
            <?php } // Show if not first page ?></td>
        <td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">前一页</a>
            <?php } // Show if not first page ?></td>
        <td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">下一个</a>
            <?php } // Show if not last page ?></td>
        <td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
            <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">最后一页</a>
            <?php } // Show if not last page ?></td>
      </tr>
    </table>
    记录 <?php echo ($startRow_Recordset1 + 1) ?> 到 <?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?> (总共 <?php echo $totalRows_Recordset1 ?> <br />
  <?php if ($totalRows_Recordset1 == 0) { // Show if recordset empty ?>
    <strong>無任何留言</strong>
    <?php } // Show if recordset empty ?>
  <?php } // Show if recordset not empty ?>
  <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</body>
</html>
<?php
mysql_free_result($Recordset1);

?>
簡單簡述一下,我寫左個留言板,用appserv。系dreamweaver用預覽就load到個網站,但係直接用chrome開個PHP網就凈系彈啲code出黎,請問要點解決。仲有唔名點解啲code有啲系簡體字(我無打過任何一粒簡體字)。thx
可能講得唔清楚,上面有條片。唔只有無錯區