Gossamer Forum
Home : Products : DBMan : Customization :

Syntax error on code in FAQ for Cookie Mod

Quote Reply
Syntax error on code in FAQ for Cookie Mod
I was making the changes to my auth.pl file from this FAQ:

http://webmagic.hypermart.net/dbman/db/dbfaq.cgi?db=dbmanfaq&uid=wdu2002.102400223849656&sb=7&so=ascend&Validated=Yes&view_records=1&Validated=Yes&keyword=cookie&view_records=Search+Records&nh=5&mh=1

and I received a syntax error, but dont know how to fix it.

The line it references is, is the @perm = ; line. Tells me there is a problem with it, but I copied and pasted from the FAQ, so I dont know what the problem is. Anyone know?

Here is the code I have:

Code:
else { # Session Cookie Mod
&GetCookies('session');
if (length($Cookies{'session'}) > 4) {
$db_uid = $Cookies{'session'};
if (-e "$auth_dir/$db_uid") {
open(AUTH, "<$auth_dir/$db_uid") or &cgierr("unable to open auth file: $auth_dir/$uid. Reason: $!\n");
@perm = ;
close AUTH;
($view, $add, $del, $mod, $mem, $admin, $max_record, $host) = split (/:/, @perm[0]);
return ('ok', $db_uid, $view, $add, $del, $mod, $mem, $admin, $max_record); }
else { return ('invalid/expired user session'); }
}
else { return 'no login'; }
}
Quote Reply
Re: [wdu2002] Syntax error on code in FAQ for Cookie Mod In reply to
I'm guessing it should be:

@perm = <AUTH>;

...and whilst I'm fixing bugs:

split (/:/, @perm[0]);

should be:

split (/:/, $perm[0]);

Smile

Last edited by:

Paul: Jun 14, 2002, 2:06 AM
Quote Reply
Re: [Paul] Syntax error on code in FAQ for Cookie Mod In reply to
Yup, check the source for the page and you will see the <AUTH> is there... just doesn't display in Lois' guide.
Quote Reply
Re: [oldmoney] Syntax error on code in FAQ for Cookie Mod In reply to
Thanks to you both for the replies. Wink
Quote Reply
Re: [wdu2002] Syntax error on code in FAQ for Cookie Mod In reply to
Thanks for catching the display problem, I have made a note to move the codes to an external .txt file so they will display correctly.

I'll fix this when I do the next FAQ update.

Another reason why I always reference the original thread is so that if something doesn't work you can check against the original threads :))

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Syntax error on code in FAQ for Cookie Mod In reply to
Lois, a quicker alternative might be to take your (large!) db into your text editor, and global find/replace:

< into &lt;
and > into &gt;

so the brackets will display. Or you can hardcode the field grep into the view function of your DBman html file(s).
Quote Reply
Re: [oldmoney] Syntax error on code in FAQ for Cookie Mod In reply to
You should only need to change < to &lt; - if one bracket (either left or right) is changed to its entity name then the other will show up anyway.
Quote Reply
Re: [oldmoney] Syntax error on code in FAQ for Cookie Mod In reply to
oldmoney:

That's the first thing I did was to manually edit the external text file. But it just displayed the &lt; and &gt; rather than < and >.

I think it's due to it being within a text file that it's a little different using the external text file to store the actual text. That is why with most threads which contain certain types of codes I have a link to an external file rather then using the display from the textarea.

Hope that makes sense :)

I did try to make the simple change and it didn't work properly.

Although I have 1262 records currently in the FAQ database the actual file size is only 266 KB :)

It does take a lot longer to do updates, as far as upload time as I always keep a backup copy of all the files on my system (just in case) which includes 799 files which get pulled in with the external text file mod, and 475 files that store the clickable links to text files which hold the thread posts.

Lots of information gathered and available :)

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/