-
Posts
142 -
Joined
-
Last visited
Everything posted by chandler
-
Ok thanks I will try that now.
-
Yes I know I have used that before when I was trying to learn PHP but I had to uninstall it due to my computer crashing every time I ran it. I am still using the same computer its very old .
-
Ok I have setup a db, I have copied all the info ($mysql_host) etc and put it into a config.php file and I have placed an include config.php on the page. Now for setting up the query I have no idea how to do this, can you please help. Thanks
-
ok if I setup a db, can you please help me with it?, I think it will be better in the end as I will want a image/file upload feature... Thanks
-
wont be a problem its a closed site just for the family, plus I just wouldn't know where to begin to change this script to use a DB
-
I thought this was the only way it could be done as I don't want the comments from page 1 mixing and being displayed with the comments from page 2 etc, I have been reading a bit about this tonight and its way over my head so I hope some one can help me..thanks
-
Hi I have this comment script it will be placed on a few pages, each are written to .txt file so there will be messages1.txt, messages2.txt, messages3.txt and so on, is it possible using php to find out what was the last comment made and on what page, and then display this info on the main page some thing like last 5 comments made: made on page 3 17.07.2011 @ 15:00 made on page 2 16.07.2011 @ 15:00 etc the comment script <?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']); ini_set('date.timezone', 'Europe/London'); // add the newest comment to the start of the file $comments = "<div id=\"comments_box\"><div id=\"comment_name\"><p>$message <em>Says:</em></div><div id=\"comment_date\">" . date ("D, M d, Y, g:i a") . "</div><br />$message2</p></div>"; // this is the new comment to be added $comments .= file_get_contents('messages.txt'); // now we get all the existing comments and append it to the $comments variable. // write all the comments back to the file with the newest comment first $fp = fopen('messages.txt', 'w'); fwrite($fp, $comments); 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>"; ?> </div> Many Thanks for you help
-
ops I didn't spot that either, nice job works perfect..Thank you
-
Thanks for that here is the update code, but what I get now is the newest post replacing the last post. Have I done something wrong? <?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']); ini_set('date.timezone', 'Europe/London'); // add the newest comment to the start of the file $comments = "<div id=\"comments_box\"><div id=\"comment_name\"><p>$message <em>Says:</em></div><div id=\"comment_date\">" . date ("D, M d, Y, g:i a") . "</div><br />$message2</p></div>"; // this is the new comment to be added $comnents .= file_get_contents('messages.txt'); // now we get all the existing comments and append it to the $comments variable. // write all the comments back to the file with the newest comment first $fp = fopen('messages.txt', 'w'); fwrite($fp, $comments); 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>"; ?>
-
Thanks for that but that's using a database I'd rather use the flat file with code I already have for the comments, it works well, is it not possible to order the comments in a flat file?
-
Brill, works perfect many thanks
-
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>"; ?>
-
Hi I have this comment script I am using on several pages. What I want is for the newest comment to appear on top, and if its possible I would like something on the main page telling the users where the last comment was made for example: last comment was made on page 3 17.07.2011 @ 15:00 I am rubbish at php so any help / links to help with the above would be much appreciated. <?php session_start(); ?> <?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>"; ?> Many Thanks
-
Thanks that did it
-
Here is the full script, all I want to be able to do is to style the comments, but if I have "<div id=\"census41_messages\">" where it is now, then I have this result <div id="census41_messages"> <p>Name<br />Message</p></div> <div id="census41_messages"> <p>Name<br />Message</p></div> <div id="census41_messages"> <p>Name<br />Message</p></div> but what I want is! <div id="census41_messages"> <p>Name<br />Message</p> <p>Name<br />Message</p> <p>Name<br />Message</p> </div> <?php if (isset($_POST['message'])) { if (isset($_SESSION['token']) && $_POST['token'] == $_SESSION['token']) { $message = htmlentities($_POST['message']); $message2 = htmlentities($_POST['message2']); $fp = fopen('messages.txt', 'a'); fwrite($fp, "<div id=\"census41_messages\"> <p>$message<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 readfile('messages.txt'); ?> Thanks
-
Hi I think this should be an easy one for you lot $fp = fopen('messages.txt', 'a'); fwrite($fp, "<div id=\"census41_messages\"><p>$message<br />$message2</p></div>"); fclose($fp); The div above is the problem, this is wrote to the file each time a comment is made and is messing up the layout of the comments, how can I get the div to go around all the comments?. Thanks for your help.
-
Thank you spiderwell, that looks like what I am after, will have a better look in the morning...Many many thanks
-
I want each user to be able to login to their own personal page where their private content is only accessible to them. I guess this would be done using a specific directory for each user with a index.php in each users directory? No upload.
-
That's just a basic log in / log out tut. But thanks
-
A little more in detail. I need a script that serves different content for each user that accesses it. The user_login.php (or whatever) page would work basically like this: if (checklogin()) { $content = readDataFor($userID); print $myheader; print $content; print $myfooter; } else { //redirect user to login script Files ect, will be stored in a user specific directory. I found this bit of code on google and it is exactly what I need to achieve, I am having trouble though finding a complete tutorial, that will show me how to make the login system and with the above included. Many Thanks
-
Thanks for that but I'd rather not use joomla.
-
Hello, can someone please advice me on what scripts I will need to accomplish the following. I want users to be able to login to their personal page, on there will be items such as pdf files, jpeg files etc, that they will be able to download. Are there any free scripts out there that can do this, that anyone knows of? I don't mind paying if its a cheapish script for one of you to make for me, but money is a bit tight at the moment so a free script would be my 1st choice... Thanks for all your help
-
that is so cool, many many thanks for your help.
-
I get no errors, but there is no countdown displayed all I see is : Thank you, we will be in touch. You'll be redirected in secs. If not, click here. I have triple checked and all paths etc are correct.
-
Hi, ok that looks good $('span.countdown').countdown({seconds: 30}); how would I add this to the code, I have tried keep getting errors. echo 'You\'ll be redirected in $('span.countdown').countdown({seconds: 30}); secs. If not, click <a href="visit.php">here</a>.'; ?? thanks