-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile3.php
More file actions
64 lines (57 loc) · 2.17 KB
/
Copy pathprofile3.php
File metadata and controls
64 lines (57 loc) · 2.17 KB
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
<?php
$pdo = new PDO('mysql:host=localhost; port=3306; dbname=misc', 'kings', 'zap');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
session_start();
require_once "util.php";
if(!isset($_SESSION['user_id']) && !isset($_SESSION['name'])) {
die('You are not logged in');
return false;
}
if(!isset($_GET['profile_id'])){
$_SESSION['error'] = "Missing profile ID";
header('location: user_acc3.php');
return;
}
if(isset($_POST['submit'])) {
header('location: user_acc3.php');
return;
}
?>
<h1>Profile resume details</h1>
<?php
$stmt = $pdo->prepare('SELECT * FROM profile WHERE profile_id = :std');
$stmt->execute(array(':std' => $_GET['profile_id']));
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
if($row === false){
$_SESSION['error'] = "Bad value for profile_id";
header('location: user_acc3.php');
return;
}
echo '<p>First name: '.$row['First_name'].'</p>';
echo '<p>Last name: '.$row['Last_name'].'</p>';
echo '<p>Email: '.$row['Email'].'</p>';
echo '<p>Headline: '.$row['Headline'].'</p>';
echo '<p>Summary: '.$row['Summary'].'</p>';
}
//load education
$schools = loadEdu($pdo, $_REQUEST['profile_id']);
foreach($schools as $school) {
echo '<ul><li>Education year = '.$school['year'].'</li></ul>';
echo '<ul><li>School = '.$school['name'].'</li></ul>';
}
$stmt = $pdo->prepare('SELECT * FROM position WHERE profile_id = :std');
$stmt->execute(array(':std' => $_GET['profile_id']));
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
if($row === false){
$_SESSION['error'] = "Bad value for profile_id";
header('location: user_acc3.php');
return;
}
echo '<ul><li>Rank = '.$row['rank'].'</li></ul>';
echo '<ul><li>Year = '.$row['year'].'</li></ul>';
echo '<ul><li>Description = '.$row['description'].'</li></ul>';
}
?>
<form method="POST">
<input type="submit"name="submit" value="Done">
</form>