-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
145 lines (118 loc) · 3.54 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
session_start();
// $files = glob('upload/*'); // get all file names
// foreach($files as $file){ // iterate files
// if(is_file($file))
// unlink($file); // delete file
// }
// $files = glob('upload/*'); // get all file names
// foreach($files as $file){ // iterate files
// if(is_file($file))
// $file = explode("/",$file)[1];
// }
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Put Your Signature Below</title>
<link href="./css/jquery.signaturepad.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="./js/numeric-1.2.6.min.js"></script>
<script src="./js/bezier.js"></script>
<script src="./js/jquery.signaturepad.js"></script>
<script type='text/javascript' src="https://github.com/niklasvh/html2canvas/releases/download/0.4.1/html2canvas.js"></script>
<script src="./js/json2.min.js"></script>
<style type="text/css">
body{
font-family:monospace;
text-align:center;
}
#btnSaveSign {
color: #fff;
background: #f99a0b;
padding: 5px;
border: none;
border-radius: 5px;
font-size: 20px;
margin-top: 10px;
}
#signArea{
width:304px;
margin: 50px auto;
}
.sign-container {
width: 60%;
margin: auto;
}
.sign-preview {
width: 150px;
height: 50px;
border: solid 1px #CFCFCF;
margin: 10px 5px;
}
.tag-ingo {
font-family: cursive;
font-size: 12px;
text-align: left;
font-style: oblique;
}
</style>
<script type="text/javascript"></script></head>
<body>
<center><img src="global_logo.png"/></center>
<center><h2 style="color:#2E3771; border-color: #2E3771;width:25%">Put Your Signature</h2></center>
<h3 style="color:red"><?php
if(isset($_SESSION['message'])){
echo $_SESSION['message'];
session_destroy();
}else{?>
<center><h3 style="color:#31708f;background-color: #d9edf7;
border-color: #bce8f1;width:45%">Append your signature and proceed to completing the application form by clicking on SAVE SIGNATURE</h3></center>
<?php }
?></h3>
<div id="signArea" >
<h2 class="tag-ingo">Please Put Your Signature Below</h2>
<div class="sig sigWrapper" style="height:auto;">
<div class="typed"></div>
<canvas class="sign-pad" id="sign-pad" width="300" height="100"></canvas>
</div>
</div>
<button id="btnSaveSign">Save Signature</button>
<div class="sign-container">
<?php
/*$image_list = glob("./doc_signs/*.png");
foreach($image_list as $image){
//echo $image;
?>
<img src="<?php echo $image; ?>" class="sign-preview" />
<?php
} */
?>
</div>
<p><a href="<?php echo "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>">Click Here</a> if u have written it wrong</p>
<script>
$(document).ready(function() {
$('#signArea').signaturePad({drawOnly:true, drawBezierCurves:true, lineTop:90});
});
$("#btnSaveSign").click(function(e){
html2canvas([document.getElementById('sign-pad')], {
onrendered: function (canvas) {
var canvas_img_data = canvas.toDataURL('image/png');
var img_data = canvas_img_data.replace(/^data:image\/(png|jpg);base64,/, "");
//ajax call to save image inside folder
$.ajax({
url: 'save_sign.php',
data: { img_data:img_data },
type: 'post',
dataType: 'json',
success: function (response) {
window.location.href = "form.php";
}
});
}
});
});
</script>
</body>
</html>