| [ PHPXref.com ] | [ Generated: Sun Jul 20 19:56:00 2008 ] | [ phpSQLiteAdmin 0.2 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 3 require_once ('include.php'); 4 5 $title = 'Add new database alias:'; 6 $action = 'insert'; 7 $createdb = 'read-only'; 8 9 $alias = new dbalias; 10 $alias->user = $current_user; 11 $alias->alias = $_POST['alias']; 12 $alias->path = $_POST['path']; 13 $alias->description = $_POST['description']; 14 15 16 if (isset($_POST['insert'])) { 17 // create the new db is case it does not exist 18 if (!file_exists($alias->path)) $newdb =& new SPSQLite($alias->path); 19 $sysdbh->query("insert into databases (user,alias,path,description) values ({$alias->user},'{$alias->alias}','{$alias->path}','{$alias->description}')"); 20 // do we really want this? 21 $_SESSION['phpSQLiteAdmin_currentdb'] = $alias->path; 22 header("Location: index.php"); 23 exit; 24 } 25 26 27 if (isset($_GET['alias'])) { 28 $sysdbh->query("select user,alias,path,description from databases where user = $current_user and alias = '".$_GET[alias]."'"); 29 while($row = $sysdbh->fetchArray()) { 30 $alias = new dbalias; 31 $alias->alias = $row[1]; 32 $alias->path = $row[2]; 33 $alias->description = $row[3]; 34 $title = 'Edit database alias:'; 35 $action = 'update'; 36 } 37 } 38 39 40 if (isset($_POST['update'])) { 41 $sysdbh->query("update databases set alias = '{$alias->alias}', path = '{$alias->path}', description = '{$alias->description}' where user = {$alias->user} and alias = '{$_POST[oldalias]}'"); 42 header("Location: index.php"); 43 exit; 44 } 45 46 47 if (isset($_POST['delete'])) { 48 $sysdbh->query("delete from databases where user = {$alias->user} and alias = '{$alias->alias}'"); 49 //unlink($alias->path); nooooooo don't do that... 50 $_SESSION['phpSQLiteAdmin_currentdb'] = ''; 51 header("Location: index.php"); 52 exit; 53 } 54 55 $type = text; 56 57 echo<<<EOT 58 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> 59 <html> 60 <head> 61 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 62 <title>phpSQLiteAdmin</title> 63 <meta http-equiv="expires" content="0"> 64 <script language="javascript" src="javascript.txt" type="text/javascript"></script> 65 <link href="phpsla.css" rel="stylesheet" type="text/css"> 66 </head> 67 <body class="right" onload="document.adddb.alias.focus();"> 68 <h3>$title</h3> 69 <form name="adddb" action="editdb.php" method="post" target="_top"> 70 <input type="hidden" name="oldalias" value="{$_GET[alias]}"> 71 <table> 72 <tr><td class=label>Alias:</td><td><input type=text size=80 name=alias value="{$alias->alias}"></td></tr> 73 <tr><td class=label>Path on server:</td><td><input type=$type size=80 name=path value="{$alias->path}"></td></tr> 74 <tr><td class=label>Description:</td><td><input type=text size=80 name=description value="{$alias->description}"></td></tr> 75 <tr><td class=label></td><td class=label><input type=submit name=$action value="Save"> <input type=button value="Cancel" onClick="history.back();"></td></tr> 76 </form> 77 </table> 78 EOT; 79 80 81 if (isset($_GET['alias'])) { 82 echo<<<EOT 83 <br><br><br><br><br> 84 <form name=delete action=editdb.php method=post onsubmit="" target="_top"> 85 <input type=hidden name=user value="{$current_user}"> 86 <input type=hidden name=alias value="{$_GET[alias]}"> 87 <input type=submit name=delete value="Remove this alias"> 88 </form> 89 EOT; 90 } 91 92 93 print "</body>\n"; 94 print "</html>\n"; 95 96 97 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |