Révision d072e29c src/plasmids.php

b/src/plasmids.php
1 1
<?php
2 2
session_start ();
3

  
4 3
require("headers.php");
5 4
//$opts["filters"] = "`ID`=330";
6 5

  
......
22 21

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

  
50
 
51
/*************************/
52
//
53
// According to login:
54
// Define priviledge options
55
// to pass to phpMyEdit
56
//
57
/*************************/
58

  
59
//check that visitor is allowed to use this table
60
$tb = "plasmids";
61
if ($session->target_table != $tb && $session->target_table != "all")
62
{
63
   echo "Sorry, your session is not granted access to table <B> $tb </B><p>";
64
   echo "Please logout and try again with appropriate login<P>";
65
   exit;
66
}
67

  
68
//define priv options and display warning accordingly
69
if ($session->mode == "view"){
70
	$privopt = 'VF';
71
	$colorband = "#00ff00";
72
	$messageband = "You are safely in VIEW mode";
73
}
74
else if ($session->mode == "add"){
75
	$privopt = 'APVF';
76
	$colorband = "orange";
77
	$messageband = 'You are in <I><B> ADD </I></B> mode, please logout after you additions';
78
}
79
else if ($session->mode == "edit"){
80
	$privopt = 'ACPVDF';
81
	$colorband = "rgb(250,0,255)";
82
	$messageband = 'IMPORTANT: You are in <I><B> EDIT </I></B> mode, please logout after editing.';
83
}
84
else{
85
	$privopt = '';
86
	$colorband = "grey";
87
}
88
echo '<style type="text/css"> ';
89
echo	"h4 {background-color: $colorband }";
90
echo '</style>';
91
echo "<h4> $messageband </h4>";
92
echo "<HR>";
93
	
94
/*************************/
95
//
96 24
// Pass phpMyEdit options
97 25
//
98 26
/*************************/
......
222 150
$opts['fdd']['Link_to_file'] = array(
223 151
  'name'     => 'Link',
224 152
  'select'   => 'T',
153
   'options'  => 'LFPDV',
225 154
  'maxlen'   => 50,
226 155
  'sort'     => true,
227 156
  'sqlw' => 'IF($val_qas = "", NULL, $val_qas)' //to use real NULL instead of empty blanks
......
366 295
$opts['fdd']['Link_to_file']['URLtarget'] = '_self';
367 296

  
368 297
// TRIGGER
369
// Before displaying the view page
370
$opts['triggers']['select']['pre']    = 'plasmids.TSP.php';
371

  
372
// Now important call to phpMyEdit
373
require_once 'phpMyEdit.class.php';
374
new phpMyEdit($opts);
375

  
376
?>
298
$opts['triggers']['select']['pre'][]    = 'plasmids.MVC.php';
299
$opts['triggers']['update']['pre'][]    = 'plasmids.MVC.php';
377 300

  
378
<div id="post_list"></div>"
379
<script type="text/javascript"> 
380
o = document.getElementById("post_list");
381
q = document.getElementById("to_be_post_list");
382
o.appendChild(q.parentNode.removeChild(q));
383
</script>
301
require("footers.php");
302
?>

Formats disponibles : Unified diff