forked from Samarpitaa/AlumNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
160 lines (152 loc) · 7.9 KB
/
signup.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
include 'admin/db_connect.php';
?>
<style>
.masthead{
min-height: 23vh !important;
height: 23vh !important;
}
.masthead:before{
min-height: 23vh !important;
height: 23vh !important;
}
img#cimg{
max-height: 10vh;
max-width: 6vw;
}
</style>
<header class="masthead">
<div class="container-fluid h-100">
<div class="row h-100 align-items-center justify-content-center text-center">
<div class="col-lg-8 align-self-end mb-4 page-title">
<h3 class="text-white">Create Account</h3>
<hr class="divider my-4" />
<div class="col-md-12 mb-2 justify-content-center">
</div>
</div>
</div>
</div>
</header>
<div class="container mt-3 pt-2">
<div class="col-lg-12">
<div class="card mb-4">
<div class="card-body">
<div class="container-fluid">
<div class="col-md-12">
<form action="" id="create_account">
<div class="row form-group">
<div class="col-md-4">
<label for="" class="control-label">Last Name</label>
<input type="text" class="form-control" name="lastname" required>
</div>
<div class="col-md-4">
<label for="" class="control-label">First Name</label>
<input type="text" class="form-control" name="firstname" required>
</div>
<div class="col-md-4">
<label for="" class="control-label">Middle Name</label>
<input type="text" class="form-control" name="middlename" >
</div>
</div>
<div class="row form-group">
<div class="col-md-4">
<label for="" class="control-label">Gender</label>
<select class="custom-select" name="gender" required>
<option>Male</option>
<option>Female</option>
</select>
</div>
<div class="col-md-4">
<label for="" class="control-label">Batch</label>
<input type="input" class="form-control datepickerY" name="batch" required>
</div>
<div class="col-md-4">
<label for="" class="control-label">Course Graduated</label>
<select class="custom-select select2" name="course_id" required>
<option></option>
<?php
$course = $conn->query("SELECT * FROM courses order by course asc");
while($row=$course->fetch_assoc()):
?>
<option value="<?php echo $row['id'] ?>"><?php echo $row['course'] ?></option>
<?php endwhile; ?>
</select>
</div>
</div>
<div class="row form-group">
<div class="col-md-5">
<label for="" class="control-label">Currently Connected To</label>
<textarea name="connected_to" id="" cols="30" rows="3" class="form-control"></textarea>
</div>
<div class="col-md-5">
<label for="" class="control-label">Image</label>
<input type="file" class="form-control" name="img" onchange="displayImg(this,$(this))">
<img src="" alt="" id="cimg">
</div>
</div>
<div class="row">
<div class="col-md-4">
<label for="" class="control-label">Email</label>
<input type="email" class="form-control" name="email" required>
</div>
<div class="col-md-4">
<label for="" class="control-label">Password</label>
<input type="password" class="form-control" name="password" required>
</div>
</div>
<div id="msg">
</div>
<hr class="divider">
<div class="row">
<div class="col-md-12 text-center">
<button class="btn btn-primary">Create Account</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$('.datepickerY').datepicker({
format: " yyyy",
viewMode: "years",
minViewMode: "years"
})
$('.select2').select2({
placeholder:"Please Select Here",
width:"100%"
})
function displayImg(input,_this) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#cimg').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$('#create_account').submit(function(e){
e.preventDefault()
start_load()
$.ajax({
url:'admin/ajax.php?action=signup',
data: new FormData($(this)[0]),
cache: false,
contentType: false,
processData: false,
method: 'POST',
type: 'POST',
success:function(resp){
if(resp == 1){
location.replace('index.php')
}else{
$('#msg').html('<div class="alert alert-danger">email already exist.</div>')
end_load()
}
}
})
})
</script>