On Wed, 24 Jul 2002, guy keren wrote:

>
> On Wed, 24 Jul 2002, Shlomi Fish wrote:
>
> > Now, if I reload an SSL script like that I get the following two warnings
> > every time the page is reloaded:
> >
> > Subroutine check_url redefined at /home/shlomi/Docs/Univ/Seminars/from_cvs/perl/ 
>site/cgi/admin/index.cgi line 17.
> > Subroutine draw_page redefined at /home/shlomi/Docs/Univ/Seminars/from_cvs/perl/ 
>site/cgi/admin/index.cgi line 56.
> >
> > How do I get rid of them?
>
> errr.. by fixing your code? you're not supplying the relevant info (which
> is the source, after all) - how can we guess? try to change the names of
> these functions - they are way too generic - use your own rule - add a
> common prefix to all function names.
>

Changing their names won't help - Perl has namespaces and it should not
matter to it how I call it.



> if this is off-target, then its your fault for not supplying the source
> code ;)
>

I attached the code to this message. You can find the rest of it in the
CVS:

http://developer.berlios.de/cvs/?group_id=382

Regards,

        Shlomi Fish

> --
> guy
>
> "For world domination - press 1,
>  or dial 0, and please hold, for the creator." -- nob o. dy
>



----------------------------------------------------------------------
Shlomi Fish        [EMAIL PROTECTED]
Home Page:         http://t2.technion.ac.il/~shlomif/
Home E-mail:       [EMAIL PROTECTED]

"Let's suppose you have a table with 2^n cups..."
"Wait a second - is n a natural number?"


-- Attached file included as plaintext by Listar --
-- File: index.cgi

#!/usr/bin/perl -w

use strict;

use CGI;

use Technion::Seminars::Config;
use Technion::Seminars::Layout;
use Technion::Seminars::SlashUrl;
use Technion::Seminars::UserMan;

use Gamla::TextStream::Out::File;

my $q = CGI->new();

sub check_url
{
    my $url = shift;

    my $verdict = ($url =~ /^admin(\/index.cgi)?$/) ? 1 : 0;
    
    return ($verdict, "admin/");
}

# Make sure our URL ends with a slash.
&normalize_url($q, \&check_url, "https");

my (%cookie);
my ($user, $password);
my $admin_level = "readonly";

my $user_man = Technion::Seminars::UserMan->new();

if (%cookie = $q->cookie('seminars_auth'))
{
    $user = $cookie{'user'};
    $password = $cookie{'password'};

    $admin_level = $user_man->get_admin_level($user, $password);
}

print $q->header();

my $title = "Administrator Login";

my $layout = 
    Technion::Seminars::Layout->new(
        'path' => "admin",
        'title' => $title,
        'admin_level' => $admin_level,
    );

my $o = Gamla::TextStream::Out::File->new(\*STDOUT);

sub draw_page
{
    my $o = shift;    
    
    $o->print("<h1>$title</h1>\n\n");
    
    if ($admin_level eq "readonly")
    {
        $o->print("<form method=\"post\" action=\"login.cgi\">\n");
        $o->print("<b>Username:</b><br />\n");
        $o->print("<input type=\"text\" name=\"username\" size=\"10\" /><br />\n");
        $o->print("<b>Password:</n><br />\n");
        $o->print("<input type=\"password\" name=\"password\" size=\"10\" /><br />\n");
        $o->print("<input type=\"submit\" value=\"Login\" />\n");
        $o->print("</form>\n");
    }
}

$layout->render($o, \&draw_page);

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to