Thread Mehrere kleine Probleme bei kleinem Test Loginsystem (23 answers)
Opened by Monk21 at 2009-04-02 16:07

Monk21
 2009-04-03 13:12
#120246 #120246
User since
2009-04-02
8 Artikel
BenutzerIn
[default_avatar]
Es tut mir leid, aber ich bekomme gerade einen Fehler, der nochnie zuvor aufgetaucht ist und den ich mir nicht erklären kann.

Beim aufruf des check.cgi Scriptes erhalte ich folgende Error Message :

Quote
Software error:

Can't call method "prepare" on an undefined value at /opt/lampp/htdocs/webpanel/check.cgi line 61.


Das hier ist nochmals (da etwas umgewandelt) die check.cgi:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/perl

use strict;
use warnings;
use CGI;
use CGI qw(:standart);
use CGI::Carp qw(fatalsToBrowser);
use HTML::Template;
use Digest::MD5 qw(md5_hex);
use DBI;
require("config.cgi");

our %config;
my $cgi = CGI->new();
my $template = HTML::Template->new(filename => "$config{'path'}/check.tmpl");

my $user_input = CGI::param('user');
my $pass_input = CGI::param('pass');



if(($user_input eq "") || ($pass_input eq "")) 
{ 
$template->param(
                 path => $config{'htmlpath'},
        weiterleitung => "index.cgi",
                farbe => "red",
         checkausgabe => "Please insert your Username and Password"
                );
}










elsif((defined($user_input)) && (defined($pass_input))) 
{

my $user = md5_hex($user_input);
my $pass = md5_hex($pass_input);

        if(($user eq $config{'login_user'}) && ($pass eq $config{'login_pass'})) 
        {
        my $session_id = int(rand(9999999999));
        my $sid = md5_hex($session_id);

        $template->param(
                         path => $config{'htmlpath'},
                weiterleitung => "online.cgi?id=$sid",
                        farbe => "green",
                 checkausgabe => "Welcome <b>Master</b>"                        
                        );
        

        my $dbh = DBI->connect("dbi:mysql:$config{'mysql_db'}", "$config{'mysql_user'}", "$config{'mysql_pass'}");
        my $sth = $dbh->prepare("SELECT SessionID FROM session_id") || die "$DBI::errstr<br>";
        $sth->execute() || die "$DBI::errstr<br>";
        my $ausgabe = $sth->fetchrow_array();
        
                if($ausgabe eq "") 
                {
                        $sth = $dbh->prepare("INSERT INTO session_id SET SessionID=MD5('$session_id')") || die "$DBI::errstr<br>";
                        $sth->execute() || die "$DBI::errstr<br>";
                        $sth->finish(); 
                }
                else 
                {
                        $sth = $dbh->prepare("UPDATE session_id SET SessionID=MD5('$session_id')") || die "$DBI::errstr<br>";
                        $sth->execute() || die "$DBI::errstr<br>";
                        $sth->finish();                                 
                }

        }
        else 
        {
        $template->param(
                         path => $config{'htmlpath'},
                weiterleitung => "index.cgi",
                        farbe => "red",
                         checkausgabe => "Wrong Username or Password! Please try again ..."
                        );
        }
}










else 
{
$template->param(
                 path => $config{'htmlpath'},           
        weiterleitung => "index.cgi",
                farbe => "red",
         checkausgabe => "OH MY GOD <b> «ERROR» </b>"
                        );
}

print $cgi->header();
print $template->output();


habe dbi schon deinstalliert und dann wieder installiert. Laut Cpan Shell erfolgreich.

Was kann es sein , bei google find ich keine wirklichen Lösungen :(

Bitte helft mir

mfg Monk21

View full thread Mehrere kleine Probleme bei kleinem Test Loginsystem