4 * Copyright (C) 2016-2017 Jerry Padgett <sjpadgett@gmail.com>
6 * LICENSE: This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * @author Jerry Padgett <sjpadgett@gmail.com>
21 * @link http://www.open-emr.org
28 require_once("../../../interface/globals.php");
31 // @TODO sanatize these
33 $user = $_GET ['user'];
34 $type = $_GET ['type'];
35 $signer = $_GET ['signer'];
37 if ($pid == 0 ||
empty($user)) {
38 if ($type != 'admin-signature' ||
empty($user)) {
44 $sig_hash = sha1($output);
46 $ip = $_SERVER ['REMOTE_ADDR'];
48 $lastmod = date('Y-m-d H:i:s');
49 if ($type == 'admin-signature') {
51 $row = sqlQuery("SELECT pid,status,sig_image,type,user FROM onsite_signatures WHERE user=? && type=?", array($user,$type));
53 $row = sqlQuery("SELECT pid,status,sig_image,type,user FROM onsite_signatures WHERE pid=?", array($pid));
56 if (!$row ['pid'] && !$row ['user']) {
58 $qstr = "INSERT INTO onsite_signatures (pid,lastmod,status,type,user,signator,created) VALUES (?,?,?,?,?,?,?) ";
59 sqlStatement($qstr, array($pid,$lastmod, $status,$type,$user,$signer,$created));
62 if ($row ['status'] == 'filed') {
63 header("Content-Type: image/png");
64 echo $row ['sig_image'];
66 } else if ($row ['status'] == 'waiting' ||
$status == 'waiting') {