making a comment on my web page

sirbum69
05-28-2002, 07:21 PM
can someone tell me what i need to do to make a form that ppl can use to leave comments on my web page...

kinda like a msg board but i want it to just be a small little form that they put there nick in and then a comment and it leaves the comment at the bottom of the page..along with everyone elses...

orufet
05-28-2002, 07:26 PM
I did a little thing like this in PHP for my site, however due to all of the rude comments I took it off. If you want this, prepare for a lifetime of constant deleting of rude messages directed at you...I'll give you the code when I find it (assuming your host supports PHP)

Robby
05-28-2002, 07:28 PM
For the code part, you can do this using ASP/VB script.

The data must be held somewhere, you can use a database or a text file.

I really don't know your level of knowledge, so I can't recommend much else.

orufet
05-28-2002, 07:46 PM
I know you asked to do this in JS/VBS, but here's a PHP alternative....


// code for add.php
<?php
$handle=fopen("posts.inc", "a"); // open the file

$buffer="<font color='#676767'>$name</font> - <font color='#000000'>$message</font><br><hr>"; // set the message with their name, etc

//check the length
$length=strlen($message);

if($length<100) {
fwrite($handle,$buffer); // write to the file

fclose($handle); // close the file

header("Location: http://www.sheehy.ca/thoughts/thoughts.php"); // show results
}
if($length>100) {
echo 'Message too long. Please use less than 100 characters. Thank you.';

}
?>




<!--code for post.inc-->
<html>
<body>
<form method="post" action="http://www.sheehy.ca/thoughts/add.php">
<input type="text" name="name" value="name"></input><br>
<textarea value="message" name="message" cols="10"></textarea><br>
<input type="submit" value="Submit">
</form>
</body>
</html>



// code for thoughts.php
<?php

echo ("
<html>
<head>
<link rel='stylesheet' href='http://www.sheehy.ca/style.css' type='text/css'>
</head>
<body>
<table>");

include "http://www.sheehy.ca/thoughts/posts.inc";

echo ("
</table>
<font size='2'>
<a href='http://www.sheehy.ca/thoughts/post.inc'>post a message</a>
</font>
</body>
</html>
");
?>


You'll have to create a file called posts.inc, where they will be stored. If you want to see a sample of this working, let me know and I'll set it up again on my site. Oh yeah, and you'll have to change all of the paths...

Again, sorry for not answering your question, but I can't give you the code in JS/VBS...

Agent
05-28-2002, 07:56 PM
If you are (I think the word is...) well-versed in PHP, what
you first want to do is show their IP to them. For scared little
kids, they think you will you automatically know who you
are or something and usually won't post something stupid.
Also, if you make it where they have to fill out valid information,
like E-mail, name, and body of paragraph, they usually don't
waste their time. Also adding, that, if you re-direct them to a
page where they can't hit RELOAD (refresh) ten times and it
send you e-mail, that is always good.

Robby
05-28-2002, 10:19 PM
Agent brings up some good points here. I suggest that once you get your page working, come back and we'll let you know of what to look out for. (Regarding idiots double posting and stuff)

sirbum69
05-28-2002, 10:47 PM
lol now thats funny...yeh i agree with you on all accounts and actully i said in js but i can do it in php that is fine....

i just thought it was only possible in java...as for how good am i at php...im not....lol....i have a little back ground in visual basic and then i am preatty well versed in html but not php...

but yeh i would love to try this code out that you gave me here...i believe my web host takes it...its angelfire so im guessing they do i know they handle cgi....

i guess what im wandering is the file that i create that stores it do i put it in my normal dir where i have all the html files...thats what im assuming...

yeh please ill do this and try it....if you want you can email me at shawnjj@lvcm.com....

ChiefRedBull
05-29-2002, 05:17 AM
A little punctuation and sentence structure wouldn't go amiss sirbum. Just makes it a little easier on the eye :D

JS won't work because JS has no file handling capabilities.
I'm not sure if AngelFire will let you run this, it's a free service is it not? Normally one has to pay for CGI, whether it be VBS, Perl, PHP, Coldfusion, etc..

sirbum69
05-29-2002, 04:05 PM
no i run cgi on there now....i have a poll and a counter that are both cgi scripts made out of perl.....

The poll was made by them but the counter is one i picked up from off the net on a perl site....



So yes they do allow it with out having to pay.....

i guess its couse of the server type that they run wich is apache
1.3 or something like that...

but i tried this script he gave me up there and it didnt work on my desk top...i use web writer to do my pages off line but i guess i didnt do it right...

orufet
05-29-2002, 04:11 PM
The code I gave you requires PHP to be installed on your computer if that's where you're going to host the site. If not, your host will need to support it. I doubt that Angelfire supports it, but I haven't checked. If you can't use it, then I'll probably be of no help to you...

sirbum69
05-29-2002, 04:39 PM
well your right i just found out that my site doesnt support php...


but...i have a friend who runs his own server and he does support php on his....so i should still be able to run it...


im just waiting to get back with him.....to set up on his server....



then all i will need to know is what goes where lol....

couse when i set those codes up in pages they just showed the code but i guess that would be couse i dont have php set on my computer....

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum