Leser: 3
|< 1 2 3 4 >| | 38 Einträge, 4 Seiten |
1 2 3 4 5 6
#!/usr/bin/perl use strict; use warnings; print sprintf "%s :: %s\n", $_, $ENV{$_} for keys %ENV;
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
#!/usr/bin/perl use warnings; use strict; use DBI; my $gamebin = "/usr/games/slashem"; ### DB ### my $database = "nethack"; my $hostname = "127.0.0.1"; my $dsn = "DBI:mysql:database=$database;host=$hostname"; my $dbuser = "nethack"; my $dbpasswd = 'whatApa55'; my $dbh = DBI->connect( $dsn, $dbuser, $dbpasswd, {RaiseError => 1, AutoCommit => 0} ) || die $DBI::errstr; ### SUBS ### sub countusers { my $sth = $dbh->prepare( q{ SELECT username from users }); my $rc = $sth->execute; print "$sth->{NUM_OF_FIELDS}"; $dbh->disconnect; } sub auth { my ($login, $password) = shift; # Hier brauch ich hilfe } sub game { system("clear"); print("Hello welcome to SlashEm!\n\nSlashEm is a modification of the great NetHack Game...\nMore Info: http://nethack.org/v343/Guidebook.html or press '?' ingame..."); sleep("5"); print("Login: "); chomp(my $login = <STDIN>); print("\nPassword: "); chomp(my $password = <STDIN>); auth($login, $password); # wenn login = nicht vorhanden, neu erstellen: createuser(); # wenn login vorhanden, passwort abgleichen; # wenn pass falsch -> exit; # wenn pass richtig -> login fertig; system("clear"); print("You enter the World of SlashEm... Currently there are", countusers(), "Users registered\n\n"); sleep("2"); } ### MAIN ### #system("$gamebin -u $name");
|< 1 2 3 4 >| | 38 Einträge, 4 Seiten |