This repository was archived by the owner on Apr 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangePhone.php
executable file
·65 lines (60 loc) · 2.18 KB
/
changePhone.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
<?php include('boilerplate.php');
if (!isset($_SESSION['email']) ) {
echo '<script>
location.href="error.php"
</script>';
}
include "dbConfig.php";
$validation = new validation;
$queries = new queries;
if (isset($_POST['submit'])) {
$validation->validate('phone', 'Phone Number', 'uniqueEmail|customer|required|min_len|6');
if ($validation->run()) {
$phone = $validation->input('phone');
$id = $_SESSION['id'];
$update = mysqli_query($connect, "UPDATE customer SET phone = '$phone' WHERE id='$id'");
if($update)
{
$_SESSION['updatephone'] = "Mobile number successfully updated.";
} else {
$_SESSION['unmatched'] = "Some Error Occured";
}
}
}
?>
<link rel="stylesheet" href="css/login.css">
<main>
<div class="container-fluid">
<div class="row">
<div class="col-sm-6 login-section-wrapper">
<?php if (isset($_SESSION['updatephone'])) : ?>
<div class="alert alert-success">
<?php echo $_SESSION['updatephone']; ?>
</div>
<?php endif; ?>
<?php unset($_SESSION['updatephone']); ?>
<?php if (isset($_SESSION['unmatched'])) : ?>
<div class="alert alert-danger">
<?php echo $_SESSION['unmatched']; ?>
</div>
<?php endif; ?>
<?php unset($_SESSION['unmatched']); ?>
<div class="login-wrapper my-auto">
<h1 class="login-title">Upate Mobile Number</h1>
<form method="post" action="">
<div class="form-group mb-4">
<label for="phone">New Number</label>
<input type="number" name="phone" id="phone" class="form-control" required />
<div class="error text-danger text-center">
<?php if (!empty($validation->errors['phone'])) : echo $validation->errors['phone'];
endif; ?>
</div>
</div>
<input name="submit" id="login" class="btn btn-block login-btn" type="submit" value="Proceed">
</form>
</div>
</div>
</div>
</div>
</main>
<?php include('footer.php'); ?>