Php coding help |
Author: |
Message: |
king_of_cool_kids
Full Member
Im a Cat fan.
Posts: 264
– / / –
Joined: Dec 2003
|
O.P. Php coding help
Ok. I have a contact form on my site, and have a JavaScript code to stop multiple submitting in one go. However, recently I have been getting lots and I think it may be because people have JavaScript turned off in their browser. I was talking to a friend this morning, and he said that the same effect could be done using php, and that it is more secure and reliable.
So:
a) Is this true
b) If so, how can I go about implementing it on my site??
Thanks in advance.
|
|
08-07-2004 05:35 AM |
|
|
WDZ
Former Admin
Posts: 7106 Reputation: 107
– / /
Joined: Mar 2002
|
RE: Php coding help
That javascript probably only works until the page is refreshed... someone could send one, refresh the form, paste the message back in, send another, and so on.
quote: Originally posted by king_of_cool_kids
a) Is this true
PHP being more secure and reliable than javascript? Yes, definitely.
quote: Originally posted by king_of_cool_kids
b) ... how can I go about implementing it on my site??
You want to stop the same person from submitting 2+ messages in a row? Does your contact script store anything on the server or just send an e-mail? If nothing is stored, the easiest method is probably setting a cookie, but that's not really secure, because the submitter could reject or delete it.
A more secure method of duplicate-checking would be storing the submitter's IP address on the server (in a text file or database) and then checking/updating it next time a submission is made.
|
|
08-07-2004 05:55 AM |
|
|
king_of_cool_kids
Full Member
Im a Cat fan.
Posts: 264
– / / –
Joined: Dec 2003
|
O.P. RE: Php coding help
ok, well, basicly, I want something (php) that will disable the submit button once clicked, and have a time span of 3 mins between submitions.
Database available if needed.
|
|
08-07-2004 06:16 AM |
|
|
WDZ
Former Admin
Posts: 7106 Reputation: 107
– / /
Joined: Mar 2002
|
RE: Php coding help
quote: Originally posted by king_of_cool_kids
ok, well, basicly, I want something (php) that will disable the submit button once clicked
Hmm... well, because PHP is server-side, it can't disable the submit button right away like javascript can. The user would have to reload the form before the submit button could be disabled.
quote: Originally posted by king_of_cool_kids
and have a time span of 3 mins between submitions.
Are you sure that's enough? Someone could spam you with almost 20 messages per hour if they were determined...
If you use the cookie-based method, you could simply set a cookie with a 3-minute expiration time. With the other method, you'd have to store a time on the server along with the IP.
|
|
08-07-2004 06:30 AM |
|
|
king_of_cool_kids
Full Member
Im a Cat fan.
Posts: 264
– / / –
Joined: Dec 2003
|
O.P. RE: Php coding help
a) Whats an fast, reliable option to stop people from submitting lots of times??
b) Cookies can be deleted easily. I want something that cant be. Any ideas??
c) PM me if you can, its easier to keep track of
This post was edited on 08-07-2004 at 06:37 AM by king_of_cool_kids.
|
|
08-07-2004 06:36 AM |
|
|
KeyStorm
Elite Member
Inn-sewer-ants-pollie-sea
Posts: 2156 Reputation: 45
38 / / –
Joined: Jan 2003
|
RE: Php coding help
Well, you can user sessions to do that, although people could keep restarting their browsers to override that.
If you're keeping track of the usernames and the date and time they last posted, it's not very difficult to stop them from submitting in 3 minutes.
|
|
08-07-2004 08:58 AM |
|
|
king_of_cool_kids
Full Member
Im a Cat fan.
Posts: 264
– / / –
Joined: Dec 2003
|
O.P. RE: Php coding help
ok, so how do I go about (in php or another reliable coding) setting up anything to stop people from submitting things lots of times in one go by either disabling the button, or whatever?? So long as they cant click, click, click heaps of times, then im happy.
Edit: Ok, I talked to my friend again this morning. He said that session would be good and easy, but if I wanted an easier way, make a script that will prevent a user from clicking the button, as it would be greyed out with the words "Need Javascipt on to use form" if they didn't have javascript on.
Does anyone know any way of coding this type of thing??
This post was edited on 08-09-2004 at 05:16 AM by king_of_cool_kids.
|
|
08-09-2004 05:13 AM |
|
|
-dt-
Scripting Contest Winner
;o
Posts: 1819 Reputation: 74
36 / /
Joined: Mar 2004
|
RE: Php coding help
if i remember right the noscript tag will display whats inside it insted of the javascript if scripts are off code: <noscript> test </noscript>
This post was edited on 08-09-2004 at 06:45 AM by -dt-.
Happy Birthday, WDZ
|
|
08-09-2004 06:43 AM |
|
|
king_of_cool_kids
Full Member
Im a Cat fan.
Posts: 264
– / / –
Joined: Dec 2003
|
O.P. RE: Php coding help
??? Im talking about a script that tests if Javasciprt is enabled. If so, lets the form be processed, if not, on loading the page, make the submit button grey with the words "Need Javascipt on to use form"
This post was edited on 08-09-2004 at 06:58 AM by king_of_cool_kids.
|
|
08-09-2004 06:56 AM |
|
|
ddunk
Veteran Member
Posts: 1228 Reputation: 51
35 / /
Joined: Mar 2004
|
|
08-09-2004 07:10 AM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|