".$head;
$numposts=$user[posts]+1;
$numdays=(ctime()-$user[regdate])/86400;
$head=doreplace($head,$numposts,$numdays,$username);
$message=doreplace($message,$numposts,$numdays,$username);
$sign=doreplace($sign,$numposts,$numdays,$username);
$t--;
$s=0;
while($smilies[$s][0]){
$smilie=$smilies[$s];
$smile=$smilie[0];
$message=str_replace($smile,"

",$message);
$head=str_replace($smile,"

",$head);
$sign=str_replace($smile,"

",$sign);
$s++;
}
$message=str_replace($br,"
",$message);
if($submit){
$currenttime=ctime();
$postnum=$user[posts]+1;
if ($doublevote == "yes") { $doublevote = 1; } else { $doublevote=0; }
mysql_query("UPDATE users SET posts=posts+1,lastposttime=$currenttime WHERE id=$userid");
mysql_query("INSERT INTO poll (id,question,briefing,closed,doublevote) VALUES (NULL,'".addslashes($pollquestion)."','".addslashes($pollbriefing)."',0,$doublevote)");
$p=mysql_insert_id();
foreach ($pollchoices as $chid => $data) {
$ccolor = $data[color];
print "";
$cname = $data[choice];
mysql_query("INSERT INTO poll_choices (id,poll,choice,color) VALUES (NULL,$p,'".addslashes($cname)."','".addslashes($ccolor)."')");
$moo = mysql_affected_rows();
print "";
}
mysql_query("INSERT INTO threads (id,forum,user,views,closed,title,icon,replies,lastpostdate,lastposter,pollid) VALUES (NULL,$id,$userid,0,0,'".addslashes($subject)."','".addslashes($posticon)."',0,$currenttime,$userid,$p)");
$t=mysql_insert_id();
mysql_query("INSERT INTO posts (id,thread,user,date,ip,text,num,headtext,signtext) VALUES (NULL,$t,$userid,$currenttime,'".addslashes($userip)."','".addslashes($message)."',$postnum,'".addslashes($head)."','".addslashes($sign)."')");
mysql_query("UPDATE forums SET numthreads=numthreads+1,numposts=numposts+1,lastpostdate=$currenttime,lastpostuser=$userid WHERE id=$id");
print "
$tccell1 Thank you, $user[name], for submitting your new thread and poll.
".redirect("thread.php?id=$t","go to the thread",0)."