Comment Form

Status
Not open for further replies.

e85andyou

New Member
Messages
49
Reaction score
0
Points
0
I have been looking for a comment form that I would like to use on my site but I cant find anything that I like. I tried to program my own but found that PHP and MySQL are still a little over my head. I looked on all the sites I could find and could not find a code that looked good.

If anyone is interested in creating one for me I will give 400 credits to the first to do so.

Details:
I would like a database with just name, comment and product id.
I would like to place a different comment box for each product and just have to change a product number in the code.
The display should just have the comments and a leave comment link to a popup window.
I would also like some type of captcha or spam control since my other forms use to get spammed like crazy.
If you have any questions please feel free to PM me.
 

Scoochi2

New Member
Messages
185
Reaction score
0
Points
0
Take a look at the form on my page at http://scoochi2.freehostia.com/.
Is that something similar to what you would like?

The select box could be used for the product id (or a text entry box) for example. A captcha could be easily added and the comments either shown publically or privately to just you.
 

e85andyou

New Member
Messages
49
Reaction score
0
Points
0
I want the product Id to be a hidden field and I want the comments to be publicly displayed
 

souradipm

New Member
Messages
45
Reaction score
0
Points
0
Hi,
I have cooked up a small script you may edit as you wish. Remember to edit the variable $secret!

It doesnt have capcha, but it would be easy to add. Just comment.php?act=create&secret=<secret_code> to create the table after you have made sure the database connection works.

comment.php?act=display&getid=<product_id> = Display a list of comments for <product_id>

comment.php?act=form&pid=<product_id> = Display a form for submitting to comments under the product id <product_id>

comment.php?act=submit = called by the ?act=form to submit the data to the database, posting the details.

Also has minimal protection - htmlspecialchars and the secret code for creating the table.

Demo: http://www.fivepointsoft.co.cc/testing_area/comment.php
Append the appropriate stuff to the end of the url to test it out. I will remove the demo after a few days.

Link to txt version of script - so you can download it: http://www.fivepointsoft.co.cc/testing_area/comment.txt

~souradipm
 

souradipm

New Member
Messages
45
Reaction score
0
Points
0
Did you go to http://www.fivepointsoft.co.cc/testing_area/comment.php ?
If so, it will not work, because you need to append stuff to the url. If you want, you can split the file across many different php files so you can include them where you want them.

Try:
http://www.fivepointsoft.co.cc/testing_area/comment.php?act=form&pid=1 to submit a comment under the product id of 1, and then navigate to http://www.fivepointsoft.co.cc/testing_area/comment.php?act=display&getid=1 to read the comments under the product id of 1.

These are the two main things my script provides.

Obviously the create function wont work because you don't know my secret code and it has already been created so the query will fail anyway.

~souradipm
 
Last edited:

itman647

New Member
Messages
45
Reaction score
0
Points
0
you could make one using text files

example

build your html form using expression web or frontpage
call the email box email, the name box name and comments box comments

the form action attribute should be something like "post.php?viewmode=post" and the method should be "post"

okay in post.php you should start off like this:

<?php

$login = $_GET['login'];

// ENTER YOUR PASSWORD BELOW
$pass = md5("mypasswordis12345);

$viewmode = $_GET['viewmode'];

// CHANGE THE PATH BELOW TO A 777 CHMOD'D FILE
$comments = "locationofmycomments.comments.file"

if($viewmode="post")
{
$file = fopen($comments,"a");
$name = $_GET['name'];
$email = $_GET['email'];
$comments = $_GET['comments'];
$line = $name."|".$email."|".$comments;
fwrite($file,$line);
fclose($file);
}

if($viewmode="view")
{
if (md5($login)==$pass)
{echo "Access Granted";}
else
{echo "Access Denied"; die();}
$data = file($comments);
$count = count($data);

$i = 0;

foreach ($data as $line)
{
$linex = explode("|",$data[$i]);
echo "Name: ".$linex[0]." Email: ".$linex[1]."<hr>Comments: ".$linex[2]."<hr><br>";
$i++;
}
}

thats a very simple php form but i cant be arsed atm because i have lots of problems with my own site, but if I have time i'll make a more secure and advanced php script.

i've never learnt how to create a mysql database and prob never will do, because php code cannot be accessed really without the server password and username, all browsers output html and javascript only, you never see the php code outputted, yes its a text file with no password protection but they wont know the location of it on the server so they can't access it, and if its stored in lots of folders and the absolute url of the file is never exposed or echo'ed to the browser you wont have to worry. so thats why i like using text files, sure you have to be careful but if you know what you're doing you should be fine
 
Last edited:

e85andyou

New Member
Messages
49
Reaction score
0
Points
0
I had a slow day today so I spent it looking for comment program. I stumbled across one exactly what I was looking for after a few hours of searching.

I thank you all for your help

You may close this thread
 
Status
Not open for further replies.
Top