Ejemplo n.º 1
0
 function time_parser($detik)
 {
     if ($detik > 60) {
         $menit = floor($detik / 60);
         if ($menit > 60) {
             $jam = floor($menit / 60);
             $sisa = $menit % 60;
             return leading_zero($jam, 2) . ":" . leading_zero($sisa, 2);
         } else {
             return "00:" . leading_zero($menit, 2);
         }
     } else {
         return "00:00";
     }
 }
Ejemplo n.º 2
0
 protected function leading_zero($num, $places = 0)
 {
     if (defined('STRICT_TYPES') && CAMEL_CASE == '1') {
         return (string) self::parameters(['num' => [DT::INT64, DT::UINT64], 'places' => DT::UINT8])->call(__FUNCTION__)->with($num, $places)->returning(DT::STRING);
     } else {
         return (string) leading_zero($num, $places);
     }
 }
Ejemplo n.º 3
0
	if (count($error) > 0) {
		error('admin.php?action=members&job=edit&id='.$query['id'], $error);
	}
	else {
		// Now we create the birthday...
		if (empty($query['birthmonth']) || empty($query['birthday'])) {
			$query['birthmonth'] = 0;
			$query['birthday'] = 0;
			$query['birthyear'] = 0;
		}
		if (empty($_POST['birthyear'])) {
			$query['birthyear'] = 1000;
		}
		$query['birthmonth'] = leading_zero($query['birthmonth']);
		$query['birthday'] = leading_zero($query['birthday']);
		$query['birthyear'] = leading_zero($query['birthyear'], 4);
		$bday = $query['birthyear'].'-'.$query['birthmonth'].'-'.$query['birthday'];

		$query['icq'] = str_replace('-', '', $query['icq']);
		if (!is_id($query['icq'])) {
			$query['icq'] = 0;
		}

		if (!empty($query['pw']) && strlen($query['pw']) >= $config['minpwlength']) {
			$md5 = md5($query['pw']);
			$update_sql = ", pw = '{$md5}' ";
		}
		else {
			$update_sql = ' ';
		}
Ejemplo n.º 4
0
 function cb_plain_code($matches)
 {
     global $lang;
     $pid = $this->noparse_id();
     list(, , $code) = $matches;
     $rows = explode("\n", $code);
     $code = $this->code_prepare($code);
     if (count($rows) > 1) {
         $a = 0;
         $code = '';
         $lines = strlen(count($rows));
         foreach ($rows as $row) {
             $a++;
             $code .= leading_zero($a, $lines) . ": {$row}\n";
         }
         $this->noparse[$pid] = "\n" . $lang->phrase('bb_sourcecode') . "\n-------------------\n{$code}-------------------\n";
     } else {
         $this->noparse[$pid] = $code;
     }
     return '<!PID:' . $pid . '>';
 }
Ejemplo n.º 5
0
    if (($_POST['birthyear'] < gmdate('Y') - 120 || $_POST['birthyear'] > gmdate('Y')) && $_POST['birthyear'] != 0) {
        $error[] = $lang->phrase('editprofile_birthyear_incorrect');
    }
    if (strxlen($_POST['fullname']) > 128) {
        $error[] = $lang->phrase('editprofile_fullname_incorrect');
    }
    if (count($error) > 0) {
        error($error, "editprofile.php?action=profile" . SID2URL_x);
    } else {
        // Now we create the birthday...
        if (!$_POST['birthmonth'] && !$_POST['birthday'] && !$_POST['birthyear']) {
            $bday = '0000-00-00';
        } else {
            $_POST['birthmonth'] = leading_zero($_POST['birthmonth']);
            $_POST['birthday'] = leading_zero($_POST['birthday']);
            $_POST['birthyear'] = leading_zero($_POST['birthyear'], 4);
            $bday = $_POST['birthyear'] . '-' . $_POST['birthmonth'] . '-' . $_POST['birthday'];
        }
        $_POST['icq'] = str_replace('-', '', $_POST['icq']);
        if (!is_id($_POST['icq'])) {
            $_POST['icq'] = 0;
        }
        if ($config['changename_allowed'] == 1) {
            $changename = ", name = '{$_POST['name']}'";
        } else {
            $changename = '';
        }
        $db->query("UPDATE {$db->pre}user SET icq = '{$_POST['icq']}', yahoo = '{$_POST['yahoo']}', aol = '{$_POST['aol']}', msn = '{$_POST['msn']}', jabber = '{$_POST['jabber']}', birthday = '{$bday}', gender = '{$_POST['gender']}', hp = '{$_POST['hp']}', signature = '{$_POST['signature']}', location = '{$_POST['location']}', fullname = '{$_POST['fullname']}', mail = '{$_POST['email']}'{$changename} WHERE id = '{$my->id}' LIMIT 1", __LINE__, __FILE__);
        ok($lang->phrase('data_success'), "editprofile.php?action=profile" . SID2URL_x);
    }
} elseif ($_GET['action'] == "settings") {
/**
 * Returns the timezone for the current user (GMT +/-??:?? or just GMT).
 */
function getTimezone($base = null) {
	global $my, $lang;

	$tz = $lang->phrase('gmt');

	if ($base === null || $base === '') {
		$base = $my->timezone;
	}

	if ($base != 0) {
		preg_match('~^(\+|-)?(\d{1,2})\.?(\d{0,2})?$~', $base, $parts);
		$parts[2] = intval($parts[2]);
		$parts[3] = intval($parts[3]);
	}
	else {
		$parts = array(
			1 => '',
			2 => 0,
			3 => 0
		);
	}

	$summer = (date('I', times()) == 1);
	if ($summer && $parts[1] == '-') {
		$parts[2] = $parts[2] - 1;
	}
	else if ($summer) {
		$parts[2] = $parts[2] + 1;
	}

	if ($parts[2] != 0) {
		if (empty($parts[1])) {
			$parts[1] = '+';
		}

		$parts[2] = leading_zero($parts[2]);

		$parts[3] = $parts[3]/100*60;
		$parts[3] = leading_zero($parts[3]);

		$tz .= ' '.$parts[1].$parts[2].':'.$parts[3];
	}

	return $tz;
}
Ejemplo n.º 7
0
}
// Get the correct formatted timzone
$posneg = substr($my->timezone, 0, 1);
if ($posneg != '+' && $posneg != '-') {
    $posneg = '+';
    $mtz = $my->timezone;
} else {
    $mtz = substr($my->timezone, 1);
}
if (strpos($mtz, '.') === false) {
    $tz3 = '00';
    $tz2 = leading_zero($mtz, 2);
} else {
    $tz = explode('.', $mtz);
    $tz3 = $tz[1] / 100 * 60;
    $tz2 = leading_zero($tz[1], 2);
}
define("TIME_ZONE", $posneg . $tz2 . ':' . $tz3);
// Include the Feedcreator class
include "classes/class.feedcreator.php";
BBProfile($bbcode);
($code = $plugins->load('external_start')) ? eval($code) : null;
$action = strtoupper($_GET['action']);
$data = file('data/feedcreator.inc.php');
foreach ($data as $feed) {
    $feed = explode("|", $feed);
    $feed = array_map('trim', $feed);
    $f[$feed[0]] = array('class' => $feed[0], 'file' => $feed[1], 'name' => $feed[2], 'active' => $feed[3], 'header' => $feed[4]);
}
if (!isset($f[$action])) {
    $t = current($f);
Ejemplo n.º 8
0
 // Check for knowledge base stuff, prior to confirming:
 if ($_REQUEST['kbarticle'] == 'yes') {
     $sql = "INSERT INTO `{$dbKBArticles}` (doctype, title, distribution, author, published, keywords) VALUES ";
     $sql .= "('1', ";
     $sql .= "'{$kbtitle}', ";
     $sql .= "'{$distribution}', ";
     $sql .= "'" . mysql_real_escape_string($sit[2]) . "', ";
     $sql .= "'" . date('Y-m-d H:i:s', mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('Y'))) . "', ";
     $sql .= "'[{$id}]') ";
     mysql_query($sql);
     if (mysql_error()) {
         trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
     }
     $docid = mysql_insert_id();
     // Update the incident to say that a KB article was created, with the KB Article number
     $update = "<b>{$_SESSION['syslang']['strKnowledgeBaseArticleCreated']}: {$CONFIG['kb_id_prefix']}" . leading_zero(4, $docid);
     $sql = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, bodytext, timestamp) ";
     $sql .= "VALUES ('{$id}', '{$sit['2']}', 'default', '{$update}', '{$now}')";
     $result = mysql_query($sql);
     if (mysql_error()) {
         trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
     }
     // Get softwareid from Incident record
     $sql = "SELECT softwareid FROM `{$dbIncidents}` WHERE id='{$id}'";
     $result = mysql_query($sql);
     if (mysql_error()) {
         trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR);
     }
     list($softwareid) = mysql_fetch_row($result);
     if (!empty($_POST['summary'])) {
         $query[] = "INSERT INTO `{$dbKBContent}` (docid, ownerid, headerstyle, header, contenttype, content, distribution) VALUES ('{$docid}', '" . mysql_real_escape_string($sit[2]) . "', 'h1', 'Summary', '1', '{$summary}', 'public') ";
Ejemplo n.º 9
0
	private function profile() {
		global $user, $config, $comments, $cache, $upload;

		$error = w();
		$fields = w('public_email timezone dateformat location sig msnm yim lastfm website occ interests os fav_genres fav_artists rank color');
		$length_ary = w('location sig msnm yim website occ interests os fav_genres fav_artists');

		$_fields = new stdClass;
		foreach ($fields as $field) {
			$_fields->$field = $user->d('user_' . $field);
		}

		$_fields->avatar = $user->d('user_avatar');
		$_fields->gender = $user->d('user_gender');
		$_fields->hideuser = $user->d('user_hideuser');
		$_fields->email_dc = $user->d('user_email_dc');

		$_fields->birthday_day = (int) substr($user->d('user_birthday'), 6, 2);
		$_fields->birthday_month = (int) substr($user->d('user_birthday'), 4, 2);
		$_fields->birthday_year = (int) substr($user->d('user_birthday'), 0, 4);

		if (_button()) {
			foreach ($_fields as $field => $value) {
				$_fields->$field = request_var($field, $value);
			}

			$_fields->password1 = request_var('password1', '');
			$_fields->password2 = request_var('password2', '');
			$_fields->hideuser = _button('hideuser');
			$_fields->email_dc = _button('email_dc');

			if (!empty($_fields->password1)) {
				if (empty($_fields->password2)) {
					$error[] = 'EMPTY_PASSWORD2';
				}

				if (!sizeof($error)) {
					if ($_fields->password1 != $_fields->password2) {
						$error[] = 'PASSWORD_MISMATCH';
					} else if (strlen($_fields->password1) > 30) {
						$error[] = 'PASSWORD_LONG';
					}
				}
			}

			unset($_fields->password1, $_fields->password2);

			foreach ($length_ary as $field) {
				if (strlen($_fields->$field) < 2) {
					$_fields->$field = '';
				}
			}

			if (!empty($_fields->website)) {
				if (!preg_match('#^http[s]?:\/\/#i', $_fields->website)) {
					$_fields->website = 'http://' . $_fields->website;
				}

				if (!preg_match('#^http[s]?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $_fields->website)) {
					$_fields->website = '';
				}
			}

			if (!empty($_fields->rank)) {
				$rank_word = explode(' ', $_fields->rank);
				if (sizeof($rank_word) > 10) {
					$error[] = 'RANK_TOO_LONG';
				}

				if (!sizeof($error)) {
					$rank_limit = 15;
					foreach ($rank_word as $each) {
						if (preg_match_all('#\&.*?\;#is', $each, $each_preg)) {
							foreach ($each_preg[0] as $each_preg_each) {
								$rank_limit += (strlen($each_preg_each) - 1);
							}
						}

						if (strlen($each) > $rank_limit) {
							$error[] = 'RANK_TOO_LONG';
							break;
						}
					}
				}
			}

			// Rank
			if (!empty($_fields->rank) && !sizeof($error)) {
				$sql = 'SELECT rank_id
					FROM _ranks
					WHERE rank_title = ?';
				if (!$rank_id = sql_field(sql_filter($sql, $_fields->rank), 'rank_id', 0)) {
					$insert = array(
						'rank_title' => $_fields->rank,
						'rank_min' => -1,
						'rank_max' => -1,
						'rank_special' => 1
					);
					$rank_id = sql_insert('ranks', $insert);
				}

				if ($user->d('user_rank')) {
					$sql = 'SELECT user_id
						FROM _members
						WHERE user_rank = ?';
					$size_rank = sql_rowset(sql_filter($sql, $user->d('user_rank')), false, 'user_id');

					if (sizeof($size_rank) == 1) {
						$sql = 'DELETE FROM _ranks
							WHERE rank_id = ?';
						sql_query(sql_filter($sql, $user->d('user_rank')));
					}
				}

				$_fields->rank = $rank_id;
				$cache->delete('ranks');
			}

			if (!$_fields->birthday_month || !$_fields->birthday_day || !$_fields->birthday_year) {
				$error[] = 'EMPTY_BIRTH_MONTH';
			}

			// Update user avatar
			if (!sizeof($error)) {
				$upload->avatar_process($user->d('username_base'), $_fields, $error);
			}

			if (!sizeof($error)) {
				if (!empty($_fields->sig)) {
					$_fields->sig = $comments->prepare($_fields->sig);
				}

				$_fields->birthday = (string) (leading_zero($_fields->birthday_year) . leading_zero($_fields->birthday_month) . leading_zero($_fields->birthday_day));
				unset($_fields->birthday_day, $_fields->birthday_month, $_fields->birthday_year);

				$_fields->dateformat = 'd M Y H:i';
				$_fields->hideuser = $user->d('user_hideuser');
				$_fields->email_dc = $user->d('user_email_dc');

				$member_data = w();
				foreach ($_fields as $field => $value) {
					if ($value != $user->d($field)) {
						$member_data['user_' . $field] = $_fields->$field;
					}
				}

				if (sizeof($member_data)) {
					$sql = 'UPDATE _members SET ' . sql_build('UPDATE', $member_data) . sql_filter('
						WHERE user_id = ?', $user->d('user_id'));

					$sql = 'UPDATE _members SET ??
						WHERE user_id = ?';
					sql_query(sql_filter($sql, sql_build('UPDATE', $member_data), $user->d('user_id')));
				}

				redirect(s_link('m', $user->d('username_base')));
			}
		}

		if (sizeof($error)) {
			_style('error', array(
				'MESSAGE' => parse_error($error))
			);
		}

		if ($user->d('user_avatar')) {
			_style('current_avatar', array(
				'IMAGE' => $config['assets_url'] . 'avatars/' . $user->d('user_avatar'))
			);
		}

		$s_genders_select = '';
		foreach (array(1 => 'MALE', 2 => 'FEMALE') as $id => $value) {
			$s_genders_select .= '<option value="' . $id . '"' . (($_fields->gender == $id) ? ' selected="true"' : '') . '>' . lang($value) . '</option>';
		}

		_style('gender', array(
			'GENDER_SELECT' => $s_genders_select)
		);

		$s_day_select = '';
		for ($i = 1; $i < 32; $i++) {
			$s_day_select .= '<option value="' . $i . '"' . (($_fields->birthday_day == $i) ? ' selected="true"' : '') . '>' . $i . '</option>';
		}

		$s_month_select = '';
		$months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
		foreach ($months as $id => $value) {
			$s_month_select .= '<option value="' . ($id + 1) . '"' . (($_fields->birthday_month == ($id + 1)) ? ' selected="true"' : '') . '>' . $user->lang['datetime'][$value] . '</option>';
		}

		$s_year_select = '';
		for ($i = 2005; $i > 1899; $i--) {
			$s_year_select .= '<option value="' . $i . '"' . (($_fields->birthday_year == $i) ? ' selected="true"' : '') . '>' . $i . '</option>';
		}

		_style('birthday', array(
			'DAY' => $s_day_select,
			'MONTH' => $s_month_select,
			'YEAR' => $s_year_select)
		);

		$dateset = w();

		$dateformat_select = '';
		foreach ($dateset as $id => $value) {
			$dateformat_select .= '<option value="' . $id . '"' . (($value == $_fields->dateformat) ? ' selected="selected"' : '') . '>' . $user->format_date(time(), $value) . '</option>';
		}

		$timezone_select = '';
		foreach ($user->lang['zones'] as $id => $value) {
			$timezone_select .= '<option value="' . $id . '"' . (($id == $_fields->timezone) ? ' selected="selected"' : '') . '>' . $value . '</option>';
		}

		unset($_fields->timezone, $_fields->dateformat);

		if ($user->d('rank')) {
			$sql = 'SELECT rank_title
				FROM _ranks
				WHERE rank_id = ?';
			$_fields->rank = sql_field(sql_filter($sql, $user->d('rank')), 'rank_title', '--');
		}

		$output_vars = array(
			'DATEFORMAT' => $dateformat_select,
			'TIMEZONE' => $timezone_select,
			'HIDEUSER_SELECTED' => ($_fields->hideuser) ? ' checked="checked"' : '',
			'EMAIL_DC_SELECTED' => ($_fields->email_dc) ? ' checked="checked"' : ''
		);

		foreach ($_fields as $field => $value) {
			$output_vars[strtoupper($field)] = $value;
		}
		v_style($output_vars);

		$this->_title = 'MEMBER_OPTIONS';
		$this->_template = 'profile';

		return;
	}
Ejemplo n.º 10
0
 function cb_plain_code($code)
 {
     $pid = $this->noparse_id();
     $code = trim($code);
     $rows = explode("\n", $code);
     $code2 = str_replace("]", "&#93;", $code);
     $code2 = str_replace("[", "&#91;", $code2);
     if (count($rows) > 1) {
         $a = 0;
         $code = '';
         $lines = strlen(count($rows));
         foreach ($rows as $row) {
             $a++;
             $code .= leading_zero($a, $lines) . ": " . $row . "\n";
         }
         $this->noparse[$pid] = "\nQuelltext:\n" . $code;
     } else {
         $this->noparse[$pid] = $code2;
     }
     return '<!PID:' . $pid . '>';
 }
Ejemplo n.º 11
0
 echo colheader('keywords', $strKeywords, FALSE);
 echo "</tr>\n";
 $shade = 'shade1';
 while ($kbarticle = mysql_fetch_object($result)) {
     if (empty($kbarticle->title)) {
         $kbarticle->title = $strUntitled;
     } else {
         $kbarticle->title = $kbarticle->title;
     }
     if (is_number($kbarticle->author)) {
         $kbarticle->author = user_realname($kbarticle->author);
     } else {
         $kbarticle->author = $kbarticle->author;
     }
     echo "<tr class='{$shade}'>";
     echo "<td>" . icon('kb', 16) . " {$CONFIG['kb_id_prefix']}" . leading_zero(4, $kbarticle->docid) . "</td>";
     echo "<td>";
     // Lookup what software this applies to
     $ssql = "SELECT * FROM `{$dbKBSoftware}` AS kbs, `{$dbSoftware}` AS s WHERE kbs.softwareid = s.id ";
     $ssql .= "AND kbs.docid = '{$kbarticle->docid}' ORDER BY s.name";
     $sresult = mysql_query($ssql);
     if (mysql_error()) {
         trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
     }
     $rowcount = mysql_num_rows($sresult);
     if ($rowcount >= 1 and $rowcount < 3) {
         $count = 1;
         while ($kbsoftware = mysql_fetch_object($sresult)) {
             echo "{$kbsoftware->name}";
             if ($count < $rowcount) {
                 echo ", ";
Ejemplo n.º 12
0
function do_login($box_text = '', $need_admin = false, $extra_vars = false) {
	global $config, $user;

	$error = w();
	$action = request_var('mode', '');

	if (empty($user->data)) {
		$user->init(false);
	}
	if (empty($user->lang)) {
		$user->setup();
	}

	if ($user->is('bot')) {
		redirect(s_link());
	}

	$code_invite = request_var('invite', '');
	$admin       = _button('admin');
	$login       = _button('login');
	$submit      = _button();
	$need_auth   = false;

	if ($admin) {
		$need_auth = true;
	}

	$v_fields = array(
		'username' => '',
		'email' => '',
		'email_confirm' => '',
		'key' => '',
		'key_confirm' => '',
		'gender' => 0,
		'birthday_month' => 0,
		'birthday_day' => 0,
		'birthday_year' => 0,
		'tos' => 0,
		'ref' => 0
	);

	if (!empty($code_invite)) {
		$sql = 'SELECT i.invite_email, m.user_email
			FROM _members_ref_invite i, _members m
			WHERE i.invite_code = ?
				AND i.invite_uid = m.user_id';
		if (!$invite_row = sql_fieldrow(sql_filter($sql, $code_invite))) {
			fatal_error();
		}

		$v_fields['ref'] = $invite_row['user_email'];
		$v_fields['email'] = $invite_row['invite_email'];
		unset($invite_row);
	}

	switch ($action) {
		case 'in':
			if ($user->is('member') && !$admin) {
				redirect(s_link());
			}

			if ($login && (!$user->is('member') || $admin)) {
				$username = request_var('username', '');
				$password = request_var('password', '');
				$ref = request_var('ref', '');

				if (!empty($username) && !empty($password)) {
					$username_base = get_username_base($username);

					$sql = 'SELECT user_id, username, user_password, user_type, user_country, user_avatar, user_location, user_gender, user_birthday
						FROM _members
						WHERE username_base = ?';
					if ($row = sql_fieldrow(sql_filter($sql, $username_base))) {
						$exclude_type = array(USER_INACTIVE);

						if (ValidatePassword($password, $row['user_password']) && (!in_array($row['user_type'], $exclude_type))) {
							$user->session_create($row['user_id'], $admin);

							if (!$row['user_country'] || !$row['user_location'] || !$row['user_gender'] || !$row['user_birthday'] || !$row['user_avatar']) {
								$ref = s_link('my', 'profile');
							} else {
								$ref = (empty($ref) || (preg_match('#' . preg_quote($config['server_name']) . '/$#', $ref))) ? s_link('today') : $ref;
							}

							redirect($ref);
						}
					}
				}
			}
			break;
		case 'out':
			if ($user->is('member')) {
				$user->session_kill();
			}

			redirect(s_link());
			break;
		case 'up':
			if ($user->is('member')) {
				redirect(s_link('my profile'));
			} else if ($user->is('bot')) {
				redirect(s_link());
			}

			$code = request_var('code', '');

			if (!empty($code)) {
				if (!preg_match('#([a-z0-9]+)#is', $code)) {
					fatal_error();
				}

				$sql = 'SELECT c.*, m.user_id, m.username, m.username_base, m.user_email
					FROM _crypt_confirm c, _members m
					WHERE c.crypt_code = ?
						AND c.crypt_userid = m.user_id';
				if (!$crypt_data = sql_fieldrow(sql_filter($sql, $code))) {
					fatal_error();
				}

				$user_id = $crypt_data['user_id'];

				$sql = 'UPDATE _members SET user_type = ?
					WHERE user_id = ?';
				sql_query(sql_filter($sql, USER_NORMAL, $user_id));

				$sql = 'DELETE FROM _crypt_confirm
					WHERE crypt_code = ?
						AND crypt_userid = ?';
				sql_query(sql_filter($sql, $code, $user_id));

				$emailer = new emailer();

				$emailer->from('info');
				$emailer->use_template('user_welcome_confirm');
				$emailer->email_address($crypt_data['user_email']);

				$emailer->assign_vars(array(
					'USERNAME' => $crypt_data['username'])
				);
				$emailer->send();
				$emailer->reset();

				$user->session_create($user_id, 0);

				//
				if (empty($user->data)) {
					$user->init();
				}
				if (empty($user->lang)) {
					$user->setup();
				}

				$custom_vars = array(
					'S_REDIRECT' => '',
					'MESSAGE_TITLE' => lang('information'),
					'MESSAGE_TEXT' => lang('membership_added_confirm')
				);
				page_layout('INFORMATION', 'message', $custom_vars);
			}

			//
			/*$sql = 'SELECT *
				FROM _members_ref_assoc
				WHERE ref_uid = ?';
			if ($ref_assoc = sql_fieldrow(sql_filter($sql, $user_id))) {
				if ($user_id != $ref_assoc['ref_orig']) {
					$user->points_add(3, $ref_assoc['ref_orig']);

					$sql_insert = array(
						'user_id' => $user_id,
						'buddy_id' => $ref_assoc['ref_orig'],
						'friend_time' => time()
					);
					sql_insert('members_friends', $sql_insert);

					$sql_insert = array(
						'user_id' => $ref_assoc['ref_orig'],
						'buddy_id' => $user_id,
						'friend_time' => time()
					);
					sql_insert('members_friends', $sql_insert);

					$user->save_unread(UH_FRIEND, $user_id, 0, $ref_assoc['ref_orig']);
				}

				$sql = 'DELETE FROM _members_ref_assoc
					WHERE ref_id = ?';
				sql_query(sql_filter($sql, $ref_assoc['ref_id']));
			}

			//
			$sql = 'SELECT *
				FROM _members_ref_invite
				WHERE invite_email = ?';
			if ($row = sql_fieldrow(sql_filter($sql, $crypt_data['user_email']))) {
				$sql = 'DELETE FROM _members_ref_invite
					WHERE invite_code = ?';
				sql_query(sql_filter($sql, $row['invite_code']));
			}

			//
			$emailer = new emailer();

			$emailer->from('info');
			$emailer->use_template('user_welcome_confirm');
			$emailer->email_address($crypt_data['user_email']);

			$emailer->assign_vars(array(
				'USERNAME' => $crypt_data['username'])
			);
			$emailer->send();
			$emailer->reset();

			//
			if (empty($user->data)) {
				$user->init();
			}
			if (empty($user->lang)) {
				$user->setup();
			}

			$custom_vars = array(
				'S_REDIRECT' => '',
				'MESSAGE_TITLE' => lang('information'),
				'MESSAGE_TEXT' => lang('membership_added_confirm')
			);
			page_layout('INFORMATION', 'message', $custom_vars);
			 * */

			if ($submit) {
				foreach ($v_fields as $k => $v) {
					$v_fields[$k] = request_var($k, $v);
				}

				if (empty($v_fields['username'])) {
					$error['username'] = '******';
				} else {
					$len_username = strlen($v_fields['username']);

					if (($len_username < 2) || ($len_username > 20) || !get_username_base($v_fields['username'], true)) {
						$error['username'] = '******';
					}

					if (!sizeof($error)) {
						$result = validate_username($v_fields['username']);
						if ($result['error']) {
							$error['username'] = $result['error_msg'];
						}
					}

					if (!sizeof($error)) {
						$v_fields['username_base'] = get_username_base($v_fields['username']);

						$sql = 'SELECT user_id
							FROM _members
							WHERE username_base = ?';
						if (sql_field(sql_filter($sql, $v_fields['username_base']), 'user_id', 0)) {
							$error['username'] = '******';
						}
					}

					if (!sizeof($error)) {
						$sql = 'SELECT ub
							FROM _artists
							WHERE subdomain = ?';
						if (sql_field(sql_filter($sql, $v_fields['username_base']), 'ub', 0)) {
							$error['username'] = '******';
						}
					}
				}

				if (empty($v_fields['email']) || empty($v_fields['email_confirm'])) {
					if (empty($v_fields['email'])) {
						$error['email'] = 'EMPTY_EMAIL';
					}

					if (empty($v_fields['email_confirm'])) {
						$error['email_confirm'] = 'EMPTY_EMAIL_CONFIRM';
					}
				} else {
					if ($v_fields['email'] == $v_fields['email_confirm']) {
						$result = validate_email($v_fields['email']);
						if ($result['error']) {
							$error['email'] = $result['error_msg'];
						}
					} else {
						$error['email'] = 'EMAIL_MISMATCH';
						$error['email_confirm'] = 'EMAIL_MISMATCH';
					}
				}

				if (!empty($v_fields['key']) && !empty($v_fields['key_confirm'])) {
					if ($v_fields['key'] != $v_fields['key_confirm']) {
						$error['key'] = 'PASSWORD_MISMATCH';
					} else if (strlen($v_fields['key']) > 32) {
						$error['key'] = 'PASSWORD_LONG';
					}
				} else {
					if (empty($v_fields['key'])) {
						$error['key'] = 'EMPTY_PASSWORD';
					} elseif (empty($v_fields['key_confirm'])) {
						$error['key_confirm'] = 'EMPTY_PASSWORD_CONFIRM';
					}
				}

				if (!$v_fields['birthday_month'] || !$v_fields['birthday_day'] || !$v_fields['birthday_year']) {
					$error['birthday'] = 'EMPTY_BIRTH_MONTH';
				}

				if (!$v_fields['tos']) {
					$error['tos'] = 'AGREETOS_ERROR';
				}

				if (!sizeof($error)) {
					//$v_fields['country'] = strtolower(geoip_country_code_by_name($user->ip));
					$v_fields['country'] = 90;
					$v_fields['birthday'] = leading_zero($v_fields['birthday_year']) . leading_zero($v_fields['birthday_month']) . leading_zero($v_fields['birthday_day']);

					$member_data = array(
						'user_type' => USER_INACTIVE,
						'user_active' => 1,
						'username' => $v_fields['username'],
						'username_base' => $v_fields['username_base'],
						'user_password' => HashPassword($v_fields['key']),
						'user_regip' => $user->ip,
						'user_session_time' => 0,
						'user_lastpage' => '',
						'user_lastvisit' => time(),
						'user_regdate' => time(),
						'user_level' => 0,
						'user_posts' => 0,
						'userpage_posts' => 0,
						'user_points' => 0,
						'user_timezone' => $config['board_timezone'],
						'user_dst' => $config['board_dst'],
						'user_lang' => $config['default_lang'],
						'user_dateformat' => $config['default_dateformat'],
						'user_country' => (int) $v_fields['country'],
						'user_rank' => 0,
						'user_avatar' => '',
						'user_avatar_type' => 0,
						'user_email' => $v_fields['email'],
						'user_lastlogon' => 0,
						'user_totaltime' => 0,
						'user_totallogon' => 0,
						'user_totalpages' => 0,
						'user_gender' => $v_fields['gender'],
						'user_birthday' => (string) $v_fields['birthday'],
						'user_mark_items' => 0,
						'user_topic_order' => 0,
						'user_email_dc' => 1,
						'user_refop' => 0,
						'user_refby' => $v_fields['ref']
					);
					$user_id = sql_insert('members', $member_data);

					set_config('max_users', $config['max_users'] + 1);

					// Confirmation code
					$verification_code = md5(unique_id());

					$insert = array(
						'crypt_userid' => $user_id,
						'crypt_code' => $verification_code,
						'crypt_time' => $user->time
					);
					sql_insert('crypt_confirm', $insert);

					// Emailer
					$emailer = new emailer();

					if (!empty($v_fields['ref'])) {
						$valid_ref = email_format($v_fields['ref']);

						if ($valid_ref) {
							$sql = 'SELECT user_id
								FROM _members
								WHERE user_email = ?';
							if ($ref_friend = sql_field(sql_filter($sql, $v_fields['ref']), 'user_id', 0)) {
								$sql_insert = array(
									'ref_uid' => $user_id,
									'ref_orig' => $ref_friend
								);
								sql_insert('members_ref_assoc', $sql_insert);

								$sql_insert = array(
									'user_id' => $user_id,
									'buddy_id' => $ref_friend,
									'friend_time' => time()
								);
								sql_insert('members_friends', $sql_insert);
							} else {
								$invite_user = explode('@', $v_fields['ref']);
								$invite_code = substr(md5(unique_id()), 0, 6);

								$sql_insert = array(
									'invite_code' => $invite_code,
									'invite_email' => $v_fields['ref'],
									'invite_uid' => $user_id
								);
								sql_insert('members_ref_invite', $sql_insert);

								$emailer->from('info');
								$emailer->use_template('user_invite');
								$emailer->email_address($v_fields['ref']);

								$emailer->assign_vars(array(
									'INVITED' => $invite_user[0],
									'USERNAME' => $v_fields['username'],
									'U_REGISTER' => s_link('my register a', $invite_code))
								);
								$emailer->send();
								$emailer->reset();
							}
						}
					}

					// Send confirm email
					$emailer->from('info');
					$emailer->use_template('user_welcome');
					$emailer->email_address($v_fields['email']);

					$emailer->assign_vars(array(
						'USERNAME' => $v_fields['username'],
						'U_ACTIVATE' => 'http:' . s_link('signup', $verification_code))
					);
					$emailer->send();
					$emailer->reset();

					$custom_vars = array(
						'MESSAGE_TITLE' => lang('information'),
						'MESSAGE_TEXT' => lang('membership_added')
					);
					page_layout('INFORMATION', 'message', $custom_vars);
					/*
					$user->session_create($user_id, 0);

					redirect(s_link());
					*/
				}
			}
			break;
		case 'r':
			if ($user->is('member')) {
				redirect(s_link('my profile'));
			} else if ($user->is('bot')) {
				redirect(s_link());
			}

			$code = request_var('code', '');

			if (request_var('r', 0)) {
				redirect(s_link());
			}

			if (!empty($code)) {
				if (!preg_match('#([a-z0-9]+)#is', $code)) {
					fatal_error();
				}

				$sql = 'SELECT c.*, m.user_id, m.username, m.username_base, m.user_email
					FROM _crypt_confirm c, _members m
					WHERE c.crypt_code = ?
						AND c.crypt_userid = m.user_id';
				if (!$crypt_data = sql_fieldrow(sql_filter($sql, $code))) {
					fatal_error();
				}

				if (_button()) {
					$password = request_var('newkey', '');
					$password2 = request_var('newkey2', '');

					if (!empty($password)) {
						if ($password === $password2) {
							$crypt_password = HashPassword($password);

							$sql = 'UPDATE _members SET user_password = ?
								WHERE user_id = ?';
							sql_query(sql_filter($sql, $crypt_password, $crypt_data['user_id']));

							$sql = 'DELETE FROM _crypt_confirm
								WHERE crypt_userid = ?';
							sql_query(sql_filter($sql, $crypt_data['user_id']));

							// Send email
							$emailer = new emailer();

							$emailer->from('info');
							$emailer->use_template('user_confirm_passwd', $config['default_lang']);
							$emailer->email_address($crypt_data['user_email']);

							$emailer->assign_vars(array(
								'USERNAME' => $crypt_data['username'],
								'PASSWORD' => $password,
								'U_PROFILE' => s_link('m', $crypt_data['username_base']))
							);
							$emailer->send();
							$emailer->reset();

							//
							v_style(array(
								'PAGE_MODE' => 'updated'
							));
						} else {
							v_style(array(
								'PAGE_MODE' => 'nomatch',
								'S_CODE' => $code)
							);
						}
					} else {
						v_style(array(
							'PAGE_MODE' => 'nokey',
							'S_CODE' => $code)
						);
					}
				} else {
					v_style(array(
						'PAGE_MODE' => 'verify',
						'S_CODE' => $code)
					);
				}
			} else if (_button()) {
				$email = request_var('address', '');
				if (empty($email) || !email_format($email)) {
					fatal_error();
				}

				$sql = 'SELECT *
					FROM _members
					WHERE user_email = ?
						AND user_active = 1
						AND user_type NOT IN (??, ??)
						AND user_id NOT IN (
							SELECT ban_userid
							FROM _banlist
						)';
				if (!$userdata = sql_fieldrow(sql_filter($sql, $email, USER_INACTIVE, USER_FOUNDER))) {
					fatal_error();
				}

				$emailer = new emailer();

				$verification_code = md5(unique_id());

				$sql = 'DELETE FROM _crypt_confirm
					WHERE crypt_userid = ?';
				sql_query(sql_filter($sql, $userdata['user_id']));

				$insert = array(
					'crypt_userid' => $userdata['user_id'],
					'crypt_code' => $verification_code,
					'crypt_time' => $user->time
				);
				sql_insert('crypt_confirm', $insert);

				// Send email
				$emailer->from('info');
				$emailer->use_template('user_activate_passwd', $config['default_lang']);
				$emailer->email_address($userdata['user_email']);

				$emailer->assign_vars(array(
					'USERNAME' => $userdata['username'],
					'U_ACTIVATE' => s_link('signr', $verification_code))
				);
				$emailer->send();
				$emailer->reset();

				_style('reset_complete');
			}
			break;
		default:
			break;
	}

	//
	// Signup data
	//
	if (sizeof($error)) {
		_style('error', array(
			'MESSAGE' => parse_error($error))
		);
	}

	$s_genres_select = '';
	$genres = array(1 => 'MALE', 2 => 'FEMALE');
	foreach ($genres as $id => $value) {
		$s_genres_select .= '<option value="' . $id . '"' . (($v_fields['gender'] == $id) ? ' selected="true"' : '') . '>' . lang($value) . '</option>';
	}

	$s_bday_select = '';
	for ($i = 1; $i < 32; $i++) {
		$s_bday_select .= '<option value="' . $i . '"' . (($v_fields['birthday_day'] == $i) ? 'selected="true"' : '') . '>' . $i . '</option>';
	}

	$s_bmonth_select = '';
	$months = array(1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April', 5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August', 9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December');
	foreach ($months as $id => $value)
	{
		$s_bmonth_select .= '<option value="' . $id . '"' . (($v_fields['birthday_month'] == $id) ? ' selected="true"' : '') . '>' . $user->lang['datetime'][$value] . '</option>';
	}

	$s_byear_select = '';
	$current_year = date('Y');
	for ($i = ($current_year - 1); $i > $current_year - 102; $i--)
	{
		$s_byear_select .= '<option value="' . $i . '"' . (($v_fields['birthday_year'] == $i) ? ' selected="true"' : '') . '>' . $i . '</option>';
	}

	$v_fields['birthday'] = false;

	if (isset($error['birthday'])) {
		$v_fields['birthday'] = true;
	}

	$s_hidden = w();
	if ($need_auth) {
		$s_hidden = array('admin' => 1);
	}

	if (!isset($v_fields['refby'])) {
		$v_fields['refby'] = '';
	}

	$layout_vars = array(
		'IS_NEED_AUTH' => $need_auth,
		'IS_LOGIN' => $login,
		'CUSTOM_MESSAGE' => $box_text,
		'S_HIDDEN_FIELDS' => s_hidden($s_hidden),

		'U_SIGNIN' => s_link('signin'),
		'U_SIGNUP' => s_link('signup'),
		'U_SIGNOUT' => s_link('signout'),
		'U_PASSWORD' => s_link('signr'),

		'V_USERNAME' => $v_fields['username'],
		'V_KEY' => $v_fields['key'],
		'V_KEY_CONFIRM' => $v_fields['key_confirm'],
		'V_EMAIL' => $v_fields['email'],
		'V_REFBY' => $v_fields['refby'],
		'V_GENDER' => $s_genres_select,
		'V_BIRTHDAY_DAY' => $s_bday_select,
		'V_BIRTHDAY_MONTH' => $s_bmonth_select,
		'V_BIRTHDAY_YEAR' => $s_byear_select,
		'V_TOS' => ($v_fields['tos']) ? ' checked="true"' : '',
		'PAGE_MODE' => ''
	);

	foreach ($v_fields as $k => $v) {
		$layout_vars['E_' . strtoupper($k)] = (isset($error[$k])) ? true : false;
	}

	if ($login) {
		$ref = request_var('ref', '');

		_style('error', array(
			'LASTPAGE' => ($ref != '') ? $ref : s_link())
		);
	}

	$box_text = (!empty($box_text)) ? lang($box_text, $box_text) : '';

	page_layout('LOGIN2', 'login', $layout_vars);
}
Ejemplo n.º 13
0
 function cb_plain_code($code)
 {
     global $lang;
     $pid = $this->noparse_id();
     $code = trim($code);
     $rows = explode("\n", $code);
     $code2 = str_replace("]", "&#93;", $code);
     $code2 = str_replace("[", "&#91;", $code2);
     if (count($rows) > 1) {
         $a = 0;
         $code = '';
         $lines = strlen(count($rows));
         foreach ($rows as $row) {
             $a++;
             $code .= leading_zero($a, $lines) . ": " . $row . "\n";
         }
         $this->noparse[$pid] = "\n" . $lang->phrase('bb_sourcecode') . "\n-------------------\n{$code}-------------------\n";
     } else {
         $this->noparse[$pid] = $code2;
     }
     return '<!PID:' . $pid . '>';
 }
Ejemplo n.º 14
0
        ?>
</span></td>
                <td><span><?php 
        echo $ia['epp_pregnant'] == 1 ? 'Yes' : 'No';
        ?>
</span></td>
                <td><span><?php 
        echo $ia['implant_prob'] == 1 ? 'Yes' : 'No';
        ?>
</span></td>
                <td><span><?php 
        echo date('d-m-Y', $ia['implant_date']);
        ?>
</span></td>
                <td><span><?php 
        echo leading_zero($ia['implant_time']) . ':' . leading_zero($ia['implant_min']);
        ?>
</span></td>
                <td><?php 
        echo get_batch_map($ia['implant_batch']);
        ?>
</td>
            </tr>
            <?php 
    }
} else {
    ?>
        <tr>
            <td colspan="20">
                <em>No Data yet.</em>
            </td>
Ejemplo n.º 15
0
/**
 * Output the html for a KB article
 *
 * @param int $id ID of the KB article
 * @param string $mode whether this is internal or external facing, defaults to internal
 * @return string $html kb article html
 * @author Kieran Hogg
 */
function kb_article($id, $mode = 'internal')
{
    global $CONFIG, $iconset;
    $id = intval($id);
    if (!is_number($id) or $id == 0) {
        trigger_error("Incorrect KB ID", E_USER_ERROR);
        include APPLICATION_INCPATH . 'htmlfooter.inc.php';
        exit;
    }
    $sql = "SELECT * FROM `{$GLOBALS['dbKBArticles']}` WHERE docid='{$id}' LIMIT 1";
    $result = mysql_query($sql);
    if (mysql_error()) {
        trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
    }
    $kbarticle = mysql_fetch_object($result);
    if (empty($kbarticle->title)) {
        $kbarticle->title = $GLOBALS['strUntitled'];
    }
    $html .= "<div id='kbarticle'";
    if ($kbarticle->distribution == 'private') {
        $html .= " class='expired'";
    }
    if ($kbarticle->distribution == 'restricted') {
        $html .= " class='urgent'";
    }
    $html .= ">";
    $html .= "<h2 class='kbtitle'>{$kbarticle->title}</h2>";
    if (!empty($kbarticle->distribution) and $kbarticle->distribution != 'public') {
        $html .= "<h2 class='kbdistribution'>{$GLOBALS['strDistribution']}: " . ucfirst($kbarticle->distribution) . "</h2>";
    }
    // Lookup what software this applies to
    $ssql = "SELECT * FROM `{$GLOBALS['dbKBSoftware']}` AS kbs, `{$GLOBALS['dbSoftware']}` AS s ";
    $ssql .= "WHERE kbs.softwareid = s.id AND kbs.docid = '{$id}' ";
    $ssql .= "ORDER BY s.name";
    $sresult = mysql_query($ssql);
    if (mysql_error()) {
        trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
    }
    if (mysql_num_rows($sresult) >= 1) {
        $html .= "<h3>{$GLOBALS['strEnvironment']}</h3>";
        $html .= "<p>{$GLOBALS['strTheInfoInThisArticle']}:</p>\n";
        $html .= "<ul>\n";
        while ($kbsoftware = mysql_fetch_object($sresult)) {
            $html .= "<li>{$kbsoftware->name}</li>\n";
        }
        $html .= "</ul>\n";
    }
    $csql = "SELECT * FROM `{$GLOBALS['dbKBContent']}` WHERE docid='{$id}' ";
    $cresult = mysql_query($csql);
    if (mysql_error()) {
        trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
    }
    $restrictedcontent = 0;
    while ($kbcontent = mysql_fetch_object($cresult)) {
        switch ($kbcontent->distribution) {
            case 'private':
                if ($mode != 'internal') {
                    echo "<p class='error'>{$GLOBALS['strPermissionDenied']}</p>";
                    include APPLICATION_INCPATH . 'htmlfooter.inc.php';
                    exit;
                }
                $html .= "<div class='kbprivate'><h3>{$kbcontent->header} (private)</h3>";
                $restrictedcontent++;
                break;
            case 'restricted':
                if ($mode != 'internal') {
                    echo "<p class='error'>{$GLOBALS['strPermissionDenied']}</p>";
                    include APPLICATION_INCPATH . 'htmlfooter.inc.php';
                    exit;
                }
                $html .= "<div class='kbrestricted'><h3>{$kbcontent->header}</h3>";
                $restrictedcontent++;
                break;
            default:
                $html .= "<div><h3>{$kbcontent->header}</h3>";
        }
        //$html .= "<{$kbcontent->headerstyle}>{$kbcontent->header}</{$kbcontent->headerstyle}>\n";
        $html .= '';
        $kbcontent->content = nl2br($kbcontent->content);
        $search = array("/(?<!quot;|[=\"]|:\\/{2})\\b((\\w+:\\/{2}|www\\.).+?)" . "(?=\\W*([<>\\s]|\$))/i", "/(([\\w\\.]+))(@)([\\w\\.]+)\\b/i");
        $replace = array("<a href=\"\$1\">\$1</a>", "<a href=\"mailto:\$0\">\$0</a>");
        $kbcontent->content = preg_replace("/href=\"www/i", "href=\"http://www", preg_replace($search, $replace, $kbcontent->content));
        $html .= bbcode($kbcontent->content);
        $author[] = $kbcontent->ownerid;
        $html .= "</div>\n";
    }
    if ($restrictedcontent > 0) {
        $html .= "<h3>{$GLOBALS['strKey']}</h3>";
        $html .= "<p><span class='keykbprivate'>{$GLOBALS['strPrivate']}</span>" . help_link('KBPrivate') . " &nbsp; ";
        $html .= "<span class='keykbrestricted'>{$GLOBALS['strRestricted']}</span>" . help_link('KBRestricted') . "</p>";
    }
    $html .= "<h3>{$GLOBALS['strArticle']}</h3>";
    //$html .= "<strong>{$GLOBALS['strDocumentID']}</strong>: ";
    $html .= "<p><strong>{$CONFIG['kb_id_prefix']}" . leading_zero(4, $kbarticle->docid) . "</strong> ";
    $pubdate = mysql2date($kbarticle->published);
    if ($pubdate > 0) {
        $html .= "{$GLOBALS['strPublished']} ";
        $html .= ldate($CONFIG['dateformat_date'], $pubdate) . "<br />";
    }
    if ($mode == 'internal') {
        if (is_array($author)) {
            $author = array_unique($author);
            $countauthors = count($author);
            $count = 1;
            if ($countauthors > 1) {
                $html .= "<strong>{$GLOBALS['strAuthors']}</strong>:<br />";
            } else {
                $html .= "<strong>{$GLOBALS['strAuthor']}:</strong> ";
            }
            foreach ($author as $authorid) {
                $html .= user_realname($authorid, TRUE);
                if ($count < $countauthors) {
                    $html .= ", ";
                }
                $count++;
            }
        }
    }
    $html .= "<br />";
    if (!empty($kbarticle->keywords)) {
        $html .= "<strong>{$GLOBALS['strKeywords']}</strong>: ";
        if ($mode == 'internal') {
            $html .= preg_replace("/\\[([0-9]+)\\]/", "<a href=\"incident_details.php?id=\$1\" target=\"_blank\">\$0</a>", $kbarticle->keywords);
        } else {
            $html .= $kbarticle->keywords;
        }
        $html .= "<br />";
    }
    //$html .= "<h3>{$GLOBALS['strDisclaimer']}</h3>";
    $html .= "</p><hr />";
    $html .= $CONFIG['kb_disclaimer_html'];
    $html .= "</div>";
    if ($mode == 'internal') {
        $html .= "<p align='center'>";
        $html .= "<a href='kb.php'>{$GLOBALS['strBackToList']}</a> | ";
        $html .= "<a href='kb_article.php?id={$kbarticle->docid}'>{$GLOBALS['strEdit']}</a></p>";
    }
    return $html;
}
Ejemplo n.º 16
0
        ?>
            <tr >
                <td><span><?php 
        echo get_site_map($patient['site_id']);
        ?>
</span></td>
                <td><?php 
        echo get_batch_map($patient['implant_batch']);
        ?>
</td>
                <td><?php 
        echo $patient['date'];
        ?>
</td>
                <td><?php 
        echo leading_zero($patient['implant_time']) . ':' . leading_zero($patient['implant_min']);
        ?>
</td>
                <td>null</td>
                <td><?php 
        echo $patient['epp_symptoms'];
        ?>
</td>
                <td><?php 
        echo $patient['epp_pregnant'];
        ?>
</td>
                <td><?php 
        echo $patient['implant_prob'];
        ?>
</td>