-
Notifications
You must be signed in to change notification settings - Fork 0
/
second_form_stu.php
754 lines (685 loc) · 20.4 KB
/
second_form_stu.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
<?php
session_start();
$con = new mysqli('localhost', 'root', NULL, 'trupendb');
$qryst="select * from user where username='". $_SESSION["user"]."';";
$result = $con->query($qryst);
if ($result && $result->num_rows > 0) {
if($row = $result->fetch_assoc()){
if($row["img_dir"]=="" || $row["img_dir"]==NULL){
$row["img_dir"]="profile_pic/student/".$_SESSION["user"].".jpg";
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel = "icon" href ="Image_Components/truPen Better Logo.png" type = "image/x-icon">
<link rel="stylesheet" href="inpcss.css">
<style>
.topdiv{
background-color: lightpink;
height: 140px;
box-shadow: inset 2px 2px 10px 7px white;
margin: 0;
padding: 10px;
border-radius: 10%;
top: 0;
}
.botdiv{
background-color: #f1f1f1;
margin: 0;
padding: 10px;
top: 150px;
max-height: 510px;
min-height: 510px;
border-radius: 2%;
margin-bottom: 10px;
bottom: 0px;
box-shadow: inset 1px 1px 10px 6px white;
}
.profil-img {
background-image:url("");
width: 145px;
height: 145px;
cursor: pointer;
background-size: cover;
border-radius: 50%;
border: 0.1em solid rgba(255, 10, 10, 0.4);
box-shadow: inset 1px 1px 2px 7px white;
}
.profil-info {
text-align: center;
}
input[type="file"] {
display: none;
}
.bio-photo {
border-radius: 50%;
display: block;
width: 150px;
height: auto;
}
.box {
display: inline-block;
width: 98%;
height: 95px;
margin: 10px;
border-radius: 20px 20px 0 0;
background-color: rgba(250, 250, 250, 0.3);
}
/* This is for the span where the image or text is placed. */
.box .sp {
display: block;
width: 150px;
height: 150px;
border-radius: 100%;
margin-top: 2%;
margin-left: 10%;
border: 20px solid white;
font-size: 28px;
font-weight: bold;
text-align: center;
line-height: 0px;
text-indent: 180px;
background-color: #a023f0;
z-index: 20;
}
.box2 {
position: relative;
/* z-index needs to be set to a negative number, below the circular image.*/
z-index: -10;
display: inline-block;
width: 100%;
height: 500px;
/* This number may need to be adjusted if any changes are made
to border thickness. */
margin-top: -114px;
background-color: rgba(241, 241, 241, 0.6);
border-radius: 0 0 20px 20px;
vertical-align: top;
}
.balloon2 {
display: inline-block;
width: 315px;
height: 250px;
padding: 40px 0 10px 15px;
font-family: "Open Sans", sans;
font-weight: 600;
color: #377D6A;
background: #eeeeee;
border-width: 2px;
border-color: rgba(100, 50, 200, 0.8);
border-radius: 3px;
outline: 0;
text-indent: 0;
transition: all .3s ease-in-out;
}
.balloon2::-webkit-input-placeholder {
color: #efefef;
text-indent: 0;
font-weight: 300;
}
.balloon2 + label {
display: inline-block;
position: absolute;
top: 10px;
height: 28px;
left: 0;
bottom: 8px;
padding: 5px 45px;
color: #032429;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
text-shadow: 0 1px 0 rgba(19, 74, 70, 0);
transition: all .3s ease-in-out;
border-radius: 3px;
background: rgba(122, 184, 147, 0);
}
.balloon2 + label:after {
position: absolute;
content: "";
width: 0;
height: 0;
top: 100%;
left: 50%;
margin-left: -3px;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
border-top: 3px solid rgba(122, 184, 147, 0);
transition: all .3s ease-in-out;
}
.balloon2:focus,
.balloon2:active {
color: #377D6A;
padding: 8px 0 10px 15px;
text-indent: 0;
background: #fff;
}
.balloon2:focus::-webkit-input-placeholder,
.balloon2:active::-webkit-input-placeholder {
color: #aaa;
}
.balloon2:focus + label,
.balloon2:active + label {
height: 14px;
color: #fff;
text-shadow: 0 1px 0 rgba(19, 74, 70, 0.4);
background: #7ab893;
transform: translateY(-40px);
}
.balloon2:focus + label:after,
.balloon2:active + label:after {
border-top: 4px solid #7ab893;
}
.pos {
max-width: 400px;
max-height: 300px;
position: relative;
margin: 0 auto;
display: inline-block;
padding: 60px 30px;
z-index: 0;
margin-top: -353px;
margin-left:740px;
text-align: center;
}
.buttonup{
background-color: #999999;
max-width: 80px;
max-height: 30px;
position: relative;
margin-top: -335px;
margin-left: 900px;
z-index: 3;
}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<style>
@keyframes loading {
0% {
cy: 10;
}
25% {
cy: 3;
}
50% {
cy: 10;
}
}
canvas {
height: 100vh;
top: 0;
pointer-events: none;
display: inline-block;
position: absolute;
width: 100%;
z-index: 40;
}
button {
background: none;
border: none;
color: #f4f7ff;
cursor: pointer;
font-family: "Quicksand", sans-serif;
font-size: 14px;
font-weight: 500;
height: 40px;
left: 80%;
outline: none;
overflow: hidden;
padding: 0 10px;
position: fixed;
top: 28%;
transform: translate(-50%, -50%);
width: 190px;
-webkit-tap-highlight-color: transparent;
z-index: 1;
}
button::before {
background: #1f2335;
border-radius: 50px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4) inset;
content: "";
display: block;
height: 100%;
margin: 0 auto;
position: relative;
transition: width 0.2s cubic-bezier(0.39, 1.86, 0.64, 1) 0.3s;
width: 100%;
}
button.ready .submitMessage svg {
opacity: 1;
top: 1px;
transition: top 0.4s ease 600ms, opacity 0.3s linear 600ms;
}
button.ready .submitMessage .button-text span {
top: 0;
opacity: 1;
transition: all 0.2s ease calc(var(--dr) + 600ms);
}
button.loading::before {
transition: width 0.3s ease;
width: 80%;
}
button.loading .loadingMessage {
opacity: 1;
}
button.loading .loadingCircle {
animation-duration: 1s;
animation-iteration-count: infinite;
animation-name: loading;
}
button.complete .submitMessage svg {
top: -30px;
transition: none;
}
button.complete .submitMessage .button-text span {
top: -8px;
transition: none;
}
button.complete .loadingMessage {
top: 80px;
}
button.complete .successMessage .button-text span {
left: 0;
opacity: 1;
transition: all 0.2s ease calc(var(--d) + 1000ms);
}
button.complete .successMessage svg {
stroke-dashoffset: 0;
transition: stroke-dashoffset 0.3s ease-in-out 1.4s;
}
.button-text span {
opacity: 0;
position: relative;
}
.message {
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
width: 100%;
}
.message svg {
display: inline-block;
fill: none;
margin-right: 5px;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 2;
}
.submitMessage .button-text span {
top: 8px;
transition: all 0.2s ease var(--d);
}
.submitMessage svg {
color: #5c86ff;
margin-left: -1px;
opacity: 0;
position: relative;
top: 30px;
transition: top 0.4s ease, opacity 0.3s linear;
width: 14px;
}
.loadingMessage {
opacity: 0;
transition: opacity 0.3s linear 0.3s, top 0.4s cubic-bezier(0.22, 0, 0.41, -0.57);
}
.loadingMessage svg {
fill: #5c86ff;
margin: 0;
width: 22px;
}
.successMessage .button-text span {
left: 5px;
transition: all 0.2s ease var(--dr);
}
.successMessage svg {
color: #5cffa1;
stroke-dasharray: 20;
stroke-dashoffset: 20;
transition: stroke-dashoffset 0.3s ease-in-out;
width: 14px;
}
.loadingCircle:nth-child(2) {
animation-delay: 0.1s;
}
.loadingCircle:nth-child(3) {
animation-delay: 0.2s;
}
</style>
<script id="sc1">
if (document.location.search.match(/type=embed/gi)) {
window.parent.postMessage("resize", "*");
}
</script>
</head>
<body>
<canvas id="canvas"></canvas>
<button id="button" class="ready" onclick="clickButton();">
<div class="message submitMessage">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 12.2">
<polyline stroke="currentColor" points="2,7.1 6.5,11.1 11,7.1 "/>
<line stroke="currentColor" x1="6.5" y1="1.2" x2="6.5" y2="10.3"/>
</svg> <span class="button-text">Update</span>
</div>
<div class="message loadingMessage">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19 17">
<circle class="loadingCircle" cx="2.2" cy="10" r="1.6"/>
<circle class="loadingCircle" cx="9.5" cy="10" r="1.6"/>
<circle class="loadingCircle" cx="16.8" cy="10" r="1.6"/>
</svg>
</div>
<div class="message successMessage">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 11">
<polyline stroke="currentColor" points="1.4,5.8 5.1,9.5 11.6,2.1 "/>
</svg> <span class="button-text">Success</span>
</div>
</button>
<form action="second_form_pro.php" name="second" method="post" id="second" enctype="multipart/form-data">
<input type="file" id="file" accept="image/*" name="image" onchange="return fileValidation()">
<div class="box">
<span class="sp"><div class="profil-img" id="profile-image" onclick="document.getElementById('file').click()"></div><p name = "id"><?php echo $_SESSION["user"]; ?></p>
</span>
<div class="box2">
</div>
</div>
<div class="row" style="float: left;">
<span>
<input class="balloon" id="First_Name" name = "fname" type="text" value="<?php echo $row["firstname"]; ?>" placeholder="You are a Star" /><label for="firstname">First Name</label>
</span>
<span>
<input class="balloon" id="Last_Name" name = "lname" type="text" value="<?php echo $row["lastname"]; ?>" placeholder="Something left yet"/><label for="lastname">Last Name</label>
</span>
<span>
<input class="balloon" id="Email_Id" name = "email" type="text" value="<?php echo $row["email"]; ?>" placeholder="Tell your uniqueness!" /><label for="eid">Email Id</label>
</span>
<span>
<select class="skinny2" name="gender" id="gender" value="<?php echo $row["gender"]; ?>">
<option value="male">Male</option>
<option value="female">Female</option>
<option value="others">Others</option>
</select><label for="Gender">Gender</label>
</span>
<?php
$a=[""=>0,"male"=>0,"female"=>1,"others"=>2];
echo "<script>document.getElementById('gender').selectedIndex=".$a[$row['gender']].";
document.getElementById('profile-image').style.background= 'url(".explode("../", $row["img_dir"])[1].") no-repeat center';
document.getElementById('profile-image').style.backgroundSize = '145px 145px';
</script>";
?>
<span>
<input class="balloon" id="dob" name = "dob" type="date" value="<?php echo $row["birthday"]; ?>" placeholder="Years you passed!" />
<label for="DOB">Date of Birth</label>
</span><br>
<span>
<pre><a href="change_pass.php" style="z-index: 4;margin-top:90%" >Change Password</a></pre>
</span>
<div class="pos">
<div >
<span>
<textarea class="balloon2" id="bio" class="text" cols="20" rows ="5" name="bio" placeholder="Description"><?php echo $row["bio"]; ?></textarea><label for="move">Bio</label>
</span>
</div>
</div>
</div>
</form>
<?php
}
}
?>
<script type="text/javascript" src="Design_Components/jquery.min.js"></script>
<script>
function updatedb(){
var form = $('#second')[0];
$.ajax({
type:"POST",
url: "second_form_pro.php",
processData: false,
contentType: false,
enctype: 'multipart/form-data',
data: new FormData(form),
success: function(msg){
alert(msg);
}
});
}
function fileValidation() {
var fileInput =
document.getElementById('file');
var filePath = fileInput.value;
var allowedExtensions = /(\.jpg)$/i;
const fi = document.getElementById('file');
const fsize = fi.files.item(0).size;
const file = Math.round((fsize / 1024));
// The size of the file.
if (file >= 4024) {
alert(
"File too Big, please select a file less than 4 MB");
fileInput.value = '';
return false;
}
if (!allowedExtensions.exec(filePath)) {
alert('Only .jpg files are allowed');
fileInput.value = '';
return false;
}
else
{
if (fileInput.files && fileInput.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
document.getElementById('profile-image').style.background= "url("+e.target.result+") no-repeat center";
document.getElementById('profile-image').style.backgroundSize = "145px 145px";
};
reader.readAsDataURL(fileInput.files[0]);
}
}
}
</script>
<script id="rendered-js" >
// ammount to add on each button press
const confettiCount = 20;
const sequinCount = 10;
// "physics" variables
const gravityConfetti = 0.3;
const gravitySequins = 0.55;
const dragConfetti = 0.075;
const dragSequins = 0.02;
const terminalVelocity = 3;
// init other global elements
const button = document.getElementById('button');
var disabled = false;
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
let cx = ctx.canvas.width / 2;
let cy = ctx.canvas.height / 2;
// add Confetto/Sequin objects to arrays to draw them
let confetti = [];
let sequins = [];
// colors, back side is darker for confetti flipping
const colors = [
{ front: '#7b5cff', back: '#6245e0' }, // Purple
{ front: '#b3c7ff', back: '#8fa5e5' }, // Light Blue
{ front: '#5c86ff', back: '#345dd1' } // Darker Blue
];
// helper function to pick a random number within a range
randomRange = (min, max) => Math.random() * (max - min) + min;
// helper function to get initial velocities for confetti
// this weighted spread helps the confetti look more realistic
initConfettoVelocity = (xRange, yRange) => {
const x = randomRange(xRange[0], xRange[1]);
const range = yRange[1] - yRange[0] + 1;
let y = yRange[1] - Math.abs(randomRange(0, range) + randomRange(0, range) - range);
if (y >= yRange[1] - 1) {
// Occasional confetto goes higher than the max
y += Math.random() < .25 ? randomRange(1, 3) : 0;
}
return { x: x, y: -y };
};
// Confetto Class
function Confetto() {
this.randomModifier = randomRange(0, 99);
this.color = colors[Math.floor(randomRange(0, colors.length))];
this.dimensions = {
x: randomRange(5, 9),
y: randomRange(8, 15) };
this.position = {
x: randomRange(canvas.width / 2 - button.offsetWidth / 4, canvas.width / 2 + button.offsetWidth / 4),
y: randomRange(canvas.height / 2 + button.offsetHeight / 2 + 8, canvas.height / 2 + 1.5 * button.offsetHeight - 8) };
this.rotation = randomRange(0, 2 * Math.PI);
this.scale = {
x: 1,
y: 1 };
this.velocity = initConfettoVelocity([-9, 9], [6, 11]);
}
Confetto.prototype.update = function () {
// apply forces to velocity
this.velocity.x -= this.velocity.x * dragConfetti;
this.velocity.y = Math.min(this.velocity.y + gravityConfetti, terminalVelocity);
this.velocity.x += Math.random() > 0.5 ? Math.random() : -Math.random();
// set position
this.position.x += this.velocity.x;
this.position.y += this.velocity.y;
// spin confetto by scaling y and set the color, .09 just slows cosine frequency
this.scale.y = Math.cos((this.position.y + this.randomModifier) * 0.09);
};
// Sequin Class
function Sequin() {
this.color = colors[Math.floor(randomRange(0, colors.length))].back,
this.radius = randomRange(1, 2),
this.position = {
x: randomRange(canvas.width / 2 - button.offsetWidth / 3, canvas.width / 2 + button.offsetWidth / 3),
y: randomRange(canvas.height / 2 + button.offsetHeight / 2 + 8, canvas.height / 2 + 1.5 * button.offsetHeight - 8) },
this.velocity = {
x: randomRange(-6, 6),
y: randomRange(-8, -12) };
}
Sequin.prototype.update = function () {
// apply forces to velocity
this.velocity.x -= this.velocity.x * dragSequins;
this.velocity.y = this.velocity.y + gravitySequins;
// set position
this.position.x += this.velocity.x;
this.position.y += this.velocity.y;
};
// add elements to arrays to be drawn
initBurst = () => {
for (let i = 0; i < confettiCount; i++) {
confetti.push(new Confetto());
}
for (let i = 0; i < sequinCount; i++) {
sequins.push(new Sequin());
}
};
// draws the elements on the canvas
render = () => {
ctx.clearRect(0, 0, canvas.width, canvas.height);
confetti.forEach((confetto, index) => {
let width = confetto.dimensions.x * confetto.scale.x;
let height = confetto.dimensions.y * confetto.scale.y;
// move canvas to position and rotate
ctx.translate(confetto.position.x, confetto.position.y);
ctx.rotate(confetto.rotation);
// update confetto "physics" values
confetto.update();
// get front or back fill color
ctx.fillStyle = confetto.scale.y > 0 ? confetto.color.front : confetto.color.back;
// draw confetto
ctx.fillRect(-width / 2, -height / 2, width, height);
// reset transform matrix
ctx.setTransform(1, 0, 0, 1, 0, 0);
// clear rectangle where button cuts off
if (confetto.velocity.y < 0) {
ctx.clearRect(canvas.width / 2 - button.offsetWidth / 2, canvas.height / 2 + button.offsetHeight / 2, button.offsetWidth, button.offsetHeight);
}
});
sequins.forEach((sequin, index) => {
// move canvas to position
ctx.translate(sequin.position.x, sequin.position.y);
// update sequin "physics" values
sequin.update();
// set the color
ctx.fillStyle = sequin.color;
// draw sequin
ctx.beginPath();
ctx.arc(0, 0, sequin.radius, 0, 2 * Math.PI);
ctx.fill();
// reset transform matrix
ctx.setTransform(1, 0, 0, 1, 0, 0);
// clear rectangle where button cuts off
if (sequin.velocity.y < 0) {
ctx.clearRect(canvas.width / 2 - button.offsetWidth / 2, canvas.height / 2 + button.offsetHeight / 2, button.offsetWidth, button.offsetHeight);
}
});
// remove confetti and sequins that fall off the screen
// must be done in seperate loops to avoid noticeable flickering
confetti.forEach((confetto, index) => {
if (confetto.position.y >= canvas.height) confetti.splice(index, 1);
});
sequins.forEach((sequin, index) => {
if (sequin.position.y >= canvas.height) sequins.splice(index, 1);
});
window.requestAnimationFrame(render);
};
// cycle through button states when clicked
clickButton = () => {
if (!disabled) {
updatedb();
disabled = true;
// Loading stage
button.classList.add('loading');
button.classList.remove('ready');
setTimeout(() => {
// Completed stage
button.classList.add('complete');
button.classList.remove('loading');
setTimeout(() => {
window.initBurst();
setTimeout(() => {
// Reset button so user can select it again
disabled = false;
button.classList.add('ready');
button.classList.remove('complete');
}, 4000);
}, 320);
}, 1800);
}
};
//re-init canvas if the window size changes
resizeCanvas = () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
cx = ctx.canvas.width / 2;
cy = ctx.canvas.height / 2;
};
// resize listenter
window.addEventListener('resize', () => {
resizeCanvas();
});
// click button on spacebar or return keypress
/*
document.body.onkeyup = e => {
if (e.keyCode == 13) {
//clickButton();
}
};
*/
// Set up button text transition timings on page load
textElements = button.querySelectorAll('.button-text');
textElements.forEach(element => {
characters = element.innerText.split('');
let characterHTML = '';
characters.forEach((letter, index) => {
characterHTML += `<span class="char${index}" style="--d:${index * 30}ms; --dr:${(characters.length - index - 1) * 30}ms;">${letter}</span>`;
});
element.innerHTML = characterHTML;
});
// kick off the render loop
render();
</script>
<script src="https://cpwebassets.codepen.io/assets/editor/iframe/iframeRefreshCSS-4793b73c6332f7f14a9b6bba5d5e62748e9d1bd0b5c52d7af6376f3d1c625d7e.js"></script>
</body>
</html>