Code: Select all
<!--add.php--------------->
<?php
require_once("sys_conf.inc");
//decide whether message and username is empty
$errorm="";
if (!isset($message) or $message=="" or !isset($name) or $name=="")
{
$errorm="<font color=red></font>* Must be entered";
}
else
{
$link_id=mysql_connect($DBHOST,$DBUSER,$DBPWD);
mysql_select_db($DBNAME);
$space = " ";
$time = date("YmdHi");
$ip=$REMOTE_ADDR;
$message=StripSlashes($message);
$message=htmlspecialchars($message);
$message=nl2br($message);
$guestcontent = "<tr><td><font color=#AB00E1>Message Content:</font><br>$message";
$guestcontent=$guestcontent."<br><font color=#6633FF>Username: </font>$name";
if ($email !="")
$guestcontent=$guestcontent."<br><font color=#9900CC>Email:</font><a href=\"mailto:$email\">$email</a>"."$space";
if ($Domain !="")
$guestcontent=$guestcontent."<font color=#9900CC>Domain";
if ($Team !="")
$guestcontent=$guestcontent."<br><font color=#0000FF>Team:</font>";
$guestcontent=ereg_replace(chr(10),"",$guestcontent);
$guestcontent=$guestcontent."<hr size=1></td></tr>\n";
$str="insert into guestbook (time,ip,name,domain,team,email,message,content,is_delete)";
$str=$str."values('$time','$ip','$name','$domain','$team','$email','$message','$guestcontent','n')";
//echo $str;
$result=mysql_query($str,$link_id);
mysql_close($link_id);
}
?>
<html>
<head>
<title>Search
</title>
<style>
<!--
A:link {text-decoration: none ; color:0000ff}
A:visited {text-decoration: none; color:004080}
A:active {text-decoration: none}
A:hover {text-decoration: underline; color:ff0000}
BODY {FONT-SIZE:10pt}
TH {FONT-SIZE:10 pt}
TD {FONT-SIZE: 10pt}
TEXTAREA
{
FONT-FAMILY: "Time News Roman";
FONT-SIZE: 10pt;
}
-->
</style>
</head>
<body bgcolor=#FFFFFD>
<center>
<?php include "head.html"?>
<h2>Post Message</h2>
<table width="68%" border="1" cellpadding="3" cellspacing="0" bordercolor="#E3E3E3">
<form method="POST" action="add.php">
<?php
if ($errorm)
{
echo "<tr>";
echo "<td colspan=3 height=32> ";
echo "$errorm";
echo "</td>";
echo "</tr>";
}
?>
<tr>
<td width="32%" bgcolor="#F0F0F0"><font color="#000000">*Username<font color="#FF0033"></font></font></td>
<td colspan="2" width="78%" bgcolor="#F0F0F0"><font color="#00FF00">
<input type="text" name="name" size="40">
</font></td>
</tr>
<tr>
<td width="22%" height="29">Domain:</td>
<td colspan="2" height="29" width="78%">
<input type="text" name="domain" size="40">
</td>
</tr>
<tr>
<td width="22%" height="27" bgcolor="#F0F0F0">Team:</td>
<td colspan="2" height="27" width="78%" bgcolor="#F0F0F0">
<input type="text" name="team" size=40">
</td>
</tr>
<tr>
<td width="22%" height="20">Email:</td>
<td colspan="2" height="20" width="78%"><font color="#00FF00">
<input type="text" name="email" size="40">
</font></td>
</tr>
<tr>
<td colspan="3" valign="middle" align="left">
<div align="center"><font color="#000000">*Leave Message</font><font color="#FF0033"></font><font color="#00FF00"><br>
<textarea rows="6" name="message" cols="55" wrap="VIRTUAL"></textarea>
</font></div>
</td>
</tr>
<tr bgcolor="#F0F0F0">
<td colspan="3" height="24">
<div align="center"><font color="#00FF00">
<input type="submit" value="Submit" name="ok">
<input type="reset" value="Clear" name="cencel">
</font>
</td>
</tr>
</form>
</table>
</center>
</body>
</html>