Révision d072e29c src/strains.php

b/src/strains.php
1 1
<?php
2 2
session_start ();
3
require("headers.php");
3 4

  
5
// if (array_key_exists("action", $_REQUEST)) {
6
//   if ($_REQUEST["action"] == "SEARCH_IN_GENOTYPE") {
7
//     $keys = split(" ", $_REQUEST["geno"]); 
8
//     print_r($keys );
9
// 
10
//     $tmp_filter = "ynl095c:PBY-306-ynl095C";
11
//     $likes = "";
12
//     foreach ($keys as $k) {
13
//       if ($k != "") {
14
//         $likes .= "`locus1` LIKE '%$k%' OR `locus2` LIKE '%$k%' OR `locus3` LIKE '%$k%' OR `locus4` LIKE '%$k%' OR `locus5` LIKE '%$k%' OR `ADE2` LIKE '%$k%' OR `HIS3` LIKE '%$k%' OR `LEU2` LIKE '%$k%' OR `LYS2` LIKE '%$k%' OR `MET15` LIKE '%$k%' OR `TRP1` LIKE '%$k%' OR `URA3` LIKE '%$k%' OR `HO_` LIKE '%$k%' OR `Cytoplasmic_Character` LIKE '%$k%' OR `extrachromosomal_plasmid` LIKE '%$k%'";
15
//       }
16
//     }
17
//     $opts["filters"] = $likes . " " ;
18
//   }
19
// }
20
// 
21
// if (!array_key_exists("PME_sys_operation", $_REQUEST)) {
22
//   if (array_key_exists("geno", $_REQUEST)) {
23
//     $geno = $_REQUEST["geno"]; 
24
//   } else {
25
//     $geno = "";
26
//   }
27
//   echo "<form action='' method='post'>";
28
//   //echo "<fieldset style='border:1px plain black; width: 300px;'>";
29
//   //echo "<legend>Search in genotype</legend>";
30
//   echo "Search in genotype: <input type='hidden' name='action' value='SEARCH_IN_GENOTYPE'/>";
31
//   echo "<input type='text' name='geno' value='$geno'/>";
32
//   echo "<input type='button' name='send' value='Search' onclick='return this.form.submit();'/>";
33
// //  echo "</fieldset>";
34
//   echo "</form>";
35
// }
4 36

  
5
require("headers.php");
6 37
/*
7 38
 * IMPORTANT NOTE: This generated file contains only a subset of huge amount
8 39
 * of options that can be used with phpMyEdit. To get information about all
......
19 50
 *              generating setup script: 1.50
20 51
 */
21 52

  
22
/*************************/
23
// Connect to DB and 
24
// handle session/authentification
25
/*************************/
26
require_once ("connect_entry.php");
27
require_once ("session.php");
28
// connect to DB
29
$connexion = mysql_pconnect (SERVEUR, NOM, PASSE);
30
if (!$connexion)
31
{
32
 echo "Sorry, connexion to " . SERVEUR . " failed\n";
33
 exit;
34
}
35
if (!mysql_select_db (BASE, $connexion))
36
{
37
 echo "Sorry, connexion to database " . BASE . " failed\n";
38
 exit;
39
}
40
// authentification
41
CleanOldSessions($connexion);
42
$session = ControleAcces ("strains.php", $_POST, session_id(), $connexion);
43
if (!is_object($session))
44
	exit;
45

  
46
/*************************/
47
// According to login:
48
// Define priviledge options
49
// to pass to phpMyEdit
50
/*************************/
51

  
52
//check that visitor is allowed to use this table
53
$tb = "strains";
54
if ($session->target_table != $tb && $session->target_table != "all")
55
{
56
   echo "Sorry, your session is not granted access to table <B> $tb </B><p>";
57
   echo "Please logout and try again with appropriate login<P>";
58
   exit;
59
}
60

  
61
//define priv options and change background color accordingly
62
if ($session->mode == "view"){
63
	$privopt = 'VF';
64
	$colorband = "#00ff00";
65
	$messageband = "You are safely in VIEW mode";
66
}
67
else if ($session->mode == "add"){
68
	$privopt = 'APVF';
69
	$colorband = "orange";
70
	$messageband = 'You are in <I><B> ADD </I></B> mode, please logout after you additions';
71
}
72
else if ($session->mode == "edit"){
73
	$privopt = 'ACPVDF';
74
	$colorband = "rgb(250,0,255)";
75
	$messageband = 'IMPORTANT: You are in <I><B> EDIT </I></B> mode, please logout after editing.';
76
}
77
else{
78
	$privopt = '';
79
	$colorband = "grey";
80
}
81
echo '<style type="text/css"> ';
82
echo	"h4 {background-color: $colorband }";
83
echo '</style>';
84
echo "<h4> $messageband </h4>";
85
echo "<HR>";
86

  
87

  
88
  //print_r($_REQUEST );
89

  
90
if (array_key_exists("action", $_REQUEST)) {
91
  if ($_REQUEST["action"] == "SEARCH_IN_GENOTYPE") {
92
    $keys = split(" ", $_REQUEST["geno"]); 
93
    print_r($keys );
94

  
95
    $tmp_filter = "ynl095c:PBY-306-ynl095C";
96
    $likes = "";
97
    foreach ($keys as $k) {
98
      if ($k != "") {
99
        $likes .= "`locus1` LIKE '%$k%' OR `locus2` LIKE '%$k%' OR `locus3` LIKE '%$k%' OR `locus4` LIKE '%$k%' OR `locus5` LIKE '%$k%' OR `ADE2` LIKE '%$k%' OR `HIS3` LIKE '%$k%' OR `LEU2` LIKE '%$k%' OR `LYS2` LIKE '%$k%' OR `MET15` LIKE '%$k%' OR `TRP1` LIKE '%$k%' OR `URA3` LIKE '%$k%' OR `HO_` LIKE '%$k%' OR `Cytoplasmic_Character` LIKE '%$k%' OR `extrachromosomal_plasmid` LIKE '%$k%'";
100
      }
101
    }
102
    $opts["filters"] = $likes . " " ;
103
  }
104
}
105

  
106
if (!array_key_exists("PME_sys_operation", $_REQUEST)) {
107
  if (array_key_exists("geno", $_REQUEST)) {
108
    $geno = $_REQUEST["geno"]; 
109
  } else {
110
    $geno = "";
111
  }
112
  echo "<form action='' method='post'>";
113
  //echo "<fieldset style='border:1px plain black; width: 300px;'>";
114
  //echo "<legend>Search in genotype</legend>";
115
  echo "Search in genotype: <input type='hidden' name='action' value='SEARCH_IN_GENOTYPE'/>";
116
  echo "<input type='text' name='geno' value='$geno'/>";
117
  echo "<input type='button' name='send' value='Search' onclick='return this.form.submit();'/>";
118
//  echo "</fieldset>";
119
  echo "</form>";
120
}
121

  
122

  
123

  
124

  
125
//************************/
126
//
127
// Fix a problem displaying
128
// symbols (such as delta)
129
//
130
//************************/
131

  
132
mysql_query("SET NAMES 'UTF8'", $connexion);
133 53

  
134 54
/*************************/
135 55
//
......
137 57
//
138 58
/*************************/
139 59

  
140

  
141 60
$opts['dbh'] = $connexion;
142 61
$opts['tb'] = $tb;
143 62

  
......
454 373

  
455 374
// TRIGGER
456 375
// Before displaying the view page
457
$opts['triggers']['select']['pre'] = 'strains.TSP.php';
458
$opts['triggers']['select']['before'] = 'strains.test.php';
459

  
460
// Now important call to phpMyEdit
461
require_once 'phpMyEdit.class.php';
462
new phpMyEdit($opts);
463

  
464
?>
465

  
466

  
376
$opts['triggers']['select']['pre'][] = 'strains.TSP.php';
377
require("footers.php");
378
?>

Formats disponibles : Unified diff