IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 22, 2026, 12:04:59 PM (3 months ago)
Author:
eugene
Message:

update pstamp/web relative to installation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/web/authenticate.php

    r25322 r42994  
    33// function check_login()
    44
     5$lifetime=86400;
    56session_start();
     7setcookie(session_name(),session_id(),time()+$lifetime);
     8ini_set('session.gc_maxlifetime', 86400);
    69
    710// 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";
    1016
    1117$user   = $_SERVER['PHP_AUTH_USER'];
     
    1319$did_login = isset($_SESSION['did_login']);
    1420
    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;
    1723
    18     echo "Welcome:  " . $user;
    19     echo "&nbsp;&nbsp;&nbsp; <a href=\"./logout.php\">Logout</a>";
    20     echo "<br />";
    21     echo "<br />";
    22 } else {
     24$valid_pwd = 0;
     25if ($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
     30if (!$skip_login && !$valid_pwd) {
    2331    $_SESSION['did_login'] = true;
    2432    header('WWW-Authenticate: Basic realm="Restricted Section"');
     
    3139
    3240?>
     41<?php
     42function welcomeHeader($user, $link, $text)
     43{
     44    echo "Welcome:  " . $user;  //  . "<br /><br />";
     45    echo "&nbsp;&nbsp;&nbsp;";
     46    echo "<a href=\"./logout.php\">Logout</a>";
     47    echo "&nbsp;&nbsp;&nbsp;\n";
     48    if ($link) {
     49        echo "<a href=\"./$link\">$text</a>";
     50    }
     51    include "pstamp_links.php";
     52    echo "<br /><br />";
    3353
     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.