redendant data

Posted on 2005-04-29
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
    LVL 1

    Author Comment

    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

    > 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;

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
    It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
    Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
    The viewer will learn how to count occurrences of each item in an array.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now