# Current Branch Development Moon-Stable-1.4
## Urgent
-* Autologin feature, that expires on logout.
+*✔ Autologin feature, that expires on logout.
*✔ Data/Login control updated to read the configuration file.
>> Configuration file to be updated to carry also categories.
* ✔ Configuration page to be updated, system variables description field to be implemented.
if($cgi->param('logout')){&logout}
+&checkAutologinSet;
if(&processSubmit==0){
print $cgi->header(-expires=>"0s", -charset=>"UTF-8", -cookie=>$cookie);
sub processSubmit{
try{
- &checkAutologinSet;
+
if($alias&&$passw){
$passw = uc crypt $passw, hex $cipher_key;
my $db = DBI->connect($dsn, $cre[0], $cre[1], { RaiseError => 1 })
or die "<p>Error->"& $DBI::errstri &"</p>";
#check if enabled.
- my $st = $db->prepare("SELECT NAME, VALUE FROM CONFIG WHERE NAME='$AUTO_LOGIN';");
+ my $st = $db->prepare("SELECT VALUE FROM CONFIG WHERE NAME='AUTO_LOGIN';");
$st->execute();
my @set = $st->fetchrow_array();
if(@set && $set[0]=="1"){
$alias = $cre[0];
- $passw = $cre[1];
+ $passw = $cre[1];
}
}
}
#
use strict;
use warnings;
+use DBI;
+#DEFAULT SETTINGS HERE!
+our $LOG_PATH = '/home/will/dev/LifeLog/dbLifeLog/';
+#END OF SETTINGS
+
+
+my @cre;
open(my $fh, '<', '/home/will/dev/LifeLog/htdocs/cgi-bin/main.cnf' ) or die "Can't open main.cnf: $!";
while (my $line = <$fh>) {
if(rindex ($line, "<<AUTO_LOGIN<", 0)==0){
my $end = index $line, ">", 14;
my $crest = substr $line, 13, $end - 13;
- my @cre = split '/', $crest;
+ @cre = split '/', $crest;
if(@cre &&scalar(@cre)>1){
- print @cre;
+ print @cre; last;
}
}
}
close $fh;
+
+ if(scalar(@cre)>1){
+
+ my $database = $LOG_PATH.'data_'.$cre[0].'_log.db';
+ my $dsn= "DBI:SQLite:dbname=$database";
+ my $db = DBI->connect($dsn, $cre[0], $cre[1], { RaiseError => 1 })
+ or die "<p>Error-></p>";
+ #check if enabled.
+ my $st = $db->prepare("SELECT VALUE FROM CONFIG WHERE NAME='AUTO_LOGIN';");
+ $st->execute();
+ my @set = $st->fetchrow_array();
+ print $set[0];
+ if($set[0] eq "0"){
+ my $alias = $cre[0];
+ my $passw = $cre[1];
+ }
+ else{
+ print "sucks cock!"
+ }
+ }
=Comm
my $fh;
my $inData = 0;