Ejemplo n.º 1
0
<?php

session_start();
require "accrp.php";
require "security/secure.php";
beginDocument("Main", $sess_user);
$db = getDBConnection();
beginPrettyTable("2", "Backup");
deldir("/tmp/accrpexport/");
mkdir("/tmp/accrpexport", 0333);
# 0333 does not work properly :-( so chmod ...
chmod("/tmp/accrpexport", 0733);
$result = mysql_query("SHOW TABLES FROM {$DBNAME}");
checkMySQLError();
while ($row = mysql_fetch_array($result, $db)) {
    $tablename = $row["Tables_in_accrp"];
    $filename = "/tmp/accrpexport/" . $tablename . ".txt";
    $query = "SELECT * FROM {$tablename} INTO OUTFILE \"{$filename}\"";
    $result2 = mysql_query($query, $db);
    checkMySQLError($query);
}
$today = get_today_srd_string();
$backup_filename = "accrp-datadump-{$today}.tar.gz";
exec("tar -czf /tmp/accrpexport/{$backup_filename} /tmp/accrpexport/*");
$doc_root = $_SERVER["DOCUMENT_ROOT"];
copy("/tmp/accrpexport/{$backup_filename}", "{$doc_root}/crp/backups/{$backup_filename}");
echo "<a href=\"backups/{$backup_filename}\"> click here to download datadump</a>";
endDocument();
Ejemplo n.º 2
0
        checkMySQLError();
        mysqlReport($result, "Employer sucessfully updated", "main.php", "Home");
        mysql_close($db);
    } else {
        $query = "INSERT INTO PERSONAL (EMP_NAME, DESIG_ID, STATUS, AC_NO, CONF_DT,JOIN_DT) VALUES ('{$emp_name}','{$desig_id}','{$status}', '{$ac_no}', '{$conf_dt}','{$join_dt}')";
        echo $query;
        $result = mysql_query($query, $db);
        checkMySQLError();
        mysqlReport($result, "Employer sucessfully added", "main.php", "Home");
        mysql_close($db);
    }
} else {
    $db = getDBConnection();
    if ($EMP_ID3) {
        $result = mysql_query("select * from PERSONAL where EMP_ID3 = {$EMP_ID3}");
        checkMySQLError();
        $edit = mysql_fetch_array($result);
    }
    $desig_array = get_designation_array();
    ?>
 
	<table cellpadding=5 cellspacing=0 border=0 width='100%'>
	 <tr>
	  <td valign=top width='15%'>
	
           <?php 
    beginPrettyTable("1");
    ?>
	   <tr>
	    <?php 
    echo "<td><a href='list_personal.php'>show List</a></td>";
Ejemplo n.º 3
0
 function Accounts($where_clause, $startdate, $enddate, $type_string)
 {
     $this->whereClause = $where_clause . " AND " . get_whereclause_for_accounts($type_string);
     $this->startdate = $startdate;
     $this->enddate = $enddate;
     $this->sum = 0;
     $this->finish_flag = 0;
     $db = getDBConnection();
     $query = "SELECT * FROM `AC_CODE5` WHERE {$this->whereClause}";
     #echo "$query<br>";
     $this->result = mysql_query($query, $db);
     checkMySQLError("Accounts");
 }