-
Notifications
You must be signed in to change notification settings - Fork 138
/
Copy pathrequest_certificate.php
132 lines (107 loc) · 4.82 KB
/
request_certificate.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
require_once "classControllers/init.php";
$request = new Certificate;
$intern = new Intern;
if (isset($_POST["certificate-btn"])) {
$error = '';
$name = $database->escape_string($_POST["name"]);
$email = $database->escape_string($_POST["email"]);
$slack_username =$database->escape_string( $_POST["slack_username"]);
$year = $database->escape_string($_POST["year"]);
if (empty($_POST["name"]) || empty($_POST["email"]) || empty($_POST["slack_username"]) || empty($_POST["year"])) {
$error = "All feild are required";
} else {
$count = $intern->emailExists($email);
if ($count === 1) {
$count2 = $request->confirmEmail($email);
if($count2 === 0){
$request->requestCertificate($email, $name, $slack_username, $year);
$request_mess = '<p style="text-align:center;">Application successful. You will be informed when your certificate is ready. Thank you!</a>';
}else{
$error = "Email already exist";
}
} else {
$error = "User can not be found on the database";
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Request For Certificate</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css">
<link rel="stylesheet" type="text/css" href="css/header-footer.css">
<link rel="stylesheet" type="text/css" href="css/request_certificate.css">
<link rel="icon" type="img/png" href="images/hng-favicon.png">
</head>
<body>
<div class="heading">
<?php include('fragments/site_header.php'); ?>
<div class="container main-header-content">
<h1 class="text-center main-heading">Request for your HNG Certificate</h1>
<p class="text-center mt-4 mb-1">Thanks for taking part in the HNG Internship and making it to the end.</p>
<p class="text-center">Kindly fill the form below.</p>
</div>
</div>
<main class="main">
<div class="container pb-5">
<form class="main-form" method="post">
<small class="please-note text-center mb-5 ">Kindly note that this Certificate will be issued to only those who completed the
program.</small>
<?php
?>
<div id="">
<?php
if (!empty($request_mess)) {
echo "<center><h4 class='text-success text-center success' style='background: #D3ECDB; color: #2B5036; padding: 6px; width:66%;'>" . $request_mess . "</h4></center>";
}
if (!empty($error)) {
echo "<h4 style='text-align:center; color: red;'>$error</h4>";
}
?>
</div>
<div class="form-group ">
<div class="mx-auto row">
<label class="mx-auto col-md-8 pl-0" for="name">Your Full Name</label>
</div>
<div class="mx-auto row">
<input type="text" class=" mx-auto col-md-8 form-control" placeholder="Enter your Name" required name="name" id="name">
</div>
</div>
<div class="form-group ">
<div class="mx-auto row">
<label class="mx-auto col-md-8 pl-0" for="email">Your Email</label>
</div>
<div class="mx-auto row">
<input type="email" class=" mx-auto col-md-8 form-control" placeholder="Enter your email address" required name="email" id="email">
</div>
</div>
<div class="form-group ">
<div class="mx-auto row">
<label class="mx-auto col-md-8 pl-0" for="text">Slack username</label>
</div>
<div class="mx-auto row">
<input type="text" class=" mx-auto col-md-8 form-control" placeholder="Enter your Slack username" required name="slack_username" id="name">
</div>
</div>
<div class="form-group ">
<div class="mx-auto row">
<label class="mx-auto col-md-8 pl-0" for="year">What Date did you finish?</label>
</div>
<div class="row mx-auto">
<input type="date" class=" mx-auto col-md-8 form-control" placeholder="Enter the Date you were an intern" required name="year" id="year">
</div>
</div>
<input type="submit" class="btn submit-btn px-5 mt-4 mx-auto" value="Submit" name="certificate-btn">
</form>
</div>
</main>
<?php include "fragments/site_footer.php"; ?>
</body>
</html>