当加载到服务器http://letsplays.uni.me/addchannel.html代码从这部分出现,因为这就是语法高亮停止的地方!$value) { if (empty($value) && in_array($key, $required_fields) === true) { $errors[] = '标有 * 的字段是必填的'; 休息1;} } } ?>
看起来很突然,似乎没有任何问题!
<?php
if(empty($_Post) === false) {
$required_fields = array('email', 'password', 'repeatpassword', 'channelurl', 'chanelname', 'embedd1', 'keywords');
foreach($_POST as $key=>$value) {
if (empty($value) && in_array($key, $required_fields) === true) {
$errors[] = 'Fields marked with * are required';
break 1;
}
}
}
?>
<?php require_once('Connections/connecttotable.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 Userchannel (chanelID, firstname, lastname, email, password, channelurl, chanelname, `description`, embedd1, game1, Embedd2, game2) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['chanelID'], "int"),
GetSQLValueString($_POST['firstname'], "text"),
GetSQLValueString($_POST['lastname'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['channelurl'], "text"),
GetSQLValueString($_POST['chanelname'], "text"),
GetSQLValueString($_POST['description'], "text"),
GetSQLValueString($_POST['embedd1'], "text"),
GetSQLValueString($_POST['game1'], "text"),
GetSQLValueString($_POST['Embedd2'], "text"),
GetSQLValueString($_POST['game2'], "text"));
mysql_select_db($database_connecttotable, $connecttotable);
$Result1 = mysql_query($insertSQL, $connecttotable) or die(mysql_error());
$insertGoTo = "mychanel.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_connecttotable, $connecttotable);
$query_Recordset1 = "SELECT * FROM Userchannel";
$Recordset1 = mysql_query($query_Recordset1, $connecttotable) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<style type="text/css">
#wrapper .pretag #main h1 {
text-align: center;
}
</style>
<!-- InstanceBegin template="/Templates/header.dwt" codeOutsideHTMLIsLocked="false" -->
<style type="text/css">
.links {
font-size: 24px;
color: #FFF;
}
#main {
height: auto;
width: 1024px;
}
#main {
height: auto;
width: 1024px;
}
#footer {
height: auto;
width: 1024px;
}
#navbar2 {
height: auto;
width: 512px;
float: left;
}
#advertisement {
background-color: #039;
height: 150px;
width: 512px;
float: left;
}
</style>
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
<body onLoad="MM_preloadImages('images/homerollover.jpg','images/ChannelSearchrlo.jpg','images/Channelcreaterlo.jpg','images/Newsrlo.jpg','images/about.jpg','images/Aboutrlo.jpg')">
<!-- InstanceBeginEditable name="mainarea" -->
<div id="wrapper">
<style type="text/css">
#wrapper {
height: auto;
width: 1024px;
margin-right: auto;
margin-left: auto;
}
#header {
background-image: url(images/heading2.jpg);
height: 200px;
width: 1024px;
}
</style>
<div id="header">
<pre>
<p class="pretag"><span class="links"></span></p>
<pre class="pretag"><span class="links">
<a href="http://letsplays.uni.me/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1','','images/homerollover.jpg',1)"><img src="images/Home.jpg" alt="Go Home" name="Image1" width="150" height="30" border="0"></a><a href="http://letsplays.uni.me/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('home','','images/homerollover.jpg',1)"></a></span> <a href="ChannelSearch.php.txt" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Channelsearch','','images/ChannelSearchrlo.jpg',1)"><img src="images/channelsearch.jpg" alt="Channel Search" name="Channelsearch" width="150" height="30" border="0"></a> <a href="CreateChannel.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Create Channel','','images/Channelcreaterlo.jpg',1)"><img src="images/channeladd.jpg" alt="Create Channel" name="Create Channel" width="150" height="30" border="0"></a> <a href="ign.com" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('News','','images/Newsrlo.jpg',1)"><img src="images/News.jpg" alt="News" name="News" width="150" height="30" border="0"></a> <a href="About.html.txt" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('About','','images/Aboutrlo.jpg',1)"><img src="images/about.jpg" alt="About this page" name="About" width="150" height="30" border="0"></a><a href="About.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('About ','','images/about.jpg',1)"></a></pre>
</div>
<span class="pretag">
<div id="main"><h1>Add Your Channel</h1>
<?php
<?php
if(empty($_POS) === false) {
$required_fields = array('email', 'password', 'repeatpassword', 'channelurl', 'chanelname', 'embedd1', 'keywords')
foreach($_POST as $key=>$value) {
if (empty($value) && in_array($key, $required_fields) === true) {
$errors[] = 'Fields marked with * are required';
break 1;
}
}
}
print_r($errors);
?>
</h1>
<p> </p>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">First name:</td>
<td><input type="text" name="firstname" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Last name:</td>
<td><input type="text" name="lastname" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Email:*</td>
<td><input type="text" name="email" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Password:*</td>
<td><input type="password" name="password" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Repeat Password:*</td>
<td><input type="password" name="repeatpassword" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right" valign="top">Channel url:*</td>
<td><textarea name="channelurl" cols="50" rows="1"></textarea></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Channel name:*</td>
<td><input type="text" name="chanelname" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Description:</td>
<td><textarea name="description" cols="32" rows="6"></textarea></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Video 1:* </td>
<td><input type="text" name="embedd1" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">What game is it?</td>
<td><input type="text" name="game1" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Video 2:</td>
<td><input type="text" name="Embedd2" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">What game is it?</td>
<td><input type="text" name="game2" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Keywords to describe and find your channel*</td>
<td><input type="text" name="keywords" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Channel Create"></td>
</tr>
</table>
<input type="hidden" name="chanelID" value="">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
</div>
</span>
<div id="footer">
<div id="navbar2">
<ul>
<li>
<url src="http://letsplays.uni.me">
Home</li>
<li>
<url src="http://letsplays.uni.me/addchannel">
Cnannel Add</li>
<li>
<url src="http://letsplays.uni.me/channelsearch">
Channel Search</li>
<li>
<url src="http://letsplays.uni.me/news">
News</li>
<li>
<url src="http://letsplays.uni.me/about">
About and Contact</li>
</ul>
</div>
<div id="advertisement"></div>
</div>
</div>
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd -->
<?php
mysql_free_result($Recordset1);
?>