#!/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 = ); print("\nPassword: "); chomp(my $password = ); 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");