Gossamer Forum
Home : Products : Links 2.0 : Customization :

how do i modify a link w/o validating it

Quote Reply
how do i modify a link w/o validating it
I was looking at validate_records in db.pl, and it is much too complicated for my mind to comprehend. Is there a simple way to modify a site w/o validating it. Perhaps there is already a simpler code somewhere already i just missed...

Thanks,
- Jonathan
http://www.magicdirectory.com/

Quote Reply
Re: how do i modify a link w/o validating it In reply to
Why

You could validate modify and then build

or

you could call up the validate screen make the changes and validate

DavyC

Quote Reply
Re: how do i modify a link w/o validating it In reply to
I guess I wasn't clear enough. I have a mod allowing the user to log in w/ a user name and password and modify their personal information to (modify.cgi) and I dont' want to have to validate it everytime they login to update their personal information. If it would just automatically update, it would be one less step for me and less of a hassle for them...

......... - Jonathan
http://www.magicdirectory.com/

Quote Reply
Re: how do i modify a link w/o validating it In reply to
I thought I would bring this back to the top... I know it can't be that hard... someone must know...

Thanks,

- Jonathan
http://www.magicdirectory.com/
Quote Reply
Re: how do i modify a link w/o validating it In reply to
Did someone already figured this out?

Quote Reply
Re: how do i modify a link w/o validating it In reply to
Yeah I've used something for my mpoll mod which does essentialy the same thing, not sure if it's the best way but it works fine. Look at mpoll_id.cgi and mpoll_vote.cgi

From this you should be able to work out a method of doing it.

http://mir.spaceports.com/~glennu/mpoll.html

Or take a look at what I used in my comments 2 mod. It writes the altered info straight to comments.db (assuming the email address the user gave is correct)

Good Luck!

Glenn


http://mir.spaceports.com/~glennu/
Quote Reply
Re: how do i modify a link w/o validating it In reply to
I figured it out a while back... if you know perl pretty good all you have to do is edit the database commands so that it opens up the database and reads it instead of opening the validate form... It can be complicated or easy... basically there is a sub_routine in db.pl or dbutils.pl (can't remember which) that you can copy almost the whole sub routine to get it to work...

- Jonathan
http://www.magicdirectory.com/
Quote Reply
Re: how do i modify a link w/o validating it In reply to
hey did any of you guys figure this out yet?

Quote Reply
Re: how do i modify a link w/o validating it In reply to
'hey did any of you guys figure this out yet?'

Yep.

Glenn

Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
Quote Reply
Re: how do i modify a link w/o validating it In reply to
Open modify.cgi find the following:

# First make sure the link isn't already in there.
open (MOD, "<$db_modified_name") or &cgierr ("error opening modified database: $db_modified_name. Reason: $!");
while (<MOD>) {
chomp;
@values = split /\|/;
if ($values[0] eq $in{$db_key}) {
close MOD;
&site_html_modify_failure("A request to modify this record has already been received. Please try again later.");
return;
}
}
close MOD;

# Print out the modified record to a "modified database" where it is stored until
# the admin decides to add it into the real database.
open (MOD, ">>$db_modified_name") or &cgierr("error in modify.cgi. unable to open modification database: $db_modified_name. Reason: $!");
flock(MOD, $LOCK_EX) unless (!$db_use_flock);
print MOD &join_encode(%in);
close MOD; # automatically removes file lock


Replace it with:

$found = 0;
open (DB, "<$db_file_name") or &cgierr("error in modify_records. unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB>) {
(/^#/) and ($output .= $_ and next LINE);
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);

if ($data[$db_key_pos] eq $in{$db_key}) {
$output .= &join_encode(%in);
$found = 1;
}
else {
$output .= "$_\n"; # else print regular line.
}
}
close DB;


if ($found) {
open (DB, ">$db_file_name") or &cgierr("error in modify_records. unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) {
flock(DB, 2) or &cgierr("unable to get exclusive lock on $db_file_name.\nReason: $!");
}
print DB $output;
close DB; # automatically removes file lock





Glenn

Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
Quote Reply
Re: [glennu] how do i modify a link w/o validating it In reply to
It doesn't modify the record that needs to be modified but replaces the very first record in the .db file with the modified record.