-
Notifications
You must be signed in to change notification settings - Fork 1
/
profile.php
152 lines (145 loc) · 5.42 KB
/
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
<?php
//$page_title = "Profile page";
//include_once 'parseProfile.php';
$conn = mysqli_connect("localhost","root","","studentconcession");
if(!$conn){
echo "<script type='text/javascript'>alert('Database failed');</script>";
die('Could not connect: '.mysqli_connect_error());
}
//echo "<script type='text/javascript'>alert('Connection successful');</script>";
/*$regid = 0;
$fname = "";
$lname = "";
$email = "";
$gender = "";*/
session_start();
$regid = $_SESSION['regid'];
//echo "<script type='text/javascript'>alert('$regid');</script>";
$sql = "SELECT * FROM students WHERE p_regid = '$regid' ";
$sql_result = mysqli_query($conn,$sql);
//echo "<script type='text/javascript'>alert('query executed');</script>";
/*$rows = mysqli_fetch_assoc($sql_result);
$regid = $rows['p_regid'];
$fname = $rows['p_fname'];
$lname = $rows['p_lname'];
$email = $rows['p_email'];
$gender = $rows['p_gender'];*/
$sql1 = "SELECT * FROM details WHERE p_regid = '$regid' ";
$sql_result1 = mysqli_query($conn,$sql1);
$user_pic = "images/".$regid;
$default = "images/default.jpg";
if(file_exists($user_pic)){
$profile_picture = $user_pic;
}
else{
$profile_picture = $default;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" />
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600&display=swap');
body{
background: #1A1E25;
color: white;
font-family: 'Poppins', sans-serif;
}
h1{
margin-top: 30px;
margin-left: 50px;
margin-bottom: 30px;
}
table, th, td {
border: 1px solid white;
border-collapse: collapse;
text-align: left;
justify-content: center;
margin-left: 50px;
/*margin-top: 40px;*/
padding: 7px;
}
a{
color: white;
text-align-last: auto;
}
i{
color: white;
}
img{
margin-left: 50px;
}
.button{
display: inline;
align-items: center;
justify-content: center;
height: 45px;
max-width: 200px;
width: 100%;
border: none;
outline: none;
color: #000;
border-radius: 5px;
margin: 25px 25px;
background-color: #00fecb;
transition: all 0.3s linear;
cursor: pointer;
font-size: 18px;
font-weight: 400;
margin-left: 50px;
}
#button:hover{
background-color: #027256;
}
</style>
</head>
<body>
<div class="container" id="content">
<div>
<h1>Profile</h1>
<section class="col col-lg-7">
<div class="row col-lg-3">
<img src="<?php if(isset($profile_picture)) echo $profile_picture; ?>" class="img img-rounded" width="200">
</div><br>
<table class="table table-bordered table-condensed" style="border: 1px black;">
<?php while($rows = mysqli_fetch_assoc($sql_result)){ ?>
<tr><th style="width: 20%;">Registration ID:</th><td><?php echo $rows['p_regid']; ?></td></tr>
<tr><th>Name:</th><td><?php echo $rows['p_fname']." ".$rows['p_lname']; ?></td></tr>
<tr><th>Email:</th><td><?php echo $rows['p_email']; ?></td></tr>
<tr><th>Gender:</th><td><?php echo $rows['p_gender']; ?></td></tr>
<?php }?>
<?php while($rows1 = mysqli_fetch_assoc($sql_result1)){ ?>
<tr><th>Mobile Number:</th><td><?php echo $rows1['p_mob']; ?></td></tr>
<tr><th>Date of Birth:</th><td><?php echo strftime("%b %d, %Y",strtotime($rows1['p_dob'])); ?></td></tr>
<tr><th>Address:</th><td><?php echo $rows1['p_address']; ?></td></tr>
<tr><th>City:</th><td><?php echo $rows1['p_city']; ?></td></tr>
<tr><th>State:</th><td><?php echo $rows1['p_state']; ?></td></tr>
<tr><th>Semester:</th><td><?php echo $rows1['p_sem']; ?></td></tr>
<tr><th>Year:</th><td><?php echo $rows1['p_year']; ?></td></tr>
<tr><th>Program:</th><td><?php echo $rows1['p_program']; ?></td></tr>
<tr><th>Branch:</th><td><?php echo $rows1['p_branch']; ?></td></tr>
<?php }?>
<tr><th></th><td><a class="pull-right" href="#"><i class="fa-solid fa-pen-to-square"></i>
Edit Profile</a></td></tr>
</table>
<br><br>
<button class="button" id="button">Generate PDF</button>
</section>
</div>
</div>
<script>
var button = document.getElementById("button");
var makepdf = document.getElementById("content");
button.addEventListener("click", function() {
var mywindow = window.open("", "PRINT", "height=400,width=600");
mywindow.document.write(makepdf.innerHTML);
mywindow.document.close();
mywindow.focus();
mywindow.print();
mywindow.close();
return true;
});
</script>
</body>
</html>