<?php
require_once('config.php');
/*
id fullname user_name dp gender dob mood history past_history treatments address fu_plans
*/
$active='profile';
// page title
$pagetitle="View Patient - ".$sitename;
$styles.='
.leftcl {
padding-right:10px;
float: left;
width: 200px;
border-right: 1px solid #ccc;
margin-bottom:10px;
}
.leftcl a {
padding-bottom:5px;
padding-top:5px;
border-bottom:1px solid #ccc;
display:block;
}
.leftcl a:hover {
color:rgb(226,4,4);
background:#eee;
}
.dp {
width: 200px;
height: 200px;
border:1px solid #ccc;
}
.ptheader {
width:509px;
padding-left:10px;
float:left;
margin-bottom:10px;
}
.h_line {
border-bottom:1px solid #ddd;display:block;margin-bottom:10px;overflow:hidden;
}
.cltitle {
//color: rgb(153, 153, 153);
color:#666;font-weight: bold;line-height: 15px;text-align: left;word-wrap: break-word;float:left;
}
.clarea {
float:right;
display:block;
font-family: Verdana, sans-serif;
}
#posts_container, #photos, #pt_wrapper {
clear:both;
border-bottom:1px solid #ccc;
min-height:300px;
margin-top:50px;
border-top:1px dashed #ccc;
display:block;
padding-bottom:20px;
}
.post {
padding-top:20px;
padding-bottom:20px;
border-bottom:dashed 1px #dedede;
overflow:auto;
}
.post:hover {
background:#eee;
}
.status {
word-wrap:break-word;
padding:5px;
border-bottom:1px solid #ccc;
}
.status b {
color:#006699;
}
.st_time {
font-size:11px;
color:#999;
font-family:Arial, Helvetica, sans-serif;
margin-top:3px;
text-align:right;
}
';
require_once('header.php');
function age($dob) {
list($d,$m,$y) = explode('-', $dob);
if (($m = (date('m') - $m)) < 0) {
$y++;
} elseif ($m == 0 && date('d') - $d < 0) {
$y++;
}
return date('Y') - $y;
}
function time_stamp($session_time)
{
$time_difference = time() - $session_time ;
$seconds = $time_difference ;
$minutes = round($time_difference / 60 );
$hours = round($time_difference / 3600 );
$days = round($time_difference / 86400 );
$weeks = round($time_difference / 604800 );
$months = round($time_difference / 2419200 );
$years = round($time_difference / 29030400 );
if($seconds <= 60)
{
return "$seconds seconds ago";
}
else if($minutes <=60)
{
if($minutes==1)
{
return "one minute ago";
}
else
{
return "$minutes minutes ago";
}
}
else if($hours <=24)
{
if($hours==1)
{
return "one hour ago";
}
else
{
return "$hours hours ago";
}
}
else if($days <=7)
{
if($days==1)
{
return "one day ago";
}
else
{
return "$days days ago";
}
}
else if($weeks <=4)
{
if($weeks==1)
{
return "one week ago";
}
else
{
return "$weeks weeks ago";
}
}
else if($months <=12)
{
if($months==1)
{
return "one month ago";
}
else
{
return "$months months ago";
}
}
else
{
if($years==1)
{
return "one year ago";
}
else
{
return "$years years ago";
}
}
}
if($_GET['id']){
$id=mysql_real_escape_string($_GET['id']);
$uq=mysql_query("SELECT * FROM $tbl2 WHERE id='$id'") or print_r("ERROR");
$u=mysql_fetch_array($uq);
if(mysql_num_rows($uq)=='0'){
echo '<h1>Not found</h1>';
echo '<p style="margin-left:20px;">Sorry, you entered an invalid input. <a href="/patients">Click here</a> to go back.</p>';
} else {
$age=$u['dob'];
$age=age($age);
$name=$u['fullname'];
$mood=$u['mood'];
$user=$u['user_name'];
$gender=$u['gender'];
$addr=$u['address'];
$past_history=$u['past_history'];
$history=$u['history'];
$treatments=$u['treatments'];
$fu_plans=$u['fu_plans'];
$dp=$u['dp'];
?>
<h1>Profile of <?=$name?></h1>
<div class="leftcl">
<img src="<?=$dp?>" class="dp" />
<div style="padding-bottom:30px;margin-top:20px;">
<a href="/patients/<?=$id?>">Profile</a>
<a href="/patients/<?=$id?>/photos">View Photos</a>
<a href="/patients/<?=$id?>/photos">Guestbook (Comments)</a>
</div>
</div>
<div class="ptheader">
<div class="h_line">
<span class="cltitle">Name: </span> <span class="clarea"><?=$name?></span></div>
<div class="h_line">
<span class="cltitle">Age: </span> <span class="clarea"> <?=$age?></span></div>
<div class="h_line">
<span class="cltitle">Gender: </span> <span class="clarea"> <?=$gender?></span></div>
<div class="h_line">
<span class="cltitle">Mood: </span> <span class="clarea"> <?=$mood?></span></div>
<div class="h_line">
<span class="cltitle">Address: </span> <span class="clarea"><?=$addr?></span></div>
<div class="h_line">
<span class="cltitle">History: </span> <span class="clarea"><?=$history?></span></div>
<div class="h_line">
<span class="cltitle">Past History: </span> <span class="clarea"><?=$past_history?></span></div>
<div class="h_line">
<span class="cltitle">Future Plans: </span> <span class="clarea"><?=$fu_plans?></span></div>
<div class="h_line">
<span class="cltitle">Treatments: </span> <span class="clarea"><?=$treatments?></span></div>
</div>
<?php if($_GET['view']=='photos'){ ?>
<div id="photos">
<h2 class="h2">Photos</h2>
<div class="gallery">
<?php
foreach(glob("uploads/folks/images/$user*.*") as $filename){
$filename=' <a class="image-link" href="/thumber.php?img='.$filename.'&h=800" data-lightbox="example-set" title="Image of '.$name.'"><img class="image" src="/thumber.php?img='.$filename.'&h=200" alt="'.$name.'\'s image" width="150" height="150"/></a>';
echo $filename;
}
?>
</div>
</div>
<?php } elseif($_GET['view']=='guestbook') { ?>
<h2 class="h2">Guestbook</h2>
<div id="pt_wrapper">
<?php if($_GET['action']=='add'){ ?>
<?php if($_POST['email'] && $_POST['name'] $$ $_POST['comment']){
$time=time();
$sql=mysql_query("INSERT INTO $tbl_name(user, name, email, comment, datetime)VALUES('$user', '$name', '$email', '$comment', '$time')") or die(mysql_error());
echo 'Your comment has been posted! <br/>Click <a href="/patients/'.$id.'/guestbook">here</a> to view the Guestbook.';
} else {
?>
<b>Post Your Comment</b>
<form id="form1" name="form1" method="post" action="">
Name:<br/>
<input name="name" type="text" id="name" size="40" /><br/><br/>
Email:<br/>
<input name="email" type="text" id="email" size="40" /><br/><br/>
Comment:<br/>
<textarea name="comment" cols="40" rows="3" id="comment"></textarea><br/><br/>
<input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" />
<?php
}
} else { ?>
<div style="float:right;"><a href="/patients/<?=$user?>/guestbook/add">Add a Comment</a></div>
<?php
$qcomments=mysql_query("SELECT * FROM guestbook WHERE user='$user' ORDER BY id DESC") or print_r("error fetching comments");
while($post=mysql_fetch_array($qposts)){
echo "<div class=\"post\">";
echo "<div class=\"status\">".$post['comment']."</div>";
echo "<div class=\"st_time\">By ".$post['name']." about ".time_stamp($post['time'])."</div>";
echo "</div>";
}
?>
<div align="center"><a href="/patients/<?=$user?>/guestbook/add">Add a Comment</a></div>
<?php } ?>
</div>
<?php } else { ?>
<div id="posts_container">
<h2 class="h2">Status Updates</h2>
<?php
$qposts=mysql_query("SELECT * FROM pt_updates WHERE user='$user' ORDER BY id DESC") or print_r("error fetching status updates");
while($post=mysql_fetch_array($qposts)){
echo "<div class=\"post\">";
echo "<div class=\"status\">".$post['status']."</div>";
echo "<div class=\"st_time\">".time_stamp($post['time'])."</div>";
echo "</div>";
}
?>
</div>
<?php } ?>
<?php
}
} else {
?>
<h1>Patient Profile</h1>
<form style="margin-left:20px;" method="GET" action="" >
Please enter the id of the person to view his/her profile!<br/>
<input class="input" style="margin:20px;" size="50" type="text" name="id" id="id" placeholder="E.g 4535..." />
<input class="btn-submit" type="submit" name="submit" value="Get Profile" />
</form>
<?php
}
require_once('sidebar.php');
require_once('footer.php');
?>
- Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.22
- Parse error: syntax error, unexpected '$' in /in/HG4IH on line 278
Process exited with code 255.
preferences:
191.14 ms | 1395 KiB | 58 Q