 








|
|
include("include/session.php");
include("include/usermenu.php");
show_menubar();
if (!($session->logged_in)) {
show_login();
exit;
}
#print "lvl:".$session->userlevel." ";
if ($session->userlevel < MEMBER_LEVEL) {
print "Sorry, you do not have permission to access this page. ";
print "Back to Main ";
return;
}
if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))) {
print "You must enable referrer logging to use the form ";
exit;
}
$session->username;
# Process submitted form.
if(isset($_REQUEST['name']) && !empty($_REQUEST['name'])) {
$name = $_REQUEST['name'];
$phone = $_REQUEST['phone'];
$address = $_REQUEST['address'];
$medicine = $_REQUEST['medicine'];
$allergies = $_REQUEST['allergies'];
$medical_conditions = $_REQUEST['medical_conditions'];
$doctor_name = $_REQUEST['doctor_name'];
$doctor_phone = $_REQUEST['doctor_phone'];
$username = $session->username;
$query = "select `username` from medical_info
where username = '".$session->username."'";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
$row_count = mysql_num_rows($result);
if ($row_count == 0) {
$sql = 'INSERT INTO `medical_info` (`username`, `name`, `phone`, `address`, `medicine`, `allergies`, `medical_conditions`, `doctor_name`, `doctor_phone`, `modification_date`)
VALUES (\''.$username.'\',
\''.$name.'\',
\''.$phone.'\',
\''.$address.'\',
\''.$medicine.'\',
\''.$allergies.'\',
\''.$medical_conditions.'\',
\''.$doctor_name.'\',
\''.$doctor_phone.'\',
now())';
} else {
$sql = 'UPDATE medical_info
set name="'.$name.'",
phone="'.$phone.'",
address="'.$address.'",
medicine="'.$medicine.'" ,
allergies="'.$allergies.'" ,
medical_conditions="'.$medical_conditions.'" ,
doctor_name="'.$doctor_name.'" ,
doctor_phone="'.$doctor_phone.'" ,
modification_date=now()
where username = "'.$username.'"';
}
# print "$sql ";
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
} else {
$query = "select `username` , `name` , `phone` , `address` , `medicine` ,
`allergies` , `medical_conditions` , `doctor_name` , `doctor_phone`, `modification_date`
from medical_info
where username = '".$session->username."'";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
$row_count = mysql_num_rows($result);
if ($row_count > 0) {
list ($username, $name, $phone, $address, $medicine,
$allergies, $medical_conditions, $doctor_name,
$doctor_phone, $modification_date) = mysql_fetch_row($result);
#$out = "No Records Found";
#return $out;
}
}
?>
Emergency Contact and Medical Information
Please update this information any time there is a major change. This information will be invaluable in the event there is an emergency situation.
All information is kept confidential and will not be released without your permissoin.
This information WILL BE PROVIDED to PPS Medical.
|
|