-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproceed.php
88 lines (81 loc) · 2.7 KB
/
proceed.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
<!DOCTYPE html>
<html>
<head>
<?php require 'db.php';
$user = $_COOKIE["user"];
$email = "";
if (isset($_COOKIE["page"]) && $_COOKIE["page"] != "proceed.php") {
header("Location: ".$_COOKIE["page"]);
}
setcookie('page', 'proceed.php');
DBLogin("a8823305_audio");
$result = DBQuery("SELECT email FROM users WHERE username = '".$user."'");
if ($result->num_rows > 0) {
$result = $result->fetch_array(MYSQL_ASSOC);
$email = $result["email"];
}
if (isset($_POST["hf_cancel"]) && $_POST["hf_cancel"] != "") {
DBLogin("a8823305_audio");
DBQuery("DELETE FROM users WHERE username = '".$user."'");
DBC();
} else {
header("Location: workstation.php");
}
?>
<script type="text/javascript" src="js/jquery-1.10.2.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#btn_proceed").on("click", function() {
clearHiddenFields();
$("#form1").submit();
});
$("#btn_cancel").on("click", function() {
$("#hf_cancel").val("cancel");
$("#form1").submit();
});
function clearHiddenFields() {
$("#hf_cancel").val("");
}
});
</script>
<link rel="stylesheet" type="text/css" href="css/common.css" />
</head>
<body>
<?php
if (logged_in()) {
echo "Logged in as ".$user.". <a href=\"logout.php\">Logout</a><br>\n";
include 'menu_bar.php';
echo "<form id='form1' name='form1' action='proceed.php'>\n";
echo "<div class='instructions'>To prove you are the owner of ".$email.", please complete the following reCAPTCHA and click proceed.</div>\n";
require_once('recaptchalib.php');
// Get a key from https://www.google.com/recaptcha/admin/create
$publickey = "";
$privatekey = "";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
echo "You got it!";
} else {
# set the error code so that we can display it
$error = $resp->error;
}
}
echo recaptcha_get_html($publickey, $error);
echo "<br><input type='button' id='btn_proceed' name='btn_proceed' value='Proceed' />\n";
echo "<br><input type='button' id='btn_cancel' name='btn_cancel' value='Cancel' />\n";
echo "<input type='hidden' id='hf_cancel' name='hf_cancel' value='' />\n";
echo "</form>\n";
} else {
header("Location: cms.php");
}
?>
</body>
</html>