forked from LahiruSen/OOSD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
l_profile.php
979 lines (787 loc) · 54.4 KB
/
l_profile.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
<?php
/**
* Created by PhpStorm.
* User: BlackLion
* Date: 3/30/2018
* Time: 6:09 AM
*/
require 'db.php';
if (session_status() == PHP_SESSION_NONE) { session_start();}
if ( $_SESSION['logged_in'] != 1 ) {
$_SESSION['message'] = "You must log in before viewing your profile page!";
header("location: error.php");
}
elseif($_SESSION['active'] != 1)
{
$_SESSION['message'] = "We have sent you a verification email to your email account. Please click verification link to verify your account!!!";
header("location: error.php");
} else
{
// Makes it easier to read
$first_name = $_SESSION['first_name'];
$last_name = $_SESSION['last_name'];
$email = $_SESSION['email'];
$active = $_SESSION['active'];
$types = $_SESSION['types'];
$two_step= $_SESSION['two_step'];
//user data
$result = $mysqli->query("SELECT * FROM users WHERE email='$email'") or die($mysqli->error());
if($result->num_rows ==0)
{
$_SESSION['message'] = "This user is not a valid user!!!";
header("location: error.php");
} else
{
$user = $result->fetch_assoc();
$result->free();
$userId = $user['id'];
$_SESSION['user_id'] = $userId;
//get students or employee data if available
if( $types == 2)
{
$student_result = $mysqli->query("SELECT * FROM student_data WHERE user_id='$userId'") or die($mysqli->error());
$ayear_result = $mysqli->query("SELECT * FROM academic_year WHERE status=1") or die($mysqli->error());
if($ayear_result->num_rows != 0)
{
$ayear_data = $ayear_result->fetch_assoc();
$ayear_result->free();
}
if($student_result->num_rows != 0)
{
$student_data = $student_result->fetch_assoc();
$student_result->free();
}
}
else
{
$employee_result = $mysqli->query("SELECT * FROM employee_data WHERE user_id='$userId'") or die($mysqli->error());
$employee_types_result = $mysqli->query("SELECT * FROM employee_types") or die($mysqli->error());
if($employee_types_result->num_rows ==0)
{
$_SESSION['message'] = "No Employee types found ";
header("location: error.php");
}else
{
$employee_types_data = array();
while ($row = $employee_types_result->fetch_assoc())
{
$employee_types_data[] = $row;
}
$employee_types_result->free();
}
if($employee_result->num_rows != 0)
{
$employee_data = $employee_result->fetch_assoc();
$employee_result->free();
}
}
}
}
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
require 'l_profile_reset_password.php';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Vocational training center">
<meta name="author" content="G27">
<title>Profile : <?= $first_name.' '.$last_name ?></title>
<?php include 'css/css.html'; ?>
</head>
<body id="page-top">
<?php if(!$active) { ?>
<div class="form text-center">
<h4 class="alert-heading">Please verify your account!</h4>
<p>We have sent you a verification email to your email account. Please click verification link to verify your account!!!</p>
<a href="logout.php"><button class="btn btn-group btn-lg">Logout</button></a>
</div>
<?php } else { ?>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg bg-secondary fixed-top text-uppercase" id="mainNav">
<div class="container">
<a class="navbar-brand js-scroll-trigger" href="#page-top">Emplup<i class="fa fa-user"></i></a>
<button class="navbar-toggler navbar-toggler-right text-uppercase bg-primary text-white rounded" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
Menu
<i class="fa fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<?php require 'navigation.php';?>
</div>
</div>
</nav>
<!-- Header -->
<header class="masthead bg-primary text-white text-center ">
<div>
<h1 class="text-uppercase mb-0">Emplup <i class="fa fa-user"></i></h1>
<h2 style="font-size:50px" class="text-dark mb-2"> Profile </h2>
</div>
</header>
<!-- for Employee -->
<?php if($types == 1) { ?>
<section style="padding:10px;" id="portfolio">
<div class="container ">
<div id="two_step_submission_form" class="two_step_form" >
<div class="container">
<div class="text-left">
<form action="l_profile.php" method="post">
<div id="form_section_header" class="bg-topfive">
<h2> Change Password </h2>
</div>
<div class="row m-2">
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="last_name">New password</label>
<input type="password" id="new_password" name="new_password" class="input-active" pattern=".{8,}" placeholder="min 8 characters" title="Should have atleast 8 charactors" required>
<?php if(isset($error_array) && array_key_exists('new_password',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['new_password'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="email">Confirm Password</label>
<input type="password" id="confirm_password" name="confirm_password" oninput="check(this)" class="input-active" pattern=".{8,}" title="Should have atleast 8 charactors" placeholder="min 8 characters" required>
<?php if(isset($error_array) && array_key_exists('confirm_password',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['confirm_password'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="text-center m-2">
<button name="changepsw" type="submit" class="btn btn-xl btn-outline-primary" >Submit</button>
</div>
</form>
</div>
<div class="text-left">
<div id="form_section_header" class="bg-topfive">
<h2> Basic Information </h2>
</div>
<div class="row m-2">
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="first_name">First Name</label>
<input type="text" style="background-color: #e6e9ee" id="first_name" name="first_name" class="input-active" value="<?= $first_name ?>" readonly>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="last_name">Last Name</label>
<input type="text" style="background-color: #e6e9ee" id="last_name" name="last_name" class="input-active" value="<?= $last_name ?>" readonly>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-12 col-md-12">
<label class="text-dark" for="email">Email</label>
<input type="text" style="background-color: #e6e9ee" id="email" name="email" class="input-active" value="<?= $email ?>" readonly>
</div>
</div>
</div>
<div class="text-left">
<div id="form_section_header" class="bg-topfive">
<h2> Personal Information </h2>
</div>
<div class="row m-2">
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="title">Title</label>
<select id="title" name="title" disabled >
<option value="Mr" <?php if(isset($employee_data)) {if ($employee_data['title'] == 'Mr') {echo "selected";}} ?> >Mr</option>
<option value="Miss" <?php if(isset($employee_data)) {if ($employee_data['title'] == 'Miss') {echo "selected";}} ?> >Miss</option>
<option value="Mrs" <?php if(isset($employee_data)) {if ($employee_data['title'] == 'Mrs') {echo "selected";}} ?> >Mrs</option>
</select>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="sex">Sex</label>
<select id="sex" name="sex" disabled>
<option value="Male" <?php if(isset($employee_data)) {if ($employee_data['sex'] == 'Male') {echo "selected";}} ?> >Male</option>
<option value="Female" <?php if(isset($employee_data)) {if ($employee_data['sex'] == 'Female') {echo "selected";}} ?> >Female</option>
</select>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-12 col-md-12">
<label class="text-dark" for="full_name">Full Name</label>
<input type="text" id="full_name" name="full_name" required <?php if(isset($employee_data)) {echo 'value="'.$employee_data['full_name'].'"';} ?> readonly >
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="dob">Date of Birth</label>
<input type="date" id="dob" name="dob" required <?php if(isset($employee_data)) {echo 'value="'.$employee_data['dob'].'"';} ?> readonly >
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="sex">Civil Status</label>
<select id="civil_status" name="civil_status" disabled >
<option value="Single" <?php if(isset($employee_data)) {if ($employee_data['civil_status'] == 'Single') {echo "selected";}} ?> >Single</option>
<option value="Married" <?php if(isset($employee_data)) {if ($employee_data['civil_status'] == 'Married') {echo "selected";}} ?> >Married</option>
</select>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-12 col-md-12">
<label class="text-dark" for="nic">National Identity Card Number</label>
<input type="text" id="nic" name="nic" required <?php if(isset($employee_data)) {echo 'value="'.$employee_data['nic'].'"';} ?> readonly >
</div>
</div>
</div>
<div class="text-left">
<div id="form_section_header" class="bg-topfive">
<h2> Contact Information </h2>
</div>
<div class="row m-2">
<div class="form-group col-lg-12 col-md-12">
<label class="text-dark" for="add_line_1">Address Line 1</label>
<input type="text" id="add_line_1" name="add_line_1" required <?php if(isset($employee_data)) {echo 'value="'.$employee_data['address_line_1'].'"';} ?> <?php if(isset($employee_data)){if($employee_data['is_locked'] == 1){echo ('readonly');}}?> >
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-12 col-md-12">
<label class="text-dark" for="add_line_2">Address Line 2</label>
<input class="<?php if(isset($error_array) && array_key_exists('add_line_2',$error_array)) { echo('text-danger');} ?>" type="text" id="add_line_2" name="add_line_2" required <?php if(isset($old)){echo 'value="'.$old['add_line_2'].'"';}else{if(isset($employee_data)) {echo 'value="'.$employee_data['address_line_2'].'"';}} ?> <?php if(isset($employee_data)){if($employee_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('add_line_2',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['add_line_2'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="postal_code">Postal Code</label>
<input class="<?php if(isset($error_array) && array_key_exists('postal_code',$error_array)) { echo('text-danger');} ?>" type="number" id="postal_code" name="postal_code" required <?php if(isset($old)){echo 'value="'.$old['postal_code'].'"';}else{if(isset($employee_data)) {echo 'value="'.$employee_data['postal_code'].'"';}} ?> <?php if(isset($employee_data)){if($employee_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('postal_code',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['postal_code'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="city">City</label>
<input class="<?php if(isset($error_array) && array_key_exists('city',$error_array)) { echo('text-danger');} ?>" type="text" id="city" name="city" required <?php if(isset($old)){echo 'value="'.$old['city'].'"';}else{if(isset($employee_data)) {echo 'value="'.$employee_data['city'].'"';}} ?> <?php if(isset($employee_data)){if($employee_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('city',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['city'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-8 col-md-8">
<label class="text-dark" for="phone_number">Phone Number</label>
<input class="<?php if(isset($error_array) && array_key_exists('phone_number',$error_array)) { echo('text-danger');} ?>" type="number" id="phone_number" name="phone_number" required <?php if(isset($old)){echo 'value="'.$old['phone_number'].'"';}else{if(isset($employee_data)) {echo 'value="'.$employee_data['phone_number'].'"';}} ?> <?php if(isset($employee_data)){if($employee_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('phone_number',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['phone_number'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<div class="text-left">
<div id="form_section_header" class="bg-topfive">
<h2> Employment Information </h2>
</div>
<div class="row m-2">
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="employee_id">Employee ID</label>
<input class="<?php if(isset($error_array) && array_key_exists('employee_id',$error_array)) { echo('text-danger');} ?>" type="number" id="employee_id" name="employee_id" class="input-active" required <?php if(isset($old)){echo 'value="'.$old['employee_id'].'"';}else{if(isset($employee_data)) {echo 'value="'.$employee_data['employee_id'].'"';}} ?> <?php if(isset($employee_data)){if($employee_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('employee_id',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['employee_id'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="employee_type_id">I want to be a/an</label>
<select id="employee_type_id" name="employee_type_id" <?php if(isset($employee_data)){if($employee_data['is_locked'] == 1){echo ('disabled');}}?> >
<?php for( $j=0;$j<count($employee_types_data);$j++ ) { ?>
<option value="<?= $employee_types_data[$j]['id'] ?>" <?php if(isset($old)){if ($old['employee_type_id'] == $employee_types_data[$j]['id']) {echo "selected";}}else{if(isset($employee_data)) {if ($employee_data['employee_type_id'] == $employee_types_data[$j]['id']) {echo "selected";}}} ?> ><?= $employee_types_data[$j]['title'] ?></option>
<?php } ?>
</select>
</div>
</div>
</div>
<input name="user_id" id="user_id" type="hidden" value="<?= $userId ?>">
<input name="type" id="type" type="hidden" value="<?= $types ?>">
<?php if(isset($employee_data)) {?>
<?php if($employee_data['is_locked'] != 1) {?>
<div class="text-center mt-4">
<button name="employee" type="submit" class="btn btn-xl btn-outline-primary">Save</button>
<button value="lock" name="employee" type="submit" class="btn btn-xl btn-outline-success">Complete</button>
</div>
<?php }?>
<?php }else {?>
<div class="text-center mt-4">
<button name="employee" type="submit" class="btn btn-xl btn-outline-primary">Save</button>
</div>
<?php } ?>
</div>
</div>
</form>
</div>
</section>
<!-- for Student -->
<?php } else { if(isset($ayear_data)){ ?>
<section style="padding:10px;" id="portfolio">
<div class="container ">
<div id="two_step_submission_form" class="two_step_form" >
<div class="container">
<div class="container">
<div class="text-left">
<form action="l_profile.php" method="post">
<div id="form_section_header" class="bg-topfive">
<h2> Change Password </h2>
</div>
<div class="row m-2">
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="last_name">New password</label>
<input type="password" id="new_password" name="new_password" class="input-active" pattern=".{8,}" placeholder="min 8 characters" title="Should have atleast 8 charactors" required>
<?php if(isset($error_array) && array_key_exists('new_password',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['new_password'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="email">Confirm Password</label>
<input type="password" id="confirm_password" name="confirm_password" oninput="check(this)" class="input-active" pattern=".{8,}" placeholder="min 8 characters" title="Should have atleast 8 charactors" required>
<?php if(isset($error_array) && array_key_exists('confirm_password',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['confirm_password'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="text-center m-2">
<button name="changepsw" type="submit" class="btn btn-xl btn-outline-primary" >Submit</button>
</div>
</form>
</div>
<div class="text-left">
<div id="form_section_header" class="bg-topfive">
<h2> Basic Information </h2>
</div>
<div class="row m-2">
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="first_name">First Name</label>
<input type="text" style="background-color: #e6e9ee" id="first_name" name="first_name" class="input-active" value="<?= $first_name ?>" readonly>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="last_name">Last Name</label>
<input type="text" style="background-color: #e6e9ee" id="last_name" name="last_name" class="input-active" value="<?= $last_name ?>" readonly>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-12 col-md-12">
<label class="text-dark" for="email">Email</label>
<input type="text" style="background-color: #e6e9ee" id="email" name="email" class="input-active" value="<?= $email ?>" readonly>
</div>
</div>
</div>
<div class="text-left">
<div id="form_section_header" class="bg-topfive">
<h2> Personal Information </h2>
</div>
<div class="row m-2">
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="title">Title</label>
<select id="title" name="title" <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('disabled');}}?> >
<option value="Mr" <?php if(isset($old)){if ($old['title'] == 'Mr') {echo "selected";}}else{if(isset($student_data)) {if ($student_data['title'] == 'Mr') {echo "selected";}}} ?> >Mr</option>
<option value="Miss" <?php if(isset($old)){if ($old['title'] == 'Miss') {echo "selected";}}else{if(isset($student_data)) {if ($student_data['title'] == 'Miss') {echo "selected";}}} ?> >Miss</option>
<option value="Mrs" <?php if(isset($old)){if ($old['title'] == 'Mrs') {echo "selected";}}else{if(isset($student_data)) {if ($student_data['title'] == 'Mrs') {echo "selected";}}} ?> >Mrs</option>
</select>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="sex">Sex</label>
<select id="sex" name="sex" <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('disabled');}}?> >
<option value="Male" <?php if(isset($old)){if ($old['sex'] == 'Male') {echo "selected";}}else{if(isset($student_data)) {if ($student_data['sex'] == 'Male') {echo "selected";}}} ?> >Male</option>
<option value="Female" <?php if(isset($old)){if ($old['sex'] == 'Female') {echo "selected";}}else{if(isset($student_data)) {if ($student_data['sex'] == 'Female') {echo "selected";}}} ?> >Female</option>
</select>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-12 col-md-12">
<label class="text-dark" for="full_name">Full Name</label>
<input class="<?php if(isset($error_array) && array_key_exists('full_name',$error_array)) { echo('text-danger');} ?>" type="text" id="full_name" name="full_name" required <?php if(isset($old)){echo 'value="'.$old['full_name'].'"';}else{if(isset($student_data)) {echo 'value="'.$student_data['full_name'].'"';}} ?><?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('full_name',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['full_name'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="dob">Date of Birth</label>
<input class="<?php if(isset($error_array) && array_key_exists('dob',$error_array)) { echo('text-danger');} ?>" type="date" id="dob" name="dob" required <?php if(isset($old)){echo 'value="'.$old['dob'].'"';}else{if(isset($student_data)) {echo 'value="'.$student_data['dob'].'"';}} ?> <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('dob',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['dob'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="civil_status">Civil Status</label>
<select id="civil_status" name="civil_status" <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('disabled');}}?> >
<option value="Single" <?php if(isset($old)){if ($old['civil_status'] == 'Single') {echo "selected";}}else{if(isset($student_data)) {if ($student_data['civil_status'] == 'Single') {echo "selected";}}} ?> >Single</option>
<option value="Married" <?php if(isset($old)){if ($old['civil_status'] == 'Married') {echo "selected";}}else{if(isset($student_data)) {if ($student_data['civil_status'] == 'Married') {echo "selected";}}} ?> >Married</option>
</select>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-12 col-md-12">
<label class="text-dark" for="nic">National Identity Card Number</label>
<input class="<?php if(isset($error_array) && array_key_exists('nic',$error_array)) { echo('text-danger');} ?>" type="text" id="nic" name="nic" required <?php if(isset($old)){echo 'value="'.$old['nic'].'"';}else{if(isset($student_data)) {echo 'value="'.$student_data['nic'].'"';}} ?> <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('nic',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['nic'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-4 col-md-4">
<label class="text-dark" for="is_physical">Are you physically okay?</label>
<input disabled type="checkbox" id="is_physical" name="is_physical" <?php if(isset($old)){if ($old['is_physical'] == 'on') {echo "checked";}}else{if(isset($student_data)) {if ($student_data['is_physically_disabled'] == 'on') {echo "checked";}}} ?> <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('readonly');}}?> >
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-12 col-md-12">
<label class="text-dark" for="father_full_name">Father's Full Name</label>
<input class="<?php if(isset($error_array) && array_key_exists('father_full_name',$error_array)) { echo('text-danger');} ?>" type="text" id="father_full_name" name="father_full_name" required <?php if(isset($old)){echo 'value="'.$old['father_full_name'].'"';}else{if(isset($student_data)) {echo 'value="'.$student_data['father_full_name'].'"';}} ?> <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('father_full_name',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['father_full_name'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-12 col-md-12">
<label class="text-dark" for="mother_full_name">Mother's Full Name</label>
<input class="<?php if(isset($error_array) && array_key_exists('mother_full_name',$error_array)) { echo('text-danger');} ?>" type="text" id="mother_full_name" name="mother_full_name" required <?php if(isset($old)){echo 'value="'.$old['mother_full_name'].'"';}else{if(isset($student_data)) {echo 'value="'.$student_data['mother_full_name'].'"';}} ?> <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('mother_full_name',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['mother_full_name'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<div class="text-left">
<div id="form_section_header" class="bg-topfive">
<h2> Contact Information </h2>
</div>
<div class="row m-2">
<div class="form-group col-lg-12 col-md-12">
<label class="text-dark" for="add_line_1">Address Line 1</label>
<input class="<?php if(isset($error_array) && array_key_exists('add_line_1',$error_array)) { echo('text-danger');} ?>"type="text" id="add_line_1" name="add_line_1" required <?php if(isset($old)){echo 'value="'.$old['add_line_1'].'"';}else{if(isset($student_data)) {echo 'value="'.$student_data['address_line_1'].'"';}} ?> <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('add_line_1',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['add_line_1'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-12 col-md-12">
<label class="text-dark" for="add_line_2">Address Line 2</label>
<input class="<?php if(isset($error_array) && array_key_exists('add_line_2',$error_array)) { echo('text-danger');} ?>" type="text" id="add_line_2" name="add_line_2" required <?php if(isset($old)){echo 'value="'.$old['add_line_2'].'"';}else{if(isset($student_data)) {echo 'value="'.$student_data['address_line_2'].'"';}} ?> <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('add_line_2',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['add_line_2'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="postal_code">Postal Code</label>
<input class="<?php if(isset($error_array) && array_key_exists('postal_code',$error_array)) { echo('text-danger');} ?>" type="number" id="postal_code" name="postal_code" required <?php if(isset($old)){echo 'value="'.$old['postal_code'].'"';}else{if(isset($student_data)) {echo 'value="'.$student_data['postal_code'].'"';}} ?> <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('postal_code',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['postal_code'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
<div class="form-group col-lg-6 col-md-6">
<label class="text-dark" for="city">City</label>
<input class="<?php if(isset($error_array) && array_key_exists('city',$error_array)) { echo('text-danger');} ?>" type="text" id="city" name="city" required <?php if(isset($old)){echo 'value="'.$old['city'].'"';}else{if(isset($student_data)) {echo 'value="'.$student_data['city'].'"';}} ?> <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('city',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['city'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-8 col-md-8">
<label class="text-dark" for="phone_number">Phone Number</label>
<input class="<?php if(isset($error_array) && array_key_exists('phone_number',$error_array)) { echo('text-danger');} ?>" type="number" id="phone_number" name="phone_number" required <?php if(isset($old)){echo 'value="'.$old['phone_number'].'"';}else{if(isset($student_data)) {echo 'value="'.$student_data['phone_number'].'"';}} ?> <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('phone_number',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['phone_number'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-12 col-md-12">
<label class="text-dark" for="cp_full_name">Contact Person's Full Name</label>
<input class="<?php if(isset($error_array) && array_key_exists('cp_full_name',$error_array)) { echo('text-danger');} ?>" type="text" id="cp_full_name" name="cp_full_name" required <?php if(isset($old)){echo 'value="'.$old['cp_full_name'].'"';}else{if(isset($student_data)) {echo 'value="'.$student_data['contact_person_full_name'].'"';}} ?> <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('cp_full_name',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['cp_full_name'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="row m-2">
<div class="form-group col-lg-8 col-md-8">
<label class="text-dark" for="cp_phone_number">Contact Person's Phone Number</label>
<input class="<?php if(isset($error_array) && array_key_exists('cp_phone_number',$error_array)) { echo('text-danger');} ?>" type="number" id="cp_phone_number" name="cp_phone_number" required <?php if(isset($old)){echo 'value="'.$old['cp_phone_number'].'"';}else{if(isset($student_data)) {echo 'value="'.$student_data['contact_person_phone_number'].'"';}} ?> <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('cp_phone_number',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['cp_phone_number'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<div class="text-left">
<div id="form_section_header" class="bg-topfive">
<h2> Educational Information </h2>
</div>
<div class="row m-2">
<div class="form-group col-lg-8 col-md-8">
<label class="text-dark" for="al_index_number">A/L Index Number</label>
<input class="<?php if(isset($error_array) && array_key_exists('al_index_number',$error_array)) { echo('text-danger');} ?>" type="number" id="al_index_number" name="al_index_number" class="input-active" required <?php if(isset($old)){echo 'value="'.$old['al_index_number'].'"';}else{if(isset($student_data)) {echo 'value="'.$student_data['al_index_number'].'"';}} ?> <?php if(isset($student_data)){if($student_data['is_locked'] == 1){echo ('readonly');}}?> >
<?php if(isset($error_array) && array_key_exists('al_index_number',$error_array)) {?>
<div class="row">
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-10 col-xs-10">
<small id="passwordHelp" class="text-danger">
<?= $error_array['al_index_number'] ?>
</small>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<input name="user_id" id="user_id" type="hidden" value="<?= $userId ?>">
<input name="type" id="type" type="hidden" value="<?= $types ?>">
<input name="ayear_id" id="ayear_id" type="hidden" value="<?= $ayear_data['id'] ?>">
<div class="text-center mt-4">
<button name="student" type="submit" class="btn btn-xl btn-outline-primary" >Save</button>
</div>
</div>
</div>
</div>
</section>
<?php }
else
{?>
<section style="padding:10px;" id="portfolio">
<div class="container ">
<div class="row topfive-margin">
<div class="col-lg-12">
<h2>New batch registration is not started yet. It will be available soon. Please be wait :)</h2>
</div>
</div>
</div>
</section>
<?php
}
} ?>
<!--Model-->
<!-- Footer -->
<footer class="footer text-center">
<div class="container">
<div class="row">
<div class="col-md-4 mb-5 mb-lg-0">
<h4 class="text-uppercase mb-4">Location</h4>
<p class="lead mb-0">University of Moratuwa, <strong>Sri Lanka</strong></p>
</div>
<div class="col-md-4 mb-5 mb-lg-0">
<h4 class="text-uppercase mb-4">Around the EMPLUP</h4>
<ul class="list-inline mb-0">
<li class="list-inline-item">
<a class="btn btn-outline-light btn-social text-center rounded-circle" href="#">
<i class="fa fa-fw fa-facebook"></i>
</a>
</li>
<li class="list-inline-item">
<a class="btn btn-outline-light btn-social text-center rounded-circle" href="#">
<i class="fa fa-fw fa-google-plus"></i>
</a>
</li>
<li class="list-inline-item">
<a class="btn btn-outline-light btn-social text-center rounded-circle" href="#">
<i class="fa fa-fw fa-twitter"></i>
</a>
</li>
<li class="list-inline-item">
<a class="btn btn-outline-light btn-social text-center rounded-circle" href="#">
<i class="fa fa-fw fa-linkedin"></i>
</a>
</li>
<li class="list-inline-item">
<a class="btn btn-outline-light btn-social text-center rounded-circle" href="#">
<i class="fa fa-fw fa-dribbble"></i>
</a>
</li>
</ul>
</div>
<div class="col-md-4">
<h4 class="text-uppercase mb-4">Footer Note</h4>
<p class="lead mb-0">This is the description of the footer note </p>
</div>
</div>
</div>
</footer>
<div class="copyright py-4 text-center text-white">
<div class="container">
<small>Copyright © EMPLUP 2018</small>
</div>
</div>
<!-- Scroll to Top Button (Only visible on small and extra-small screen sizes) -->
<div class="scroll-to-top d-lg-none position-fixed ">
<a class="js-scroll-trigger d-block text-center text-white rounded" href="#page-top">
<i class="fa fa-chevron-up"></i>
</a>
</div>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5aa8ad68cc6156e6"></script>
<?php } ?>
<!-- Bootstrap core JavaScript -->
<script src="js/jquery.min.js"></script>
<script src="js/moment.min.js"></script>
<script src="js/bootstrap.bundle.min.js"></script>
<!-- Plugin JavaScript -->
<script src="js/jquery.easing.min.js"></script>
<script src="js/jquery.magnific-popup.min.js"></script>
<!-- Contact Form JavaScript -->
<script src="js/jqBootstrapValidation.min.js"></script>
<script src="js/contact_me.js"></script>
<!-- Custom scripts for this template -->
<script src="js/freelancer.js"></script>
<script language='javascript' type='text/javascript'>
function check(input) {
if (input.value != document.getElementById('new_password').value) {
input.setCustomValidity('Password Must be Matching.');
} else {
// input is valid -- reset the error message
input.setCustomValidity('');
}
}
</script>
<script type="text/javascript">
$(document).ready(function() {
setInterval(function(){getMessage()}, 10000);
});
function getMessage() {
$.ajax({
type: 'get',
url: 'message_count.php',
dataType:"html",
data: {user_id: '<?= $_SESSION['user_id'] ?>'},
success: function (data) {
if(data =='0'){
$('#unseen_count').html('');
$('#user_logo').css({"border-color": '', "border-style": '',"border-size": '',"border-radius": ''});
}else
{
$('#unseen_count').html(" "+data);
$('#user_logo').css({"border-color": "orangered", "border-style": "solid","border-size": "2px","border-radius": "25px"});
}
},
error: function(jqxhr, status, exception) {
}
});
}
</script>
</body>
</html>