Jump to content

Little Problem, should take 5 mins to solve.


Noskiw

Recommended Posts

PROBLEM

 

<?php

ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);

if(!$_POST['submit']){
   echo "Invalid Usage of file!\n";
}else{
   $tid = mss($_GET['id']);
   $msg = mss($_POST['reply']);

      if(!$tid){
      echo "You did not supply a topic to reply to!\n";
   }else{
      $sql = "SELECT * FROM forum_topics WHERE id='$tid'";
      $res = mysql_query($sql) or die(mysql_error());
      if(mysql_num_rows($res) == 0){
         echo "This topic does not exist!\n";
      }else{
         $row = mysql_fetch_assoc($res);
         $sql2 = "SELECT admin FROM forum_sub_cats WHERE id='{$row['cid']}'";
         $res2 = mysql_query($sql2) or die(mysql_error());
         $row2 = mysql_fetch_assoc($res2);
         if($row2['admin'] == 1 && $admin_user_level == 0){
            echo "You cannot post here, this is because you are not an admin!\n";
         }else{
            if(!$msg){
               echo "You did not supply a message for the reply!\n";
            }else{
               if(strlen($msg) < 10 || strlen($msg) > 500){
                  echo "Your reply must be between 10 and 500 characters!\n";
               }else{
                  $sessionuid = $_SESSION['uid'];
                  $date = date("m-d-y") . " at " . date("h:i:s");
                  $time = time();
                  $sql3 = "INSERT INTO `forum_replies` (`tid`,`uid`,`message`,`date`,`time`) VALUES('".$tid."','".$_SESSION['uid']."','".$msg."','".$date."','".$time."')";
                  $res3 = mysql_query($sql3) or die(mysql_error());
                  $sql4 = "UPDATE `forum_topics` SET `time`='".time()."' WHERE `id`='".$tid."'";
                  $res4 = mysql_query($sql4) or die(mysql_error());
                  header("Location: forum-index.php?act=topic&id=".$tid);
               }
            }
         }
      }
   }
}

?>

 

i want it to go back to the topic but it doesn't. anything wrong here?

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.