VFront
Administration
[
class tree: VFront
] [
index: VFront
] [
all elements
]
VFront
INSTALL
LICENSE
README
Todo List
Packages:
VFront
Source for file export_sql.php
Documentation is available at
export_sql.php
<?php
/**
*
@desc
Utility per l'esportazione dell'SQL (DUMP)
*
@package
VFront
*
@subpackage
Administration
*
@author
M.Marcello Verona
*
@copyright
2007 M.Marcello Verona
*
@version
0.90
*
@license
http://www.gnu.org/licenses/gpl.html GNU Public License
*/
include
(
"../inc/conn.php"
)
;
include
(
"../inc/layouts.php"
)
;
include
(
"../inc/func.comuni.php"
)
;
proteggi
(
3
)
;
########################################################################
#
#
# ESPORTAZIONE REGISTRI
$IS_UNIX
=
(
eregi
(
'WIN'
,
$_ENV
[
'OS'
]
))
?
0
:
1
;
if
(
isset
(
$_POST
[
'exp_dati'
]
))
{
if
(
$IS_UNIX
)
{
$zippa
=
"| gzip -c "
;
$estensione_zip
=
".gz"
;
}
else
{
$zippa
=
""
;
$estensione_zip
=
""
;
}
// tipo di dati richiesti
if
(
$_GET
[
'exp'
]
==
'registri'
)
{
$DB
=
$db1
[
'frontend'
]
;
}
else
{
$DB
=
$db1
[
'dbname'
]
;
}
// opzioni dati/schema
if
(
$_POST
[
'schema_only'
]
==
'1'
)
{
$opzioni
=
"--no-data "
;
}
else
{
$opzioni
=
""
;
}
$nome_file
=
FRONT_REALPATH
.
"
/
html
/
$DB
.
sql
{
$estensione_zip
}
"
;
if
(
$db1
[
'dbtype'
]
==
'mysql'
)
{
$bat
=
_PATH_MYSQLDUMP
.
" --add-drop-table --force "
.
"
-
u
{
$db1
[
'user'
]
}
"
.
"
-
p
{
$db1
[
'passw'
]
}
"
.
"
-
P
{
$db1
[
'port'
]
}
"
.
"
-
h
{
$db1
[
'host'
]
}
"
.
"
$opzioni
"
.
"
{
$DB
}
"
.
"
$zippa
"
.
"
>
$nome_file
"
;
}
elseif
(
$db1
[
'dbtype'
]
==
'postgres'
)
{
/*$bat= _PATH_PG_DUMP.
" -n $DB".
"-U{$db1['user']} ".
"-p{$db1['passw']} ".
"-p {$db1['port']} ".
"-h {$db1['host']} ".
"$opzioni ".
"{$db1['postgres_dbname']} ".
"$zippa ".
">$nome_file";*/
die
(
"DUMP su Postgres non ancora supportato!"
)
;
}
$exec
=
passthru
(
$bat
)
;
// var_dump($exec);
if
(
is_file
(
$nome_file
))
{
header
(
'Pragma: anytextexeptno-cache'
,
true
)
;
header
(
'Content-type: application/x-gzip'
)
;
header
(
'Content-Transfer-Encoding: Binary'
)
;
header
(
'Content-length: '
.
filesize
(
$nome_file
))
;
header
(
'Content-disposition: attachment; filename='
.
basename
(
$nome_file
))
;
readfile
(
$nome_file
)
;
}
unlink
(
$nome_file
)
;
exit
;
}
#
#
########################################################################
echo
openLayout1
(
"Esportazione Database"
,
array
(
"sty/admin.css"
))
;
echo
"<div id=\"briciole\"><a href=\"index.php\">home amministrazione</a> » amministrazione database</div>\n"
;
echo
"
<
h1
>
Esportazione
Database
</
h1
>
<
img
src
=\"../
img
/
db_export
.
gif
\"
class
=\"
img
-
float
\"
alt
=\"
impostazioni
registri
\" />
<
div
class
=\"
box
-
db
\">
<
h2
>
Esportazione
Database
dati
(<
span
class
=\"
var
\">{
$db1
[
'dbname'
]
}
</
span
>)</
h2
>
<
form
action
=\"
"
.
$_SERVER
[
'PHP_SELF'
]
.
"
?
exp
=
dati
\"
method
=\"
post
\">
<
br
/>
<
input
type
=\"
radio
\"
name
=\"
schema_only
\"
id
=\"
schemaonly_1
\"
value
=\"1\"
checked
=\"
checked
\"/><
label
for
=\"
schemaonly_1
\">
Solo
schema
</
label
><
br
/>
<
input
type
=\"
radio
\"
name
=\"
schema_only
\"
id
=\"
schemaonly_2
\"
value
=\"2\" /><
label
for
=\"
schemaonly_2
\">
Dati
e
schema
</
label
><
br
/>
<
br
/>
<
input
type
=\"
submit
\"
name
=\"
exp_dati
\"
value
=\"
Esporta
\" />
</
form
>
</
div
>
<
div
class
=\"
box
-
db
\">
<
h2
>
Esportazione
Database
Registri
(<
span
class
=\"
var
\">{
$db1
[
'frontend'
]
}
</
span
>)</
h2
>
<
form
action
=\"
"
.
$_SERVER
[
'PHP_SELF'
]
.
"?exp=registri\" method=\"post\">
<br />
<input type=\"radio\" name=\"schema_only\" id=\"schema_reg_only_1\" value=\"1\" checked=\"checked\"/><label for=\"schema_reg_only_1\">Solo schema</label><br />
<input type=\"radio\" name=\"schema_only\" id=\"schema_reg_only_2\" value=\"2\" /><label for=\"schema_reg_only_2\">Dati e schema</label><br />
<br />
<input type=\"submit\" name=\"exp_dati\" value=\"Esporta\" />
</form>
</div> \n"
;
echo
closeLayout1
(
)
;
?>
Documentation generated on Sat, 22 Sep 2007 11:50:02 +0200 by
phpDocumentor 1.4.0a2