Jump to content

message not posting


runnerjp

Recommended Posts

for some reason my message part of my forum has all of a sudden decided not to post the id of the thread into parentid :S

 

 

<?php
session_start();
//connection string
require_once '../settings.php';
include "connect.php";
$id = $_SESSION['user_id']; 

$query = "SELECT * FROM users WHERE ID = '$id' LIMIT 1"; 
if ($result = mysql_query($query)){
    if (mysql_num_rows($result)) {
        $array = mysql_fetch_assoc($result);        
        $puser = $array['Username']; 	
	$pimage = $array['image']; 
?>

<link rel='stylesheet' href='style.css' type='text/css'>
<table class='maintables'>

<tr class='headline'><td>Reply</td></tr>

<tr class='maintables'><td>
<?php 
if(isset($_POST['submit']))

{

   $name=$puser;

   $yourpost=$_POST['yourpost'];

   $subject=$_POST['subject'];

   $id=$_POST['id'];

  

if(strlen($yourpost)<1)

   {

      print "You did not type in a post."; //no post entered

   }

   else

   {

      $thedate=date("U"); //get unix timestamp

      $displaytime=date("F j, Y, g:i a");

      //we now strip HTML injections

      $subject=strip_tags($subject);

      $name=strip_tags($name);

      $yourpost=strip_tags($yourpost); 

      $insertpost="INSERT INTO forumtutorial_posts(author,title,post,showtime,realtime,lastposter,parentid) values('$name','$subject','$yourpost','$displaytime','$thedate','$name','$id')";

      mysql_query($insertpost) or die("Could not insert post"); //insert post

      $updatepost="Update forumtutorial_posts set numreplies=numreplies+'1', lastposter='$name',showtime='$displaytime', lastrepliedto='$thedate' where postid='$id'";

      mysql_query($updatepost) or die("Could not update post");

      print "Message posted, go back to <A href='index.php?page=message&id=$id'>Message</a>.";

   }



}

else

{
$gettopic="SELECT * from forumtutorial_posts where postid='$id'";

$gettopic2=mysql_query($gettopic) or die("Could not get topic");

$gettopic3=mysql_fetch_array($gettopic2);

   $id=$_GET['id'];
   

   $message=strip_tags($getreplies3['post']);

   $message=nl2br($message);

   ?>

  <form action='index.php?page=reply' method='post'>

   <input type='hidden' name='id' value='$id'>

   Your message:<br>

   <textarea name='yourpost' rows='5' cols='40'></textarea><br>

   <input type='submit' name='submit' value='submit'></form>


<?php
}
?>
</td></tr></table>
<?php }}
?>

Link to comment
https://forums.phpfreaks.com/topic/108047-message-not-posting/
Share on other sites

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.