| 
			
				
				| [求助]能帮小弟看看 图片为什么上传不到数据库吗? |  
					| <?php require_once('Connections/connews.php'); ?> <?php
 session_start();
 $MM_authorizedUsers = "";
 $MM_donotCheckaccess = "true";
 
 // *** Restrict Access To Page: Grant or deny access to this page
 function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
 // For security, start by assuming the visitor is NOT authorized.
 $isValid = False;
 
 // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
 // Therefore, we know that a user is NOT logged in if that Session variable is blank.
 if (!empty($UserName)) {
 // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
 // Parse the strings into arrays.
 $arrUsers = Explode(",", $strUsers);
 $arrGroups = Explode(",", $strGroups);
 if (in_array($UserName, $arrUsers)) {
 $isValid = true;
 }
 // Or, you may restrict access to only certain users based on their username.
 if (in_array($UserGroup, $arrGroups)) {
 $isValid = true;
 }
 if (($strUsers == "") && true) {
 $isValid = true;
 }
 }
 return $isValid;
 }
 
 $MM_restrictGoTo = "login.php";
 if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
 $MM_qsChar = "?";
 $MM_referrer = $_SERVER['PHP_SELF'];
 if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
 if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
 $MM_referrer .= "?" . $QUERY_STRING;
 $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
 header("Location: ". $MM_restrictGoTo);
 exit;
 }
 ?>
 <?php
 function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
 {
 $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 news (typeid, title,img,content ,author) VALUES (%s,%s, %s, %s, %s)",
 GetSQLValueString($_POST['typeid'], "text"),
 GetSQLValueString($_POST['title'], "text"),
 GetSQLValueString($_POST['img'], "text"),
 GetSQLValueString($_POST['content'], "text"),
 GetSQLValueString($_POST['author'], "text"));
 
 
 mysql_select_db($database_connews, $connews);
 $Result1 = mysql_query($insertSQL, $connews) or die(mysql_error());
 }
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 <title>新闻发布界面</title>
 <style type="text/css">
 <!--
 body {
 background-color: #00FF99;
 }
 .style2 {
 font-size: 24px;
 font-weight: bold;
 }
 .style5 {
 font-size: 24px;
 color: #000000;
 font-weight: bold;
 }
 -->
 </style></head>
 
 <body>
 <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="form1">
 <p> </p>
 <table width="234" height="73" align="center" cellpadding="0" cellspacing="0">
 <tr>
 <td height="37"><div align="left"><span class="style2"><span class="style5">login success! </span></span></div></td>
 </tr>
 <tr>
 <td class="style2"><div align="center">新闻发布系统</div></td>
 </tr>
 </table>
 <p> </p>
 <table width="476" height="382" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
 <tr>
 <th width="125" height="32" align="center" scope="row">新闻类型:</th>
 <td width="351"><p>
 </p>
 <p>1.企业文化 2.公司概况 3.政策法规 </p>
 <p>4.项目运营 5.新闻动态 6.媒体报道</p>
 <p>
 <input name="typeid" type="text" id="typeid">
 (输入数字) </p>
 <p>  </p></td>
 </tr>
 <tr>
 <th height="28" align="center" scope="row">标题:</th>
 <td><input name="title" type="text" id="title2"></td>
 </tr>
 <tr>
 <th height="28" align="center" scope="row">图片:</th>
 <td><label><input name="img" type="file" id="img"></label></td>
 </tr>
 <tr>
 <th align="center" scope="row">新闻内容:</th>
 <td><textarea name="content" cols="50" rows="7" id="textarea"></textarea></td>
 </tr>
 <tr>
 <th height="29" align="center" scope="row">作者:</th>
 <td><input name="author" type="text" id="author"></td>
 </tr>
 <tr>
 <th colspan="2" scope="row"><input type="submit" name="Submit" value="提交">
 
 <input type="reset" name="Submit2" value="重置"></th>
 </tr>
 <tr>
 <th height="30" colspan="2" scope="row"><a href="login.php">管理员退出</a>     <a href="search.php">新闻搜索界面</a>     </th>
 </tr>
 </table>
 <p> </p>
 <input type="hidden" name="MM_insert" value="form1">
 </form>
 </body>
 </html>
 
 |  
					|  |  |