查看文件: homemenu_add.php
大小: 2.81 KB
类型: application/octet-stream
<?php require_once('../Connections/BE2.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; } } $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 mdat (m1, m2, m3) VALUES (%s, %s, %s)", GetSQLValueString($_POST['m1'], "text"), GetSQLValueString($_POST['m2'], "text"), GetSQLValueString($_POST['m3'], "int")); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($insertSQL, $BE2) or die(mysql_error()); $insertGoTo = $_POST['url']; header(sprintf("Location: %s", $insertGoTo)); } ?> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> <table align="center"> <tr valign="baseline"> <td colspan="2" align="right" nowrap="nowrap"></td> </tr> <tr valign="baseline"> <td width="76" align="right" nowrap="nowrap"><span class="font2">選單名稱</span>:</td> <td width="308"><input type="text" name="m1" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><span class="font2">選單連結</span>:</td> <td><input type="text" name="m2" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><span class="font2">排列序</span>:</td> <td><input type="text" name="m3" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"><input name="url" type="hidden" id="url" value="<? echo $_SERVER['HTTP_REFERER'];?>" /></td> <td><input type="submit" value="插入記錄" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" /> </form>
保存
取消
返回文件列表