Jump to content

help with where to put code


chandler

Recommended Posts

Can some one show me where I should put the date and time code into the comment script below, I want it to show the date and time in each comment that's made. like this

echo date("l, F d, Y h:i" ,time());

I would like it in a div so I can add some css to it...thanks

 

 

 

		<?php

if (isset($_POST['message']))
{

if (isset($_SESSION['token']) && $_POST['token'] == $_SESSION['token'])
{
$message = htmlentities($_POST['message']);
$message2 = htmlentities($_POST['message2']);
$message = stripslashes($_POST['message']); 
$message2 = stripslashes($_POST['message2']); 



$fp = fopen('messages.txt', 'a');
fwrite($fp,"<div id=\"comments_box\"><div id=\"comment_name\"><p>$message <em>Says:</em></div><br />$message2</p></div>");
fclose($fp);
}
}

$token = md5(uniqid(rand(), true));
$_SESSION['token'] = $token;



?>


<form id="contFrm" method="POST">
<input type="hidden" name="token" value="<?php echo $token;?>" />
<label><span class="required">*</span> Full Name:</label>
<input type="text" class="box"  name="message"><br />
<label><span class="required">*</span> Message: </label>
<textarea name="message2" id="message" cols="25" rows="8"></textarea><br />
<input type="submit" class="button" value="Submit">
</form> 




<?php
echo "<div id=\"census41_messages\">";
readfile ('messages.txt');
echo "</div>";

?> 	

Link to comment
https://forums.phpfreaks.com/topic/242192-help-with-where-to-put-code/
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.