-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathipreport.php
More file actions
37 lines (29 loc) · 957 Bytes
/
Copy pathipreport.php
File metadata and controls
37 lines (29 loc) · 957 Bytes
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
<?php
session_start();
// initializing variables
$username = "";
$name = "";
$email = "";
$errors = array();
// connect to the database
$db = mysqli_connect('localhost', 'root', 'root', 'version');
//geekboardeditor
if (isset($_POST['reportbutton']))
{
// yaha par form se input ara hai
$username = $_SESSION['username'];
$reported = mysqli_real_escape_string($db, $_POST['reported']);
$reporting = $_SERVER["REMOTE_ADDR"];
// form validation: ensure that the form is correctly filled ...
// by adding (array_push()) corresponding error unto $errors array
if (empty($reported)) { array_push($errors, "An IP is required"); }
// Finally, submit the post if there are no errors in the form
if (count($errors) == 0)
{
$query = "INSERT INTO report (username, reportedip, reportingip)
VALUES('$username', '$reported', '$reporting')";
mysqli_query($db, $query);
header('location: settings.php');
}
}
?>