Gossamer Forum
Home : Products : DBMan : Customization :

default.log

Quote Reply
default.log
Hi JPDeni,

Congrats on your new site,....it's very, very informative. Keep up the good work !! Hope you had some fun on your vacation !!

Here's my question: I want to add three fields of the database to the default.log file when a record is added. I know the sub to do this is auth_logging in auth.pl, but I don't know how to get $rec{'field'} to write to the log file.

Am I on the wrong track ..?
Quote Reply
Re: default.log In reply to
Thanks JPDeni,

That works perfectly !! Smile

I have one other question; the time when the record is added, on the record itself vs. the default.log always differs by about 20 secs. Any ideas why ..? The time on the record is earlier. My database is quite near to 1MB at the moment.
Quote Reply
Re: default.log In reply to
It's possibly because of the size of your file.

I'm assuming you have a field that keeps the time a record is added, right? Are you using &get_time for that? If so, the time in the field is the time the add form was invoked. (Couldn't think of another word! Smile ) The logging time is the time after the record has been added. Twenty seconds is pretty good!


------------------
JPD





Quote Reply
Re: default.log In reply to
Thanks! Yes, I had a really nice time.

For the logging question, what you can do is go through db.cgi and search for &auth_loggin, which will show you the value that is sent to the logging subroutine. You can add anything you want to within the string, using $in{'Fieldname'} variables.

For example, if you wanted the email address to be added to the .log file when someone added their record, you would find

&auth_logging("added record: $in{$db_key}") if ($auth_logging);

and change it to

&auth_logging("added record: $in{$db_key}, $in{'Email'}") if ($auth_logging);

You can put anything that was sent to the script through a form or URL that way.


------------------
JPD





Quote Reply
Re: default.log In reply to
Twenty seconds is good ? I think it could be poor, seeing as I'm on an intranet. Your explanation is fine; I think the file size is affecting the time difference. I'm going to archive the database into 2 separate ones manually.

How can I have people update records using their $db_userid in the archived database without logging in twice ..? Ideally I would want to have a link to the archived database on the DBman home page for the smaller new database ....
Quote Reply
Re: default.log In reply to
Twenty seconds is good, since that includes the time to fill out the form.

You can go from one database to another without logging in again. When you make your links, instead of using

$db_script_link_url

use

$db_script_url?db=your database name&uid=$db_userid

and then whatever else you want to add to your link.


------------------
JPD





Quote Reply
Re: default.log In reply to
I'm not sure I understand....The link I was planning to use would be to another instance of DBman. How would I do it in your example ..? (I think setting up another instance of DBman would be quicker and easier )
Quote Reply
Re: default.log In reply to
Let's say you have two databases, default and archive. Each database has its own .cfg file, its own .db (of course) and its own html.pl file. They share a .pass file. (.log files and .count files can be shared or not, as you prefer.)

In your html.pl file -- the one for the "default" database -- you want to have a link that will take the user to the add form for the "archive" database. You would set it up like this:

<a href="$db_script_url?db=archive&uid=$db_userid&add_form=1">

Does that make any sense?


------------------
JPD





Quote Reply
Re: default.log In reply to
I see what you are saying JPD..... I see. But what I think what I want the archive to be is another instance of DBMan in another directory. There will be no adding to it, only searching and updating.
So currently my link to the archives looks like this
: print qq!- [A HREF="/cgi-bin/db_archive/db.pl?&html_home=1&uid=$db_userid"]Go to Archives[/A[ ! if ($per_add);

I want the transfer between the two to be seamless using the authentication from the previous (i.e. current) database login. I edited default.cfg in the archive instance for $auth_dir & $auth_pw_file to point to the orig location installation, however it gives me an invalid/expired user session when I click the link. Any suggestions ..?

Thanks ( as always ) for your help.
Quote Reply
Re: default.log In reply to
Ohhhhh Smile ...what I needed was uid=$db_uid, however it won't bring up the home page.
Quote Reply
Re: default.log In reply to
[A HREF="/cgi-bin/db_archive/db.pl?uid=$db_uid"]Go to Archives[/A] does the trick for me !!! Wink

Thanks JPD !!! I hope all I do now is put a similar link back to the current database.
Quote Reply
Re: default.log In reply to
Ain't it nice when you figure it out on your own? Smile I've been busy installing and configuring another script for my site and you did my job for me here!!!


------------------
JPD





Quote Reply
Re: default.log In reply to
 Smile ..yeah but you pointed me in the right direction. The praise is really yours.