Révision d072e29c src/oligos.php
b/src/oligos.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
session_start (); |
3 |
|
|
4 |
|
|
5 | 3 |
require("headers.php"); |
6 | 4 |
|
7 |
|
|
8 | 5 |
/* |
9 | 6 |
* IMPORTANT NOTE: This generated file contains only a subset of huge amount |
10 | 7 |
* of options that can be used with phpMyEdit. To get information about all |
... | ... | |
23 | 20 |
|
24 | 21 |
/*************************/ |
25 | 22 |
// |
26 |
// Connect to DB and |
|
27 |
// handle session/authentification |
|
28 |
// |
|
29 |
/*************************/ |
|
30 |
require_once ("connect_entry.php"); |
|
31 |
require_once ("session.php"); |
|
32 |
// connect to DB |
|
33 |
$connexion = mysql_pconnect (SERVEUR, NOM, PASSE); |
|
34 |
if (!$connexion) |
|
35 |
{ |
|
36 |
echo "Sorry, connexion to " . SERVEUR . " failed\n"; |
|
37 |
exit; |
|
38 |
} |
|
39 |
if (!mysql_select_db (BASE, $connexion)) |
|
40 |
{ |
|
41 |
echo "Sorry, connexion to database " . BASE . " failed\n"; |
|
42 |
exit; |
|
43 |
} |
|
44 |
// authentification |
|
45 |
CleanOldSessions($connexion); |
|
46 |
$session = ControleAcces ("oligos.php", $_POST, session_id(), $connexion); |
|
47 |
if (!is_object($session)) |
|
48 |
exit; |
|
49 |
|
|
50 |
/*************************/ |
|
51 |
// |
|
52 |
// According to login: |
|
53 |
// Define priviledge options |
|
54 |
// to pass to phpMyEdit |
|
55 |
// |
|
56 |
/*************************/ |
|
57 |
|
|
58 |
//check that visitor is allowed to use this table |
|
59 |
$tb = "oligos"; |
|
60 |
if ($session->target_table != $tb && $session->target_table != "all") |
|
61 |
{ |
|
62 |
echo "Sorry, your session is not granted access to table <B> $tb </B><p>"; |
|
63 |
echo "Please logout and try again with appropriate login<P>"; |
|
64 |
exit; |
|
65 |
} |
|
66 |
|
|
67 |
//define priv options and display warning accordingly |
|
68 |
if ($session->mode == "view"){ |
|
69 |
$privopt = 'VF'; |
|
70 |
$colorband = "#00ff00"; |
|
71 |
$messageband = "You are safely in VIEW mode"; |
|
72 |
} |
|
73 |
else if ($session->mode == "add"){ |
|
74 |
$privopt = 'APVF'; |
|
75 |
$colorband = "orange"; |
|
76 |
$messageband = 'You are in <I><B> ADD </I></B> mode, please logout after you additions'; |
|
77 |
} |
|
78 |
else if ($session->mode == "edit"){ |
|
79 |
$privopt = 'ACPVDF'; |
|
80 |
$colorband = "rgb(250,0,255)"; |
|
81 |
$messageband = 'IMPORTANT: You are in <I><B> EDIT </I></B> mode, please logout after editing.'; |
|
82 |
} |
|
83 |
else{ |
|
84 |
$privopt = ''; |
|
85 |
$colorband = "grey"; |
|
86 |
} |
|
87 |
echo '<style type="text/css"> '; |
|
88 |
echo "h4 {background-color: $colorband }"; |
|
89 |
echo '</style>'; |
|
90 |
echo "<h4> $messageband </h4>"; |
|
91 |
echo "<HR>"; |
|
92 |
|
|
93 |
/*************************/ |
|
94 |
// |
|
95 | 23 |
// Pass phpMyEdit options |
96 | 24 |
// |
97 | 25 |
/*************************/ |
... | ... | |
248 | 176 |
'column' => 'type') |
249 | 177 |
); |
250 | 178 |
|
251 |
// Now important call to phpMyEdit |
|
252 |
require_once 'phpMyEdit.class.php'; |
|
253 |
new phpMyEdit($opts); |
|
254 |
|
|
255 |
?> |
|
179 |
require("footers.php"); |
|
180 |
?> |
Formats disponibles : Unified diff