-
Notifications
You must be signed in to change notification settings - Fork 0
/
.htProfiloUtente.php
47 lines (44 loc) · 1.54 KB
/
.htProfiloUtente.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
//20110206.008
$TABLE = "users";
$PAGE_CONTENT = "<h1>Profilo utente</h1>\n";
switch($_REQUEST["cmd2"]) {
case "save":
$FIELDS = Objects::getProfiloUtenteFields();
$config = array(
"idField" => BasicTable::getIdField($FIELDS),
"fields" => $FIELDS,
"data" => $_POST,
"table" => $TABLE,
"where" => "username='" . $DBL->real_escape_string($LOGIN->getUserData("username")) . "'",
);
$saveRecord = BasicTable::saveRecord($config);
$PAGE_CONTENT .= $saveRecord["htmlCode"];
logMessage("Aggiornato profilo utente");
break;
case "edit":
case "show":
default:
$FIELDS = ($_REQUEST["cmd2"] == "edit") ? Objects::getProfiloUtenteFields() : Objects::getUtentiFields();
$config = array(
"idField" => BasicTable::getIdField($FIELDS),
"idValue" => $LOGIN->getUserData("username"),
"table" => $TABLE,
);
$old = BasicTable::getOldData($config);
if(!is_array($old)) die(".");
$config = array(
"jsCheckForm" => "ADMIN.validateObject('ProfiloUtente', '" . $_REQUEST["cmd2"] . "')",
"action" => $_REQUEST["cmd2"],
"idField" => BasicTable::getIdField($FIELDS),
"fields" => $FIELDS,
"data" => $old,
);
$PAGE_CONTENT .= BasicTable::getForm($config);
break;
}
$PAGE_CONTENT .= "<div>
<a href='" . $_SERVER["SCRIPT_NAME"] . "?cmd=" . $_REQUEST["cmd"] . "'>Visualizza profilo</a><br />
" . ((!$LOGIN->isGuest()) ? "<a href='" . $_SERVER["SCRIPT_NAME"] . "?cmd=" . $_REQUEST["cmd"] . "&cmd2=edit'>Modifica profilo</a><br />" : "") . "
</div>\n";
?>