/[synchroedit]/espi.cgi
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /espi.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations)
Sun Apr 15 23:10:09 2007 UTC (14 years, 7 months ago) by dpavlin
File size: 875 byte(s)
added $admins hash to configure users and logins which will be granted admin rights
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use CGI;
6 use CGI::Carp 'fatalsToBrowser';
7
8 use Data::Dump qw/dump/;
9
10 $| = 1;
11
12 my $admins = {
13 'dpavlin' => 'my admin secret',
14 };
15
16 my $espi_hook = {
17 # 'authenticate-user' => 'ACCESS GRANTED ADMIN',
18 # 'authenticate-user' => 'ACCESS GRANTED',
19 'authenticate-user' => sub {
20 my $param = shift;
21 warn "param = ",dump( $param );
22 my $ret = 'ACCESS GRANTED';
23 $ret .= ' ADMIN' if defined( $admins->{ $param->{uid} } ) && $admins->{ $param->{uid} } eq $param->{pwd};
24 return $ret;
25 }
26 };
27
28 my $cgi = new CGI;
29
30 print $cgi->header();
31
32 my $v = $cgi->Vars;
33
34 warn dump( $v );
35
36 my $hook = $v->{espi_hook} || die "no espi_hook?";
37
38 die "can't find hook for $hook" unless defined( $espi_hook->{ $hook } );
39
40 if ( ref( $espi_hook->{ $hook } ) eq 'CODE' ) {
41 print $espi_hook->{ $hook }->( $v );
42 } else {
43 print $espi_hook->{ $hook }
44 };
45 print "\n";

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26