profile.php
Go to the documentation of this file.
<?php
include 'server.php';
session_start();
error_reporting(0);
if(isset($_SESSION['loggedin']))
{
$error = array();
$servername = "localhost";
$username = "root";
$pass = "";
$dbname = "webpage";
$db = mysqli_connect($servername, $username, $pass, $dbname);
if (!$db) {
die("Connection failed: " . mysqli_connect_error());
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>PlacementExperience | Profile</title>
<!-- Bootstrap -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- Google Font -->
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@800&family=Roboto+Mono&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@500&display=swap" rel="stylesheet">
<!--user icon -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- External CSS -->
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" href="css/style_yourpost.css">
<script type="text/javascript">
function confirmationDelete(anchor)
{
var conf = confirm('Are you sure want to delete this record?');
if(conf)
window.location=anchor.attr("href");
}
</script>
</head>
<body>
<div class="row">
<div class="col-sm-3" style="left:0px;">
<div class="container-fluid sidenav">
<a href="mainpage.php"><img src="img/logoo.png" style="width:100px; margin-top:15px;"></a>
<br><br>
<div id="cse">
<a style="text-decoration: none;" href="https://www.cse.iitb.ac.in" target="_blank">
<h6 style="text-align: center;">Department of</h6>
<h6 style="text-align: center;">Computer Science and Engineering</h6>
<h5 style="text-align: center;">IIT Bombay</h5>
</a>
</div>
<br><br>
<ul>
<li><a href="mainpage.php"> HOME </a></li>
<li><a href="posts.php"> POSTS </a></li>
<li><a href="exp_form.php">SHARE</a></li>
<li><a href="profile.php"> PROFILE </a></li>
</ul>
<br><br>
<div id="iLinks">
<h5>Important Links</h5>
<ul>
<li style="font-size:10px;"><a href="http://www.iitb.ac.in/" target=_blank> IITB Home</a></li>
<li style="font-size:10px;"><a href="https://www.cse.iitb.ac.in/"> CSE@IITB </a></li>
<li style="font-size:10px;"><a href="https://asc.iitb.ac.in/"> ASC </a></li>
</ul>
</div>
<br><br>
</div>
</div>
<div class="container-fluid col-md-8 whole" style="margin-top:0px;">
<div class="row">
<div class="col-sm-8 main" id="title">
<img src="img/heading_trans.png" alt="placementExperience" style="align-content: center; margin-left: 25%; margin-right: 25%;">
</div>
<div class="col-sm-4" style="left:0px; padding-top:20px; vertical-align: center;">
<button id="logout" type="button" class="btn btn-info btn-round" style="float:right;">
Logout
</button>
<a href="profile.php"><i class="fa fa-user-circle-o" style="font-size:36px; float:right; padding-right:10px;" ></i></a>
</div>
</div>
<hr class="lineform">
<h3 style="color: #e67f11">Profile</h3><br>
<?php
$user_email = $_SESSION['Logged_email'];
$sql_smt= "SELECT name, roll, email, branch FROM student WHERE email = '$user_email' ";
$result = mysqli_query($db, $sql_smt);
if (mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_assoc($result)
?>
<div>
<table>
<th>Name</th>
<th>Roll No.</th>
<th>Branch</th>
<th>Email</th>
<tr>
<?php echo '<td>'.$row['name'].'</td>'; ?>
<?php echo '<td>' .$row['roll']. '</td>'; ?>
<?php echo '<td>' .$row['branch']. '</td>'; ?>
<?php echo '<td>' .$row['email']. '</td>';
echo '</tr>';
}
mysqli_close($conn);
?>
</table>
</div>
<br>
<h3 style="color: #e67f11"> Your Posts : </h3>
<table>
<th>Company</th>
<th>Posted On</th>
<th>Update</th>
<th>Delete</th>
<?php
$user_email = $_SESSION['Logged_email'];
$sql_smt= "SELECT id, companyname, created_at FROM posts WHERE email = '$user_email' ORDER BY created_at DESC";
$result = mysqli_query($db, $sql_smt);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
echo '<tr>';
echo '<td>'.$row['companyname'].'</td>';
echo '<td>'.date('jS M Y', strtotime($row['created_at'])).'</td>';
mysqli_close($conn);
?>
<td>
<button class="editbtn"><a href="edit_exp.php?id=<?= $row['id']; ?>">Edit</a></button>
</td>
<td>
<button class="delbtn"><a onclick='javascript:confirmationDelete($(this));return false;' href="delpost.php?id=<?= $row['id']; ?>">Delete</a></button>
</td>
<?php
echo '</tr>';
}
}
?>
</table>
<br>
<button class="editbtn"><a href="exp_form.php">Add New Experience</a></button>
<br><br>
</div>
</div>
<br><br>
<div class="footer">
<p style="color:#e88924">&#9400; Copyright@IITB</p>
</div>
<!-- Bootstrap scripts -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<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>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script type="text/javascript">
document.getElementById("logout").onclick = function () {
location.href = "logout.php";
};
</script>
</body>
</html>
<?php
}
else{
header("location: index.php");
}
?>