<?php
header("Pragma: no-cache");
$act=$HTTP_POST_VARS['act'];
$pstopic=$HTTP_POST_VARS['pstopic'];
$psmsg=$HTTP_POST_VARS['psmsg'];
$REMOTE_ADDR=$_SERVER['REMOTE_ADDR'];
$ispoll = $HTTP_POST_VARS['ispoll'];
$pollvar1 = $HTTP_POST_VARS['pollvar1'];
$pollvar2 = $HTTP_POST_VARS['pollvar2'];
$pollvar3 = $HTTP_POST_VARS['pollvar3'];
require "inc.php";
$myid=$_COOKIE["usid"];
$mypass=$_COOKIE["pass"];
$db=mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname,$db);
if (!isset($myid)) $myid=0;
$sqlc="select * from users where usid=$myid";
$c=mysql_query($sqlc);
$resc=mysql_fetch_array($c);
if ($resc[pass]==$mypass)
{
if ((!isset($act))||($pstopic=="")||($psmsg==""))
{
echo "
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html>
<head>
<title></title>
<meta name=\"description\" content=\"\">
<meta name=\"keywords\" content=\"\">
</head>
<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#006699\" vlink=\"#006699\" alink=\"#006699\">
<STYLE type=\"text/css\">
A {text-decoration: none;}
body
{
margin-left: 1%;
margin-right: 1%;
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
background-color: #F0F0F0;
}
</STYLE>";
include "top.php";
echo"
<form method=\"post\" action=\"newtop.php\">
<FONT size=2 color=\"#000000\" face=\"Arial\"><FONT size=2 color=\"#000000\" face=\"Arial\">
<TABLE width=100% border=1 cellpadding=1 bordercolor=\"#222288\" cellspacing=0>
<TR valign=top>
<TD> <FONT size=2 color=\"#000000\" face=\"Arial\">
<DIV>
<TABLE width=100% bgcolor=\"#FFFFFF\" border=0 cellpadding=5 bordercolor=\"#000000\" cellspacing=0>
<TR valign=top>
<TD colspan=\"4\" bgcolor=\"#8B93A0\">
<FONT size=2 color=\"#000000\" face=\"Arial\">
<DIV align=\"center\"><strong>New Topic </strong></DIV>
</FONT></TD>
</TR>
<TR valign=top>
<TD height=16 bgcolor=\"#D5DAEA\"> </TD>
<TD height=16 bgcolor=\"#D5DAEA\"><FONT size=2 color=\"#000000\" face=\"Arial\"><strong>Topic:</strong></FONT></TD>
<TD height=16 bgcolor=\"#D5DAEA\"><div align=\"justify\">
<input name=\"pstopic\" type=\"text\" size=\"70\" maxlength=\"50\" value=\"$pstopic\">
</div></TD>
<TD height=16 bgcolor=\"#D5DAEA\"> </TD>
</TR>
<TR valign=top>
<TD height=16 bgcolor=\"#D5DAEA\"> </TD>
<TD height=16 bgcolor=\"#D5DAEA\"><FONT size=2 color=\"#000000\" face=\"Arial\"><strong>Content:</strong></FONT></TD>
<TD height=16 bgcolor=\"#D5DAEA\">
<div align=\"justify\">
<p>
<textarea name=\"psmsg\" cols=\"60\" rows=\"10\">$psmsg</textarea>
</p>
</div></TD>
<TD height=16 bgcolor=\"#D5DAEA\"> </TD>
</TR>";
if ($myid=="1") echo"
<TR valign=top>
<TD width=\"10%\" height=16 bgcolor=\"#D5DAEA\"></TD>
<TD width=\"15%\" height=16 bgcolor=\"#D5DAEA\"><font color=\"#000000\" size=\"2\" face=\"Arial\"><strong>Is poll?</strong></font></TD>
<TD width=\"65%\" height=16 bgcolor=\"#D5DAEA\">
<font color=\"#000000\" size=\"2\" face=\"Arial\">
<input name=\"ispoll\" type=\"radio\" value=\"0\" checked>No
<input name=\"ispoll\" type=\"radio\" value=\"1\">Yes
</font>
</TD>
<TD width=\"10%\" height=16 bgcolor=\"#D5DAEA\"></TD>
</TR>
<TR valign=top>
<TD width=\"10%\" height=16 bgcolor=\"#D5DAEA\"></TD>
<TD width=\"15%\" height=16 bgcolor=\"#D5DAEA\"><font color=\"#000000\" size=\"2\" face=\"Arial\"><strong>Poll option #1:</strong></font></TD>
<TD width=\"65%\" height=16 bgcolor=\"#D5DAEA\">
<font color=\"#000000\" size=\"2\" face=\"Arial\">
<input name=\"pollvar1\" type=\"text\" size=\"70\" maxlength=\"50\">
</font>
</TD>
<TD width=\"10%\" height=16 bgcolor=\"#D5DAEA\"></TD>
</TR>
<TR valign=top>
<TD width=\"10%\" height=16 bgcolor=\"#D5DAEA\"></TD>
<TD width=\"15%\" height=16 bgcolor=\"#D5DAEA\"><font color=\"#000000\" size=\"2\" face=\"Arial\"><strong>Poll option #2:</strong></font></TD>
<TD width=\"65%\" height=16 bgcolor=\"#D5DAEA\">
<font color=\"#000000\" size=\"2\" face=\"Arial\">
<input name=\"pollvar2\" type=\"text\" size=\"70\" maxlength=\"50\">
</font>
</TD>
<TD width=\"10%\" height=16 bgcolor=\"#D5DAEA\"></TD>
</TR>
<TR valign=top>
<TD width=\"10%\" height=16 bgcolor=\"#D5DAEA\"></TD>
<TD width=\"15%\" height=16 bgcolor=\"#D5DAEA\"><font color=\"#000000\" size=\"2\" face=\"Arial\"><strong>Poll option #3:</strong></font></TD>
<TD width=\"65%\" height=16 bgcolor=\"#D5DAEA\">
<font color=\"#000000\" size=\"2\" face=\"Arial\">
<input name=\"pollvar3\" type=\"text\" size=\"70\" maxlength=\"50\">
</font>
</TD>
<TD width=\"10%\" height=16 bgcolor=\"#D5DAEA\"></TD>
</TR>";
echo"
<TR valign=top>
<TD width=\"10%\" height=16 bgcolor=\"#D5DAEA\"></TD>
<TD width=\"15%\" height=16 bgcolor=\"#D5DAEA\"></TD>
<TD width=\"65%\" height=16 bgcolor=\"#D5DAEA\">
<div align=\"justify\"><font color=\"#000000\" size=\"2\" face=\"Arial\">
<input type=\"submit\" name=\"Submit\" value=\" OK \">
<input type=\"hidden\" name=\"act\" value=\"post\">
<a href=\"index.php\"><input type=\"button\" name=\"cancel\" value=\"Cancel\"></a>
</font>
</div>
</TD>
<TD width=\"10%\" height=16 bgcolor=\"#D5DAEA\"></TD>
</TR>
</table>
</div>
</font>
</TABLE>
</FONT></FONT></form>";
include "bottom.php";
echo"
</body>
</html>";
}else
if ($act=="post")
{
$date = date("Y-m-d");
$time = date("H-i");
$psmsg=htmlspecialchars($psmsg, ENT_QUOTES);
$pstopic=htmlspecialchars($pstopic, ENT_QUOTES);
if ($myid=="1")
{
$sql="insert into forum values(Null, '$psmsg', '$pstopic', '$myid', '$date', '$time', '$REMOTE_ADDR', '0', '$ispoll', '$pollvar1', '$pollvar2', '$pollvar3', '0', '0', '0')";
}else
{
$sql="insert into forum values(Null, '$psmsg', '$pstopic', '$myid', '$date', '$time', '$REMOTE_ADDR', '0', '0', '0', '0', '0', '0', '0', '0')";
}
$a=mysql_query($sql);
$sql="select * from users where usid='$myid'";
$a=mysql_query($sql);
$res=mysql_fetch_array($a);
$ppp=$res[posts]+1;
$sql="update users set posts='$ppp' where usid='$myid'";
$a=mysql_query($sql);
Header("Location: index.php");
}
}else
{
Header("Location: login.php");
}
?>