There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot browser bsod computer cpu crash css dell desktop driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware missing monitor network networking outlook outlook 2003 outlook 2007 outlook express password popups problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Stopping the "paste" command in a textarea


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
katonca's Avatar
Computer Specs
Distinguished Member with 11,262 posts.
 
Join Date: Aug 2004
Location: Great Lakes area
Experience: Depends on subject
20-Aug-2007, 12:20 PM #1
Stopping the "paste" command in a textarea
Hi folks, I have a couple of text boxes on my website (for comments, correspondence, etc). I have been inundated with spam (obviously copied and pasted text - tons of links and text). I have placed a code on the page which limits the number of characters that can be TYPED but it's not stopping the copy & paste command.

I have disabled the right click option also but that still is not the answer, so is there a way to keep text from being pasted into a textarea/input type box?

Thanks
__________________
.
.
Dave
.
.
"What lies behind us, and what lies before
us are small matters compared
to what lies within us."
Emerson
.
.

Helping the disabled find needed benefits
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,049 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am what I am.
22-Aug-2007, 10:02 PM #2
Well rather than do that, you can make it so when they click "submit", it turnicates text that is over a certain point. This is of course, much more effective than limiting what they can type.
MMJ's Avatar
MMJ MMJ is offline
Distinguished Member with 3,196 posts.
 
Join Date: Oct 2006
23-Aug-2007, 01:16 AM #3
http://forums.digitalpoint.com/attac...5&d=1186934101

This disables F5.

All you have to do is change the key code to the key code for control & v.

http://forums.digitalpoint.com/showthread.php?t=431702

However what 404 said makes more sense.
Duckman69's Avatar
Computer Specs
Senior Member with 626 posts.
 
Join Date: Jun 2007
23-Aug-2007, 06:14 AM #4
intresting thanks guys im in the middle of redoing my forums / site so my old forums are dead and not in use but i have realized over the past 3 weeks i was inactive with them i got like 100+ spam messages about porn and other related stuff... very uncool im gonna look into these right here, gonna see if php has some anti spammer scripts out next... thanks for the great info though...
katonca's Avatar
Computer Specs
Distinguished Member with 11,262 posts.
 
Join Date: Aug 2004
Location: Great Lakes area
Experience: Depends on subject
23-Aug-2007, 10:12 AM #5
Thanks 404, how is that done?
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,049 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am what I am.
23-Aug-2007, 11:39 AM #6
In PHP, while working with fopen(), fwrite(), and fclose() you can set a limit to how much is written. Give those pages a read and you can probably figure it out.
katonca's Avatar
Computer Specs
Distinguished Member with 11,262 posts.
 
Join Date: Aug 2004
Location: Great Lakes area
Experience: Depends on subject
23-Aug-2007, 12:14 PM #7
Quote:
Originally Posted by namenotfound
In PHP, while working with fopen(), fwrite(), and fclose() you can set a limit to how much is written. Give those pages a read and you can probably figure it out.
Thanks for the advice all
MMJ's Avatar
MMJ MMJ is offline
Distinguished Member with 3,196 posts.
 
Join Date: Oct 2006
25-Aug-2007, 06:51 AM #8
PHP Code:
$_POST['userinput'] = substr($_POST['userinput'], 015); //Only allow first 15 chars. 
katonca's Avatar
Computer Specs
Distinguished Member with 11,262 posts.
 
Join Date: Aug 2004
Location: Great Lakes area
Experience: Depends on subject
25-Aug-2007, 07:05 PM #9
Quote:
Originally Posted by MMJ
PHP Code:
$_POST['userinput'] = substr($_POST['userinput'], 015); //Only allow first 15 chars. 
Hi MMJ, where would that code be placed? Sorry folks, you're working with an unknowledgable person here.
MMJ's Avatar
MMJ MMJ is offline
Distinguished Member with 3,196 posts.
 
Join Date: Oct 2006
26-Aug-2007, 04:27 AM #10
Anywhere, just change userinput to whatever you have the input box called.

e.g. input box: <input type="text" name="input">
code: $_POST['input'] = substr($_POST['input'], 0, 15);
katonca's Avatar
Computer Specs
Distinguished Member with 11,262 posts.
 
Join Date: Aug 2004
Location: Great Lakes area
Experience: Depends on subject
27-Aug-2007, 11:09 PM #11
Quote:
Originally Posted by MMJ
Anywhere, just change userinput to whatever you have the input box called.

e.g. input box: <input type="text" name="input">
code: $_POST['input'] = substr($_POST['input'], 0, 15);
Thanks, I'll give it a try
CF_Rick's Avatar
Junior Member with 18 posts.
 
Join Date: Aug 2007
Location: So Cal
Experience: Advanced
29-Aug-2007, 02:46 AM #12
Your Spam problem
Most likely this is how your spam is being posted. There are bots out there that hunt for FORMS, they look for TEXTAREA's and populate and submit. Best way to get rid of these nasty bots is to add a CAPCHA to your form submit. This is one of those things that makes the user put in the letters and numbers before they submit. Another way to eliminate them is to scan for HREF in your submitted text and then ignore the entire message. This will also eliminate anybody trying to link to their own website, or others. Whatever you feel is the best implementation.

CF_Rick
jim4man's Avatar
Computer Specs
Senior Member with 219 posts.
 
Join Date: Aug 2007
Location: Lincolnshire
Experience: we all learn something new every day
29-Aug-2007, 05:33 AM #13
Nice one! how do you generate those CAPCHA things - i have always wondered!!


Quote:
Originally Posted by CF_Rick
Most likely this is how your spam is being posted. There are bots out there that hunt for FORMS, they look for TEXTAREA's and populate and submit. Best way to get rid of these nasty bots is to add a CAPCHA to your form submit. This is one of those things that makes the user put in the letters and numbers before they submit. Another way to eliminate them is to scan for HREF in your submitted text and then ignore the entire message. This will also eliminate anybody trying to link to their own website, or others. Whatever you feel is the best implementation.

CF_Rick
CF_Rick's Avatar
Junior Member with 18 posts.
 
Join Date: Aug 2007
Location: So Cal
Experience: Advanced
29-Aug-2007, 12:48 PM #14
Capcha
Well there are commercial options, but who likes to pay
With most web development languages take a look at the developers add on or exchanges.
Most likely you can pick up an addon or extensions for free, or if you cant find one for the development environment you like working in, look for addons that can generate images based on text. You can create your own capcha routine that way.

CF_Rick
katonca's Avatar
Computer Specs
Distinguished Member with 11,262 posts.
 
Join Date: Aug 2004
Location: Great Lakes area
Experience: Depends on subject
29-Aug-2007, 02:58 PM #15
Thanks rick, I was checking out a free CAPCHA a few weeks ago for that very purpose. Can't remember why I never installed - terrible memory
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 01:14 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.