-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprofilepage.php
111 lines (90 loc) · 2.77 KB
/
profilepage.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
<html>
<head>
<title>LivFit - Login/Register</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="shortcut icon" href="images/ui/favicon.ico">
</head>
<body>
<?php include ("header.php"); ?>
<?php include ("nav.php"); ?>
<h1>Take a look at your stats</h1>
<div id=content>
<?php
//session_start(); // ?? Must be included in all pages using sessions?
if(isset($_SESSION['sid']) && isset($_SESSION['current_user']))
{
include("db.php");
$conn = mysql_connect($servername, $username, $password);
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}
$db = mysql_select_db($dbname, $conn);
$sql = "select * from users where username='".$_SESSION['current_user']."'";
//$sql = "select * from users where username=$sessionvariable";
$result = mysql_query($sql);
while($row=mysql_fetch_array($result))
{
$fn=$row[0];
$ln=$row[1];
$un=$row[2];
$pw_raw=$row[3];
//$pw="";
//for($i=0;$i<($pw_raw);$i++)
// $pw = $pw+"*";
$pw="******";
$sx=$row[4];
$dob=$row[5];
$ht=$row[6];
$wt=$row[7];
/*echo "Firstname: ".$row[0]. "<br>Lastname: ".$row[1].
"<br>Username: ".$row[2]. "<br>Password: " . $row[3].
"<br>Sex: ".$row[4]. "<br>Birthday: ".$row[5].
"<br>Height: ".$row[6]. "<br>Weight: ".$row[7];*/
}
}
else
die('Error (not logged in?)');
?>
<form class=formwhite>
<br>
<div>
<?php
echo '<h2>'.$fn.' '.$ln.' <a href="editprofile.php"><img src = "images/ui/editprofile.png"></a> </h2>';
?>
</div>
<div class=left>
<img src="images/ui/profile.png"></img>
</div>
<div class=right>
<!--
Firstname:
<input type="text" class="bmioutput" name="Firstname" value="<?php echo $fn;?>" readonly>
<br>
Lastname:
<input type="text" class="bmioutput" name="Lastname" value="<?php echo $ln;?>" readonly>
<br>
-->
Username:
<input type="text" class="bmioutput" name="Username" value="<?php echo $un;?>" readonly>
<br>
Password:
<input type="text" class="bmioutput" name="Password" value="<?php echo $pw;?>" readonly>
<br>
Sex:
<input type="text" class="bmioutput" name="sex" value="<?php echo $sx;?>" readonly>
<br>
Birthday:
<input type="text" class="bmioutput" name="Birthday" value="<?php echo $dob;?>" readonly>
<br>
Height (cm):
<input type="text" class="bmioutput" name="height" value="<?php echo $ht;?>" readonly>
<br>
Weight (kg):
<input type="text" class="bmioutput" name="weight" value="<?php echo $wt;?>" readonly>
</div>
</form>
<?php include ("footer.php"); ?>
</div>
</body>
</html>