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 bsod computer connection cpu crash css dell desktop dma 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 monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio 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 >
Coding a form


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
00lissauers's Avatar
Member with 54 posts.
 
Join Date: Apr 2005
Location: UK
Experience: Windows Specialist !
28-Oct-2006, 01:35 PM #1
Coding a form
I have designed a report form for my forum hosting site. Seei it in action [here] Now this send an email to me when someone uses it, however I would like to know if I could add their IP address as a hidden input. I would use this to block people who continually use the form to spam me. Alternatively would it be possible to add some sort of image verification ? Or make them enter a specific answer into a box. I could ask a question such as 'What color is a tree' and make them enter brown before it would send ?

Does anyone know of anything simple I could do ?

Using script from matts script archive (automailer)
__________________
covert215's Avatar
Account Disabled with 2,651 posts.
 
Join Date: Apr 2006
Experience: Web Designer
28-Oct-2006, 01:44 PM #2
Image verifications are called CAPTCHAs. I'm sure you can find them around the net.

To get a user's IP address, inside your php page that sends the mail, enter:

$ip = $_SERVER['REMOTE_ADDR'];

and then add it to the message.

Or, if your form is on a php page, use the hidden field

<input type="hidden" value="<?php $ip = $_SERVER['REMOTE_ADDR']; ?>" />
00lissauers's Avatar
Member with 54 posts.
 
Join Date: Apr 2005
Location: UK
Experience: Windows Specialist !
28-Oct-2006, 02:38 PM #3
Thankyou so much for your help
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
28-Oct-2006, 02:49 PM #4
That would leave the value of your hidden field blank and not record their IP address. It's not a good method to use anyway since the user can spoof it.
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,102 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am
28-Oct-2006, 03:21 PM #5
Quote:
Originally Posted by covert215
Image verifications are called CAPTCHAs. I'm sure you can find them around the net.

To get a user's IP address, inside your php page that sends the mail, enter:

$ip = $_SERVER['REMOTE_ADDR'];

and then add it to the message.

Or, if your form is on a php page, use the hidden field

<input type="hidden" value="<?php $ip = $_SERVER['REMOTE_ADDR']; ?>" />
Wouldn't it have to be like this:

<input type="hidden" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>" />
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
28-Oct-2006, 03:22 PM #6
Yes but that could still be spoofed/forged by the user (they could put a fake IP address into your form value.)
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 08:51 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.