Révision d072e29c src/notebooks.php
b/src/notebooks.php | ||
---|---|---|
2 | 2 |
session_start (); |
3 | 3 |
require("headers.php"); |
4 | 4 |
|
5 |
|
|
6 | 5 |
/* |
7 | 6 |
* IMPORTANT NOTE: This generated file contains only a subset of huge amount |
8 | 7 |
* of options that can be used with phpMyEdit. To get information about all |
... | ... | |
19 | 18 |
* generating setup script: 1.50 |
20 | 19 |
*/ |
21 | 20 |
|
22 |
|
|
23 |
|
|
24 |
/*************************/ |
|
25 |
// |
|
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 ("notebooks.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 = "notebooks"; |
|
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 change background color 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 |
// Fix a problem displaying |
|
96 |
// symbols (such as delta) |
|
97 |
// |
|
98 |
//************************/ |
|
99 |
|
|
100 |
mysql_query("SET NAMES 'UTF8'", $connexion); |
|
101 |
|
|
102 | 21 |
/*************************/ |
103 | 22 |
// |
104 | 23 |
// Pass phpMyEdit options |
105 | 24 |
// |
106 | 25 |
/*************************/ |
107 | 26 |
|
108 |
|
|
109 | 27 |
$opts['dbh'] = $connexion; |
110 | 28 |
$opts['tb'] = $tb; |
111 | 29 |
|
... | ... | |
250 | 168 |
// Before displaying the view page |
251 | 169 |
|
252 | 170 |
|
253 |
// Now important call to phpMyEdit |
|
254 |
require_once 'phpMyEdit.class.php'; |
|
255 |
new phpMyEdit($opts); |
|
256 |
|
|
257 |
?> |
|
258 |
|
|
259 |
|
|
171 |
require("footers.php"); |
|
172 |
?> |
Formats disponibles : Unified diff