Jsp data backup and restoration code
Function import ($ filename)
{
Global $ fileid;
If ($ filename & fileext ($ filename) = 'SQL ')
{
$ Filepath = PHPCMS_ROOT. '/data/bakup/'. $ filename;
If (! File_exists ($ filepath) showmessage ('sorry, "'. $ filepath.'" file does not exist ');
$ SQL = file_get_contents ($ filepath );
SQL _execute ($ SQL );
The data in showmessage ("$ filename". 'has been successfully imported to the database! ');
}
Else
{
$ Fileid = $ fileid? $ Fileid: 1;
$ Pre = $ filename;
$ Filename = $ filename. $ fileid. '. SQL ';
$ Filepath = PHPCMS_ROOT. '/data/bakup/'. $ filename;
If (file_exists ($ filepath ))
{
$ SQL = file_get_contents ($ filepath );
SQL _execute ($ SQL );
$ Fileid ++;
Showmessage ('data file "'. $ filename.'" recovered successfully ',"? Mod = ". $ this-> mod. "& file = ". $ this-> file. "& action = import & pre = ". $ pre. "& fileid = ". $ fileid. "& dosubmit = 1 ");
}
Else
{
Showmessage ('database recovery successful! ','? File = database & action = import ');
}
}
}