added basic login/logout
git-svn-id: http://yolanda.mister-muffin.de/svn@10 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
b44ba64a23
commit
1615c28881
4 changed files with 32 additions and 6 deletions
|
@ -6,3 +6,5 @@ $database = 'gnutube';
|
||||||
$host = 'localhost';
|
$host = 'localhost';
|
||||||
$user = 'root';
|
$user = 'root';
|
||||||
$pass = '';
|
$pass = '';
|
||||||
|
$session_name = 'sid';
|
||||||
|
1;
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
#!/usr/bin/perl
|
|
||||||
require "/var/www/perl/include.pl";
|
require "/var/www/perl/include.pl";
|
||||||
require "/var/www/perl/functions.pl";
|
require "/var/www/perl/functions.pl";
|
||||||
|
|
||||||
#create or resume session
|
#create or resume session
|
||||||
CGI::Session->name("SID");
|
CGI::Session->name($session_name);
|
||||||
my $session = new CGI::Session;
|
my $session = new CGI::Session;
|
||||||
|
|
||||||
#store session param
|
|
||||||
$session->param('auth', 'true');
|
|
||||||
|
|
||||||
#read xml
|
#read xml
|
||||||
$page = XMLin('/var/www/perl/index.xml', ForceArray => 1, KeyAttr => {} );
|
$page = XMLin('/var/www/perl/index.xml', ForceArray => 1, KeyAttr => {} );
|
||||||
|
|
||||||
|
|
26
trunk/login.pl
Normal file
26
trunk/login.pl
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
require "/var/www/perl/include.pl";
|
||||||
|
|
||||||
|
CGI::Session->name($session_name);
|
||||||
|
my $session = new CGI::Session;
|
||||||
|
|
||||||
|
#fill %querystring with everything that was passed via GET
|
||||||
|
@parts = split( /\&/, $ENV{ "QUERY_STRING" } );
|
||||||
|
foreach $part (@parts) {
|
||||||
|
( $name, $value ) = split( /\=/, $part );
|
||||||
|
$queryString{ $name } = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($queryString{ "action" }) {
|
||||||
|
if($queryString{ "action" } eq "login") {
|
||||||
|
$session->param('auth', 'true');
|
||||||
|
print $session->header();
|
||||||
|
print "logged in";
|
||||||
|
} elsif($queryString{ "action" } eq "logout") {
|
||||||
|
$session->param('auth', 'false');
|
||||||
|
print $session->header();
|
||||||
|
print "logged out";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print $session->header();
|
||||||
|
print "incorrect query string";
|
||||||
|
}
|
|
@ -65,7 +65,9 @@
|
||||||
<div class="header2">
|
<div class="header2">
|
||||||
<a href="about:blank"><xsl:value-of select="$locale_strings/str[@id='register']" /></a>
|
<a href="about:blank"><xsl:value-of select="$locale_strings/str[@id='register']" /></a>
|
||||||
<xsl:value-of select="$locale_strings/str[@id='separator']" />
|
<xsl:value-of select="$locale_strings/str[@id='separator']" />
|
||||||
<a href="about:blank"><xsl:value-of select="$locale_strings/str[@id='login']" /></a>
|
<a href="login.pl?action=login"><xsl:value-of select="$locale_strings/str[@id='login']" /></a>
|
||||||
|
<xsl:value-of select="$locale_strings/str[@id='separator']" />
|
||||||
|
<a href="login.pl?action=logout"><xsl:value-of select="$locale_strings/str[@id='logout']" /></a>
|
||||||
<xsl:value-of select="$locale_strings/str[@id='separator']" />
|
<xsl:value-of select="$locale_strings/str[@id='separator']" />
|
||||||
<img class="openid-icon" src="./images/openid-icon.png" alt="open id logo" />
|
<img class="openid-icon" src="./images/openid-icon.png" alt="open id logo" />
|
||||||
<a href="about:blank"><xsl:value-of select="$locale_strings/str[@id='login_openid']" /></a>
|
<a href="about:blank"><xsl:value-of select="$locale_strings/str[@id='login_openid']" /></a>
|
||||||
|
|
Loading…
Reference in a new issue