Matt Posted June 20, 2006 Share Posted June 20, 2006 Well, thanks for reading this, it means you're trying to help!Here's what I need, basically.I have a comments form on a page on my site:http://matt.artemis-fowl.com/comments/comments.phpBut I need to make some serious edits to suit my needs. Please note that I'll be downloading it all and reuploading it to a new server with a different database, I'm testing through this one.I need it to there's no "E-mail" Input Field, and no checkboxes underneith it (There's two, currently, "Notify me of..." and "Hide my e-mail."I figure that bit should be fairly easy. Here's the REALLY hard part.I need it so that the user has exactly 3 minute to enter their comment, and after those three minutes, the comment gets posted and the user gets redirected to a page where they CANNOT post another message, and have no way of simply clicking back to post another.Please help, I know it's really tricky, but please.Thanks again!Matt Link to comment Share on other sites More sharing options...
Matt Posted June 20, 2006 Author Share Posted June 20, 2006 I also uploaded a complete file of all the code in the "comments.php" file.http://matt.artemis-fowl.com/comments/helpme.txt Link to comment Share on other sites More sharing options...
dcole.ath.cx Posted June 20, 2006 Share Posted June 20, 2006 well in the html, just delete the word Email and the form box that comes after it. Then search for checkbox and delete those 2 tags.As for the 3mins, you will need to use some JS with a timer script. After 180 secs you could have JS get the content from the form and send the url with the data (in the url) to a new page. The new page could send you the data and do what ever else. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 20, 2006 Share Posted June 20, 2006 You wouldn't need to send the data through the URL, there is a javascript form.submit method. Problem is, anyone could just turn off javascript and the limit wouldn't matter. You may be able to get around that by having the submit button start disabled and enable it through javascript, so that if javascript is off they can't submit at all. But then again, it would be easy enough to turn off javascript after the button has already been enabled.The only reliable way you could do this would be to record the time in a database or file when they open the form, and then check the time when they submit to make sure they are under. But then you would either trash their post and say they didn't do it quick enough, or save it if they did. There wouldn't be a way to just submit it after 3 minutes. You could have a javascript timer count down to 3 minutes so at least they know how much time they have. And maybe give them an extra 5 or 10 seconds leeway so if they hit submit right at 3 minutes, considering the few seconds of transfer time to the server, they will still make it in time.You could do the whole thing in Flash, that would let you do it. You could make a Flash form and have a timer keep track there. They wouldn't be able to disable that. But then you have to learn Flash.. Link to comment Share on other sites More sharing options...
scott100 Posted June 20, 2006 Share Posted June 20, 2006 You could use a meta tag to redirect the page after 3 mins, but that still leave the problem of the form being submitted, would require javascript? but then you have the problem if its disabled...http://www.w3schools.com/html/tryit.asp?fi...ryhtml_redirect Link to comment Share on other sites More sharing options...
justsomeguy Posted June 20, 2006 Share Posted June 20, 2006 Yeah I was thinking about a meta redirect also, but the submit problem rules that out. If you're going to rely on javascript, might as well just do everything in javascript. Link to comment Share on other sites More sharing options...
Matt Posted June 21, 2006 Author Share Posted June 21, 2006 Don't worry about their post not getting submitted quick enough, that's the idea.So, it can be done? And I know someone who can do Flash, I'll speak to him about it, but I'd REALLY prefer it if I could do it through coding... so is there any die-cast ways I can do this? Link to comment Share on other sites More sharing options...
Little Goat Posted June 21, 2006 Share Posted June 21, 2006 cant you do a meta refresh to java script:document.yourform.submit(); ?that would work, wouldn't it? Link to comment Share on other sites More sharing options...
scott100 Posted June 21, 2006 Share Posted June 21, 2006 cant you do a meta refresh to java script:document.yourform.submit(); ?that would work, wouldn't it?<{POST_SNAPBACK}> Yeah, but that would rely on javascript being enabled, the problem is if they have it disabled... Link to comment Share on other sites More sharing options...
justsomeguy Posted June 21, 2006 Share Posted June 21, 2006 There are really only 2 ways that you can be sure users won't be able to get around the time limit. One is to use a server-side language to record when they start and when they finish (do not pass the start value with the form, the start time needs to be saved in a temporary database or file on the server). The other way is to use Flash to have both the form and the timer in the Flash movie. If they have Flash disabled, they don't get the form either, so they need to enable Flash which will give them both the form as well as the timer. Link to comment Share on other sites More sharing options...
Matt Posted June 22, 2006 Author Share Posted June 22, 2006 I'm now having serious problems. The whole page is written in PHP, and I really don't know how to read it.I cannot seem to delete the parts I want to delete, the e-mail part of the form, and the two checkboxes, and I also need to move the comment form so it's ABOVE the comments that have been posted.Please help, this is, actually, for once, extremely important. Link to comment Share on other sites More sharing options...
Matt Posted June 22, 2006 Author Share Posted June 22, 2006 The complete file with all of the PHP can be located at:http://matt.artemis-fowl.com/comments/helpme.txt Link to comment Share on other sites More sharing options...
justsomeguy Posted June 22, 2006 Share Posted June 22, 2006 That file doesn't seem to have any output, it's all form processing. That file processes the forms you fill out, it doesn't display them. Link to comment Share on other sites More sharing options...
Matt Posted June 22, 2006 Author Share Posted June 22, 2006 But the same file that I edit with is the same file that I click on to see the comments. That file is simply a copy of what's in the comments.php Link to comment Share on other sites More sharing options...
justsomeguy Posted June 22, 2006 Share Posted June 22, 2006 If that page executes the view function, it ends up including a template that has the form on it:require("{$COM_CONF['full_path']}/templates/{$COM_CONF['template']}.php"); Link to comment Share on other sites More sharing options...
aleksanteri Posted June 25, 2006 Share Posted June 25, 2006 You could use: <html><head><script type="text/javascript">function comment_timeout(){ setTimeout("document.getElementById('comment_form').submit()", 100*60*3);}</script></head><body onload="comment_timeout()"><form id="comment_form" action="submitcomment.php"><!-- some inputs --></form><p>Your comment will be automaticly submitted in 3 minutes.</p> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now