|
-
Nov 12th, 2008, 06:18 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Need a little website help
I do not generally use php, I outsource for it. So this is why I'm here.
I'm just wondering if anyone would be willing to show me how to add a sort of guestbook feature.
I have a web page, which at the bottom I want to have 3 fields.
And a "Post Msg" button
Also some sort of verification or captcha must be used before posting
<page refreshes>
I then want that message to be posted at the top of the list (if there are any) with a visible (hh:mm) time stamp
The message must have a 24hr TTL then just be erased.
Is this easy and possible?
Thanks guys
-
Nov 12th, 2008, 06:44 AM
#2
Re: Need a little website help
Are you an absolute beginner to PHP? If so have a read at some beginner tutorials first and learn the basics, such as selection, iteration, variables, mysql, retrieving form data.
What you describe is a very simple web application, you could probably find a complete exampleof a guestbook if you search a bit.
Anyway, what I would recommend for this is a MySQL database to store the messages.
E.g. a table called 'posts' with columns: id (int), message (varchar), from (varchar), posted_on (datetime), ip_address (varchar).
PHP is very good at working with MySQL. Have a search for how to insert/retrive rows from mysql.
When retreiving the timestamp of the message, use the MySQL DATE_FORMAT() function to format the timestamp to hh:mm.
I would get it all working first, then add image verification (captcha), here's how:
http://www.php-mysql-tutorial.com/us...rification.php
Finally to get the time to live functionality, that depends on your hosting, is it a Linux server, windows?
If it's a Linux server, create a cron job, see 'crontab', that will call one of your PHP scripts after a specified interval e.g. every 24hrs which will run a query on the database to delete all the posts that are older than 24hrs.
If it's a windows server you can use scheduled tasks to do the same - however shared hosting may not give you access to this.
In answer to your question, yes it is very easy and very possible.
Hope this helps
-
Nov 12th, 2008, 08:02 AM
#3
Re: Need a little website help
 Originally Posted by the182guy
Are you an absolute beginner to PHP? If so have a read at some beginner tutorials first and learn the basics, such as selection, iteration, variables, mysql, retrieving form data.
What you describe is a very simple web application, you could probably find a complete exampleof a guestbook if you search a bit.
Anyway, what I would recommend for this is a MySQL database to store the messages.
E.g. a table called 'posts' with columns: id (int), message (varchar), from (varchar), posted_on (datetime), ip_address (varchar).
PHP is very good at working with MySQL. Have a search for how to insert/retrive rows from mysql.
When retreiving the timestamp of the message, use the MySQL DATE_FORMAT() function to format the timestamp to hh:mm.
I would get it all working first, then add image verification (captcha), here's how:
http://www.php-mysql-tutorial.com/us...rification.php
Finally to get the time to live functionality, that depends on your hosting, is it a Linux server, windows?
If it's a Linux server, create a cron job, see 'crontab', that will call one of your PHP scripts after a specified interval e.g. every 24hrs which will run a query on the database to delete all the posts that are older than 24hrs.
If it's a windows server you can use scheduled tasks to do the same - however shared hosting may not give you access to this.
In answer to your question, yes it is very easy and very possible.
Hope this helps 
[hijack] Oh 182!
You know we were talking about captha image verification the other day, well you could also use this... http://recaptcha.net/
Looks pretty good, and it helps towards science as well
-
Nov 12th, 2008, 08:10 AM
#4
Thread Starter
Hyperactive Member
Re: Need a little website help
Yes absolute begginer, same as with mysql. I don't usually require anything like this.
Ok i've managed to create the mysql table in cpanel, and its a linux server, but i dont know how to use cron jobs again, i've never needed to use them.
-
Nov 12th, 2008, 09:07 AM
#5
Re: Need a little website help
 Originally Posted by I_Love_My_Vans
[hijack] Oh 182!
You know we were talking about captha image verification the other day, well you could also use this... http://recaptcha.net/
Looks pretty good, and it helps towards science as well 
Nice find ILMV. 
The only downside to it is the box is quite big and you might have trouble getting it to look right on some forms. Unless you can get a small version? However the audio feature of it is good - escpecially if you want to impress the accessibility/standards guys.
 Originally Posted by boku
Yes absolute begginer, same as with mysql. I don't usually require anything like this.
Ok i've managed to create the mysql table in cpanel, and its a linux server, but i dont know how to use cron jobs again, i've never needed to use them.
Is this a shared host, or do you have a dedicated server? If it's a shared host they might not give you access to cronjobs, if they do it will be on the cpanel somewhere.
I would get the basic web app up and running first before adding cronjobs though.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|