6, 'COMMENT' => 80); $tags=GetTags($Len); ?>

Generate Backup Files

'."\n"; echo 'Creating Unload Files'."\n"; echo ''."\n"; echo '
'."\n"; $hbc_name=hbc_name(); $BaseDir=$_SERVER['DOCUMENT_ROOT'].'/'.$hbc_name.'/back'; $query='select name from accts where keyval="'.$Key.'"'; $acct_res=mysqli_query($db, $query); $acct_row=mysqli_fetch_assoc($acct_res); $Comment=(empty($tags['COMMENT']) ? 'NONE' : $tags['COMMENT'])."\r\n"; $Comment.=date('Y-m-d H:i:s')."\r\n"; $Comment.=$Key."\r\n"; $Comment.=$acct_row['name']."\r\n"; file_put_contents($BaseDir.'/COMMENT.txt', $Comment); $TarFile=$tags['BTYPE'].'_'.date('ymd_Hi').'.tgz'; $TarCmd='tar --create --dir '.$BaseDir.' --file '.$BaseDir.'/'.$TarFile.' --gzip COMMENT.txt '; $MD5_Hash=array(); $MD5_Hash['COMMENT']=md5_file($BaseDir.'/COMMENT.txt'); foreach ($Tables as $tabname) { echo 'Processing '.$tabname.'
'."\n"; $query='insert into changelog values(null, null, "'.$Key.'", "'.$tabname.'", "B", "", "", "", "")'; mysqli_query($db, $query); $UnlFile=$tabname.'.unl'; $query='select * into outfile "'.$BaseDir.'/'.$UnlFile.'" from '.$tabname; mysqli_query($db, $query); $TarCmd.=' '.$UnlFile; $MD5_Hash[$tabname]=md5_file($BaseDir.'/'.$UnlFile); } ksort($MD5_Hash); $Big_Hash=''; foreach ($MD5_Hash as $tabname => $hashval) { $Big_Hash.=$tabname.'-'.$hashval."\n"; } $MD5_File=substr($TarFile,0,-3).'md5'; $MD5_Big=md5($Big_Hash); file_put_contents($BaseDir.'/'.$MD5_File, $MD5_Big); $TarCmd.=' '.$MD5_File; shell_exec ($TarCmd); $query='insert into changelog values(null, null, "'.$Key.'", "backup", "B", "", "'.$tags['BTYPE'].'", "'.$TarFile.'", "'.$MD5_Big.'")'; mysqli_query($db, $query); @unlink($BaseDir.'/COMMENT.txt'); foreach ($Tables as $tabname) { @unlink($BaseDir.'/'.$tabname.'.unl'); } @unlink($BaseDir.'/'.$MD5_File); echo '
'."\n"; echo '

'."\n"; echo 'Download Backup File'."\n"; echo '

'."\n"; } else { echo '

'."\n"; echo 'Invalid Backup Type Specified'."\n"; echo '

'."\n"; } ?>