forked from sushant-hiray/car-pool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.php
139 lines (127 loc) · 3.94 KB
/
profile.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
/*
* The landing page that lists all the problem
*/
require_once('functions.php');
if(!loggedin())
header("Location: login.php");
else
include('header.php');
connectdb();
?>
<div class="container">
<?php
if(isset($_GET['share']))
echo("<div class=\"alert alert-info\">\nYour Ride was succesfully added! You can edit it from your profile\n</div>");
else if(isset($_GET['nerror']))
echo("<div class=\"alert alert-error\">\nPlease enter all the details asked before you can continue!\n</div>");
?>
<?php
include('menu.php');
?>
<div class="row-fluid" id="main-content">
<div class="span5"></div>
<div class="span5">
<?php if(isset($_GET['id'])){
$query="SELECT * from users where uid=".$_GET['id'];
$res=mysql_query($query);
$fetch=mysql_fetch_array($res);
$name=$fetch['name'];
$email=$fetch['email'];
$gender=$fetch['gender'];
$contact=$fetch['contactno'];
$desc=$fetch['description'];
$credits=$fetch['credits'];
$id=$_GET['id'];
if($gender=="M")$sex="Male";
else $sex="Female";
$badge="Newbie in town";
$rank="SELECT uid from users ORDER BY credits DESC";
$resul=mysql_query($rank);
$num=mysql_num_rows($resul);
$top=$num/3;
$middle=$top * 2;
$i=1;
while($row=mysql_fetch_array($resul)){
if($row['uid']==$id){
if($i<=$top){
$badge="Trusted Car Pooler";
}
else if($i<=$middle){
$badge="Budding Car Pooler";
}
else{
$badge="Newbie in town";
}
}
$i++;
}
echo "<p>Name: <strong>".$name." </strong></p>";
echo "<p>Email Id: <strong>".$email."</strong></p>";
echo "<p>Gender: <strong>".$sex." </strong></p>";
echo "<p>Contact: <strong>".$contact."</strong></p>";
echo "<p>Description: <strong>".$desc."</strong></p>";
echo "<p>Carbon Credits: <strong>".$credits." </strong></p>";
echo "<p>Badge:<span class='label label-success'> ".$badge."</span></p>";
}
else{
$email=$_SESSION['username'];
$query="SELECT * from users where email='".$email."'";
$uid=getUserid();
$res=mysql_query($query);
$fetch=mysql_fetch_array($res);
$name=$fetch['name'];
$email=$fetch['email'];
$gender=$fetch['gender'];
$contact=$fetch['contactno'];
$desc=$fetch['description'];
$credits=$fetch['credits'];
$badge="Newbie in town";
$rank="SELECT * from users ORDER BY credits DESC";
$resul=mysql_query($rank);
$num=mysql_num_rows($resul);
$top=$num/3;
$middle=$top * 2;
$i=1;
while($row=mysql_fetch_array($resul)){
if($row['uid']==$uid){
if($i<=$top){
$badge="Trusted Car Pooler";
}
else if($i<=$middle){
$badge="Budding Car Pooler";
}
else{
$badge="Newbie in town";
}
}
$i++;
}
if($gender=="M")$sex="Male";
else $sex="Female";
echo "<p>Name: <strong>".$name." </strong></p>";
echo "<p>Email Id: <strong>".$email."</strong></p>";
echo "<p>Gender: <strong>".$sex." </strong></p>";
echo "<p>Contact: <strong>".$contact."</strong></p>";
echo "<p>Description: <strong>".$desc."</strong></p>";
echo "<p>Carbon Credits: <strong>".$credits." </strong></p>";
echo "<p>Badge:<span class='label label-success'> ".$badge."</span></p>";
}
?>
</div>
<div class="span2"></div>
</div>
</div>
<div id="push"></div>
</div> <!-- /wrap -->
<div id="footer">
<div class="container">
<p class="muted credit">Built with love by <a href="about.php">@sushant @ashish @nilesh.</a></p>
</div>
</div>
<!-- javascript files
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="js/bootstrap.min.js"></script>
</body></html>