[Last Call] Learn how to a build a cloud-first strategyRegister Now


redendant data

Posted on 2005-04-29
Medium Priority
Last Modified: 2013-12-25
i have a cgi application  which contains submit button. after hitting the submit button, my application saves customers email addres in flat file
if some nasty user keeps on hitting the submit button, my application keeps on saving the information on file. this is redendant.

also i have a counter  using File::CounterFile

if the same url user keeps hitting refresh button, i don't want to increase the counter as it comes from same ip.
how do i prevent this.

Question by:shahrahulb

Author Comment

ID: 13899461
i m using
my $file = "$application" . "_" . "$incident_id" . "_noofhits";
my $c = CounterFile->new("$CONFIG::DATA/$file");

i don't want to increase the counter if someone hits refresh as it is coming from same ip
LVL 51

Accepted Solution

ahoffmann earned 2000 total points
ID: 13901654
> if some nasty user keeps on hitting the submit button, my application keeps on saving the information on file
use one file per email address, then hitting again or using refresh writes the same file
I'd use the email address itself as filename (after proper sanitation)

> ..  i don't want to increase the counte
my $file = $ENV{'REMOTE_ADDR'};
if ( ! -e $file ) {
  my $c = CounterFile->new("$CONFIG::DATA/your-counter");
  open( F,">$file") && close F;

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question