-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
81 lines (64 loc) · 2.38 KB
/
index.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
<?php
include 'head.php';
session_start(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sudarshan Giri</title>
</head>
<body>
<div class="container">
<p><h2>RESUME REGISTRY OF Sudarshan Giri</h2></p>
<?php
if(isset($_SESSION['message'])){
echo $_SESSION['message'];
}
unset($_SESSION['message']);
if(isset($_SESSION['user_id'])){
echo " <p><a href='logout.php'> Logout</a></p>";
}
else{
echo " <p><a href='login.php'>Please log in</a></p>";
}
?>
<?php
include 'dbcon.php';
/*$sql="select * from users";
$stmt = $pdo->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $val){
echo "Name". $val['name'];
}
*/
$sql="select * from profile";
$stmt = $pdo->prepare($sql);
$stmt->execute();
//$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
?><table border="1">
<tr><th>Name</th><th>Headline</th> <?php if(isset($_SESSION['user_id'])){ ?>
<th>Action</th><tr> <?php }?>
<?php
while($result = $stmt->fetch()){
?>
<tr>
<td><a href="view.php?profile_id= <?php echo $result["profile_id"] ?>"><?php echo $result['first_name']; ?></a></td>
<td><?php echo $result['headline']; ?></td>
<?php if(isset($_SESSION['user_id'])){
?><td><a href='edit.php?profile_id= <?php echo $result["profile_id"] ?>'> Edit</a>
<a href="delete.php?profile_id= <?php echo $result["profile_id"] ?>"> Delete</a>
</td>
<?php
}?>
</tr>
<?php
} ?></table><?php
if(isset($_SESSION['user_id'])){
echo " <p><a href='add.php'>Add New Entry</a></p>";
}
?>
</div>
</body>
</html>