-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
2,334 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
fab-online | ||
========== | ||
|
||
Monitor similar to Open_Access_Control written on Perl and Mojolicious | ||
Monitor similar to Open_Access_Control written on Perl and Mojolicious<br> | ||
|
||
Require libmojolicious-perl.<br> | ||
To start app please enter morbo ./script/open_access<br> | ||
To long collect data from OpenAccess control just add to crontab script/db_gen/parse_in_db, first changing path | ||
to your text file with logs and database parameters<br> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package OpenAccess; | ||
use Mojo::Base 'Mojolicious'; | ||
|
||
# This method will run once at server start | ||
sub startup { | ||
my $self = shift; | ||
|
||
# Documentation browser under "/perldoc" | ||
$self->plugin('PODRenderer'); | ||
|
||
# Routes | ||
my $r = $self->routes; | ||
|
||
# Normal route to controller | ||
$r->route('/')->to('example#welcome'); | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package OpenAccess::Example; | ||
use Mojo::Base 'Mojolicious::Controller'; | ||
use DBI; | ||
use Data::Dumper; | ||
|
||
sub welcome { | ||
my $self = shift; | ||
my @a; | ||
my $dbh = DBI->connect('DBI:mysql:openaccess', 'root', 'toor') || die "Could not connect to database: $DBI::errstr"; | ||
$dbh->do('set names utf8'); | ||
my $sth = $dbh->prepare("SELECT u.id, u.name, u.surname, u.tag, l.created FROM users as u JOIN log as l on l.tag=u.tag GROUP BY u.id ORDER BY l.created DESC LIMIT 10"); | ||
$sth->execute(); | ||
my $a = $sth->fetchall_hashref("tag"); | ||
warn Dumper $a; | ||
$self->render( | ||
users => $a, | ||
} | ||
|
||
1; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!doctype html><html> | ||
<head> | ||
<title>Welcome to the Mojolicious real-time web framework!</title> | ||
</head> | ||
<body> | ||
<h2>Welcome to the Mojolicious real-time web framework!</h2> | ||
This is the static document "public/index.html", | ||
<a href="/welcome">click here</a> to get back to the start. | ||
</body> | ||
</html> |
Oops, something went wrong.