Gossamer Forum
Home : Products : Links 2.0 : Customization :

What do YOU think (improve add routine)

Quote Reply
What do YOU think (improve add routine)
Hello all,

Currently I'm working on a improved add routine (add.cgi). For a site I modified add.cgi that add.cgi handles general (personal) data and 7 questions. Because ALL questions are important and need to be answered I set them all to required.

BUT there's a problem: I would like to know people's personal data anyway, even if they don't pass the validation in add.cgi. (So I can contact them in person.) My first thoughts was editting add.cgi to write every failed entry to a special error-database. But that would create a big error-database, because It would be possible that I would receive 5 or even more error from 1 person. My second thought, was to make a simmular function as rate.cgi so add.cgi would generate a seperate file for every entry where It would keep the up-to-date input of all enties (correct and wrong). And so I could read all input to see which entries I need to contact.

...and my last thought was asking people of the forum of a sollution!

Who would like to give me their thought or even sollutions?

Quote Reply
Re: What do YOU think (improve add routine) In reply to
One suggestion is to add another send_email routine that would email you the information inputted before the record is submitted. But in terms of CPU/Memory, this would be very intensive on your server.

Good luck!


Eliot Lee
Quote Reply
Re: What do YOU think (improve add routine) In reply to
Just for the record: This is what I did!

Added the following in my site_html.pl at add_ en error_:
add: <input type="hidden" name="UserID" value="false">
error: <input type="hidden" name="UserID" value="$in{'UserID'}">
I use UserID just because It sounds cool!

.....and this is what I added to add.cgi:

In plain english:
I save some input from every entry that fails validation.
(...at least if they provide me a valid email and e serious name.)

else {
# Print out the input to the error database. But only
# the first time this error happens. (saves server-space)
if ($in{'UserID'} eq "false") {
if (($in{'Email'} =~ /. \@. \.. /) && ($in{'Nachname'} !~ /^\s*$/)) {
open (DB, ">>$db_request_error_name") or &cgierr("error in add_record. unable to open database file: $db_request_error_name. Reason: $!");
flock(DB, 2) unless (!$db_use_flock);
print DB "$in{$db_cols[$db_modified]}$db_delim$ENV{'REMOTE_ADDR'}$db_delim$in{'Email'}$db_delim$in{'Nachname'}$db_delim$in{'Anrede'}$db_delim\n";
close DB; # automatically removes file lock
$in{'UserID'} = "true";
# Send the visitor to the error page.
&site_html_request_error ($status);
That's right: German!

I would prefer to strip | and spaces, but I don't know how &join_encode(.........); will act if there's no hash. Who has some tips for me! (Or would it slow down the proccess to much?)

....and I'm planning to make a seperate script that will:

- check alle emailadresses agains the real and validate database.
- check for double emailadresses.
- send "he, something went wrong, please fill in our form again" email to all adresses.
- save emailed adresses in seperate file, so they don't get mailed again.