
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
// Default config options.
// Override these by pasting them in the form $tacfg['....'] above the require() code in the actual
// page to be protected.
// Username and password
$tacfgd['uname'] = 'haag';
$tacfgd['pword'] = 'hetwarendechampignons';
// Title of page.
$tacfgd['title'] = 'Toneelgroep HAAG Login';
// Text to appear just above login form.
$tacfgd['helptext'] = 'Om privacy-redenen is deze pagina niet publiekelijk toegankelijk.
Vul hieronder uw gebruikersnaam en wachtwoord in om verder te gaan...';
// Set to true to enable the optional remember-me feature, which stores encrypted login details to
// allow users to be logged-in automatically on their return. Turn off for a little extra security.
$tacfgd['allowrm'] = true;
// If you have multiple protected pages, and there's more than one username / password combination,
// you need to group each combination under a distinct rmgroup so that the remember-me feature
// knows which login details to use.
$tacfgd['rmgroup'] = 'default';
// Set to true if you use your own sessions within your protected page, to stop txtAuth interfering.
// In this case, you _must_ call session_start() before you require() txtAuth. Logging out will not
// destroy the session, so that is left up to you.
$tacfgd['ownsessions'] = false;
foreach ($tacfgd as $key => $val) {
if (!isset($tacfg[$key])) $tacfg[$key] = $val;
}
if (!$tacfg['ownsessions']) {
session_name('txtauth');
session_start();
}
// Logout attempt made. Deletes any remember-me cookie as well
if (isset($_GET['txtlogout']) || isset($_POST['txtlogout'])) {
setcookie('txtauth_'.$rmgroup, '', time()-86400*14);
if (!$tacfg['ownsessions']) {
$_SESSION = array();
session_destroy();
}
else $_SESSION['txtauthin'] = false;
}
// Login attempt made
elseif (isset($_POST['login'])) {
if ($_POST['uname'] == $tacfg['uname'] && $_POST['pword'] == $tacfg['pword']) {
$_SESSION['txtauthin'] = true;
if ($_POST['rm']) {
// Set remember-me cookie for 2 weeks
setcookie('txtauth_'.$rmgroup, md5($tacfg['uname'].$tacfg['pword']), time()+86400*14);
}
}
else $err = 'Ongeldige gebruikersnaam of wachtwoord';
}
// Remember-me cookie exists
elseif (isset($_COOKIE['txtauth_'.$rmgroup])) {
if (md5($tacfg['uname'].$tacfg['pword']) == $_COOKIE['txtauth_'.$rmgroup] && $tacfg['allowrm']) {
$_SESSION['txtauthin'] = true;
}
else $err = 'Remember-me cookie disabled or invalid';
}
if (!$_SESSION['txtauthin']) {
?>

![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |