Hi Carol..I searched the archives looking for but couldn't find any code that would or could automaticly delete a User ID & Password when a User Deleted a record..is this available to your knowledge?....Rob
Oct 3, 1999, 8:42 AM
Veteran / Moderator (8669 posts)
Oct 3, 1999, 8:42 AM
Post #2 of 13
Views: 2549
There isn't a mod that does exactly what you're asking, although something similar has been added recently to the "autodelete" mod.
This one shouldn't be too hard.
In db.cgi, sub delete_records, change
($delete_list{$data[$db_key_pos]} = 0) : # then mark it deleted and don't print it to the new database.
($output .= $line . "\n"); # otherwise print it.
}
to
$delete_list{$data[$db_key_pos]} = 0;
open (PASS, "<$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) { flock(PASS, 1) }
@passlines = <PASS>;
close PASS;
open (PASS, ">$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) {
flock(PASS, 2) or &cgierr("unable to get exclusive lock on $auth_pw_file.\nReason: $!");
}
my $found = 0;
foreach $passline (@passlines) {
($passline =~ /^$data[$auth_user_field]:/) ?
($found = 1) :
print PASS $passline;
}
close PASS;
}
else {
$output .= $line . "\n";
}
I have only checked this for syntax errors, not for functionality, so be sure you back up all of your data before you try it.
------------------
JPD
This one shouldn't be too hard.
In db.cgi, sub delete_records, change
Code:
$delete_list{$data[$db_key_pos]} ? # if this id is one we want to delete ($delete_list{$data[$db_key_pos]} = 0) : # then mark it deleted and don't print it to the new database.
($output .= $line . "\n"); # otherwise print it.
}
to
Code:
if ($delete_list{$data[$db_key_pos]}) { $delete_list{$data[$db_key_pos]} = 0;
open (PASS, "<$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) { flock(PASS, 1) }
@passlines = <PASS>;
close PASS;
open (PASS, ">$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) {
flock(PASS, 2) or &cgierr("unable to get exclusive lock on $auth_pw_file.\nReason: $!");
}
my $found = 0;
foreach $passline (@passlines) {
($passline =~ /^$data[$auth_user_field]:/) ?
($found = 1) :
print PASS $passline;
}
close PASS;
}
else {
$output .= $line . "\n";
}
I have only checked this for syntax errors, not for functionality, so be sure you back up all of your data before you try it.
------------------
JPD
Oct 3, 1999, 3:49 PM
Veteran / Moderator (8669 posts)
Oct 3, 1999, 3:49 PM
Post #4 of 13
Views: 2562
Oct 3, 1999, 7:04 PM
Veteran / Moderator (8669 posts)
Oct 3, 1999, 7:04 PM
Post #6 of 13
Views: 2540
Hi Carol that was the problem..script works fine...but..here comes the BIG but...please be tolerant, I'm feeling kind of quilty asking for a tad more...can we get this script to check the database to see if the user has any other records under his Username before it deletes the password..if he others it doesn't delete..if he has none then it deletes...what do you think? enternally greatful...Rob
Oct 4, 1999, 1:38 PM
Veteran / Moderator (8669 posts)
Oct 4, 1999, 1:38 PM
Post #8 of 13
Views: 2530
I was thinking of suggesting that you only use this mod if you only allow users to have one record each.
The trouble is that, until the subroutine is finished, the original record still exists in the database. Possibly I could give you code that would check if the user only deleted one record at a time, but I'm not even sure about that. Allowing for multiple deletes would, I'm sure, be theoretically possible, but it makes my brain sore to think about it.
------------------
JPD
The trouble is that, until the subroutine is finished, the original record still exists in the database. Possibly I could give you code that would check if the user only deleted one record at a time, but I'm not even sure about that. Allowing for multiple deletes would, I'm sure, be theoretically possible, but it makes my brain sore to think about it.
------------------
JPD
Mar 5, 2000, 7:00 PM
Veteran / Moderator (3034 posts)
Mar 5, 2000, 7:00 PM
Post #11 of 13
Views: 2555
Xev:
I don't know exactly how to do this but I think the following thread may help you.
http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/001153.html
Author
Topic: Deleting user records in relational database
Alhough it's for the relational mod it may provide the information on how this could be done.
Hope it helps
I don't know exactly how to do this but I think the following thread may help you.
http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/001153.html
Author
Topic: Deleting user records in relational database
Alhough it's for the relational mod it may provide the information on how this could be done.
Hope it helps

Mar 5, 2000, 7:12 PM
User (431 posts)
Mar 5, 2000, 7:12 PM
Post #12 of 13
Views: 2539
Since you are considering deleting a record along with the userid/pass,
I assume you are dealing with a user profile DB and effectively "rejecting"
a user, yes? If so, here's something to think about: When you delete
a record, do you want to prevent someone from just resubmitting (and
making you validate/delete again)? If so, I probably wouldn't delete the
userid/password, but either change a status field to "Inactive" as opposed
to "Member" (elegant solution) or change the password (brute force) so that
they can't immediately re-subscribe.
------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)
[This message has been edited by oldmoney (edited March 05, 2000).]
I assume you are dealing with a user profile DB and effectively "rejecting"
a user, yes? If so, here's something to think about: When you delete
a record, do you want to prevent someone from just resubmitting (and
making you validate/delete again)? If so, I probably wouldn't delete the
userid/password, but either change a status field to "Inactive" as opposed
to "Member" (elegant solution) or change the password (brute force) so that
they can't immediately re-subscribe.
------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)
[This message has been edited by oldmoney (edited March 05, 2000).]