'AdaptiveJava1_0.jar', 'adaptive_classes' => 'AdaptiveJava1_0_Classes.jar', 'adaptive_src' => 'AdaptiveJava1_0_SRC.jar', 'sockets' => 'MetaSockets.tar.gz', 'act' => 'act-11-26-2003.zip', 'packages' => 'Packages-05-31-2004.zip', 'utilities' => 'utilities.jar', 'trap_readme' => 'TRAP-J-README-05-31-2004.TXT', 'trap' => 'TRAP-J-06-08-2004.zip', 'trapj21bin' => 'TRAPJ_2.1.zip', 'trapj22bin' => 'TRAPJ_2.2.zip', 'trapj22test' => 'TRAPJ_2.2_Test.zip', 'trapj21docs' => 'TRAPJ_2.1_docs.zip', 'trapj21src' => 'TRAPJ_2.1_source.zip', 'trapj22docs' => 'TRAPJ_2.2_docs.zip', 'trapj22src' => 'TRAPJ_2.2_source.zip' ); $tool = null; if ( isset($_GET['tool']) ) $tool = $_GET['tool']; if ( isset($_POST['tool']) ) $tool = $_POST['tool']; if ( $tool == null || !isset($map[$tool]) ) forward('http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/index.php"); $file = DL_PATH.$map[$tool]; if ( !file_exists($file) || !is_readable($file) ) critical("Download file {$map[$tool]} doesn't exist or cannot read it."); $params = array( "dsn" => DSN, "table" => "users", "usernamecol" => "username", "passwordcol" => "password" ); $a = new Auth("DB", $params); $a->start(); if ($a->checkAuth()) { /* * The output of your site goes here. */ if ( ob_get_level() ) ob_end_clean(); header('Content-type: application/octet-stream'); header("Content-Disposition: attachment; filename=\"{$map[$tool]}\""); readfile($file); include_once "DB.php"; $username = $a->getUsername(); $email = $name = $affiliation = $purpose = ""; $db =& DB::connect(DSN); if ( !PEAR::isError($db) ) { $res =& $db->query("SELECT * FROM users WHERE username = ?",$username); if ( !PEAR::isError($res) ) { $arr = $res->fetchRow(DB_FETCHMODE_ASSOC); $email = $arr['email']; $name = $arr['name']; $affiliation = $arr['affiliation']; $purpose = $arr['purpose']; } } $msg = "The following user downloaded '{$map[$tool]}': Username : $username Full Name : $name Email : $email Affiliation : $affiliation Purpose : $purpose Thank you, ARCL Download Script "; mail(EMAIL_FROM,"Download of ACRL software",$msg); exit(); } else forward('http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/login.php"); ?>