-
Notifications
You must be signed in to change notification settings - Fork 0
/
isseu.php
28 lines (26 loc) · 868 Bytes
/
isseu.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
<?php
// isseu.php
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
function sanitize_input($data)
{
// Sanitize the data to prevent XSS attacks
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data, ENT_QUOTES, 'UTF-8'); // Use ENT_QUOTES to handle both single and double quotes
return $data;
}
if (isset($_POST['issue'])) {
$email = sanitize_input($_POST['userEmail']);
$user = sanitize_input($_POST['username']);
echo "recieved";
echo '<br>';
echo $email;
echo '<br>';
echo $user;
} else {
echo "sorry";
}
} else {
$response = array('success' => false, 'message' => 'Invalid request.');
echo json_encode($response);
}