- Timestamp:
- Apr 22, 2026, 12:04:59 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/pstamp/web/authenticate.php
r25322 r42994 3 3 // function check_login() 4 4 5 $lifetime=86400; 5 6 session_start(); 7 setcookie(session_name(),session_id(),time()+$lifetime); 8 ini_set('session.gc_maxlifetime', 86400); 6 9 7 10 // XXX TODO use mysql 8 $auth_user="setme"; 9 $auth_passwd="setmetoo"; 11 $auth_user="SET_ME"; 12 $auth_passwd="SET_ME"; 13 14 $alt_user="SET_ME"; 15 $alt_passwd="SET_ME"; 10 16 11 17 $user = $_SERVER['PHP_AUTH_USER']; … … 13 19 $did_login = isset($_SESSION['did_login']); 14 20 15 if ($did_login && isset($user) && isset($passwd) && 16 ($auth_user == $user) && ($auth_passwd == $passwd)) { 21 # uncomment this to skipp authentication 22 $skip_login = 0; 17 23 18 echo "Welcome: " . $user; 19 echo " <a href=\"./logout.php\">Logout</a>"; 20 echo "<br />"; 21 echo "<br />"; 22 } else { 24 $valid_pwd = 0; 25 if ($did_login && isset($user) && isset($passwd)) { 26 $valid_pwd = $valid_pwd || (($auth_user == $user) && ($auth_passwd == $passwd)); 27 $valid_pwd = $valid_pwd || (($alt_user == $user) && ($alt_passwd == $passwd)); 28 } 29 30 if (!$skip_login && !$valid_pwd) { 23 31 $_SESSION['did_login'] = true; 24 32 header('WWW-Authenticate: Basic realm="Restricted Section"'); … … 31 39 32 40 ?> 41 <?php 42 function welcomeHeader($user, $link, $text) 43 { 44 echo "Welcome: " . $user; // . "<br /><br />"; 45 echo " "; 46 echo "<a href=\"./logout.php\">Logout</a>"; 47 echo " \n"; 48 if ($link) { 49 echo "<a href=\"./$link\">$text</a>"; 50 } 51 include "pstamp_links.php"; 52 echo "<br /><br />"; 33 53 54 // Top of the page is the contents of the "message of the day file" 55 // This can be empty but must exist or the user sees an error. 56 $motd_filename = "pstamp_motd.html"; 57 $file = fopen($motd_filename, "r"); 58 if ($file) { 59 fpassthru($file); 60 } 61 62 // echo "<br />"; 63 // echo "<br />"; 64 } 65 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
