PlacementExperience
profile.php
Go to the documentation of this file.
1 <?php
2 include 'server.php';
12 session_start();
13 error_reporting(0);
17 if(isset($_SESSION['loggedin']))
18 {
19  $error = array();
20  $servername = "localhost";
21  $username = "root";
22  $pass = "";
23  $dbname = "webpage";
24 
25  $db = mysqli_connect($servername, $username, $pass, $dbname);
26 
27 
28  if (!$db) {
29  die("Connection failed: " . mysqli_connect_error());
30  }
31  ?>
32 
33 <!DOCTYPE html>
34 <html lang="en">
35  <head>
36  <title>PlacementExperience | Profile</title>
37  <!-- Bootstrap -->
38  <meta charset="utf-8">
39  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
40  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
41 
42  <!-- Google Font -->
43  <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@700&display=swap" rel="stylesheet">
44  <link href="https://fonts.googleapis.com/css2?family=Nunito:wght@800&family=Roboto+Mono&display=swap" rel="stylesheet">
45  <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@500&display=swap" rel="stylesheet">
46  <!--user icon -->
47  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
48  <!-- External CSS -->
49  <link rel="stylesheet" type="text/css" href="css/style.css">
50  <link rel="stylesheet" href="css/style_yourpost.css">
51 
52  <script type="text/javascript">
56  function confirmationDelete(anchor)
57  {
58  var conf = confirm('Are you sure want to delete this record?');
59  if(conf)
60  window.location=anchor.attr("href");
61  }
62  </script>
63  </head>
64 
65  <body>
66 
67  <div class="row">
68 
69  <div class="col-sm-3" style="left:0px;">
70  <div class="container-fluid sidenav">
71  <a href="mainpage.php"><img src="img/logoo.png" style="width:100px; margin-top:15px;"></a>
72  <br><br>
73 
74  <div id="cse">
75  <a style="text-decoration: none;" href="https://www.cse.iitb.ac.in" target="_blank">
76  <h6 style="text-align: center;">Department of</h6>
77  <h6 style="text-align: center;">Computer Science and Engineering</h6>
78  <h5 style="text-align: center;">IIT Bombay</h5>
79  </a>
80  </div>
81  <br><br>
82  <ul>
83  <li><a href="mainpage.php"> HOME </a></li>
84  <li><a href="posts.php"> POSTS </a></li>
85  <li><a href="exp_form.php">SHARE</a></li>
86  <li><a href="profile.php"> PROFILE </a></li>
87  </ul>
88  <br><br>
89  <div id="iLinks">
90  <h5>Important Links</h5>
91  <ul>
92  <li style="font-size:10px;"><a href="http://www.iitb.ac.in/" target=_blank> IITB Home</a></li>
93  <li style="font-size:10px;"><a href="https://www.cse.iitb.ac.in/"> CSE@IITB </a></li>
94  <li style="font-size:10px;"><a href="https://asc.iitb.ac.in/"> ASC </a></li>
95  </ul>
96  </div>
97  <br><br>
98  </div>
99  </div>
100 
101  <div class="container-fluid col-md-8 whole" style="margin-top:0px;">
102 
103  <div class="row">
104  <div class="col-sm-8 main" id="title">
105  <img src="img/heading_trans.png" alt="placementExperience" style="align-content: center; margin-left: 25%; margin-right: 25%;">
106  </div>
107  <div class="col-sm-4" style="left:0px; padding-top:20px; vertical-align: center;">
108  <button id="logout" type="button" class="btn btn-info btn-round" style="float:right;">
109  Logout
110  </button>
111  <a href="profile.php"><i class="fa fa-user-circle-o" style="font-size:36px; float:right; padding-right:10px;" ></i></a>
112  </div>
113  </div>
114 
115  <hr class="lineform">
116  <h3 style="color: #e67f11">Profile</h3><br>
117 
118  <?php
119  $user_email = $_SESSION['Logged_email'];
120 
121  $sql_smt= "SELECT name, roll, email, branch FROM student WHERE email = '$user_email' ";
122 
123  $result = mysqli_query($db, $sql_smt);
124 
125  if (mysqli_num_rows($result) > 0) {
126  $row = mysqli_fetch_assoc($result)
127  ?>
128 
129  <div>
130  <table>
131  <th>Name</th>
132  <th>Roll No.</th>
133  <th>Branch</th>
134  <th>Email</th>
135  <tr>
136  <?php echo '<td>'.$row['name'].'</td>'; ?>
137  <?php echo '<td>' .$row['roll']. '</td>'; ?>
138  <?php echo '<td>' .$row['branch']. '</td>'; ?>
139  <?php echo '<td>' .$row['email']. '</td>';
140  echo '</tr>';
141 
142  }
143 
144  mysqli_close($conn);
145  ?>
146  </table>
147  </div>
148  <br>
149 
150  <h3 style="color: #e67f11"> Your Posts : </h3>
151  <table>
152  <th>Company</th>
153  <th>Posted On</th>
154  <th>Update</th>
155  <th>Delete</th>
156 
157  <?php
161  $user_email = $_SESSION['Logged_email'];
162  $sql_smt= "SELECT id, companyname, created_at FROM posts WHERE email = '$user_email' ORDER BY created_at DESC";
163 
164  $result = mysqli_query($db, $sql_smt);
165 
166  if (mysqli_num_rows($result) > 0) {
167  while($row = mysqli_fetch_assoc($result)) {
168  echo '<tr>';
169  echo '<td>'.$row['companyname'].'</td>';
170  echo '<td>'.date('jS M Y', strtotime($row['created_at'])).'</td>';
171 
172  mysqli_close($conn);
173  ?>
174 
175  <td>
176  <button class="editbtn"><a href="edit_exp.php?id=<?= $row['id']; ?>">Edit</a></button>
177  </td>
178  <td>
179  <button class="delbtn"><a onclick='javascript:confirmationDelete($(this));return false;' href="delpost.php?id=<?= $row['id']; ?>">Delete</a></button>
180  </td>
181 
182  <?php
183  echo '</tr>';
184  }
185  }
186 
187  ?>
188 
189  </table>
190  <br>
191  <button class="editbtn"><a href="exp_form.php">Add New Experience</a></button>
192  <br><br>
193  </div>
194 
195  </div>
196  <br><br>
197 
198  <div class="footer">
199  <p style="color:#e88924">&#9400; Copyright@IITB</p>
200  </div>
201 
202  <!-- Bootstrap scripts -->
203 
204  <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
205  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
206  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
207 
208  <script type="text/javascript">
209  document.getElementById("logout").onclick = function () {
210  location.href = "logout.php";
211  };
212  </script>
213 
214  </body>
215 </html>
216 
217 
218 <?php
219 }
223 else{
224  header("location: index.php");
225 }
226 ?>