#This is the OS developer release key, replace on istallation. As it is not secure.
my $cipher_key = '95d7a85ba891da';
+if($cgi->param('logout')){&logout}
+
if(&processSubmit==0){
print $cgi->header(-expires=>"0s", -charset=>"UTF-8", -cookie=>$cookie);
print $cgi->start_html(-title => "Personal Log Login", -BGCOLOR=>"#c8fff8",
-script=>{-type => 'text/javascript', -src => 'wsrc/main.js'},
-style =>{-type => 'text/css', -src => 'wsrc/main.css'},
- );
-
+ );
$frm = qq(
<form id="frm_login" action="login_ctr.cgi" method="post"><table border="0" width="$PRC_WIDTH%">
<tr class="r0"><td colspan="2"></td><td><input type="submit" value="Login"/></td></tr>
</table></form>);
- print "<center>";
- print "\n<div>\n" . $frm ."\n</div>\n<br/>";
- print "</center>";
+ print qq(<br><br><div id=rz>
+ <center>
+ <h2>Welcome to Life Log</h2><div>$frm</div><br/>
+ <a href="https://github.com/wbudic/LifeLog" target="_blank">Get latest version of this application here!</a><br>
+ </center><div>);
print $cgi->end_html;
}
insertDefCats($db);
}
-
$st = $db->prepare(selSQLTbl('AUTH'));
$st->execute();
if(!$st->fetchrow_array()) {
$rv = $db->do($stmt);
}
populateConfig($db);
-
+ $db->disconnect();
}
catch{
print $cgi->header;
}
}
-### CGI END
\ No newline at end of file
+sub logout{
+
+ $session->delete();
+ $session->flush();
+ print $cgi->header(-expires=>"0s", -charset=>"UTF-8", -cookie=>$cookie);
+ print $cgi->start_html(-title => "Personal Log Login", -BGCOLOR=>"black",
+ -style =>{-type => 'text/css', -src => 'wsrc/main.css'},
+ );
+
+ print qq(<font color="white"><center><h2>You have properly loged out of the Life Log Application!</h2>
+ <br>
+ <form action="login_ctr.cgi"><input type="submit" value="No, no, NO! Log me In Again."/></form><br>
+ </br>
+ <iframe width="60%" height="600px" src="https://www.youtube.com/embed/HQ5SEieVbSI?autoplay=1"
+ frameborder="0"
+ allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
+ </iframe>
+ </center></font>
+ );
+
+ print $cgi->end_html;
+ exit;
+}
+
+### CGI END
our $DATE_UNI = '0';
our $RELEASE_VER = '1.3';
our $AUTHORITY = '';
+our $IMG_W_H = '210x120';
#END OF SETTINGS
my $cgi = CGI->new;
my $dsn= "DBI:SQLite:dbname=$database";
my $db = DBI->connect($dsn, $userid, $password, { RaiseError => 1 }) or die "<p>Error->"& $DBI::errstri &"</p>";
+my ($imgw,$imgh);
+
### Authenticate session to alias password
&authenticate;
&getConfiguration($db);
my $toggle =""; if($rs_keys||$rs_cat_idx||$stmD){$toggle=1;};
$session->expire($SESSN_EXPR);
+
+#tag related framed sizing.
+my @arrwh = $IMG_W_H = ~m((\S+)\s*x\$\s*(\S+))gi;
+if(@arrwh==2){
+ $imgw = $arrwh[0];
+ $imgh = $arrwh[1];
+}
+else{
+ $imgw = 210;
+ $imgh = 120;
+}
print $cgi->header(-expires=>"0s", -charset=>"UTF-8");
print $cgi->start_html(-title => "Personal Log", -BGCOLOR=>"#c8fff8",
}
}
$lnk = qq(\n<a href="./images/$lnk" style="border=0;" target="_IMG">
- <img src="./images/$sub" width="210" height="120" class="tag_FRM"/></a>);
+ <img src="./images/$sub" width="$imgw" height="$imgh" class="tag_FRM"/></a>);
}else{
#TODO fetch from web locally the original image.
- $lnk = qq(\n<img src="$lnk" width="210" height="120" class="tag_FRM"/>);
+ $lnk = qq(\n<img src="$lnk" width="$imgw" height="$imgh" class="tag_FRM"/>);
}
$tags .= qq(<input id="tag$id" type="hidden" value="$log"/>\n);
$log=~s/<<FRM<(.*?)>/$lnk/o;
my $sub = "<b>".substr($log,$idx+4,$len-$idx)."</b>";
$log=~s/<<B<(.*?)>/$sub/o;
}
-
-
+ while ($log =~ /<<I</){
+ my $idx = $-[0];
+ my $len = index($log, '>', $idx)-4;
+ my $sub = "<i>".substr($log,$idx+4,$len-$idx)."</i>";
+ $log=~s/<<I<(.*?)>/$sub/o;
+ }
while($log =~ /<<TITLE</){
my $idx = $-[0];
my $len = index($log, '>', $idx)-8;
#
#Page printout from here!
#
-print "<center>";
- print "\n<div>\n" . $frm ."\n</div>\n<br>\n";
- print '<div id="div_srh">' . $srh .'</div>';
- print "\n<div>\n" . $tbl ."\n</div>";
- print '<br><div><a href="stats.cgi">View Statistics</a></div>';
- print '<br><div><a href="config.cgi">Configure Log (Careful)</a><a name="bottom"/></div>';
+print qq(<center>\n
+ <div>\n$frm\n</div>\n<br>\n
+ <div id="div_srh">$srh</div>
+ <div>\n$tbl\n</div><br>
+ <div><a href="stats.cgi">View Statistics</a></div><br>
+ <div><a href="config.cgi">Configure Log</a></div><hr>
+ <div><a href="login_ctr.cgi?logout=bye">LOGOUT</a><a name="bottom"/></div>
+ );
print qq(</center>
<ul id="cat_lst">
$cat_descriptions
case "PRC_WIDTH" {$PRC_WIDTH=$r[2]}
case "SESSN_EXPR" {$SESSN_EXPR=$r[2]}
case "DATE_UNI" {$DATE_UNI=$r[2]}
- case "LANGUAGE" {$LANGUAGE=$r[2]}
+ case "LANGUAGE" {$LANGUAGE=$r[2]}
+ case "IMG_W_H" {$IMG_W_H=$r[2]}
else {print "Unknow variable setting: ".$r[1]. " == ". $r[2]}
}