-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
146 lines (131 loc) · 4 KB
/
search.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
<html>
<head>
<title>Search</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Cutive">
</head>
<body>
<img src="logo.jpg" valign="top">
<p>
<?php
include 'tokens.php';
$userName = $_POST["userName"];
$userGroup = $_POST["userGroup"];
$email = $_POST["email"];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://cloud-va.aerohive.com/xapi/v1/identity/credentials?ownerId=$ownerId&userGroup=$userGroup&email=$email",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"authorization: Bearer $accesstoken",
"cache-control: no-cache",
"x-ah-api-client-id: $clientid",
"x-ah-api-client-redirect-uri: $redirecturi",
"x-ah-api-client-secret: $clientsecret"
),
));
$response = curl_exec($curl);
$json = json_decode($response, true);
$err = curl_error($curl);
$id = $json['data'][0]['id'];
$userName = $json['data'][0]['userName'];
$groupId = $json['data'][0]['groupId'];
$phone = $json['data'][0]['phone'];
$email = $json['data'][0]['email'];
$ssids = $json['data'][0]['ssids'][0];
$createTime = $json['data'][0]['createTime'];
$expireTime = $json['data'][0]['expireTime'];
if ($groupId == "7799660613379") {
$type = "student";
} elseif ($groupId == "7799660614032") {
$type = "guest";
} elseif ($groupId == "7799660614619") {
$type = "bulk guest";
} else {
$type = "Not Found or Unknown Error";
}
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
}
?>
<p>
username:
<?php
echo $userName;
?>
<p>
type:
<?php
echo $type;
?>
<p>
credential id:
<?php
echo $id;
?>
<p>
phone:
<?php
echo $phone;
?>
<p>
email:
<?php
echo $email;
?>
<p>
ssid(s):
<?php
echo $ssids;
?>
<p>
Creation Time:
<?php
echo $createTime;
?>
<p>
Expiration:
<?php
echo $expireTime;
?>
<div class="buttons">
<a id="returnbutton" href="<?php echo $returnurl ?>">Return</a>
</div>
<div class="buttons">
<form action="renew.php" method="post" onsubmit="return confirm('Are you sure you want to renew <?php echo htmlspecialchars($userName); ?>?');">
<input type="hidden" name="userName" value="<?php echo htmlspecialchars($userName); ?>">
<input type="hidden" name="id" value="<?php echo htmlspecialchars($id); ?>">
<input id="buttons" type="submit" name="submit" value="Renew">
</form>
</div>
<div class="buttons">
<form action="delete.php" method="post" onsubmit="return confirm('Are you sure you want to delete <?php echo htmlspecialchars($userName); ?>?');">
<input type="hidden" name="userName" value="<?php echo htmlspecialchars($userName); ?>">
<input type="hidden" name="id" value="<?php echo htmlspecialchars($id); ?>">
<input id="buttons" type="submit" name="submit" value="Delete" />
</form>
</div>
<div class="buttons">
<form action="email.php" method="post" onsubmit="return confirm('Are you sure you want to email the credentials for <?php echo htmlspecialchars($userName); ?> to <?php echo htmlspecialchars($email); ?>?');">
<input type="hidden" name="userName" value="<?php echo htmlspecialchars($userName); ?>">
<input type="hidden" name="id" value="<?php echo htmlspecialchars($id); ?>">
<input type="hidden" name="email" value="<?php echo htmlspecialchars($email); ?>">
<input id="buttons" type="submit" name="submit" value="Email">
</form>
</div>
<div class="buttons">
<form action="sms.php" method="post" onsubmit="return confirm('Are you sure you want to send an SMS containing the credentials for <?php echo htmlspecialchars($userName); ?> to <?php echo htmlspecialchars($phone); ?>?');">
<input type="hidden" name="userName" value="<?php echo htmlspecialchars($userName); ?>">
<input type="hidden" name="id" value="<?php echo htmlspecialchars($id); ?>">
<input type="hidden" name="phone" value="<?php echo htmlspecialchars($phone); ?>">
<input id="buttons" type="submit" name="submit" value="SMS">
</form>
</div>
</body>
</html>