forked from nonsalant/contract
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontract.php
294 lines (269 loc) · 23 KB
/
contract.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<?php
/*
Single File PHP Contract
Upload this single file to your server and send a link to your client.
(You can rename this php, for example if there are other contracts in the same folder.)
Once they have signed, this php file will delete itself and leave behind an HTML version
of the signed contract that can be printed or downloaded as a PDF.
*/
$email = ""; // Notify when contract is signed
$phpName = basename($_SERVER['PHP_SELF']) ? basename($_SERVER['PHP_SELF']) : 'index.php';
$fileName = substr($phpName , 0, -4); // without extension
$htmlName = $fileName.'.html';
$pdfName = $fileName.'.pdf';
$contractData = stripslashes ( $_POST['contractdata'] );
$ip = get_client_ip_env();
// If the HTML file exists, redirect to it
redirectIfExists();
// If the contractdata was received in the form, put it in an html file
if ($contractData) {
file_put_contents($htmlName,$contractData);
$msg = 'Your contract was signed. You can view it here: ' . getUrl();
if ($email) mail($email,'Contract signed!',$msg);
redirectIfExists();
}
// If html file exists, delete php file, redirect to html, and die.
function redirectIfExists() {
global $htmlName;
if ( file_exists($htmlName ) ) {
unlink(__FILE__); // the php file deteles itself from the server
header('Location: '.$htmlName.'#hk');
die();
}
}
// Function to get the client ip address
function get_client_ip_env() {
$ipaddress = '';
if (getenv('HTTP_CLIENT_IP'))
$ipaddress = getenv('HTTP_CLIENT_IP');
else if(getenv('HTTP_X_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
else if(getenv('HTTP_X_FORWARDED'))
$ipaddress = getenv('HTTP_X_FORWARDED');
else if(getenv('HTTP_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_FORWARDED_FOR');
else if(getenv('HTTP_FORWARDED'))
$ipaddress = getenv('HTTP_FORWARDED');
else if(getenv('REMOTE_ADDR'))
$ipaddress = getenv('REMOTE_ADDR');
else
$ipaddress = 'UNKNOWN';
return $ipaddress;
}
// Function that returns the current file URL and replaces the .php extension with .html
function getUrl() {
$url = @( $_SERVER["HTTPS"] != 'on' ) ? 'http://'.$_SERVER["SERVER_NAME"] : 'https://'.$_SERVER["SERVER_NAME"];
$url .= ( $_SERVER["SERVER_PORT"] !== 80 ) ? ":".$_SERVER["SERVER_PORT"] : "";
$url .= $_SERVER["REQUEST_URI"];
$url = substr($url,0,-4) . '.html';
return $url;
}
?><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Contract</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<style>
@import url(http://fonts.googleapis.com/css?family=Libre+Baskerville:400,700,400italic);
@import url(http://fonts.googleapis.com/css?family=Arapey);
@import url(http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700);
@import url(http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800);
body {
font-family: 'Libre Baskerville', serif;
font-size:16px;
line-height:1.5em;
color:#000;
margin:0;
background:#fff;
}
@media (max-width:600px) {
body { font-size:14px; }
}
@media print {
.noprint { display:none !important; }
}
.hidden {
display:none;
}
#content {
max-width: 600px;
margin: 0 auto;
margin-bottom: 3em;
padding: 0 2em;
background: #fff;
}
h1 {
font-size: 2em;
line-height: 1.2em;
letter-spacing: 0.15em;
font-family: 'Arapey', serif;
font-weight: normal;
margin: 1em 0;
position: relative;
text-align: center;
text-transform: uppercase;
border: solid 1px;
border-width: 1px 0;
padding: .5em 0;
}
h2 {
font-size:1.2em;
line-height:1.2em;
letter-spacing:.05em;
font-family:'Open Sans Condensed',sans-serif;
font-weight:700;
}
#signature {
width:auto;
border:dashed 2px #53777A;
margin:0;
text-align:center;
}
#hk,
#hk-contractor {
max-width:333px;
display:block;
}
#hk {
display:none;
}
#date-ip {
font-size:1.2em;
line-height:1.2em;
letter-spacing:.05em;
font-family:'Open Sans Condensed',sans-serif;
font-weight:400;
}
#print-pdf {
text-align:center;
padding:1.5em 0;
margin-top:2em;
border-top:solid 1px #ccc;
}
.buttons {
text-align:center;
margin:1.5em auto;
}
button {
margin: 0 .5em;
font-size:1.2em;
line-height:1.5em;
/* letter-spacing:.05em; */
font-family: 'Open Sans Condensed',sans-serif;
font-weight: 700;
text-transform:uppercase;
color: #0a3666;
}
button:hover {
color: #136fd2;
}
</style>
</head>
<body>
<div id="content">
<h1>Contract of work for website design and development</h1>
<p>Between <strong>Alice</strong>, referred to below as "Designer", and <strong>Bob</strong>, referred to below as "Customer".</p>
<h2>1. Agreement of parties</h2>
<p>Customer hires Designer to redesign the current website, <strong>bobswebsite.com</strong>, for the estimated total price of <strong>$PRICE</strong>.</p>
<p>The agreed payment plan is at the end of the document.</p>
<p>Designer agrees to provide quality service and to answer to the Customer’s requests in a timely manner. The services provided will be:</p>
<ol style="list-style-type: lower-alpha;">
<li>service1;</li>
<li>service2;</li>
<li>service3;</li>
<li>service4.</li>
</ol>
<h2>2. Legal matters and copyrights</h2>
<p>The Customer will guarantee to the Designer that any elements of text, graphics, photos, trademarks or other artwork that the Customer provides for inclusion in the website are either owned by him or that he has the permission to use them. When the Designer receives the final payment, copyright is automatically assigned as follows: Customer will own the graphics, virtual elements, text content photographs and other data provided, unless someone else owns them. The Designer owns the XHTML markup, CSS and other code and he licenses it to the Customer for use on only this project. Designer can reserve the right to display, with Customer’s consent, the work as part of the portfolio.</p>
<h2>3. Term and termination</h2>
<ol style="list-style-type: lower-alpha;">
<li>This contract shall commence upon the first payment, as outlined in the payment plan and shall remain effective until the services are completed and delivered.</li>
<li>This contract may be terminated at any time by either party effective immediately upon notice, or the mutual agreement of the parties.</li>
<li>In the event of termination, Designer shall be compensated for the service performed through the date of termination in the amount (a) any advanced payment, (b) a prorated portion of the fees due, or (c) hourly fees for work performed by the Designer at the time of the termination, whichever is greater, together with any additional costs incurred trough and up to the date of cancellation.</li>
<li>This Contract may be modified by parties; any modification must be in writing.</li>
<li>All notices to be given hereunder shall be transmitted in writing by electronic mail and will only be effective upon return confirmation.</li>
</ol>
<h2>4. Force majeure</h2>
<p>Designer shall not be deemed in breach of this contract if Designer is unable to complete the services or any portion by reason of fire, earthquake, labor dispute, illness, internet breaches or any technical issues that may appear beyond Designer’s control. Upon occurrence of any Force Majeure Event, Designer shall give notice to the Customer of his inability to perform or of delay in completing the services and shall propose revisions to the schedule for completion of the services.</p>
<h2>5. Payment plan</h2>
<p>Payment shall be done as follows:</p>
<ul>
<li>50% of total estimated fee will be required to commence work, after this contract has been approved and signed by both parties.</li>
<li>50% upon project closure.</li>
</ul>
<p>Any extra time required outside the project timeline/services mentioned at point 1 of this contract, will be billed at a rate of <strong>$FEE</strong> per hour.</p> <h2>Both parties agree to the terms stipulated above:</h2>
<!-- You can generate a new signature at www.cdpn.io/JYpjvE -->
<img id="hk-contractor" src="
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlYAAACWCAYAAAAc0saCAAAgAElEQVR4Xu2dDdBH2VzHd1WIJCSx2n1i1aq8V2Swj/eUQhllQtRUelEYopphNd7y0pJqe5uhJpSXUEgredaMK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V98CuzjfZ30e7+k+3zzexKG+e8XLf5+27l1hUHsV37bjdVAcBCEAAAhkEEKwyIJEEAg0JPNzKOq+wPJb7CoGRHAIQgMBSBBCsliJPvSeVgA4Of2dm51nuywRFMghAAAJrIYBgtZaRoB0niUDfQeKfMwgvtchy30maDfQVAhDYKwIIVns1nHQGAhCAAAQgAIElCSBYLUmfuiEAAQhAAAIQ2CsCCFZ7NZx0BgIQgAAEIACBJQkgWC1Jn7ohAAEIQAACENgrAghWezWcdAYCEIAABCAAgSUJIFgtSZ+6IQABCEAAAhDYKwIIVns1nHQGAhCAAAQgAIElCSBYLUmfuiEAAQhAAAIQ2CsCCFZ7NZx0BgIQgAAEIACBJQkgWC1Jn7ohAAEIQAACENgrAghWezWcdAYCEIAABCAAgSUJIFgtSZ+6IQABCEAAAhDYKwIIVns1nHQGAhCAAAQgAIElCSBYLUmfuiEAAQhAAAIQ2CsCCFZ7NZx0BgIQgAAEIACBJQkgWC1Jn7ohAAEIQAACENgrAghWezWcdAYCEIAABCAAgSUJ/B8vRToAEfrh6AAAAABJRU5ErkJggg==" style="width:100%;">
<p>
<img id="hk" class="results-page-only" src="data:image/png;base64,">
</p>
<form method="post" class="noprint" id="signature-form">
<div id="signature"></div>
<div class="buttons">
<button id="reset" type="button">
Reset
</button>
<button id="submit" type="submit">
Done →
</button>
</div>
<input type="hidden" id="signature_capture" name="contractdata" />
</form>
<div id="date-ip" class="results-page-only hidden">
<strong>Signed on:</strong> <?php echo date('j F Y'); ?>
<br><strong>IP address:</strong>
<?php echo $ip; ?><br>
</div>
<div class="results-page-only hidden noprint" id="print-pdf">
<button id="print" type="button" class="button-secondary" onclick="printContract()">
Print contract
</button>
<button id="pdf" type="button" class="button-secondary" onclick="generatePdf()">
Download as PDF
</button>
</div>
</div> <!--#content-->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<!-- https://github.com/brinley/jSignature/blob/master/README.md -->
<script src="https://cdn.rawgit.com/willowsystems/jSignature/master/libs/jSignature.min.js"></script>
<script>
$(document).ready(function() {
$('#signature').jSignature();
var $sigdiv = $('#signature');
var datapair = $sigdiv.jSignature('getData', 'svgbase64');
$('#signature').bind('change', function(e) {
var data = $('#signature').jSignature('getData');
$("#hk").attr('src',data);
});
$('#reset').click(function(e){
$('#signature').jSignature('clear');
var data = $('#signature').jSignature('getData');
$("#hk").attr('src',data);
$("#signature_capture").val('');
e.preventDefault();
});
$('#submit').click(function(e) {
$('#signature-form').hide();
$('.results-page-only').show();
pageHtml = '<!DOCTYPE html><html>' + $('html').html().toString() + '</html>';
$("#signature_capture").val(pageHtml);
// To avoid showing the Print/PDF buttons before the page is processed
$('#print-pdf, #date-ip').html('<h2 id="loading" style="text-align:center; display:none;">Saving Contract...</h2>');
$('#print-pdf, #date-ip').append('<p id="loading2" style="text-align:center; display:none;">This should only take a few seconds</p>');
$('#loading').slideDown(300, function() {
$('#loading2').delay(2000).slideDown(300);
});
});
});
function printContract() {
window.print();
}
function generatePdf() {
// http://pdfcrowd.com/save-to-pdf/
window.location.href = '//pdfcrowd.com/url_to_pdf/?use_print_media=1&height=-1&pdf_name=<?php echo $pdfName; ?>';
}
</script>
</body>
</html>