home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / modules / forums / reply.php < prev    next >
Encoding:
PHP Script  |  2002-09-16  |  26.4 KB  |  625 lines

  1. <?php
  2. ######################################################################
  3. # Modulo Splatt Forum per PHP-NUKE
  4. #-------------------------
  5. # Versione: 3.2
  6. #
  7. # Copyright (c) 2002 by:
  8. #
  9. # Giorgio Ciranni (~Splatt~)
  10. # (http://www.splatt.it)
  11. # (webmaster@splatt.it)
  12. #
  13. # Supporto tecnico disponibile sul Forum di www.splatt.it
  14. ######################################################################
  15. # Splatt Forum is free software. You can redistribute it and/or modify
  16. # it under the terms of the GNU General Public License as published by
  17. # the Free Software Foundation; either version 2 of the License.
  18. # Splatt Forum is distributed in the hope that it will be useful,
  19. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. # GNU General Public License for more details.
  22. #
  23. # You should have received a copy of the GNU General Public License
  24. # along with this program; if not, write to the Free Software
  25. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   
  26. # 02111-1307  USA
  27. ######################################################################
  28.  
  29. $module_name = "$name";
  30.  
  31. if($cancel) {
  32.         header("Location: modules.php?op=modload&name=".$module_name."&file=viewtopic&topic=$topic&forum=$forum");
  33. }
  34.  
  35. include("config.php");
  36. include("modules/".$module_name."/functions.php");
  37. include("modules/".$module_name."/auth.php");
  38. include("modules/$module_name/attachment.php");
  39.  
  40. $use_forum_password_fix = 1;
  41.  
  42. $sql = "SELECT forum_name, forum_access, forum_moderator, forum_atch FROM ${prefix}_forums WHERE (forum_id = '$forum')";
  43. if(!$result = mysql_query($sql, $db)) {
  44.         die("<font size=+1>"._ERRORE1."</font><hr>Could not connect to the forums database.");
  45. }
  46. $myrow = mysql_fetch_array($result);
  47. $forum_name = $myrow[forum_name];
  48. $forum_access = $myrow[forum_access];
  49. $forum_id = $forum;
  50. $atch = $myrow[forum_atch];
  51.  
  52. if(is_locked($topic, $db)) {
  53.         die(""._FLOKTOP.".");
  54. }
  55.  
  56. if(!does_exists($forum, $db, "forum") || !does_exists($topic, $db, "topic")) {
  57.         die("Error - The forum or topic you are attempting to post to does not exist. Please try again.");
  58. }
  59.  
  60. if($submit) {
  61.         if($message == '') $stop=1;
  62.  
  63.         if (!$user) {
  64.                 if($username == '' && $password == '' && $forum_access == 0) {
  65.                         // Not logged in, and username and password are empty and forum_access is 0 (anon posting allowed)
  66.                         $userdata = array("uid" => 1);
  67.                        // include('header.php');
  68.                 }
  69.                 else {
  70.                         // no valid session, need to check user/pass.
  71.                         if($username == '' || $password == '') {
  72.                                 die("You must enter your username and password. Go back and do so.");
  73.                         }
  74.  
  75.                         
  76.                         $userdata = get_userdata($username, $db);
  77.  
  78. $dbpass=$userdata[pass];
  79. $non_crypt_pass = $password;
  80. $old_crypt_pass = crypt($password,substr($dbpass,0,2));
  81. $md_pass = md5($password);
  82.     if (($dbpass == $non_crypt_pass) OR ($dbpass ==
  83. $old_crypt_pass)) {
  84.         $md_pass=$dbpass;
  85. }
  86.  
  87.                         if($md_pass == $userdata[pass]) {
  88.                                 $info = base64_encode("$userdata[uid]:$userdata[uname]:$userdata[pass]:$userdata[storynum]:$userdata[umode]:$userdata[uorder]:$userdata[hold]:$userdata[noscore]:$userdata[ublockon]:$userdata[theme]:$userdata[commentmax]");
  89.                                 setcookie("user","$info",time()+15552000);
  90.                              //   include('header.php');
  91.                         }
  92.                         else {
  93.                         die("You have entered an incorrect password. Go back and try again.");
  94.                         }
  95.                 }
  96.         }
  97.         else {
  98.         include('header.php');
  99.                #$user = base64_decode($user);
  100.                #$userdata = explode(":", $user);
  101.                    $userdata = $cookie;
  102.                 $userdata = get_userdata($userdata[1], $db);
  103.         }
  104.         // Either valid user/pass, or valid session. continue with post.
  105.  
  106.         if ($stop != 1) {
  107.         $poster_ip = $REMOTE_ADDR;
  108.         if($allow_html == 0 || isset($html)) $message =     htmlspecialchars($message);
  109.         $message = secure($message);
  110.         if($sig && $userdata[uid] != 1) $message .= "[addsig]";
  111.         if($allow_bbcode == 1 && !isset($bbcode)) $message = bbencode($message);
  112.         $message = str_replace("\n", "<BR>", $message);
  113.         if(!$smile) $message = smile($message);
  114.         $Message = $message;
  115.         $message = check_words($Message);
  116.         $message = make_clickable($message);
  117.         $message = addslashes($message);
  118.         $time = date("Y-m-d H:i");
  119.         $sql = "INSERT INTO ${prefix}_posts (topic_id, image, forum_id, poster_id, post_text, post_time, poster_ip) VALUES ('$topic', '$image_subject', '$forum', '$userdata[uid]', '$message', '$time', '$poster_ip')";
  120.         if(!$result = mysql_query($sql, $db)) {
  121.                 die("Error - Could not enter data into the database. Please go back and try again");
  122.         }
  123. $post_id = mysql_insert_id($db);
  124.         ConfirmAttach($post_id);
  125.         //include('header.php');
  126.         $sql = "UPDATE ${prefix}_forumtopics SET topic_time = '$time' WHERE topic_id = '$topic'";
  127.         if(!$result = mysql_query($sql, $db)) {
  128.                 die("Error - Could not enter data into the database. Please go back and try again");
  129.         }
  130.         if($userdata["uid"] != 1) {
  131.                 $sql = "UPDATE ${user_prefix}_users SET user_posts=user_posts+1 WHERE (uid = $userdata[uid])";
  132.                 $result = mysql_query($sql, $db);
  133.                 if (!$result) {
  134.                         echo mysql_error() . "<br>\n";
  135.                         die("Error updating post count.");
  136.                 }
  137.         }
  138.         $sql = "SELECT t.topic_notify, u.email, u.uname FROM ${prefix}_forumtopics t, ".$user_prefix."_users u WHERE t.topic_id = '$topic' AND t.topic_poster = u.uid";
  139.         if(!$result = mysql_query($sql, $db)) {
  140.                 die("Error - Could not query the database.");
  141.         }
  142.         $m = mysql_fetch_array($result);
  143.  
  144.         if($m[topic_notify] == 1 && $m[uname] != $username) {
  145.  
  146.                 $subject = ""._NOTIFSUB."";
  147.                 $message = ""._CIAO." $m[uname]\r\n\r\n"._NOTIFM1."";
  148.                 $message .= ""._NOTIFM2."\r\n";
  149.                 $message .= $nukeurl."/modules.php?op=modload&name=".$module_name."&file=viewtopic&topic=$topic&forum=$forum\r\n\r\n"._NOTIFM3."\r\n".$nukeurl."/index.php";
  150.                 $message .= "\r\n\r\n"._GRAZ.". \r\n"._APRSTAF." $sitename";
  151.                 // if (!$system)
  152.                 mail($m[email], $subject, $message, "From: $adminmail\r\nX-Mailer: phpNuke_forum");
  153.  
  154.         }
  155.  
  156.  
  157.         // Keledan
  158.         $total = get_total_posts($topic, $db, "topic");
  159.         if($total > $posts_per_page) {
  160.            $start = floor ($total / $posts_per_page) * $posts_per_page ;
  161.            $pagina = "modules.php?op=modload&name=".$module_name."&file=viewtopic&topic=$topic&forum=$forum&start=$start";
  162.         } else $pagina = "modules.php?op=modload&name=".$module_name."&file=viewtopic&topic=$topic&forum=$forum";
  163.         // Keledan
  164.  
  165.         echo "<center>"._FPOSTED."<br><a href=\"$pagina\">"._FVIEW."</center><P></font>";
  166.         ?>
  167.         <script language="Javascript" type="text/javascript">
  168.         <!--
  169.         function gotoThread(){
  170.         window.location.href="<?php print "$pagina" ?>";
  171.         }
  172.         window.setTimeout("gotoThread()", 3000);
  173.         //-->
  174.         </script>
  175.  
  176. <?php die();
  177.        }
  178.        else {
  179.  
  180. die(""._YOUMUST.".");
  181. //echo"<table><tr><td>"._YOUMUST."";
  182.  
  183. }
  184.  
  185. } else {
  186. resetAtchCookie();
  187.         include('header.php');
  188. $moderator = get_moderator($mod,$db);
  189. $moderators = get_moderators($forum, $db);
  190.  
  191. list($topic_title) = mysql_fetch_array(mysql_query("select topic_title from ${prefix}_forumtopics where topic_id='$topic'"));
  192. ?>
  193.         <P ALIGN=LEFT><FONT SIZE="1"><br><b>
  194.  
  195.         <!--
  196.         <b><?php echo ""._MODERATED."<a href=modules.php?name=Your_Account&op=userinfo&uname=$moderator>$moderator";?></a>
  197.         -->
  198.  
  199.         <?
  200. $topic_title = stripslashes($topic_title);
  201.  
  202.         echo ""._MODERATED."</b>";
  203.  
  204.         $count = 0;
  205.         reset ($moderators);
  206.         while(list($null, $mods) = each($moderators)) {
  207.                 while(list($mod_id, $mod_name) = each($mods)) {
  208.  
  209.                         if($count > 0) { echo " , "; }
  210.  
  211.                         echo "<a href=\"modules.php?name=Your_Account&op=userinfo&uname=$mod_name\">$mod_name</a>";
  212.  
  213.                         $count++;
  214.                 }
  215.         }
  216.  
  217.  
  218.         ?>
  219.  
  220.         <br><b>
  221.         <?php echo _FORUM;?>: </b> <a href="modules.php?op=modload&name=<?php echo $module_name?>&file=viewforum&forum=<?php echo $forum?>"><?php echo  $forum_name?></a><br><b>
  222.         <?php echo _POSTIN;?></b> <a href="modules.php?op=modload&name=<?php echo $module_name?>&file=viewtopic&forum=<?php echo $forum?>&topic=<?php echo $topic?>"><?php echo $topic_title?></a>
  223.         </b></font></p>
  224.         <FORM ACTION="modules.php?op=modload&name=<?php echo $module_name?>&file=reply" METHOD="POST" NAME="coolsus">
  225.         <TABLE BORDER="0" CELLPADDING="1" CELLSPACING=0" ALIGN="CENTER" VALIGN="TOP" WIDTH="100%"><TR><TD>
  226.         <TABLE BORDER="0" CELLPADDING="1" CELLSPACING=1" WIDTH="100%">
  227.         <TR BGCOLOR="<?php echo $bgcolor2?>" ALIGN="LEFT">
  228.                 <TD width=25%><FONT COLOR="<?php echo $textcolor1;?>"><b><?php echo _TYPES;?></b></FONT></TD>
  229. <?php
  230.         if($forum_access == 0) {
  231. ?>
  232.                 <TD><FONT COLOR="<?php echo $textcolor1;?>"><?php echo ""._FANON." "._FCANWRITE.""?></FONT></TD>
  233.  
  234. <?php
  235.         }
  236.         else if($forum_access == 1) {
  237. ?>
  238.                 <TD><FONT COLOR="<?php echo $textcolor1;?>"><?php echo ""._FREG." "._FCANWRITE."";?></FONT></TD>
  239. <?php
  240.         }
  241.         else if($forum_access == 2) {
  242. ?>
  243.                 <TD><FONT COLOR="<?php echo $textcolor1;?>"><?php echo ""._FMODS." "._FCANWRITE."";?></FONT></TD>
  244. <?php
  245.         }
  246. ?>
  247.         </TR>
  248. <?PHP
  249.         if (isset($user) && $forum_access == 1) {
  250.                 #$user = base64_decode($user);
  251.                 #$userdata = explode(":", $user);
  252.                 $userdata = $cookie;
  253.                 $sql = "SELECT pass, user_level FROM ".$user_prefix."_users WHERE uid = '$userdata[0]'";
  254.                 $result = mysql_query($sql, $db);
  255.                 $user = mysql_fetch_array($result);
  256.  
  257.                 if ($use_forum_password_fix == 1) {
  258.                         $password = $user[pass];
  259.                 } else {
  260.                         if (!$system) $password = base64_decode($user[pass]);
  261.                         else $password = $user[pass];
  262.                 }
  263.  
  264.                 if ($password == $userdata[2] && $forum_access <= $user[user_level]) {
  265.                 echo "<TR ALIGN=LEFT>";
  266.                 echo "<TD  BGCOLOR=$bgcolor3  width=25%><b>"._FNICKNAME."<b></TD>";
  267.                 echo "<TD  BGCOLOR=$bgcolor1>";
  268.                 echo $userdata[1] . " \n";
  269.                 echo "</TD></TR> \n";
  270.                 $allow_to_reply= 1;
  271.                 }
  272.                 else {
  273.                 echo "<TR>";
  274.                 echo "<TD BGCOLOR=$bgcolor3 COLSPAN=2 ALIGN=CENTER>"._YOUNOT."<BR><A HREF=javascript:history.go(-1)>"._FBACK."</A></TD>";
  275.                 echo "</TR>";
  276.                 }
  277.         } elseif (!isset($user) && $forum_access == 1) {
  278.                 echo "<TR ALIGN=LEFT>";
  279.                 echo "<TD  BGCOLOR=$bgcolor3  width=25%><b>"._FNICKNAME."<b></TD>";
  280.                 echo "<TD  BGCOLOR=$bgcolor1>";
  281.                 echo "<INPUT CLASS=textbox TYPE=\"TEXT\" NAME=\"username\" SIZE=\"25\" MAXLENGTH=\"40\" ></TD> \n";
  282.                 echo "<TR ALIGN=\"LEFT\"> \n";
  283.                 echo "<TD BGCOLOR=\"$bgcolor3\" width=25%><b>"._FPASSWORD."</b></TD> \n";
  284.                 echo "<TD BGCOLOR=\"$bgcolor1\"><INPUT CLASS=textbox TYPE=\"PASSWORD\" NAME=\"password\" SIZE=\"25\" MAXLENGTH=\"25\"></TD> \n";
  285.                 echo "</TR> \n";
  286.                 $allow_to_reply = 1;
  287.         } elseif ($forum_access == 2) {
  288.                 echo "<TR ALIGN=LEFT>";
  289.                 echo "<TD  BGCOLOR=$bgcolor3  width=25%><b>"._FNICKNAME."<b></TD>";
  290.                 echo "<TD  BGCOLOR=$bgcolor1>";
  291.                 echo "<INPUT CLASS=textbox TYPE=\"TEXT\" NAME=\"username\" SIZE=\"25\" MAXLENGTH=\"40\"></TD> \n";
  292.                 echo "<TR ALIGN=\"LEFT\"> \n";
  293.                 echo "<TD BGCOLOR=\"$bgcolor3\" width=25%><b>"._FPASSWORD."</b></TD> \n";
  294.                 echo "<TD BGCOLOR=\"$bgcolor1\"><INPUT CLASS=textbox TYPE=\"PASSWORD\" NAME=\"password\" SIZE=\"25\" MAXLENGTH=\"25\"></TD> \n";
  295.                 echo "</TR> \n";
  296.                 $allow_to_reply = 1;
  297.         } elseif ($forum_access == 0) {
  298.                 $allow_to_reply = 1;
  299.         }
  300.  
  301. if ($allow_to_reply) {
  302.  
  303. addForumScripts();
  304. ?>
  305.         <TR ALIGN="LEFT">
  306.                 <TD  BGCOLOR="<?php echo $bgcolor3?>" width=25% VALIGN="TOP"><b><?php echo _FMICON;?></b></TD>
  307.                 <TD  BGCOLOR="<?php echo $bgcolor1?>">
  308.         <?php
  309.                 $handle=opendir("./images/forum/subject");
  310.                 while ($file = readdir($handle))
  311.                         {
  312.                         $filelist[] = $file;
  313.                 }
  314.                 asort($filelist);
  315.                 while (list ($key, $file) = each ($filelist))
  316.                 {
  317.                 ereg(".gif|.jpg",$file);
  318.                 if (strtoupper(stristr($file,".gif")) == ".GIF" || strtoupper(stristr($file,".jpg")) == ".JPG") {
  319.                         echo "<input type=\"radio\" value=\"$file\" name=\"image_subject\"> ";
  320.                         echo "<IMG SRC=\"images/forum/subject/$file\" BORDER=0> ";
  321.                         $count++;
  322.                         }
  323.                 if ($count == "9") { echo "<br>"; $count = 1; }
  324.  
  325.                 }
  326.         ?>
  327.                  </TD>
  328.         </TR>
  329.         <TR ALIGN="LEFT" VALIGN="TOP">
  330.                 <TD  BGCOLOR="<?php echo $bgcolor3?>" width=25%><b><?php echo _FMESSAGE;?></b><br><br>
  331.                 <font size=-1>
  332.                 <?php
  333.                 echo "HTML : ";
  334.                 if($allow_html == 1)
  335.                         echo ""._FON."<BR>\n";
  336.                 else
  337.                         echo ""._FOFF."<BR>\n";
  338.                 echo "<br><a href=\"modules.php?op=modload&name=".$module_name."&file=bbcode_ref\" TARGET=\"blank\">BBCode</a> : ";
  339.                 if($allow_bbcode == 1)
  340.                         echo ""._FON."<br>\n";
  341.                 else
  342.                         echo ""._FOFF."<BR>\n";
  343.                 echo "<br>"._FORUMATCHM." : ";
  344.                 if($atch == 1)
  345.                         echo ""._FON."<BR>\n";
  346.                 else
  347.                         echo ""._FOFF."<BR>\n";
  348.  
  349.                 if($quote) {
  350.  
  351.                         $sql = "SELECT p.post_text, p.post_time, u.uname FROM ${prefix}_posts p left outer join ".$user_prefix."_users u on p.poster_id = u.uid WHERE post_id = '$post' " ;
  352.                         if($r = mysql_query($sql, $db)) {
  353.                                 $m = mysql_fetch_array($r);
  354.                                 $text = desmile($m[post_text]);
  355.                                 $text = str_replace("<BR>", "\n", $text);
  356.                                 $text = stripslashes($text);
  357.                                 $text = bbdecode($text);
  358.                                 if ($m[uname]) {
  359.                                         $poster = $m[uname];
  360.                                 } else {
  361.                                         $poster = ""._FANONIMO."";
  362.                                 }
  363.                                 $reply = "[quote]\nOn $m[post_time], $poster wrote:\n$text\n[/quote]";
  364.                         }
  365.                         else {
  366.                                 $reply = "Error Contacting database. Please try again.\n";
  367.                         }
  368.                 }
  369.                 ?>
  370.                 </font></TD>
  371.                 <TD  BGCOLOR="<?php echo $bgcolor1?>"><TEXTAREA CLASS=textbox NAME="message" ROWS=10 COLS=75 WRAP="VIRTUAL"><?php echo $reply?></TEXTAREA>
  372.  
  373. <br>
  374.                 <?php putitems();?></TD>
  375.         </TR>
  376.         <TR ALIGN="LEFT">
  377.                 <TD  BGCOLOR="<?php echo $bgcolor3?>" width=25%><b><?php echo _FOPTIONS;?></b></TD>
  378.                 <TD  BGCOLOR="<?php echo $bgcolor1?>" >
  379.                 <?php
  380.     if ($atch == 1) {
  381.                 echo "<br>".getAttachCode()."<br><br>";
  382. }
  383.                         if($allow_html == 1) {
  384.                 ?>
  385.                                 <INPUT TYPE="CHECKBOX" NAME="html"><?php echo _DISHTML;?><BR>
  386.                 <?php
  387.                         }
  388.                 ?>
  389.                 <?php
  390.                         if($allow_bbcode == 1) {
  391.                 ?>
  392.                                 <INPUT TYPE="CHECKBOX" NAME="bbcode"><?php echo ""._FDIS." <a href=\"modules.php?op=modload&name=".$module_name."&file=bbcode_ref\" target=\"_blank\"><i>BBCode</i></a> "._FTHISMAIL;?><BR>
  393.                 <?php
  394.                         }
  395.                 ?>
  396.  
  397.                 <INPUT TYPE="CHECKBOX" NAME="smile"><?php echo ""._FDIS." <a href=\"modules.php?op=modload&name=".$module_name."&file=bb_smilies\" target=\"_blank\"><i>Smilies</i></a> "._FTHISMAIL;?><BR>
  398.                 <?php
  399.                         if($allow_sig == 1) {
  400.                                 if($userdata[sig] == 1)
  401.                                         $s = "CHECKED";
  402.                 ?>
  403.                                 <INPUT TYPE="CHECKBOX" NAME="sig" <?php echo $s?>><?php echo _FSHOWSIG;?> <font size=-2>(<?php echo _WHATISSIG;?>)</font><BR>
  404.                 <?php
  405.                         }
  406.                 ?>
  407.                 </TD>
  408.         </TR>
  409.         <TR>
  410.                 <TD  BGCOLOR="<?php echo $bgcolor1?>" colspan=2 ALIGN="CENTER">
  411.                 <INPUT TYPE="HIDDEN" NAME="forum" VALUE="<?php echo $forum?>">
  412.                 <INPUT TYPE="HIDDEN" NAME="topic" VALUE="<?php echo $topic?>">
  413.                 <INPUT TYPE="SUBMIT" NAME="submit" VALUE="<?php echo _INVIA; ?>"> <INPUT TYPE="RESET" VALUE="<?php echo _FRESET; ?>">
  414.                  <INPUT TYPE="SUBMIT" NAME="cancel" VALUE="<?php echo _FCANC; ?>">
  415.         </TR>
  416. <?php
  417. }
  418. ?>
  419.         </TABLE></TD></TR></TABLE>
  420.         </FORM>
  421.         <BR>
  422.         <CENTER>
  423.         <TABLE BORDER="0" CELLPADDING="1" CELLPADDING="0" ALIGN="CENTER" VALIGN="TOP" WIDTH="100%"><TR><TD>
  424. <TABLE BORDER="0" CELLPADDING="3" CELLPADDING="1" WIDTH="100%">
  425. <TR BGCOLOR="<?php echo $bgcolor2?>" ALIGN="LEFT">
  426.         <TD WIDTH=20%><B><font COLOR="<?php echo $textcolor1?>"><?php echo _FAUTHOR;?></FONT></B></TD>
  427.         <TD><B><font COLOR="<?php echo $textcolor1?>"><?php echo _TREVIEW ?></FONT></B></TD>
  428. </TR>
  429. <?php
  430. $sql = "SELECT * FROM ${prefix}_posts WHERE topic_id = '$topic' ORDER BY post_id LIMIT $posts_per_page";
  431. }
  432.         if(!$result = mysql_query($sql, $db))
  433.         die("<font size=+1>"._ERRORE1."</font><hr>"._FCOULDNOT."");
  434. $myrow = mysql_fetch_array($result);
  435. $row_color = $color2;
  436. $count = 0;
  437.  
  438.  
  439. if(isset($userdata[0]) && $userdata[0] == $mod) { $viewip = 1; }
  440.  
  441. do {
  442.    if(!($count % 2))
  443.      $row_color = $bgcolor3;
  444.    else
  445.      $row_color = $bgcolor1;
  446.  
  447.    echo "<TR BGCOLOR=\"$row_color\" ALIGN=\"LEFT\">\n";
  448.  
  449. $risult = mysql_query("SELECT * FROM $user_prefix"._users." where uid= '$myrow[poster_id]'");
  450.             $num = mysql_num_rows($risult);
  451.  
  452. if($num == 0 && $myrow[poster_id] != 1) {
  453.                 $posterdata = array("uid" => 1, "uname" => ""._FANONIMO."", "posts" => "0", "rank" => -1);
  454.    echo "<TD rowspan=\"2\" valign=top><b>$posterdata[uname]</b><br><br>\n";
  455.    echo"<br><br>"._FUSDEL."";
  456.      }
  457. else
  458. {
  459.    if($myrow[poster_id] != 1) {
  460.            $posterdata = get_userdata_from_id($myrow[poster_id], $db);
  461.         }
  462.    else
  463.      $posterdata = array("uid" => 1, "uname" => ""._FANONIMO."", "posts" => "0", "rank" => -1);
  464.    echo "<TD rowspan=\"2\" valign=top><b>$posterdata[uname]</b><br><br>\n";
  465.  
  466. if ($posterdata[user_avatar] != '') {
  467.    echo "<img src=\"images/forum/avatar/$posterdata[user_avatar]\"><br>";
  468.     }
  469.    $posts = $posterdata[user_posts];
  470.  
  471.  
  472. $sql = "SELECT * FROM ${prefix}_forum_mods WHERE forum_id = '$forum' and user_id = '$posterdata[uid]'";
  473. $risultato = mysql_query($sql) or
  474.         die(mysql_error());
  475.         if(mysql_num_rows($risultato) == 0) {
  476.                 $moderatore = 0;
  477.         }
  478.         else {
  479.                 $moderatore = 1;
  480. }
  481.  
  482.     
  483. if($posterdata[user_level] == 3)
  484.  
  485.     {
  486. echo "<br><img src=\"images/forum/pips_admin.gif\"><br>";
  487. }
  488.  
  489.    if($posterdata[uid] != 1)
  490.  
  491.      {
  492.  
  493.         if($moderatore == 1 && $posterdata[user_level] != 3)
  494.  
  495.  
  496.          {
  497.         echo "<br><img src=\"images/forum/pips_moderator.gif\"><br>";
  498.         }
  499.  
  500.             else {
  501.  
  502.                  if($posterdata[user_rank] != 0)
  503.              $sql = "SELECT rank_title, rank_image FROM ${prefix}_ranks WHERE rank_id = '$posterdata[user_rank]'";
  504.                    else
  505.              $sql = "SELECT rank_title, rank_image FROM ${prefix}_ranks WHERE rank_min <= " . $posterdata[user_posts] . " AND rank_max >= " . $posterdata[user_posts] . " AND rank_special = 0";
  506.            if(!$rank_result = mysql_query($sql, $db))
  507.              die("Error connecting to the database!");
  508.            list($rank, $rankimage) = mysql_fetch_array($rank_result);
  509.             if($rankimage == ""){
  510.            echo "<font size=1>" . stripslashes($rank) . "</font>";
  511.         }else
  512.                 {
  513. if($posterdata[user_level] != 3) {
  514.             echo "<br><img src=\"images/forum/special/$rankimage\" alt=\"$rank\"><br>";
  515. }
  516.         }
  517.  
  518.     
  519. }
  520.  
  521.            echo "<BR>"._FJOINED."<br>".convertidatasolo($posterdata[user_regdate])." \n";
  522.            
  523. if($posterdata[user_from]!="")
  524.            
  525.            echo "<br><br>"._FFROM."$posterdata[user_from]\n";
  526. echo "<br><br>"._FAPOSTS." <b>$posts</b><br><br>\n";
  527.  
  528.  
  529. $result2 = mysql_query("SELECT username,guest FROM $prefix"._session." where username='$posterdata[uname]'");
  530.             $member_online_num = mysql_num_rows($result2);
  531. if ($member_online_num != 0)
  532.           echo"<img src=\"images/forum/subject/rose.gif\" height=\"19\" width=\"19\"><font color=\"red\"><b>ON-Line</b></font><br><br>";
  533.     else
  534.           echo"<img src=\"images/forum/subject/icon20.gif\" height=\"19\" width=\"19\"><font color=\"blue\"><b>OFF-Line</b></font><br><br>";    
  535.  
  536. }
  537.         
  538.            else {
  539.            echo"<img src=\"images/forum/avatar/018.gif\"><br>";
  540.             echo "<font size=1>"._NOTREG."</font>";
  541.         }
  542.  
  543. }
  544.    echo"</td>";
  545.  
  546.    if ($myrow[image] != "") echo "<TD valign=\"top\"><img src=\"images/forum/subject/$myrow[image]\"><font size=1>";
  547.    else echo "<TD valign=\"top\"><img src=\"images/forum/icons/posticon.gif\"><font size=1>";
  548.  
  549.  
  550.    echo " "._FTPOSTED." ".convertiData($myrow[post_time])."   ";
  551.    echo "<HR></font>\n";
  552.    $message = stripslashes($myrow[post_text]);
  553. Opentable();
  554.    $message = eregi_replace("\[addsig]", "<br><br><BR>-----------------<BR>" . bbencode($posterdata[user_sig]), $message);
  555.  
  556.    echo $message . "<BR>";
  557. Closetable();
  558.  
  559. echo"</td></tr><TR BGCOLOR=\"$row_color\"><td>";
  560.    echo "<HR>\n";
  561.  
  562. if ($atch==1){
  563. echo ShowAttach($myrow[post_id]);
  564. }
  565.    if($posterdata[uid] != 1)
  566.    echo " <a href=\"modules.php?name=Your_Account&op=userinfo&uname=$posterdata[uname]\"><img src=\"images/forum/icons/profile.gif\" border=0></a><FONT SIZE=1>"._FAPROFIL."</FONT>\n";
  567.    if($posterdata["femail"] != ''){
  568. echo " <IMG SRC=\"images/forum/icons/div.gif\">\n";
  569.      echo " <a href=\"mailto:$posterdata[femail]\"><IMG SRC=\"images/forum/icons/email.gif\" BORDER=0></a><FONT SIZE=1>"._FAEMAIL."</FONT>\n";
  570. }
  571.    if($posterdata["url"] != '') {
  572.       if(strstr("http://", $posterdata["url"]))
  573.         $posterdata["url"] = "http://" . $posterdata["url"];
  574. echo " <IMG SRC=\"images/forum/icons/div.gif\">\n";
  575.       echo " <a href=\"$posterdata[url]\" TARGET=\"_blank\"><IMG SRC=\"images/forum/icons/www_icon.gif\" BORDER=0></a><FONT SIZE=1>www</FONT>\n";
  576.    }
  577.    if($posterdata["user_icq"] != '')
  578.      echo " <a href=\"http://wwp.icq.com/$posterdata[user_icq]#pager\" target=\"_blank\"><img src=\"http://online.mirabilis.com/scripts/online.dll?icq=$posterdata[user_icq]&img=5\" border=\"0\"></a> <a href=\"http://wwp.icq.com/scripts/search.dll?to=$posterdata[user_icq]\"><img src=\"images/forum/icons/icq_add.gif\" border=\"0\"></a><FONT SIZE=1>"._FAADD."</FONT>";
  579.  
  580.    if($posterdata["user_aim"] != '')
  581.      echo " <a href=\"aim:goim?screenname=$posterdata[user_aim]&message=Hi+$posterdata[user_aim].+Are+you+there?\"><img src=\"images/forum/icons/aim.gif\" border=\"0\"></a><FONT SIZE=1>aim</FONT>";
  582.  
  583.    if($posterdata["user_yim"] != '')
  584.      echo " <a href=\"http://edit.yahoo.com/config/send_webmesg?.target=$posterdata[user_yim]&.src=pg\"><img src=\"images/forum/icons/yim.gif\" border=\"0\"></a>";
  585.  
  586.    if($posterdata["user_msnm"] != '')
  587.      echo " <a href=\"modules.php?name=Your_Account&op=userinfo&uname=$posterdata[uname]\"><img src=\"images/forum/icons/msnm.gif\" border=\"0\"></a>";
  588.  
  589.    echo " <IMG SRC=\"images/forum/icons/div.gif\">\n";
  590.    if($posterdata[uid]==$userdata[0] || $mod==$userdata[0])
  591.      echo " <a href=\"modules.php?op=modload&name=".$module_name."&file=editpost&post_id=$myrow[post_id]&topic=$topic&forum=$forum\"><img src=\"images/forum/icons/edit.gif\" border=0></a><FONT SIZE=1>"._FAEDIT."</FONT>\n";
  592.      
  593.    if($viewip == 1) {
  594.       echo " <IMG SRC=\"images/forum/icons/div.gif\">\n";
  595.       echo " <a href=\"modules.php?op=modload&name=".$module_name."&file=topicadmin&mode=viewip&post=$myrow[post_id]&forum=$forum\"><IMG SRC=\"images/forum/icons/ip_logged.gif\" BORDER=0></a><FONT SIZE=1>ip</FONT>\n";
  596.    }
  597.    echo "</TD></TR>";
  598.    
  599. } while($myrow = mysql_fetch_array($result));
  600.  
  601.  
  602. ?>
  603.  
  604. </TABLE></TD></TR></TABLE>
  605. <TABLE ALIGN="CENTER" BORDER="0" WIDTH="95%">
  606. <?php
  607. if($total > $posts_per_page) {
  608.         $times = 1;
  609.         echo "<TR ALIGN=\"RIGHT\"><TD COLSPAN=2><font size=1>"._FGOTO."";
  610.         for($x = 0; $x < $total; $x += $posts_per_page) {
  611.                 if($times != 1)
  612.                         echo " | ";
  613.                 echo "  <a href=\"modules.php?op=modload&name=".$module_name."&file=viewtopic&topic=$topic&forum=$forum&start=$x\">$times</a>";
  614.                 $times++;
  615.         }
  616.         echo "</TD></TR>\n";
  617. }
  618.  
  619.  
  620. echo "</TABLE>";
  621. echo"<p align=\"center\">Splatt Forum © By: <a href=\"http://www.splatt.it\" target=\"_blank\">Splatt.it</a><br>Version: $forumver</font></p><br><br>";
  622.  
  623. include('footer.php');
  624.  
  625. ?>