gateDB interface - Main

'; } else if($which=='test'){ print '

gateDB interface - FEE Test Results

'; } else if($which=='chamber'){ print '

gateDB interface - ROC Test Results

'; } else if($which=='power'){ print '

gateDB interface - Low Voltage

'; } else if($which=='internal'){ print '

gateDB interface - Internal Access

'; } else { print 'Unknown loading page!'; } $gate_conn = pg_connect("dbname=$dbname user=alice") or die ("
interface.php - ERROR : Couldn't connect to database"); function ValidateLogin($uname,$password,&$uini){ global $which; $Superuser = array(1=>"PAUL",2=>"TOM",3=>"PETER",4=>"DAVID",5=>"KEN",6=>"JOCHEN"); //don't start with index 0! $safe_user = strtr(addslashes(trim($uname)),array('_'=>'\_','%'=>'\%')); $safe_user = strtoupper($safe_user); $password = strtoupper(trim($password)); $query = "SELECT initials,username,passwd FROM users WHERE username LIKE '$safe_user'"; $res = pg_query($query) or die ("
interface.php - ERROR : Couldn't execute user query"); $NumUsers = pg_num_rows($res); if($NumUsers > 0){ // query found user(s) with this username while($row = pg_fetch_array($res)) { // loop over found user(s) $password = crypt($password,trim($row['initials'])); // encrypt incoming password if($password != $row['passwd']) continue; // this user's password does not match, try next // from here on, a username with matching password is found if($which != 'internal'){ // normal user - ALLOW! $uini = trim($row['initials']); return true; } else { // internal access requested if(array_search($row['username'],$Superuser)){ // user is super - ALLOW! return true; } else {return false;} // user is not super - DONT ALLOW! } } // user loop } else {return false;} // no user(s) found - DONT ALLOW! return false; // default - DONT ALLOW! } ?>

Use "contact" link in left menu panel for registration requests

Please enter (case insensitive) your:

Username

Password

Check if you want to change them:

0) $username = $_POST['username']; if(strlen($_POST['passwd'])>0) $passwd = $_POST['passwd']; if(isset($_POST['parsed'])) $parsed = $_POST['parsed']; else $parsed = 0; if(isset($_POST['ChangeLogin'])) $ChangeLogin = $_POST['ChangeLogin']; else $ChangeLogin = 0; $uini = 'none'; if($parsed){ if(!ValidateLogin($username,$passwd,$uini)){ print "

Login Error - Invalid username:'".$username."' and/or password:'".$passwd."'

"; if($which=='internal') print '

You do not have internal access!

'; exit; } else { // VALID USER LOGIN! print ''; print ''; print 'gateDB login redirect page'; print ''; if($ChangeLogin){ // redirect to login changing page $redirect = ''; print $redirect; } else { // redirect to actual DB data presentation page if($which=='gate'){ print ''; } else if($which=='test'){ print ''; } else if($which=='chamber'){ print ''; } else if($which=='power'){ print ''; } else if($which=='internal'){ print ''; // print ''; } else { print 'Unknown loading page!'; } } // redirection print ''; print ''; print ''; } // valid login } // parsed form pg_close() or die ("
interface.php - ERROR : Couldn't disconnect database"); ?>