Location: PHPKode > scripts > BackItUp > backitup/struktur_backup.php
<?php

/****************************************************************
*	BackItUp by Eirik Opsanger (hide@address.com)				*
*	Please contact me if you find any bugs or need help!		*
****************************************************************/		

//DO NOT change anyting in this file!
$data = ("
		#################
		##BackItUp by Eirik Opsanger (january 2005)
		##
		##Backupdate: ".date(d).".".date(m).".".date(Y)."
		##Database: $db
		#################\n
");


$tabeller = mysql_list_tables("$db");
$tab_navn = array();
for ($i = 0; $i < mysql_num_rows($tabeller); $i++) {
     $tab_navn[] = mysql_tablename($tabeller, $i);
}

foreach ($tab_navn as $tabell) {
$query = mysql_query("SHOW CREATE TABLE $tabell");
$result = mysql_fetch_array($query);

$data .= ("$result[1]**\n\n");
}

mysql_close();

$filnavn = time().'_-_'.$db.'_-_struk.inc';

    if (!$action = fopen('files/'.$filnavn, 'w')) {
         print("Can not open: $filnavn");
    } elseif (fwrite($action, $data) === FALSE) {
        print("Can not write to: $filnavn");
    } else {
    
    print("<center>Structure-backup of <i>$db</i> was successfull!!</center><br>");
 	}     
 	fclose($action);

 	?>
Return current item: BackItUp