|< 1 2 >| | 18 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
use DBI;
$dbh = DBI->connect("DBI:$dbdriver:$dbdatabase:$dbhost:$dbport", $dbuser, $dbpassword);
$data = $dbh->selectrow_hashref("SELECT * FROM hpm_sessions WHERE sid='$uid';");
$dbh->disconnect;
$username = $$data{'username'};
$lng = $$data{'lng'};
$userid = $$data{'userid'};
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
#!/usr/bin/perl
#Einleitung
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use POSIX;
$q = new CGI;
$page = $q->param("page");
require "../hpm_einstellungen.cgi";
require "../templates_login/$logintemplate/daten.cgi";
if ($page eq "index")
{
#Eingaben einlesen
$username = $q->param("user");
$passwort = $q->param("pass");
$lng = $q->param("lng");
$username = lc($username);
if ($username eq "") { print "Location: $maindir/index.php?lng=$lng&page=fehler&er=29\n\n"; exit(); }
if ($passwort eq "") { print "Location: $maindir/index.php?lng=$lng&page=fehler&er=30\n\n"; exit(); }
if (!(-e "../$internmaindir/userdaten/main/$username.dat")) { print "Location: $maindir/index.php?lng=$lng&page=fehler&er=31\n\n"; }
open(FILE, "../$internmaindir/userdaten/main/$username.dat");
chomp(@userdata = <FILE>);
close(FILE);
$userid = $userdata[0];
$sollpass = $userdata[2];
$lng = $userdata[3];
$passwortc = crypt $passwort, 12;
$pass = $passwort;
if (!($passwortc eq $sollpass)) { print "Location: $maindir/index.php?lng=$lng&page=fehler&er=31\n\n"; }
#Session anlegen
$uid .= ("a".."z")[int rand 62] foreach 1..10;
use DBI;
$dbh = DBI->connect("DBI:$dbdriver:$dbdatabase:$dbhost:$dbport", $dbuser, $dbpassword);
$dbh->do("INSERT INTO hpm_sessions VALUES ('$uid','time();','$username','$lng','$userid');");
}
else
{
$uid = $q->param("uid");
#Session vorhanden?
use DBI;
$dbh = DBI->connect("DBI:$dbdriver:$dbdatabase:$dbhost:$dbport", $dbuser, $dbpassword);
$data = $dbh->selectrow_hashref("SELECT username, lng, userid FROM hpm_sessions WHERE sid='$uid';");
$username = $$data{'username'};
$lng = $$data{'lng'};
$userid = $$data{'userid'};
if (!$username)
{
print "Location: $maindir/index.php?lng=$lng&page=fehler&er=31\n\n";
}
$bilderdir = "$maindir/sprache/$lng/bilder";
}
require $page . ".cgi";
exit();
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
#!/usr/bin/perl
#Einleitung
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use POSIX;
$q = new CGI;
$page = $q->param("page");
require "../hpm_einstellungen.cgi";
require "../templates_login/$logintemplate/daten.cgi";
if ($page eq "index")
{
#Eingaben einlesen
$username = $q->param("user");
$passwort = $q->param("pass");
$lng = $q->param("lng");
$username = lc($username);
if ($username eq "") { print "Location: $maindir/index.php?lng=$lng&page=fehler&er=29\n\n"; exit(); }
if ($passwort eq "") { print "Location: $maindir/index.php?lng=$lng&page=fehler&er=30\n\n"; exit(); }
if (!(-e "../$internmaindir/userdaten/main/$username.dat")) { print "Location: $maindir/index.php?lng=$lng&page=fehler&er=31\n\n"; }
open(FILE, "../$internmaindir/userdaten/main/$username.dat");
chomp(@userdata = <FILE>);
close(FILE);
$userid = $userdata[0];
$sollpass = $userdata[2];
$lng = $userdata[3];
$passwortc = crypt $passwort, 12;
$pass = $passwort;
if (!($passwortc eq $sollpass)) { print "Location: $maindir/index.php?lng=$lng&page=fehler&er=31\n\n"; }
#Session anlegen
$time = time();
$zf .= ("a".."z","A".."Z",0..9)[int rand 62] foreach 1..8;
$uid = $time . "_" . $zf;
open(FILE, ">sessions/$uid");
print FILE $username . "\n";
print FILE $lng . "\n";
print FILE $userid . "\n";
close(FILE);
}
else
{
$uid = $q->param("uid");
#Session vorhanden?
if (-e "sessions/$uid")
{
open(FILE, "sessions/$uid");
chomp(@sessfile = <FILE>);
close(FILE);
($username, $lng, $userid) = @sessfile;
}
else
{
print "Location: $maindir/index.php?lng=$lng&page=fehler&er=31\n\n";
}
$bilderdir = "$maindir/sprache/$lng/bilder";
}
require $page . ".cgi";
exit();
1
2
3
4
5
<Location dein_cgi_skript.cgi>
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
</Location>
1
2
3
4
5
<Location dein_cgi_skript.cgi>
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
</Location>
|< 1 2 >| | 18 Einträge, 2 Seiten |