-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
294 lines (262 loc) · 8.49 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
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
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
/* Maintenance Mode */
$maintenance = false; // true | false;
/* Force https */
$force_https = false; // true | false;
/* Google Tag */
$gtag = 'G-XXXXXXXXXX';
/* Domain / Email */
$domain = 'example.com';
/* Email Sender / Receiver */
$from_email = 'sender@example.com';
$to_email = 'receiver@example.com';
$bcc_email = '';
/* SMTP Configuration */
$smtp_server = 'smtp.example.com';
$smtp_username = 'sender@example.com';
$smtp_password = 'secret';
$smtp_auth = true;
$smtp_encryption = 'tls'; // tls | ssl
$smtp_port = 587;
$description = 'Domain ' . $domain . ' is now available for sale. Buy now with best offered price.';
$keywords = array(
$domain,
'domain ' . $domain . ' for sale',
'domain',
'domain name',
'Buy domain',
'domain parking',
'register domain',
'new domain name',
'domains for sale',
'premium domains',
'website',
'transfer domain',
'buy website',
'domain auction',
'marketplace',
'domain brokerage',
);
if($force_https === true && $_SERVER['REQUEST_SCHEME'] === 'http') {
header('Location: https://' . $domain);
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="index, follow">
<meta name="description" content="<?php echo $description; ?>">
<meta name="keywords" content="<?php echo implode(',',$keywords); ?>">
<title>Domain <?php echo $domain; ?> for sale</title>
<link rel="preconnect" href="https://fonts.googleapis.com" crossorigin>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="dns-prefetch" href="https://www.googletagmanager.com/gtag/js?id=<?php echo $gtag; ?>">
<link href="https://fonts.googleapis.com/css2?family=Anton&family=Be+Vietnam+Pro:wght@200&family=Georama&family=Passions+Conflict&display=swap" rel="stylesheet" media="print" onload="this.media='all'; this.onload = null; this.defer = true;">
<style>
body {
background: #844;
}
h1 {
color: #fff;
text-align: center;
font-size: 4rem;
font-weight: 700;
font-family: 'Georama', sans-serif;
}
.domain-for-sale {
font-family: 'Passions Conflict', cursive;
font-weight: 400;
font-size: 5rem;
color: #fff;
text-align: center;
}
.domain-name {
font-family: 'Anton', sans-serif;
font-weight: 400;
font-size: 4.5rem;
color: #fff;
text-align: center;
}
.make-an-offer {
font-family: 'Georama', sans-serif;
font-weight: 400;
font-size: 2rem;
color: #fff;
text-align: center;
}
.make-an-offer-form,
.submit-offer {
padding: 15px;
margin: 15px auto 15px auto;
text-align: center;
}
.make-an-offer p {
font-family: 'Be Vietnam Pro', sans-serif;
font-size: 1.5rem;
font-weight: 700;
}
input[type="text"] {
padding: 5px;
margin: 5px;
font-size: 1.2rem;
font-family: 'Be Vietnam Pro', sans-serif;
border: 2px solid #fff;
background: #db4848;
background: #4E0E0E;
color: #fff;
color: #F1A865;
}
input[type="text"]::-webkit-input-placeholder { /* Edge */
color: #fff;
}
input[type="text"]:-ms-input-placeholder { /* Internet Explorer 10-11 */
color: #fff;
}
input[type="text"]::placeholder {
color: #fff;
}
input[type="submit"].btn {
border: 2px solid #fff;
padding: 5px;
font-size: 1.2rem;
width: 150px;
margin: 0 auto;
cursor: pointer;
background: #4E0E0E;
color: #fff;
}
input[type="submit"].btn:hover {
background: #fff;
color: #4E0E0E;
border: 2px solid #4E0E0E;
}
input[type="submit"].btn.disabled,
input[type="submit"].btn.disabled:hover {
background: #cfcfcf;
color: #a3a3a3;
cursor: not-allowed;
}
#offer-validate {
margin: 15px auto;
color: #fff;
}
.keywords {
color: #fff;
font-size:1rem;
font-weight:700;
}
</style>
<?php if(isset($gtag) === true && empty($gtag) === false) { ?>
<script src="https://www.googletagmanager.com/gtag/js?id=<?php echo $gtag; ?>" async></script>
<script>
setTimeout(function(){
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '<?php echo $gtag; ?>');
},5000);
</script>
<?php } ?>
</head>
<body>
<?php
if($maintenance === true) {
echo '<div class="domain-name">Domain for sale<br> email: ' . $from_email . '</div>';
} else if(isset($_POST['domain-lead']) === true && empty($_POST['domain-lead']) === false) {
require_once 'vendor/autoload.php';
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = 0;
$mail->isSMTP();
$mail->Host = $smtp_server;
$mail->SMTPAuth = true;
$mail->Username = $smtp_username;
$mail->Password = $smtp_password;
$mail->SMTPSecure = $smtp_encryption;
$mail->Port = $smtp_port;
//Recipients
$mail->setFrom($from_email, $domain);
$mail->addAddress($to_email);
if(isset($bcc_email) === true && empty($bcc_email) === false) {
$mail->addBCC($bcc_email);
}
$mail->addReplyTo($from_email, $domain);
//Content
$mail->isHTML(true);
$mail->Subject = 'Lead (' . $domain . ')';
$incomplete_form = false;
$mail_body = '';
foreach($_POST as $fk => $field) {
if($fk === 'domain-lead') {
continue;
}
if(empty($field) === true) {
$incomplete_form = true;
break;
}
if($fk === 'offer' && is_numeric($field) === true) {
$mail_body .= '<p>' . $fk . ': ' . number_format($field, 2) . '</p>';
} else {
$mail_body .= '<p>' . $fk . ': ' . $field . '</p>';
}
}
if($incomplete_form) {
echo '<h2 style="color:#fff;">Please complete all fields</h2>';
} else {
$mail->Body = $mail_body;
$mail->send();
echo '<h2 style="color:#fff;">Thank You</h2>';
}
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
} else { ?>
<h1><?php echo $description ?></h1>
<div class="domain-for-sale">Domain for Sale</div>
<div class="domain-name"><?php echo $domain; ?></div>
<div class="make-an-offer">
Submit this form with your offered price to get this domain.
<p>Send offer request with Indian Rupees only</p>
</div>
<div class="make-an-offer-form">
<form action="/" method="POST" onsubmit="return validateForm()">
<input type="hidden" name="domain-lead" value="domain-for-sale">
<input type="text" id="offer-name" name="name" placeholder="Your Name">
<input type="text" id="offer-contact" name="contact" placeholder="Contact Number">
<input type="text" id="offer-email" name="email" placeholder="E-mail">
<input type="text" id="offer-offer" name="offer" placeholder="Offered Price">
<div class="submit-offer">
<input type="submit" class="btn btn-submit" value="Make an Offer">
<div id="offer-validate"></div>
</div>
</form>
</div>
<div class="keywords"><?php echo strtoupper( implode(' | ',$keywords) ); ?></div>
<script>
function validateForm() {
let name = document.getElementById('offer-name').value;
let contact = document.getElementById('offer-contact').value;
let email = document.getElementById('offer-email').value;
let offer = document.getElementById('offer-offer').value;
if (name == '' || contact == '' || email == '' || offer == '') {
document.getElementById('offer-validate').innerHTML = 'All fields are required.';
return false;
} else if ((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) === false) {
document.getElementById('offer-validate').innerHTML = 'Invalid email address.';
return false;
} else if(isNaN(offer) === true || isNaN(contact) === true ) {
document.getElementById('offer-validate').innerHTML = 'Required numeric value for contact and offer.';
return false;
}
}
</script>
<?php } ?>
</body>
</html>