· 9 years ago · Nov 21, 2016, 08:08 AM
1<?php
2if(isset($_POST['submit']) && !empty($_POST['submit'])){
3 if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])){
4 //your site secret key
5 $secretKey = '6Ld9eAwUAAAAAPNn5cbvocAJwhZkUyWh0bg_fDD-';
6 //get verify response data
7 $verifydata = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secretKey.'&response='.$_POST['g-recaptcha-response']);
8 $response= json_decode($verifydata);
9 if($response->success){
10
11
12 //contact form submission code
13 $name = !empty($_POST['username'])?$_POST['username']:'';
14 $email = !empty($_POST['email'])?$_POST['email']:'';
15 $www = !empty($_POST['www'])?$_POST['www']:'';
16 $message = !empty($_POST['unblock'])?$_POST['unblock']:'';
17 $formcontent="Správa: \n Meno a Priezvisko: $name \n Email: $email \n Stránka: $www \n Dôvod odblokovania: $message";
18 $recipient = "ondrej.ruman@sos-it.sk";
19 $subject = "=?UTF-8?B?".base64_encode("Blokovanie web stránok")."?=";
20 $mailheader = "From: <$email>\r\nMIME-Version: 1.0\r\nContent-type: text/html; charset=UTF-8\r\n";
21 mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
22 $success = 'Váš mail bol úspešne odoslaný.';
23 }
24 else{
25 $error = 'Robot verification failed, please try again.';
26 }
27 }
28 else{
29 $error = 'ProsÃm potvrdte že nie ste robot !';
30 }
31}
32else{
33 $error = '';
34 $success = '';
35}
36?>
37<!DOCTYPE html>
38<html>
39<head>
40<link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
41<meta charset="UTF-8">
42<title>Blokovanie webstránok</title>
43<style>
44body {
45 background-size: cover;
46 font-family: Montserrat;
47 background: url('bg.jpg');
48 background-position: top center;
49 background-repeat: no-repeat;
50}
51
52.logo {
53 width: 213px;
54 height: 36px;
55 margin: 30px auto;
56}
57
58.login-block {
59 width: 820px;
60 padding: 300px 0 0 0;
61 margin: 0 auto;
62}
63
64.login-block h1 {
65 text-align: center;
66 color: #990012;
67 font-size: 25px;
68 text-transform: uppercase;
69 margin-top: 0;
70 margin-bottom: 20px;
71 font-family: calibri;
72}
73h3 {
74 font-size: 14px;
75 font-family: calibri;
76 color: #7f7f7f;
77 text-align: center;
78}
79
80.login-block input {
81 width: 48%;
82 height: 42px;
83 box-sizing: border-box;
84 border-radius: 5px;
85 border: 1px solid #7f7f7f;
86 margin: 0 18px 20px 0;
87 font-size: 14px;
88 font-family: Montserrat;
89 padding: 0 20px 0 50px;
90 outline: none;
91}
92.login-block input:nth-child(even) {
93 margin: 0 0 20px 0;
94}
95
96.login-block input#username {
97 background: #fff url('1.png') 20px top no-repeat;
98 background-size: 16px 80px;
99}
100
101.login-block input#username:focus {
102 background: #fff url('1.png') 20px bottom no-repeat;
103 background-size: 16px 80px;
104}
105.login-block input#email {
106 background: #fff url('3.png') 20px top no-repeat;
107 background-size: 16px 80px;
108}
109
110.login-block input#email:focus {
111 background: #fff url('3.png') 20px bottom no-repeat;
112 background-size: 16px 80px;
113}
114.login-block input#unblock {
115 background: #fff url('2.png') 20px top no-repeat;
116 background-size: 16px 80px;
117}
118
119.login-block input#unblock:focus {
120 background: #fff url('2.png') 20px bottom no-repeat;
121 background-size: 16px 80px;
122}
123.login-block input#www {
124 background: #fff url('4.png') 20px top no-repeat;
125 background-size: 16px 80px;
126}
127
128.login-block input#www:focus {
129 background: #fff url('4.png') 20px bottom no-repeat;
130 background-size: 16px 80px;
131}
132
133.login-block input:active, .login-block input:focus {
134 border: 1px solid #ff656c;
135}
136.g-recaptcha {
137 width: 49%;
138 float: left;
139}
140
141.login-block button {
142 width: 48%;
143 height: 42px;
144 background: #ff656c;
145 box-sizing: border-box;
146 border-radius: 5px;
147 border: 1px solid #e15960;
148 color: #fff;
149 font-weight: bold;
150 text-transform: uppercase;
151 font-size: 14px;
152 font-family: Montserrat;
153 outline: none;
154 cursor: pointer;
155 float: right;
156 margin: 0 8px 0 0;
157}
158
159.login-block button:hover {
160 background: #ff7b81;
161}
162
163</style>
164</head>
165
166<body>
167
168<div class="logo"></div>
169<div class="login-block">
170 <h1>Táto web stránka je blokovaná administrátorom</h1>
171 <h3>V prÃpade že chcete povoliÅ¥ webstránku vyplnte prosÃm formulár.</h3>
172 <?php echo $error;echo $success;?>
173 <br>
174 <script src="https://www.google.com/recaptcha/api.js" async defer></script>
175 <form method="post" action="" name="loginform">
176 <input type="text" value="" placeholder="Meno a Priezvisko" id="username" name="username" />
177 <input type="text" name="email" id=email placeholder="Email" />
178 <input type="text" name="www" id=www placeholder="Názov www"/>
179 <input type="text" name="unblock" id=unblock placeholder="Dôvod odblokovania"/>
180 <!--use your site-key here-->
181 <div class="g-recaptcha" data-sitekey="6Ld9eAwUAAAAAH5ZblJoHJ0rGFmLF_VfpA8GK2r8"></div>
182 <button type="submit" name="submit" value="Odoslať"><span>Odoslať</span></button>
183 </form>
184</div>
185</body>
186</html>