CGI Meld

They have: 7 posts

Joined: May 2003

Hi, Basically on my site I have a forum, UBB and a gallery, Imagefolio.

Ive been trying on and off for months to make it so the imagefolio checks for the UBB cookie and acts accordingly.

if there logged in, gr8 carry on. If not prompt the user with the "agree" page

Ive been to the UBBDEV site and they didnt seem too interested.

However I reciently got hold of a standalone cgi script that uses the ubb cookie in the form of a shoutbox. And it does exactly what I want the imagefolio to do!

This gave me new hope, so ive been following thru the code to my best ability, and come up with loads of errors every time lol :*(

I cant for the life of me get it to work Sad
Everytime I attempt to do it, i get the following error:

Undefined subroutine &main::cookie called at "blah blah"

Shout box Code

#!/usr/bin/perl

use constant SEVENSEVENSEVEN => 0777;
use constant SIXSIXSIX => 0666;

BEGIN { # get our modules directory set up
($0 =~ m!(.*)(\\|/)[^/\\]+!) && unshift(@INC, $1, "$1$2Modules");
$| = 1;
}

use lib("./Modules", "."); # if there's no $0, or it's not sane...

BEGIN { # pull in the best copy of Digest::MD5 that we can find
do "Digest/MD5.pm";
if (!$Digest::MD5::VERSION) {
require Digest::Perl::MD5;
import Digest::Perl::MD5 'md5_hex';
} else {
import Digest::MD5 'md5_hex';
} # end if
} # end BEGIN

# load modules
use vars qw($allowmods $backwards $confdel $deletealt $filehandle $floodcheck $ipalert $js $js2 $masterCharset $me $message $nomeend $page_background $password $pubname $reset $savename $send $shoutbox $shoutext $shoutmax $shouts $shoutsize $show_public_name $staff $styles $typemsg $typeshout $ubb_images $unreg $unregpost $user_number $user_topic_view $username $viewunreg %GotTime %in %template_html %template_match %vars_config %vars_misc %vars_style %vars_style_shoutbox %vars_wordlets %vars_wordlets_err @checkTheProfile @ubber $images);
use strict;
use UBBCGI qw(:cgi); # CGIPath/Modules/UBBCGI.pm
use UBBCGI::Carp qw(fatalsToBrowser set_message); # CGIPath/Modules/UBBCGI/Carp.pm
require "vars_config.cgi";
require "$vars_config{CGIPath}/ubb_lib.cgi";
&RequireCode("$vars_config{CGIPath}/ubb_lib_filehandler.cgi");
&RequireCode("$vars_config{CGIPath}/ubb_lib_posting.cgi");
&RequireCode("$vars_config{CGIPath}/ubb_lib_files.cgi");
&RequireCode("$vars_config{CGIPath}/ubb_lib_filehandle.cgi");
$filehandle = new UBB::FileHandler(\%vars_config);
&RequireCode("$vars_config{CGIPath}/ubb_lib_time.cgi");
&RequireCode("$vars_config{VariablesPath}/vars_time.cgi");
&RequireCode("$vars_config{VariablesPath}/vars_misc.cgi");
&RequireCode("$vars_config{VariablesPath}/vars_wordlets.cgi");
&RequireCode("$vars_config{VariablesPath}/vars_wordlets_date.cgi");
&RequireCode("$vars_config{VariablesPath}/vars_wordlets_err.cgi");
&RequireCode("$vars_config{VariablesPath}/vars_template_match.cgi");

$vars_misc{'max_image_limit'} = $images;

%in = map{
my @z = param($_);
( scalar(@z) > 1 ?
( $_ => join(",", @z) ) :
( $_ => $z[0] )
)
} param();

%vars_style = $styles ? %vars_style_shoutbox : &LoadStyleTemplateRaw($template_match{summary_page});

@ubber = cookie("ubber$vars_config{Cookie_Number}");
if ($ubber[0] ne '') { $username        = $ubber[0]; }
if ($ubber[1] ne '') { $password        = $ubber[1]; }
if ($ubber[2] ne '') { $pubname         = $ubber[2]; }
if ($ubber[3] ne '') { $user_topic_view = $ubber[3]; }
if ($ubber[4] ne '') { $user_number     = $ubber[4]; }

if (@ubber) {
@checkTheProfile = &verify_id_num_2($username, $password, $user_number);
);
&StandardHTML("User not approved");
}
if ($checkTheProfile[8] eq 'Administrator' || ($allowmods == 1 && $checkTheProfile[8] eq 'Moderator')) {
$staff = 'yes';
}
} elsif ($viewunreg == 0) {
&StandardHTML(qq!$vars_wordlets_err{not_logged_in}<p> <a href="$vars_config{CGIURL}/ultimatebb.cgi?ubb=login" target="_blank">$vars_wordlets{login_now}</a> $vars_wordlets{or} <a href="$vars_config{CGIURL}/ultimatebb.cgi?ubb=agree" target="_blank">$vars_wordlets{register_title}</a></p>!);
}

sub StandardHTML {
my $row = qq~<table width="100%" border="0" cellspacing="0" cellpadding="2">\n<tr bgcolor="$vars_style_shoutbox{AltColumnColor1}">\n<td>\n<font size="1" face="$vars_style_shoutbox{FontFace}" color="$vars_style_shoutbox{TextColor}">\n$_[0]\n</font>\n</td>\n</tr>\n</table>\n~;
if ($in{s} eq 'javascript') {
$row = 'document.write(unescape("'.UBBCGI::escape($row).'"));';
} elsif ($in{s} ne 'ssi') {
if ($vars_style_shoutbox{PageBackground} ne '') {
$page_background = qq!background="$vars_config{NonCGIURL}/$vars_style_shoutbox{PageBackground}"!;
} else {
$page_background = '';
}
$row = qq~<html $vars_style_shoutbox{html_extra}>
<head>

Etc...etc..
'

Could some one please please please rip the code I could "plug into" the other cgi application pleaseeeeee. Id be most greatful.

They have: 7 posts

Joined: May 2003

If anyone is intersted - I figured it out in the end! and its all up and working as of 20 minutes ago Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.