VFront
[
class tree: VFront
] [
index: VFront
] [
all elements
]
VFront
INSTALL
LICENSE
README
Todo List
Packages:
VFront
Source for file index.php
Documentation is available at
index.php
<?php
########################################################################
#
# This file is part of VFront.
#
# VFront is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# any later version.
#
# VFront is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
/**
* File di index di VFront.
* Questo file viene richiamato per fare il login e|o come Home per l'utente
* Il file di index mostra il login qualora non ci fosse una sessione valida.
*
*
@package
VFront
*
@author
Mario Marcello Verona <marcelloverona@gmail.com>
*
@copyright
2007 Mario Marcello Verona
*
@version
0.90
*
@license
http://www.gnu.org/licenses/gpl.html GNU Public License
*/
require_once
(
"./inc/conn.php"
)
;
require_once
(
"./inc/layouts.php"
)
;
require_once
(
"./inc/func.comuni.php"
)
;
$INPUTS
=
""
;
if
(
isset
(
$_GET
[
'login'
]
))
{
require
(
"./inc/auth.php"
)
;
$_dati
=
pulisci_dom
(
$_POST
)
;
$LOGIN
=
new
auth
(
$_dati
[
'nick'
]
,
$_dati
[
'passw'
]
)
;
exit
;
}
elseif
(
isset
(
$_GET
[
'logout'
]
))
{
$_SESSION
=
array
(
)
;
header
(
"Location: "
.
FRONT_DOCROOT
.
"/index.php"
)
;
exit
;
}
elseif
(
isset
(
$_GET
[
'nolog'
]
))
{
$_SESSION
=
array
(
)
;
mostra_login
(
)
;
exit
;
}
elseif
(
isset
(
$_SESSION
[
'user'
]
)
&&
is_array
(
$_SESSION
[
'user'
]
))
{
mostra_loggato
(
)
;
}
else
{
mostra_login
(
)
;
}
##########################################################################################################
/**
* Questa funzione genera la pagina di login nel caso il file index sia stato richiamato senza
* la presenza di una sessione valida.
* Puņ presentare il link per il recupero della password se l'opzione č stata definita tra le variabili
* di VFront e se l'autenticazione non avviene mediante strumenti esterni.
*
*/
function
mostra_login
(
)
{
global
$conf_auth
;
// MODULO PRINCIPALE
$apertura
=
str_replace
(
"<body>"
,
"<body onload=\"document.getElementById('nick').focus();\">"
,
openLayout1
(
_NOME_PROJ
))
;
echo
$apertura
;
if
(
isset
(
$_GET
[
'nolog'
]
))
{
echo
"<div id=\"nologin\"><p>Errore di nome utente o password, prego verificare</p></div>\n"
;
}
if
(
!
isset
(
$GLOBALS
[
'_VARIABILI'
]
))
{
require_once
(
"./inc/func.var_frontend.php"
)
;
var_frontend
(
)
;
}
if
(
isset
(
$GLOBALS
[
'_VARIABILI'
]
[
'recupero_password'
]
)
&&
$GLOBALS
[
'_VARIABILI'
]
[
'recupero_password'
]
==
1
&&
$conf_auth
[
'tipo_external_auth'
]
==
null
)
{
$PASSW_RECOVER
=
"<p><a href=\"password_recover.php\">Ho dimenticato la password</a></p>"
;
}
else
{
$PASSW_RECOVER
=
''
;
}
echo
"
<div id=\"login\" align=\"center\">
<form method=\"post\" action=\""
.
$_SERVER
[
'PHP_SELF'
]
.
"
?
login
\" >
<
fieldset
>
<
legend
>
Accesso
al
sistema
</
legend
>
<
br
/>
<
label
for
=\"
nick
\">
E
-
mail
</
label
><
br
/>
<
input
type
=\"
text
\"
name
=\"
nick
\"
size
=\"30\"
maxlength
=\"200\"
id
=\"
nick
\" /><
br
/><
br
/>
<
label
for
=\"
passw
\">
Password
</
label
><
br
/>
<
input
type
=\"
password
\"
name
=\"
passw
\"
size
=\"30\"
maxlength
=\"100\"
id
=\"
passw
\" /><
br
/><
br
/>
<
input
type
=\"
submit
\"
name
=\"
accedi
\"
value
=\"
Accedi
\"
id
=\"
accedi
\" />
$PASSW_RECOVER
</
fieldset
>
</
form
>
</
div
>
"
;
echo
closeLayout1
(
)
;
exit
;
}
/**
* Funzione che genera il codice per produrre la home page.
* Qualora non ci fosse una sessione valida viene invece creata la pagina di login,
* mediante la funzione mostra_login()
*
@see
function mostra_login
*
*/
function
mostra_loggato
(
)
{
global
$link
,
$db1
;
proteggi
(
1
)
;
echo
openLayout1
(
_NOME_PROJ
)
;
echo
"<h1 style=\"padding-left:4px;\">Menu principale</h1>\n"
;
if
(
$_SESSION
[
'gid'
]
==
0
)
{
echo
"<div class=\"info\"><strong>Attenzione!</strong><br />
Si sta facendo un login mediante il <strong>gruppo predefinito</strong>.
<!--Si tratta di un livello di accesso in <em>sola lettura</em>, senza possibilità di operare sui record.-->
Se si è fatto il login per la prima volta, questo è normale;
è necessario contattare il proprio referente informatico
per farsi attribuire i diritti d'uso corretti.</div>\n"
;
}
######################################################################################################################
// RECUPERO LE TABELLE
$sql_tab
=
"
SELECT
*
FROM
{
$db1
[
'frontend'
]
}
.
registro_tab
WHERE
gid
='
"
.
$_SESSION
[
'gid'
]
.
"'
AND visibile=1
AND table_type='BASE TABLE'
ORDER BY table_name
"
;
$q_tab
=
vmsql_query
(
$sql_tab
,
$link
)
;
$matrice_tab
=
vmsql_fetch_assoc_all
(
$q_tab
)
;
// RECUPERO LE VISTE
$sql_view
=
"
SELECT
*
FROM
{
$db1
[
'frontend'
]
}
.
registro_tab
WHERE
gid
='
"
.
$_SESSION
[
'gid'
]
.
"'
AND visibile=1
AND table_type='VIEW'
ORDER BY table_name
"
;
$q_view
=
vmsql_query
(
$sql_view
,
$link
)
;
$matrice_view
=
vmsql_fetch_assoc_all
(
$q_view
)
;
$LI1
=
""
;
for
(
$i
=
0
;
$i
<
count
(
$matrice_tab
)
;
$i
++
)
{
$LI1
.=
"
<li>
<a href=\"scheda.php?oid="
.
$matrice_tab
[
$i
]
[
'id_table'
]
.
"\">"
.
$matrice_tab
[
$i
]
[
'table_name'
]
.
"</a>
<div class=\"desc-tab\">"
.
htmlentities
(
utf8_decode
(
$matrice_tab
[
$i
]
[
'commento'
]
)
,
ENT_QUOTES
)
.
"</div>
</li>\n"
;
}
$LI2
=
""
;
for
(
$i
=
0
;
$i
<
count
(
$matrice_view
)
;
$i
++
)
{
$LI2
.=
"
<li>
<a href=\"scheda.php?oid="
.
$matrice_view
[
$i
]
[
'id_table'
]
.
"\">"
.
$matrice_view
[
$i
]
[
'table_name'
]
.
"</a>
<div class=\"desc-tab\"> </div>
</li>\n"
;
}
######################################################################################################################
echo
"
<
div
id
=\"
box
-
tabelle
\"
class
=\"
box
-
home
\">
<
div
class
=\"
box
-
home
-
txt
\">
<
h2
>
Tabelle
disponibili
</
h2
>
<
ul
class
=\"
lista
-
tabelle
\">
$LI1
</
ul
>
</
div
>
</
div
>
"
;
if
(
count
(
$matrice_view
)
>
0
)
{
echo
"
<
div
id
=\"
box
-
viste
\"
class
=\"
box
-
home
\">
<
div
class
=\"
box
-
home
-
txt
\">
<
h2
>
Viste
sui
dati
</
h2
>
<
ul
class
=\"
lista
-
tabelle
\">
$LI2
</
ul
>
</
div
>
</
div
>
"
;
}
echo
"
<p style=\"clear:both;\"> </p>
<div id=\"box-info\" class=\"box-home\">
<div class=\"box-home-txt\">
<h2>Informazioni e domande frequenti</h2>
<p><a href=\"helpdocs.php\">Documenti utili</a></p>
<p><a href=\"credits.php\">Crediti</a></p>
</div>
</div>
<p style=\"clear:both;\"> </p>
"
;
echo
closeLayout1
(
)
;
}
?>
Documentation generated on Sat, 22 Sep 2007 11:50:53 +0200 by
phpDocumentor 1.4.0a2