"Fossies" - the Fresh Open Source Software Archive

Member "sqlgreywebinterface-1.1.8/opt_in_out.php" (10 Aug 2015, 2903 Bytes) of package /linux/privat/old/sqlgreywebinterface-1.1.8.tgz:


The requested HTML page contains a <FORM> tag that is unusable on "Fossies" in "automatic" (rendered) mode so that page is shown as HTML source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "opt_in_out.php" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.1.7_vs_1.1.8.

    1 <?php
    2 
    3 /********************************************
    4 SQLgrey Web Interface
    5 Filename:   opt_in_out.php
    6 Purpose:    Renders the optin/out pages
    7 Version:    1.1.8
    8 *********************************************/
    9 
   10     require "includes/functions.inc.php";
   11     require "includes/opt_in_out.inc.php";
   12     
   13     isset($_GET["direction"]) ? $direction = $_GET["direction"] : $direction = "out";
   14     isset($_GET["what"]) ? $what = $_GET["what"] : $what = "domain";
   15     isset($_GET["action"]) ? $action = $_GET["action"] : $action = "";
   16     
   17     //  Add some explanation.
   18     if ($direction == "out") {
   19         $helptag = $helptag_dir;
   20     } else {
   21         $helptag = $helptag_dir.$helptag_what;
   22     }
   23     
   24     // Perform demanded action.
   25     switch ($action) {
   26         case "del":
   27             $entry = $_GET["field"];
   28             if ($entry == '') {
   29                 $report = '<br />Nothing was entered.';
   30             } else {
   31                 do_query("DELETE FROM ".$table." WHERE ".$field."='".addslashes($entry)."'");
   32                 $report = '<br />'.$entry.' deleted.';
   33             }
   34             break;
   35         case "add":
   36             $entry = $_POST[$field];
   37             if ($entry == '') {
   38                 $report = '<br />Nothing was entered.';
   39             } else {
   40                 do_query("INSERT INTO ".$table."(".$field.") VALUES('".addslashes(strtolower($entry))."')");
   41                 $report = '<br />'.$entry.' added.';
   42             }
   43             break;
   44         case "":
   45             $report = "";
   46             break;
   47     }
   48 ?>
   49 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   50      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   51 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
   52 
   53 <head>
   54     <title><?php echo $title; ?></title>
   55     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   56     <link rel="stylesheet" href="main.css" type="text/css" charset="utf-8" />
   57 </head>
   58 
   59 <body>
   60 
   61 <div id="page">
   62 
   63     <div class="navcontainer">
   64         <?php shownav('grey','', $direction, $what); ?>
   65     </div>
   66         
   67     <table width="100%" summary="main">
   68         <tr>
   69         <td>
   70             <p><span class="h1"><?php echo $title; ?></span>&nbsp;&nbsp;<span class="h2"><?php echo $helptag; ?></span></p>
   71             <table border="0" summary="data"><tr><td> </td></tr><?php
   72                 $query = "SELECT ".$field." FROM ".$table." ORDER BY ".$field;
   73                 $result = do_query($query);
   74                 while($line = fetch_row($result)) {
   75                 echo ('
   76                 <tr>
   77                     <td>'.$line[$field].'</td>
   78                     <td><a href="opt_in_out.php?direction='.$direction.'&amp;what='.$what.'&amp;field='.$line[$field].'&amp;action=del">delete</a></td>
   79                 </tr>');
   80                 }
   81                 echo "\n";
   82             ?>
   83             </table>
   84             
   85             <br /><br />
   86             
   87             <form action="opt_in_out.php?direction=<?php echo $direction.'&amp;what='.$what; ?>&amp;action=add" method="post">
   88                 <input type="text" name="<?php echo $field; ?>" size="40" />
   89                 <input class="btn" type="submit" value="Add" />
   90             </form>
   91             <?php if (! $report == '' ) echo '<span class="alert">'.$report.'</span>'; ?>
   92         </td>
   93         </tr>
   94     </table>
   95     
   96     <br />
   97     
   98     <div id="footer" style="width: 800px">
   99         <?php include "includes/copyright.inc.php" ?>
  100     </div>
  101 
  102 </div>
  103 
  104 </body>
  105 
  106 </html>