<?
########## Confixx(R) 3.0 Professional ############
####### Copyright SWsoft, Inc. 2004-2005 ##########
#### http://www.sw-soft.com - info@sw-soft.com ####

#
#
#
$DEBUG=0;
#
#
#

include_once("auth.php");

if(isset($GLOBALS["backup_off"]) && $GLOBALS["backup_off"]) {
	exit();
}

if ($mysql && $backup_mysql)
  $mysql=0;
if ($files && $backup_files)
  $files=0;
if ($html && $backup_html)
  $html=0;

if ($DEBUG){
  echo "backup.id: $backup_id<br>\n";
  echo "html: $html<br>\n";
  echo "files: $files<br>\n";
  echo "mysql: $mysql<br>\n";
}

if ($html || $files || $mysql){
  db_connect($db_host, $db_user, $db_pass);

  if($backup_id){
    $id = db_query("select id from backup where id=$backup_id");
    if (db_num_rows($id) <= 0){
      $backup_id=0;
    }
  }

	$loUser = new SQLString($PHP_AUTH_USER);
	$lcUser = $loUser->SQL();
  if($backup_id){
    $sql="UPDATE backup SET ";
    if ($mysql){
      $sql.=" mysql=$lcUser,";
    }
    if ($files){
      $sql.=" files=$lcUser,";
    }
    if ($html){
      $sql.=" html=$lcUser,";
    }
    $sql=substr($sql,0,strlen($sql)-1);
    $sql.=" WHERE id=$backup_id";
  }else{
    $sql="INSERT INTO backup(kunde";
    if ($mysql){
      $sql.=",mysql";
    }
    if ($files){
      $sql.=",files";
    }
    if ($html){
      $sql.=",html";
    }
    $sql.=") values($lcUser";
    if ($mysql){
      $sql.=",$lcUser";
    }
    if ($files){
      $sql.=",$lcUser";
    }
    if ($html){
      $sql.=",$lcUser";
    }
    $sql.=")";
  }  
  if ($DEBUG){
    echo "sql: $sql<br>\n";
  }
  db_query($sql);
  $fehlertext = ltext("alfr2_error7");
  db_close();
}
include("tools_backup.php");
exit();
?>
