| [ PHPXref.com ] | [ Generated: Sun Jul 20 19:56:02 2008 ] | [ phpSQLView 2.4 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /*################################################################# 3 # 4 # Name: index.php 5 # 6 # Description: 7 # Start of sqlview. Get the details of the database to open. 8 # Save connection details as cookies. 9 # 10 # Parameters: 11 # project - optional project to be used, allows overrides of 12 # local_config values so we can work with alternate databases. 13 # cid - optional cookie id number. Allows multiple instances of SQLView 14 # state - controls which session variables we use 15 # 'startover' - use existing session 16 # else create a new session, discard old one 17 # 18 # Copyright (C) 2001-2005 Dmitriy Katsman, Terry Gliedt, University of Michigan 19 # This is free software; you can redistribute it and/or modify it under the 20 # terms of the GNU General Public License as published by the Free Software 21 # Foundation; See http://www.gnu.org/copyleft/gpl.html 22 #################################################################*/ 23 include_once "common.php"; 24 global $cid; 25 include_once "session.php"; // Set up session variables 26 ob_start(); 27 eval('include_once "local_config.php";'); // Maybe local_config not done 28 $value = ob_get_contents(); 29 ob_end_clean(); 30 if ($value) { // This failed, try setup 31 local_config_failed($value); 32 exit; 33 } 34 35 $allfields = array( 36 'type' => 'Database Type', 37 'host' => 'Database Host', 38 'db' => 'Database Name', 39 'user' => 'User Name', 40 'pass' => 'Password', 41 'table' => 'Table Name', 42 ); 43 44 //print "<!-- _GET=\n"; print_r($_GET); print " -->\n"; 45 //print "<!-- _SESSION=\n"; print_r($_SESSION); print "-->\n"; 46 47 // Get parameters passed in via normal invocation 48 extract(isolate_parms( 'state', 'project')); 49 $_SESSION['CID'] = $cid; 50 51 // Do some cleanup in the global data 52 unset($_SESSION['desc']); 53 unset($_SESSION['cmd']); 54 unset($_SESSION['showdetails']); 55 unset($_SESSION['project']); 56 57 // Override any project related variables 58 get_project($project); 59 60 //------------------------------------------------------------------- 61 // We only do one thing, prompt to connect to the database 62 //------------------------------------------------------------------- 63 doheader(0); 64 65 // See if the user is allowed to use this project 66 verify_access($project); 67 68 // Maybe the project code provided a little extra HTML to replace the header 69 if ($LOCALOPT['text']) { print $LOCALOPT['text']; } 70 else { 71 $t = "SQLView - View a Table"; 72 if ($LOCALOPT['title'] != '') { $t = $LOCALOPT['title']; } 73 print "<h2 align=\"center\">" . $LOCALOPT['title'] . "</h2>\n"; 74 } 75 76 // Generate the form on the first page 77 print <<<END 78 <form action="display.php" method="post"> 79 <input type="hidden" name="query" value="selectall"/> 80 <input type="hidden" name="cid" value="$cid"/> 81 82 END; 83 84 // Generate hidden fields (i.e. those not in $LOCALOPT['promptfor'] 85 // $LOCALOPT['promptfor'] contains a list of fields to prompt for 86 reset ($allfields); 87 while (list ($key, $val) = each($allfields)) { 88 if (in_array($key, $LOCALOPT['promptfor'])) { continue; } 89 $t = "default$key"; 90 print "<input type=\"hidden\" name=\"sql_$key\" value=\"$LDB[$t]\"/>\n"; 91 } 92 93 print "<table summary=\"Input\" border=\"0\" cellspacing=\"15\">\n"; 94 95 reset ($allfields); 96 while (list ($key, $val) = each($allfields)) { 97 if ( ! in_array($key, $LOCALOPT['promptfor'])) { continue; } 98 $t = "sql_$key"; 99 if (isset($_SESSION[$t])) { $defval = $_SESSION[$t]; } 100 else { 101 $t = "default$key"; 102 $defval = $LDB[$t]; 103 } 104 $typ = 'text'; 105 if ($key == 'pass') { $typ = 'password'; } 106 print <<<END 107 <tr> 108 <td><b>$val:</b></td> 109 <td><input type="$typ" name="sql_$key" value="$defval"/> 110 </td> 111 </tr> 112 113 END; 114 } 115 116 print " <tr>\n"; 117 if ($LOCALOPT['showdetails']) { 118 print " <td align=\"left\"><input type=\"checkbox\" value=\"1\" name=\"showdetails\"/> " . 119 " Show Details</td>\n"; 120 } 121 else { print " <td> </td>\n"; } 122 print <<<END 123 <td><b><input type="submit" value=" Connect to DataBase "/></b></td> 124 </tr> 125 </table> 126 </form> 127 128 END; 129 130 dofooter(0); 131 132 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |