<?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();
function get_today_hrd_string() { return conv_to_hrd(get_today_srd_string()); }
$errorNo2 .= $back_button; $errorNo3 .= $back_button; $errorNo4 .= $back_button; $errorNo5 .= $back_button; beginDocument("Enter Transaction", $sess_user, $javascript); if ($submitnow == "1") { $db = getDBConnection(); $ac5_array = get_ac5_array(); # Get easily the different AC_Codes with AC_ID5 # For this, AC_ID5 must be a primary key (no doubles) $ac_id1 = $ac5_array[$ac_name][1]; $ac_id2 = $ac5_array[$ac_name][2]; $ac_id3 = $ac5_array[$ac_name][3]; $ac_id4 = $ac5_array[$ac_name][4]; $vr_dt = conv_to_srd($vr_dt); $t_dt = get_today_srd_string(); # First, we have to check, if everything is fine (see above errormessages) # This is already done with javascript but we need a fallback-solution # 1. An Account must be chosen if ($ac_name == -1) { die($errorNo1); } $sum = 0; for ($i = 0, $varname2 = "ac_name_" . $i; isset($_POST[$varname2]); $i++, $varname2 = "ac_name_" . $i) { $varname = "ac_name_" . $i; $ac_name_temp = $_POST[$varname]; # 2. We need at least one "counter-booking" if ($ac_name_temp != -1) { $proceed_flag = 1; } # sum it up
<?php # List Loans of personal require "accrp.php"; session_start(); require "security/secure.php"; beginDocument($lCustomerProfile, $sess_user); $db = getDBConnection(); # the date, which is the reference for the calculation of due and balance $ref_date = get_today_srd_string(); $personal_array = get_personal_array(); echo "<h2>Centre for the rehabilitation of the paralysed - CRP</h2>"; echo "<div align=center>" . ($type == "PF" ? "Provident " : "Credit Union ") . "Fund Statement for the month of "; echo get_month_name($ref_date) . " " . get_year($ref_date) . "</div>"; if ($type == "PF") { $loan_table = "PF_LOAN"; } else { if ($type == "CUF") { $loan_table = "CUF_LOAN"; } else { die("Loantype unspecified !"); } } $result = mysql_query("select * from {$loan_table}", $db); checkMySQLError(); beginPrettyTable("4", "{$loan_table}"); printRow(array("Emp_ID3", "Emp. Name", "LoanStart", "LoanEnd", "Loan-Amt", "Instalment", "Tot_Amt", "Due", "Balance")); while ($row = mysql_fetch_array($result)) { $name = $personal_array[$row["EMP_ID3"]]; $rest_inst_no = datediff("m", $ref_date, $row["LOAN_END"]); $rest_amount = $rest_inst_no * $row["INT_RATE"];