-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathforgetpassprocess.php
61 lines (35 loc) · 1.04 KB
/
forgetpassprocess.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
<?php
$Email_error = $DB_error ="";
$Email="";
$conn = new mysqli('localhost','root','','messaging system');
if($conn->connect_error) {
$DB_error ="database connection error!";
} else{
if ($_SERVER["REQUEST_METHOD"] == "POST") {
//email validation
if (empty($_POST["Email"])) {
$Email_error = "Email is required";
} else {
$Email = test_input($_POST["Email"]);
// check if e-mail address is well-formed with a built in function in php ^^
if (!filter_var($Email, FILTER_VALIDATE_EMAIL)) {
$Email_error = "Invalid email format";
}else {
$result= $conn->query("SELECT * FROM user WHERE Email = '$Email' ");
if( $result->num_rows == 0 ){
$Email_error = "This Email is not exits";
}else {
//header( "Refresh:2; url=Mailprocess.php" );
include 'Mailprocess.php';
}
}
}
}
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>