Esempio n. 1
0
                $stmt->execute(array(':client_tel' => $client_tel, ':client_login' => $client_login, ':unit_desc' => $unit_desc, ':client_adr' => $client_adr, ':client_mail' => $client_mail, ':client_posada' => $client_posada, ':client_id_param' => $client_id_param));
                $stmt = $dbConnection->prepare("SELECT MAX(id) max_id FROM tickets");
                $stmt->execute();
                $max_id_ticket = $stmt->fetch(PDO::FETCH_NUM);
                $max_id_res_ticket = $max_id_ticket[0] + 1;
                $stmt = $dbConnection->prepare('INSERT INTO tickets
								(id, user_init_id,user_to_id,date_create,subj,msg, client_id, unit_id, status, hash_name, prio, last_update) VALUES (:max_id_res_ticket, :user_init_id, :user_to_id, now(),:subj, :msg,:max_id,:unit_id, :status, :hashname, :prio, now())');
                $stmt->execute(array(':max_id_res_ticket' => $max_id_res_ticket, ':user_init_id' => $user_init_id, ':user_to_id' => $user_to_id, ':subj' => $subj, ':msg' => $msg, ':max_id' => $client_id_param, ':unit_id' => $unit_id, ':status' => $status, ':hashname' => $hashname, ':prio' => $prio));
                $unow = $_SESSION['helpdesk_user_id'];
                $stmt = $dbConnection->prepare('INSERT INTO ticket_log (msg, date_op, init_user_id, ticket_id, to_user_id, to_unit_id) values (:create, now(), :unow, :max_id_res_ticket, :user_to_id, :unit_id)');
                $stmt->execute(array(':create' => 'create', ':unow' => $unow, ':max_id_res_ticket' => $max_id_res_ticket, ':user_to_id' => $user_to_id, ':unit_id' => $unit_id));
                //echo("dd");
                if ($CONF_MAIL['active'] == "true") {
                    if ($user_to_id == "0") {
                        //echo("dd");
                        send_mail_to('new_all', $max_id_res_ticket);
                    } else {
                        if ($user_to_id != "0") {
                            //echo("dd");
                            send_mail_to('new_user', $max_id_res_ticket);
                            //echo("dd");
                            send_mail_to('new_coord', $max_id_res_ticket);
                        }
                    }
                }
                echo $hashname;
            }
            check_unlinked_file();
        }
    }
}
<?php

$table = 'campaignsN';
$hours = 3;
$recipient = '*****@*****.**';
$qry_em = "select group_concat(campaignID) as campaignd_without_automation from (select campaignId,max(ts) as last_update from campaignsNHistory where campaignId in (select\ncampaignID\nfrom campaignsN\nwhere parentid = 1601983051\nand status = 'active')\ngroup by 1\n) t\nwhere TIMESTAMPDIFF(HOUR,last_update,NOW()) > " . $hours;
$qry_res = mysqli_query($con, $qry_em);
$row = mysqli_fetch_array($qry_res, MYSQLI_ASSOC);
$campaignd_without_automation = $row['campaignd_without_automation'];
echo $campaignd_without_automation;
if (!isset($campaignd_without_automation)) {
    // all is good
    echo $campaignd_without_automation;
} else {
    // We have a problem
    $alert = "TURN AUTOMATION ALERT - We have campaigns that have not been updated in the last " . $hours . " hours : " . $campaignd_without_automation;
    send_mail_to($recipient, $alert);
}