$query = "SELECT * from users WHERE username='$user_name'";
$show = mysql_query($query);
while ($row=mysql_fetch_array($show))
{
echo $row[ghtml];
}
////////////////////////////////
// This checks to see if we need to add another guestbook entry.
////////////////////////////////
if (($REQUEST_METHOD=='POST')) {
////////////////////////////////
// This loop removed "dangerous" characters from the posted data
// and puts backslashes in front of characters that might cause
// problems in the database.
////////////////////////////////
for(reset($HTTP_POST_VARS);
$key=key($HTTP_POST_VARS);
next($HTTP_POST_VARS)) {
$this = addslashes($HTTP_POST_VARS[$key]);
$this = strtr($this, ">", " ");
$this = strtr($this, "<", " ");
$this = strtr($this, "|", " ");
$$key = $this;
}
////////////////////////////////
// This will catch if someone is trying to submit a blank
// or incomplete form.
////////////////////////////////
if ( $message ) {
////////////////////////////////
// This is the meat of the query that updates the guests table
////////////////////////////////
$query = "SELECT * from image WHERE userf='$userses'";
$show = mysql_query($query);
while ($row=mysql_fetch_array($show))
{
$image = $row[urler];
}
$query = "SELECT * FROM users WHERE username='$SESSION[edithtml]";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$new_value = $row[post_count] + 1;
echo "$new_value";
mysql_query("UPDATE users SET post_count='$new_value' WHERE username='$SESSION[edithtml]'");
$query = "INSERT INTO guest";
$query .= "(guest_id, guest_name,";
$query .= " guest_time, guest_message, user_name, imag)";
$query .= " values(0000,'$userses',NULL,'$message','$user_name','$image')";
mysql_pconnect("localhost","chaotici","")
or die("Unable to connect to SQL server");
mysql_select_db("chaotici_") or die("Unable to select database");
mysql_query($query) or die("Insert Failed!");
} else {
////////////////////////////////
// If they didn't include all the required fields set a variable
// and keep going.
////////////////////////////////
$notall = 1;
}
}
?>