{"id":406,"date":"2013-10-19T14:17:10","date_gmt":"2013-10-19T06:17:10","guid":{"rendered":"http:\/\/rwweng.rainwoodwood.tw\/?p=406"},"modified":"2013-10-19T15:36:57","modified_gmt":"2013-10-19T07:36:57","slug":"php-%e6%b8%ac%e8%a9%a6%e6%96%87","status":"publish","type":"post","link":"https:\/\/english.rwwttf.tw\/?p=406","title":{"rendered":"php \u6e2c\u8a66\u6587"},"content":{"rendered":"<p><?php\n# FileName=\"Connection_php_mysql.htm\"\n# Type=\"MYSQL\"\n# HTTP=\"true\"\n$hostname_connEnglish = \"localhost\";\n$database_connEnglish = \"rainwood_english\";\n$username_connEnglish = \"rainwood_main\";\n$password_connEnglish = \"chen0612\";\n$connEnglish = mysql_pconnect($hostname_connEnglish, $username_connEnglish, $password_connEnglish) or trigger_error(mysql_error(),E_USER_ERROR); \nmysql_query('set names utf8'); #\u975e\u5e38\u91cd\u8981\u7269\u5fc5\u8981\u52a0\u9019\u4e00\u53e5\u8207\u6cd5,\u624d\u80fd\u78ba\u4fdd\u4f60\u7684\u7db2\u9801\u4e0d\u6703\u6709\u4e82\u78bc 2009.01.11  \n?><\/p>\n<p><?php\n\/\/initialize the session\nif (!isset($_SESSION)) {\n  session_start();\n}\n$nowtime=date(\"Y-m-d H:i:s\",mktime (date(H)+8, date(i), date(s), date(m), date(d), date(Y)));\n\n\/\/ ** Logout the current user. **\n$logoutAction = $_SERVER['PHP_SELF'].\"?doLogout=true\";\nif ((isset($_SERVER['QUERY_STRING'])) &#038;&#038; ($_SERVER['QUERY_STRING'] != \"\")){\n  $logoutAction .=\"&#038;\". htmlentities($_SERVER['QUERY_STRING']);\n}\n\nif ((isset($_GET['doLogout'])) &#038;&#038;($_GET['doLogout']==\"true\")){\n  \/\/to fully log out a visitor we need to clear the session varialbles\n  $_SESSION['MM_Username'] = NULL;\n  $_SESSION['MM_UserGroup'] = NULL;\n  $_SESSION['PrevUrl'] = NULL;\n  unset($_SESSION['MM_Username']);\n  unset($_SESSION['MM_UserGroup']);\n  unset($_SESSION['PrevUrl']);\n\t\n  $logoutGoTo = \"index.php\";\n  if ($logoutGoTo) {\n    header(\"Location: $logoutGoTo\");\n    exit;\n  }\n}\n?><br \/>\n<?php\nif (!isset($_SESSION)) {\n  session_start();\n}\n$MM_authorizedUsers = \"admin,member\";\n$MM_donotCheckaccess = \"false\";\n\n\/\/ *** Restrict Access To Page: Grant or deny access to this page\nfunction isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { \n  \/\/ For security, start by assuming the visitor is NOT authorized. \n  $isValid = False; \n\n  \/\/ When a visitor has logged into this site, the Session variable MM_Username set equal to their username. \n  \/\/ Therefore, we know that a user is NOT logged in if that Session variable is blank. \n  if (!empty($UserName)) { \n    \/\/ Besides being logged in, you may restrict access to only certain users based on an ID established when they login. \n    \/\/ Parse the strings into arrays. \n    $arrUsers = Explode(\",\", $strUsers); \n    $arrGroups = Explode(\",\", $strGroups); \n    if (in_array($UserName, $arrUsers)) { \n      $isValid = true; \n    } \n    \/\/ Or, you may restrict access to only certain users based on their username. \n    if (in_array($UserGroup, $arrGroups)) { \n      $isValid = true; \n    } \n    if (($strUsers == \"\") &#038;&#038; false) { \n      $isValid = true; \n    } \n  } \n  return $isValid; \n}\n\n$MM_restrictGoTo = \"\/rainwoodwood\/eng\/index.php?errMsg=3\";\nif (!((isset($_SESSION['MM_Username'])) &#038;&#038; (isAuthorized(\"\",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   \n  $MM_qsChar = \"?\";\n  $MM_referrer = $_SERVER['PHP_SELF'];\n  if (strpos($MM_restrictGoTo, \"?\")) $MM_qsChar = \"&#038;\";\n  if (isset($QUERY_STRING) &#038;&#038; strlen($QUERY_STRING) > 0)<br \/>\n  $MM_referrer .= &#8220;?&#8221; . $QUERY_STRING;<br \/>\n  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . &#8220;accesscheck=&#8221; . urlencode($MM_referrer);<br \/>\n  header(&#8220;Location: &#8220;. $MM_restrictGoTo);<br \/>\n  exit;<br \/>\n}<br \/>\n?><br \/>\n<?php\nif (!function_exists(\"GetSQLValueString\")) {\nfunction GetSQLValueString($theValue, $theType, $theDefinedValue = \"\", $theNotDefinedValue = \"\") \n{\n  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;\n\n  $theValue = function_exists(\"mysql_real_escape_string\") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);\n\n  switch ($theType) {\n    case \"text\":\n      $theValue = ($theValue != \"\") ? \"'\" . $theValue . \"'\" : \"NULL\";\n      break;    \n    case \"long\":\n    case \"int\":\n      $theValue = ($theValue != \"\") ? intval($theValue) : \"NULL\";\n      break;\n    case \"double\":\n      $theValue = ($theValue != \"\") ? \"'\" . doubleval($theValue) . \"'\" : \"NULL\";\n      break;\n    case \"date\":\n      $theValue = ($theValue != \"\") ? \"'\" . $theValue . \"'\" : \"NULL\";\n      break;\n    case \"defined\":\n      $theValue = ($theValue != \"\") ? $theDefinedValue : $theNotDefinedValue;\n      break;\n  }\n  return $theValue;\n}\n}\n\n$colname_RecUser = \"-1\";\nif (isset($_SESSION['MM_Username'])) {\n  $colname_RecUser = $_SESSION['MM_Username'];\n}\nmysql_select_db($database_connEnglish, $connEnglish);\n$query_RecUser = sprintf(\"SELECT m_id, m_name, m_nick, m_username FROM memberdata WHERE m_username = %s\", GetSQLValueString($colname_RecUser, \"text\"));\n$RecUser = mysql_query($query_RecUser, $connEnglish) or die(mysql_error());\n$row_RecUser = mysql_fetch_assoc($RecUser);\n$totalRows_RecUser = mysql_num_rows($RecUser);\n\n\n\n$colname_Receng = \"-1\";\nif (isset($_GET['vocabularyid'])) {\n  $colname_Receng = $_GET['vocabularyid'];\n}\n$HH=\"SELECT * FROM \".$row_RecUser['m_username'].\" WHERE id LIKE '$colname_Receng' ORDER BY id ASC\";\/\/\u96e8\u6728\u6728\u66f4\u6539\nmysql_select_db($database_connEnglish, $connEnglish);\n$query_Receng = \"$HH\";\n$Receng = mysql_query($query_Receng, $connEnglish) or die(mysql_error());\n$row_Receng = mysql_fetch_assoc($Receng);\n$totalRows_Receng = mysql_num_rows($Receng);\n$colname_Recexplanation = \"-1\";\nif (isset($_GET['vocabularyid'])) {\n  $colname_Recexplanation = $_GET['vocabularyid'];\n}\n$HHH=\"SELECT * FROM \".$row_RecUser['m_username'].\" WHERE id LIKE '$colname_Recexplanation' ORDER BY id ASC\";\/\/\u96e8\u6728\u6728\u66f4\u6539\nmysql_select_db($database_connEnglish, $connEnglish);\n$query_Recexplanation = \"$HHH\";\n$Recexplanation = mysql_query($query_Recexplanation, $connEnglish) or die(mysql_error());\n$row_Recexplanation = mysql_fetch_assoc($Recexplanation);\n$totalRows_Recexplanation = mysql_num_rows($Recexplanation);\n\n$colname_Rec = \"-1\";\nif (isset($_GET['vocabularyid'])) {\n  $colname_Rec = $_GET['vocabularyid'];\n}\n$HHP=\"SELECT * FROM \".$row_RecUser['m_username'].\" WHERE id LIKE '$colname_Rec' ORDER BY id ASC\";\/\/\u96e8\u6728\u6728\u66f4\u6539\nmysql_select_db($database_connEnglish, $connEnglish);\n$query_Rec = \"$HHP\";\n$Rec = mysql_query($query_Rec, $connEnglish) or die(mysql_error());\n$row_Rec = mysql_fetch_assoc($Rec);\n$totalRows_Rec = mysql_num_rows($Rec);\n\n$colname_Recc = \"-1\";\nif (isset($_GET['vocabularyid'])) {\n  $colname_Recc = $_GET['vocabularyid'];\n}\n$HHPP=\"SELECT * FROM \".$row_RecUser['m_username'].\" WHERE id LIKE '$colname_Recc' ORDER BY id ASC\";\/\/\u96e8\u6728\u6728\u66f4\u6539\nmysql_select_db($database_connEnglish, $connEnglish);\n$query_Recc = \"$HHPP\";\n$Recc = mysql_query($query_Recc, $connEnglish) or die(mysql_error());\n$row_Recc = mysql_fetch_assoc($Recc);\n$totalRows_Recc = mysql_num_rows($Recc);\n?><\/p>\n<form action=\"pronouncation.php\" method=\"get\" name=\"form1\" target=\"_parent\">\n            <span class=\"style6\">\u8acb\u8f38\u5165\u55ae\u5b57\u7b49\u7d1a\u55ae\u5143\u7684ID<\/span><\/span><br \/>\n          <input name=\"vocabularyid\" type=\"text\" id=\"vocabularyid\" size=\"20\"><br \/>\n          <input type=\"submit\" name=\"button2\" id=\"button2\" value=\"\u9001\u51fa\"><br \/>\n          <\/form>\n<p> <TR><br \/>\n    <TD colspan=\"3\" align=\"center\"><\/p>\n<p align=\"center\">&nbsp;<\/p>\n<p>      <?php if ($totalRows_Receng > 0) { \/\/ Show if recordset not empty ?><\/p>\n<div align=\"left\">\n<p class=\"style10\">\u770b\u5f62\u77e5\u97f3\u8207\u77e5\u7fa9<\/p>\n<\/p><\/div>\n<table width=\"720\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<?php $cno=0;echo\"\n\n<tr>&#8220;;\/\/\u63db\u884c\u91cd\u8907\u986f\u5f0f\u7684\u8a9e\u6cd5\/\/\u5148\u5c07\u8b8a\u6578\u6b78\u96f6?><br \/>\n<?php  do { ?><\/p>\n<td width=\"180\"  <?php $kk=$row_Receng['test4'];$tt=\"#FF3399\"?><?php if(\"$kk\">=1){echo &#8220;bgcolor=$tt&#8221;;} ?>><span class=\"style6\"><?php echo $row_Receng['id']; ?><\/span><?php $search=mb_substr( $row_Receng['word'], 0, 1, 'UTF-8');\/\/\u96e8\u6728\u6728\u591a\u4eba\u7248 ?><span class=\"style21\"><?php echo $row_Receng['word']; ?><\/span><\/td>\n<p><?php $cno++;if($cno%4==0){echo \"<\/tr>\n<tr>&#8220;;}\/\/\u63db\u884c\u91cd\u8907\u986f\u5f0f\u7684\u8a9e\u6cd5?><br \/>\n               <?php } while ($row_Receng = mysql_fetch_assoc($Receng)); ?><?php echo\"<\/tr>\n<p>&#8220;; ?><br \/>\n        <\/table>\n<div align=\"left\">\n<p class=\"style10\">\u770b\u5f62\u77e5\u97f3\u8207\u77e5\u7fa9<\/p>\n<\/p><\/div>\n<table width=\"720\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<p>                   <?php $cno=0;echo\"\n\n<tr>&#8220;;\/\/\u63db\u884c\u91cd\u8907\u986f\u5f0f\u7684\u8a9e\u6cd5\/\/\u5148\u5c07\u8b8a\u6578\u6b78\u96f6?><br \/>\n            <?php  do { ?><\/p>\n<td width=\"180\"  <?php $kk=$row_Receng['test4'];$tt=\"#FF3399\"?><?php if(\"$kk\">=1){echo &#8220;bgcolor=$tt&#8221;;} ?>><span class=\"style6\"><?php echo $row_Receng['id']; ?><\/span><br \/>\n              <?php $search=mb_substr( $row_Receng['word'], 0, 1, 'UTF-8');\/\/\u96e8\u6728\u6728\u591a\u4eba\u7248 ?><span class=\"style21\"><?php echo $row_Receng['word']; ?><\/span><\/td>\n<p>                  <?php $cno++;if($cno%4==0){echo \"<\/tr>\n<tr>&#8220;;}\/\/\u63db\u884c\u91cd\u8907\u986f\u5f0f\u7684\u8a9e\u6cd5?><br \/>\n               <?php } while ($row_Receng = mysql_fetch_assoc($Receng)); ?><?php echo\"<\/tr>\n<p>&#8220;; ?><br \/>\n        <\/table>\n<div align=\"left\">\n<p class=\"style10\">\u807d\u97f3\u77e5\u7fa9\u8207\u62fc\u5f62<\/p>\n<\/p><\/div>\n<table width=\"720\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n<td>\n<div align=\"center\">\n              <script type=\"text\/javascript\">\nAC_FL_RunContent( 'codebase','http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=9,0,28,0','width','800','height','250','src','voice','quality','high','pluginspage','http:\/\/www.adobe.com\/shockwave\/download\/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','voice' ); \/\/end AC code\n<\/script><noscript><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=9,0,28,0\" width=\"800\" height=\"250\"><param name=\"movie\" value=\"voice.swf\"><param name=\"quality\" value=\"high\"><embed src=\"voice.swf\" quality=\"high\" pluginspage=\"http:\/\/www.adobe.com\/shockwave\/download\/download.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application\/x-shockwave-flash\" width=\"800\" height=\"250\"><\/embed><\/object><br \/>\n            <\/noscript><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<div align=\"left\">\n<p class=\"style10\">\u770b\u7fa9\u62fc\u5f62\u8207\u77e5\u97f3<\/p>\n<\/p><\/div>\n<table width=\"720\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<?php $cno=0;echo\"\n\n<tr>&#8220;;\/\/\u63db\u884c\u91cd\u8907\u986f\u5f0f\u7684\u8a9e\u6cd5\/\/\u5148\u5c07\u8b8a\u6578\u6b78\u96f6?><br \/>\n<?php  do { ?><\/p>\n<td width=\"180\"  <?php $kk=$row_Recc['test4'];$tt=\"#FF3399\"?><?php if(\"$kk\">=1){echo &#8220;bgcolor=$tt&#8221;;} ?>><span class=\"style6\"><?php echo $row_Recc['id']; ?><\/span><?php $search=mb_substr( $row_Recc['word'], 0, 1, 'UTF-8');\/\/\u96e8\u6728\u6728\u591a\u4eba\u7248 ?><span class=\"style21\"><?php echo $row_Recc['explanation']; ?><\/span><\/td>\n<p>                  <?php $cno++;if($cno%4==0){echo \"<\/tr>\n<tr>&#8220;;}\/\/\u63db\u884c\u91cd\u8907\u986f\u5f0f\u7684\u8a9e\u6cd5?><br \/>\n               <?php } while ($row_Recc = mysql_fetch_assoc($Recc)); ?><?php echo\"<\/tr>\n<p>&#8220;; ?><br \/>\n        <\/table>\n<div align=\"left\">\n<p class=\"style10\">\u5f62\u97f3\u7fa9 <\/p>\n<\/p><\/div>\n<p>         <TR><br \/>\n    <TD height=\"20\" colspan=\"10\" background=\"ima\"><\/p>\n<div align=\"center\">\n<p>  <script type=\"text\/javascript\">\nAC_FL_RunContent( 'codebase','http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=9,0,28,0','width','900','height','650','src','card','quality','high','pluginspage','http:\/\/www.adobe.com\/shockwave\/download\/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','card' ); \/\/end AC code\n<\/script><noscript><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=9,0,28,0\" width=\"900\" height=\"650\"><param name=\"movie\" value=\"card.swf\"><param name=\"quality\" value=\"high\"><embed src=\"card.swf\" quality=\"high\" pluginspage=\"http:\/\/www.adobe.com\/shockwave\/download\/download.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application\/x-shockwave-flash\" width=\"900\" height=\"650\"><\/embed><\/object><\/noscript>\n<\/p>\n<\/div>\n<p><\/TD><br \/>\n  <\/TR><\/p>\n<p>          <?php } \/\/ Show if recordset not empty ?><\/p>\n<p>      <\/TD><br \/>\n  <\/TR><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-406","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/english.rwwttf.tw\/index.php?rest_route=\/wp\/v2\/posts\/406","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/english.rwwttf.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/english.rwwttf.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/english.rwwttf.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/english.rwwttf.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=406"}],"version-history":[{"count":0,"href":"https:\/\/english.rwwttf.tw\/index.php?rest_route=\/wp\/v2\/posts\/406\/revisions"}],"wp:attachment":[{"href":"https:\/\/english.rwwttf.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/english.rwwttf.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/english.rwwttf.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}