-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessingEmail.php
More file actions
40 lines (32 loc) · 860 Bytes
/
Copy pathprocessingEmail.php
File metadata and controls
40 lines (32 loc) · 860 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
38
39
<?php
$mail = "";
$checker = "";
$q = $_REQUEST["q"];
function test_input($q) {
$q = trim($q);
$q = stripslashes($q);
$q = htmlspecialchars($q);
return true;
}
if (test_input($q) === true) {
if (!filter_var($q, FILTER_VALIDATE_EMAIL)) {
$mail = "needs format of: example@mail.here";
} else {
include "operations.php";
$conn = new mysqli($servername, $username, $password, $dbname);
// MySQLi Object-oriented
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM user WHERE email = '$q' ";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
$mail = "Email taken";
} else {
$mail = "Valid";
}
$conn->close();
}
}
echo $mail;