function motm() { global $db, $allowHover; $userpics = get_files(basePath . '/inc/images/uploads/userpics/'); $qry = db("SELECT * FROM " . $db['users'] . " WHERE level >= 2"); while ($rs = _fetch($qry)) { foreach ($userpics as $userpic) { $tmpId = intval($userpic); if ($tmpId == $rs['id']) { $temparr[] = $rs['id']; $a++; break; } } } $arrayID = rand(0, count($temparr) - 1); $uid = $temparr[$arrayID]; $get = _fetch(db("SELECT * FROM " . $db['users'] . " WHERE id = '" . $uid . "'")); if (!empty($get) && !empty($temparr)) { $status = $get['status'] == 1 || $get['level'] == 1 ? _aktiv : _inaktiv; if ($allowHover == 1) { $info = 'onmouseover="DZCP.showInfo(\'<tr><td colspan=2 align=center padding=3 class=infoTop>' . rawautor($get['id']) . '</td></tr><tr><td width=80px><b>' . _posi . ':</b></td><td>' . getrank($get['id']) . '</td></tr><tr><td><b>' . _status . ':</b></td><td>' . $status . '</td></tr><tr><td><b>' . _age . ':</b></td><td>' . getAge($get['bday']) . '</td></tr><tr><td colspan=2 align=center>' . jsconvert(userpic($get['id'])) . '</td></tr>\')" onmouseout="DZCP.hideInfo()"'; } $member = show("menu/motm", array("uid" => $get['id'], "upic" => userpic($get['id'], 130, 161), "info" => $info)); } else { $member = ''; } return empty($member) ? '' : '<table class="navContent" cellspacing="0">' . $member . '</table>'; }
function createNpc() { $trait_table = "npc_traits"; $table = "npc"; $columns = getColumnNames($table); if (empty($_POST["sex"])) { $_POST["sex"] = getGender(); } if (empty($_POST["weight"])) { $_POST["weight"] = getWeight(); } if (empty($_POST["feet"]) || empty($_POST["inches"])) { $_POST["height"] = getHeight(); } else { $_POST["height"] = $_POST["feet"] * 12 + $_POST["inches"]; } if (empty($_POST["age"])) { $_POST["age"] = getAge(); } if (empty($_POST["first_name"])) { $_POST["first_name"] = getName(); } // will add the remaining traits not already added foreach ($columns as $column) { if (empty($_POST[$column])) { $_POST[$column] = getTrait($trait_table, $column); } } }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $target_c_member_id = $requests['target_c_member_id']; // ---------- if ($target_c_member_id == $u) { openpne_redirect('ktai', 'page_h_home'); } if (!db_member_is_active_c_member_id($target_c_member_id)) { ktai_display_error('該当するメンバーが見つかりません。'); } if (db_member_is_access_block($u, $target_c_member_id)) { openpne_redirect('ktai', 'page_h_access_block'); } //管理画面HTML $this->set('c_siteadmin', p_common_c_siteadmin4target_pagename('k_f_home')); //ターゲットのc_member $is_friend = db_friend_is_friend($u, $target_c_member_id); $target_c_member = db_member_c_member_with_profile($target_c_member_id, 'private'); $target_c_member['last_login'] = p_f_home_last_login4access_date($target_c_member['access_date']); if ($target_c_member['birth_year']) { $target_c_member['age'] = getAge($target_c_member['birth_year'], $target_c_member['birth_month'], $target_c_member['birth_day']); } $this->set("target_c_member", $target_c_member); //ターゲットの最新日記5件 $this->set("c_diary_list", db_diary_get_c_diary_list4c_member_id($target_c_member_id, 5, $u)); //フレンドランダム5人 $this->set("c_friend_list", db_friend_c_friend_list_random4c_member_id($target_c_member_id, 5)); //参加コミュニティ最新書き込み5件 $this->set("c_commu_list", db_commu_c_commu_list_lastupdate4c_member_id($target_c_member_id, 5)); //共通コミュニティ $this->set('common_commu_count', count(db_common_commu_common_commu_id4c_member_id($target_c_member_id, $u))); //ターゲットと自分との関係 $this->set("relation", db_friend_relationship4two_members($u, $target_c_member_id)); $is_friend = db_friend_is_friend($u, $target_c_member_id); if ($is_friend) { $this->set('is_friend', $is_friend); } else { $this->set('friend_path', db_friend_friend_path4c_member_ids($u, $target_c_member_id)); } $this->set('profile_list', db_member_c_profile_list()); // 誕生日まであと何日? $this->set('days_birthday', db_member_count_days_birthday4c_member_id($target_c_member_id)); if (OPENPNE_USE_POINT_RANK) { // ポイント $point = db_point_get_point($target_c_member_id); $this->set("point", $point); // ランク $this->set("rank", db_point_get_rank4point($point)); } // inc_entry_point $this->set('inc_ktai_entry_point', fetch_inc_entry_point($this->getView(), 'ktai_f_home')); //あしあとをつける db_ashiato_insert_c_ashiato($target_c_member_id, $u); return 'success'; }
function decodeUserDetails($req) { include_once "dbconnect.php"; $res = file_get_contents($req); $jsonObject = json_decode($res); $user_id = $jsonObject->id; $user_name = $jsonObject->name; $user_birthday = $jsonObject->birthday; $user_gender = $jsonObject->gender; $user_relationship_status = $jsonObject->relationship_status; $user_age = getAge($user_birthday); $user_location = $jsonObject->location->name; $user_hometown = $jsonObject->hometown->name; echo 'User ID : ' . $user_id . ' <br/>'; echo 'Name : ' . $user_name . ' <br/>'; echo 'Birthday : ' . $user_birthday . ' <br/>'; echo 'Gender : ' . $user_gender . ' <br/>'; echo 'Relationship Statuds : ' . $user_relationship_status . ' <br/>'; echo 'Location : ' . $user_location . ' <br/>'; echo 'Hometown : ' . $user_hometown . ' <br/>'; echo 'Age : ' . $user_age; try { $id = mysqli_real_escape_string($dbc, $user_id); global $u_id; $u_id = $id; $age = mysqli_real_escape_string($dbc, $user_age); $gender = mysqli_real_escape_string($dbc, $user_gender); $rel = mysqli_real_escape_string($dbc, $user_relationship_status); $sql = "INSERT INTO user_details VALUES(" . $user_id . ", " . $user_age . ", '" . $user_gender . "', '" . $user_relationship_status . "', 'apple') "; mysqli_query($dbc, $sql); } catch (Exception $e) { echo '<br/>skipped ' . $user_id . '<br/><br/>'; } echo '<br/> EDUCATION <br/>'; foreach ($jsonObject->education as $edu) { $school_id = $edu->school->id; $school_name = $edu->school->name; $school_type = $edu->type; echo $school_id . ' : ' . $school_name . ' : ' . $school_type . ' <br/>'; } echo '<br/> WORK <br/>'; foreach ($jsonObject->work as $job) { $employer_id = $job->employer->id; $employer_name = $job->employer->name; $location = $job->location->name; $position = $job->position->name; $start_date = $job->start_date; $end_date = $job->end_date; echo $employer_id . ' : ' . $employer_name . ' : ' . $location . ' : ' . $position . ' : ' . $start_date . ' to ' . $end_date . ' <br/>'; } echo '<br/> INTERESTED IN <br/>'; foreach ($jsonObject->interested_in as $inter) { echo $inter . ' <br/>'; } echo '<div onload="isDoneLoading()" style="display : none">'; mysqli_close($dbc); }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); $target_c_member_id = $u; $this->set('is_h_prof', 1); $this->set('inc_navi', fetch_inc_navi('h')); $target_c_member = db_member_c_member_with_profile($u, 'private'); $this->set('is_friend', 0); $this->set('c_diary_list', db_diary_get_c_diary_list4c_member_id($target_c_member_id, 5, null, 'friend')); if (OPENPNE_USE_ALBUM) { // アルバム $this->set('c_album_list', db_album_get_c_album_subject_list4c_member_id($target_c_member_id, 5, null, 'friend')); } // --- f_home, h_prof 共通処理 $this->set('target_c_member_id', $target_c_member_id); $target_c_member['last_login'] = p_f_home_last_login4access_date($target_c_member['access_date']); if ($target_c_member['birth_year']) { $target_c_member['age'] = getAge($target_c_member['birth_year'], $target_c_member['birth_month'], $target_c_member['birth_day']); } $this->set('target_c_member', $target_c_member); $this->set('c_rss_cache_list', db_rss_c_rss_cache_list4c_member_id($target_c_member_id, 5)); $this->set('c_friend_comment_list', db_friend_c_friend_comment4c_member_id($target_c_member_id)); $this->set('c_friend_list', db_friend_c_friend_list4c_member_id($target_c_member_id, 9)); $this->set('c_friend_count', db_friend_count_friends($target_c_member_id)); $this->set('user_count', db_commu_count_c_commu4c_member_id($target_c_member_id)); $this->set('c_commu_list', db_commu_c_commu_list4c_member_id_2($target_c_member_id, 9)); $this->set('c_review_list', db_review_c_review_list4member($target_c_member_id, 5)); $this->set('profile_list', db_member_c_profile_list()); // 誕生日まであと何日? $this->set('days_birthday', db_member_count_days_birthday4c_member_id($target_c_member_id)); if (OPENPNE_USE_POINT_RANK) { // ポイント $point = db_point_get_point($target_c_member_id); $this->set("point", $point); // ランク $this->set("rank", db_point_get_rank4point($point)); } // ---bizここから $this->set('is_h_prof', 1); //カレンダー表示用 $biz_dir = OPENPNE_MODULES_BIZ_DIR . '/biz/'; //bizモジュールディレクトリの定義 include_once $biz_dir . 'lib/smarty_functions.php'; //bizモジュールよりライブラリを拝借 include_once $biz_dir . 'lib/mysql_functions.php'; //bizモジュールよりライブラリを拝借 $this->set('calendar', biz_getScheduleWeek($u, $u, $requests['w'], 'p', true, true, true, $target_c_member)); $todolist = biz_getTodoList($u, $u, "h", $target_c_member['nickname']); $this->set("todolist", $todolist); $group_list = biz_getHomeGroupList($u); $this->set('group_list', $group_list); // ---bizここまで // inc_entry_point $this->set('inc_entry_point', fetch_inc_entry_point($this->getView(), 'f_home')); return 'success'; }
/** * 用户信息 **/ public function userinfo() { $user_id = $this->get_user_id(TRUE); $user_info = $this->model->get_user_detail($user_id, TRUE); if ($user_info) { $user = array('user_id' => $user_info['user_id'], 'user_name' => $user_info['user_name'], 'state' => $user_info['state'], 'nick_name' => $user_info['nick_name'], 'headimg' => $user_info['headimg'], 'signature' => $user_info['signature'], 'birthday' => $user_info['birthday'], 'age' => getAge($user_info['birthday']), 'sex' => $user_info['sex'], 'role' => $user_info['role'], 'mobile_phone' => $user_info['user_mobile']); response_json('1', $user); } response_code('4005'); }
/** * in this function we compare ages of human1 and human 2 * @param unknown $human1 * @param unknown $human2 */ public static function compare($human1, $human2) { if ($human1 . getAge() > $human2 . getAge()) { return 1; } else { if ($human1 . getAge() < $human2 . getAge()) { return -1; } else { return 0; } } }
function storeStaffCredentials($staffInfo) { $dbConnection = connectToDB(); if (!$dbConnection) { //echo "Unable to connect to MySQL.".PHP_EOL; return 0; } $fname = $staffInfo["firstName"]; // $middleInitial = $staffInfo["middleName"]; // $lname = $staffInfo["lastName"]; // $nickname = $staffInfo["nickName"]; // $usernameProvided = $staffInfo["username"]; // $emailProvided = $staffInfo["email"]; // $password = $staffInfo["password"]; // $dob = $staffInfo["dob"]; // $phone = $staffInfo["phone"]; // $age = getAge($dob); //Cleaning data (prevent SQL injections) $username = mysqli_real_escape_string($dbConnection, $usernameProvided); $email = mysqli_real_escape_string($dbConnection, $emailProvided); $hashCodeEmail = mysqli_real_escape_string($dbConnection, md5(rand(0, 1000))); $cleanPassword = mysqli_real_escape_string($dbConnection, $password); //hashing password $options = array('cost' => 10); $passwordHashed = password_hash($cleanPassword, PASSWORD_BCRYPT, $options); $query = "INSERT INTO registered_staff ( username, password, email, hashEmail, firstName, middleInitial, lastName, nickname, phone, dateOfBirth, age)\n VALUES ('" . $username . "', '" . $passwordHashed . "', '" . $email . "', '" . $hashCodeEmail . "' , '" . $fname . "', '" . $middleInitial . "', '" . $lname . "', '" . $nickname . "', '" . $phone . "', '" . $dob . "', '" . $age . "')"; // echo "<p>".$query."</p>"; $result = mysqli_query($dbConnection, $query); if ($result) { $staffID = $dbConnection->insert_id; if (isset($staffID)) { //echo "<p>staff saved with id $staffID</p>"; return $staffID; } else { // echo "Unable to retrieve staff ID"; return -3; } } // echo "Unable to store staff credentials"; return -2; }
function team($tID = '') { global $db, $teamRow, $l_team; //SQL if (!empty($tID)) { $where = "WHERE id = '" . intval($tID) . "' AND navi = 1"; } else { $where = "WHERE navi = '1' ORDER BY RAND()"; } $get = _fetch(db("SELECT * FROM " . $db['squads'] . " " . $where . "")); //Members $qrym = db("SELECT s1.squad,s2.id,s2.level,s2.nick,s2.status,s2.rlname,s2.bday,s4.position\n FROM " . $db['squaduser'] . " AS s1\n LEFT JOIN " . $db['users'] . " AS s2\n ON s2.id=s1.user\n LEFT JOIN " . $db['userpos'] . " AS s3\n ON s3.squad=s1.squad AND s3.user=s1.user\n LEFT JOIN " . $db['pos'] . " AS s4\n ON s4.id=s3.posi\n WHERE s1.squad='" . $get['id'] . "'\n AND s2.level != 0\n ORDER BY s4.pid"); $i = 1; $cnt = 0; while ($getm = _fetch($qrym)) { unset($tr1, $tr2); if ($i == 0 || $i == 1) { $tr1 = "<tr>"; } if ($i == $teamRow) { $tr2 = "</tr>"; $i = 0; } $status = $getm['status'] == 1 || $getm['level'] == 1 ? _aktiv : _inaktiv; $info = 'onmouseover="DZCP.showInfo(\'<tr><td colspan=2 align=center padding=3 class=infoTop>' . rawautor($getm['id']) . '</td></tr><tr><td width=80px><b>' . _posi . ':</b></td><td>' . getrank($getm['id'], $get['id']) . '</td></tr><tr><td><b>' . _status . ':</b></td><td>' . $status . '</td></tr><tr><td><b>' . _age . ':</b></td><td>' . getAge($getm['bday']) . '</td></tr><tr><td colspan=2 align=center>' . jsconvert(userpic($getm['id'])) . '</td></tr>\')" onmouseout="DZCP.hideInfo()"'; $member .= show("menu/team_show", array("pic" => userpic($getm['id'], 40, 50), "tr1" => $tr1, "tr2" => $tr2, "squad" => $get['id'], "info" => $info, "id" => $getm['id'], "width" => round(100 / $teamRow, 0))); $i++; $cnt++; } if (is_float($cnt / $teamRow)) { for ($e = $i; $e <= $teamRow; $e++) { $end .= '<td></td>'; } $end = $end . "</tr>"; } // Next / last ID $all = cnt($db['squads'], "WHERE `navi` = '1'"); $next = _fetch(db("SELECT id FROM " . $db['squads'] . " WHERE `navi` = '1' AND `id` > '" . $get['id'] . "' ORDER BY `id` ASC LIMIT 1")); if (empty($next)) { $next = _fetch(db("SELECT id FROM " . $db['squads'] . " WHERE `navi` = '1' ORDER BY `id` ASC LIMIT 1")); } $last = _fetch(db("SELECT id FROM " . $db['squads'] . " WHERE `navi` = '1' AND `id` < '" . $get['id'] . "' ORDER BY `id` DESC LIMIT 1")); if (empty($last)) { $last = _fetch(db("SELECT id FROM " . $db['squads'] . " WHERE `navi` = '1' ORDER BY `id` DESC LIMIT 1")); } //Output $team = show("menu/team", array("row" => $teamRow, "team" => re($get['name']), "id" => $get['id'], "next" => $next['id'], "last" => $last['id'], "br1" => $all <= 1 ? '<!--' : '', "br2" => $all <= 1 ? '-->' : '', "member" => $member, "end" => $end)); return '<div id="navTeam">' . $team . '</div>'; }
function uotm() { global $db, $allowHover; $imgFiles = array(); $folder = get_files('../inc/images/uploads/userpics'); foreach ($folder as $file) { array_push($imgFiles, $file); } if (count($imgFiles) != 0) { $userid = intval($imgFiles[rand(0, count($imgFiles) - 1)]); $get = _fetch(db("SELECT id,nick,country,bday FROM " . $db['users'] . " WHERE id = '" . $userid . "'")); if (!empty($get)) { if ($allowHover == 1) { $info = 'onmouseover="DZCP.showInfo(\'<tr><td colspan=2 align=center padding=3 class=infoTop>' . rawautor($get['id']) . '</td></tr><tr><td width=50%><b>' . _age . ':</b></td><td>' . getAge($get['bday']) . '</td></tr><tr><td colspan=2 align=center>' . jsconvert(userpic($get['id'])) . '</td></tr>\')" onmouseout="DZCP.hideInfo()"'; } $uotm = show("menu/uotm", array("uid" => $userid, "upic" => userpic($get['id'], 130, 161), "info" => $info)); } } return empty($uotm) ? '' : '<table class="navContent" cellspacing="0">' . $uotm . '</table>'; }
function execute($requests) { $u = $GLOBALS['AUTH']->uid(); $target_c_member_id = $u; $this->set('is_h_prof', 1); $this->set('inc_navi', fetch_inc_navi('h')); $target_c_member = db_member_c_member_with_profile($u, 'private'); $this->set('is_friend', 0); $this->set('c_diary_list', db_diary_get_c_diary_list4c_member_id($target_c_member_id, 5, null, 'friend')); if (OPENPNE_USE_ALBUM) { // アルバム $this->set('c_album_list', db_album_get_c_album_subject_list4c_member_id($target_c_member_id, 5, null, 'friend')); } // --- f_home, h_prof 共通処理 $this->set('target_c_member_id', $target_c_member_id); $target_c_member['last_login'] = p_f_home_last_login4access_date($target_c_member['access_date']); if ($target_c_member['birth_year']) { $target_c_member['age'] = getAge($target_c_member['birth_year'], $target_c_member['birth_month'], $target_c_member['birth_day']); } $this->set('target_c_member', $target_c_member); $this->set('c_rss_cache_list', db_rss_c_rss_cache_list4c_member_id($target_c_member_id, 5)); $this->set('c_friend_comment_list', db_friend_c_friend_comment4c_member_id($target_c_member_id)); $this->set('c_friend_list', db_friend_c_friend_list4c_member_id($target_c_member_id, 9)); $this->set('c_friend_count', db_friend_count_friends($target_c_member_id)); $this->set('user_count', db_commu_count_c_commu4c_member_id($target_c_member_id)); $this->set('c_commu_list', db_commu_c_commu_list4c_member_id_2($target_c_member_id, 9)); $this->set('c_review_list', db_review_c_review_list4member($target_c_member_id, 5)); $this->set('profile_list', db_member_c_profile_list()); // 誕生日まであと何日? $this->set('days_birthday', db_member_count_days_birthday4c_member_id($target_c_member_id)); if (OPENPNE_USE_POINT_RANK) { // ポイント $point = db_point_get_point($target_c_member_id); $this->set("point", $point); // ランク $this->set("rank", db_point_get_rank4point($point)); } // inc_entry_point $this->set('inc_entry_point', fetch_inc_entry_point($this->getView(), 'f_home')); return 'success'; }
public function getHTML() { $container = isset($_SESSION['opensocial_container']) ? $_SESSION['opensocial_container'] : null; $page = new Neuron_Core_Template(); $player = Neuron_GameServer::getPlayer(); if ($player) { $page->set('plid', $player->getId()); } else { $page->set('plid', ''); } if (isset($_SESSION['birthday'])) { $page->set('birthday', date('Y-m-d', $_SESSION['birthday'])); $page->set('age', getAge(date('Y-m-d', $_SESSION['birthday']))); } if (isset($_SESSION['gender'])) { $page->set('gender', $_SESSION['gender']); } $page->set('container', $container); //print_r ($_SESSION); return $page->parse('neuron/advertisement/loading.phpt'); }
/** * Gets user's information from database by user's id * @param $sId - user ID * @return $aInfo - user info */ function getUserInfo($sId) { global $sWomanImageUrl; global $sManImageUrl; global $sImagesPath; global $sProfileUrl; global $sRootURL; //get info by ID on these fields $sNick = ""; $sSex = ""; $sAge = "0"; $sDesc = ""; $sImg = ""; $sProfile = ""; // You should change this query to retrieve user's data correctly $aUser = getArray("SELECT * FROM `Profiles` WHERE `ID` = '" . $sId . "' LIMIT 1"); /** * Define photo. * If this user has a photo you should define it's uri here. * Otherwise a "no_photo" image is used. */ if ((int) $aUser['PrimPhoto'] != 0) { $sPhoto = $sImagesPath . $aUser['ID'] . "/thumb_" . getValue("SELECT `med_file` FROM `media` WHERE `med_id`='" . $aUser['PrimPhoto'] . "'"); } else { $sPhoto = $aUser['Sex'] == 'female' ? $sWomanImageUrl : $sManImageUrl; } $sSex = isset($aUser['Sex']) ? $aUser['Sex'] : "male"; $sNick = $aUser['NickName']; $sAge = isset($aUser['DateOfBirth']) ? getAge($aUser['DateOfBirth']) : "25"; $sDesc = isset($aUser['DescriptionMe']) ? $aUser['DescriptionMe'] : ""; $sModRewrite = getValue("SELECT `VALUE` FROM `GlParams` WHERE `Name`='enable_modrewrite' LIMIT 1"); $sProfile = $sModRewrite == "on" ? $sRootURL . $sNick : $sProfileUrl . "?ID=" . $sId; /** * Return user info. * NOTE. Do not change the return statement order. */ return array("nick" => $sNick, "sex" => $sSex, "age" => $sAge, "desc" => $sDesc, "photo" => $sPhoto, "profile" => $sProfile); }
/** * Gets user's information from database by user's id * @param $sId - user ID * @return $aInfo - user info */ function getUserInfo($sId, $bNick = false) { global $sWomanImageUrl; global $sManImageUrl; global $sProfileUrl; global $sRootURL; //get info by ID on these fields $sNick = ""; $sSex = ""; $sAge = "0"; $sDesc = ""; $sPhoto = ""; $sProfile = ""; //You should change this query to retrieve user's data correctly $sWherePart = ($bNick ? "`NickName`" : "`ID`") . " = '" . $sId . "'"; $aUser = getArray("SELECT * FROM `Profiles` WHERE " . $sWherePart . " LIMIT 1"); /** * Define photo. * If this user has a photo you should define it's uri here. * Otherwise a "no_photo" image is used. */ $oBaseFunctions = bx_instance("BxBaseFunctions"); $sSex = !empty($aUser['Sex']) ? $aUser['Sex'] : "male"; $sPhoto = $oBaseFunctions->getMemberAvatar($sId); if (empty($sPhoto)) { $sPhoto = $sSex == "male" ? $sManImageUrl : $sWomanImageUrl; } $sNick = $aUser['NickName']; $sAge = isset($aUser['DateOfBirth']) ? getAge($aUser['DateOfBirth']) : "25"; $sDesc = isset($aUser['DescriptionMe']) ? strip_tags($aUser['DescriptionMe']) : ""; $sProfile = getParam('enable_modrewrite') == "on" ? $sRootURL . $sNick : $sProfileUrl . "?ID=" . $sId; /** * Return user info. * NOTE. Do not change the return statement order. */ return array("id" => (int) $aUser["ID"], "nick" => $sNick, "sex" => $sSex, "age" => $sAge, "desc" => $sDesc, "photo" => $sPhoto, "profile" => $sProfile); }
public function view() { $uid = intval($_REQUEST['uid']); if (!$uid) { $this->error('错误用户'); } $userModel = D('User'); $intentionModel = D('Intention'); $introModel = D('Intro'); $userJoinKeywordModel = D('UserJoinKeyword'); $userJoinFunctionModel = D('UserJoinFunction'); $jobModel = D('Job'); $projectModel = D('Project'); $dictMajorModel = D('DictMajor'); $dictLocationModel = D('DictLocation'); $data = array(); $data['user'] = $userModel->where(" uid = {$uid} ")->find(); $data['intention'] = $intentionModel->where(" uid = {$uid} ")->find(); $data['intro'] = $introModel->where(" uid = {$uid} ")->getfield('intro'); $data['keyword'] = $userJoinKeywordModel->field('keyword.keyword')->join('LEFT JOIN keyword ON user_join_keyword.keyword_id = keyword.id ')->where(" uid = {$uid} ")->select(); $data['function'] = $userJoinFunctionModel->field('dict_function.function_name')->join('LEFT JOIN dict_function ON user_join_function.function_id = dict_function.function_id ')->where(" uid = {$uid} ")->select(); $data['job'] = $jobModel->where(" uid = {$uid} ")->select(); $data['project'] = $projectModel->where(" uid = {$uid} ")->select(); $data['user']['sex'] = getSex($data['user']['sex']); $data['user']['age'] = getAge($data['user']['birthday']); $data['user']['birthday'] = getBirthday($data['user']['birthday']); $data['user']['workyear'] = getDictValue('WORKYEAR', $data['user']['workyear']); $data['user']['location'] = $dictLocationModel->getLocationName($data['user']['location']); $data['user']['jobstatus'] = getDictValue('JOBSTATUS', $data['user']['jobstatus']); $data['user']['degrees'] = getDictValue('DEGREES', $data['user']['degrees']); $data['user']['major'] = $dictMajorModel->getMajorName($data['user']['major']); $data['intention']['jobarea'] = $dictLocationModel->getLocationName($data['intention']['jobarea']); $data['intention']['salary'] = getDictValue('SALARY', $data['intention']['salary']); $this->assign('data', $data); $this->assign('title', '查看'); $this->display(); }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $target_c_member_id = $u; // ---------- $this->set('is_h_prof', 1); //管理画面HTML $this->set('c_siteadmin', p_common_c_siteadmin4target_pagename('k_f_home')); $target_c_member = db_member_c_member_with_profile($target_c_member_id, 'private'); $target_c_member['last_login'] = p_f_home_last_login4access_date($target_c_member['access_date']); if ($target_c_member['birth_year']) { $target_c_member['age'] = getAge($target_c_member['birth_year'], $target_c_member['birth_month'], $target_c_member['birth_day']); } $this->set("target_c_member", $target_c_member); //ターゲットの最新日記5件 $this->set('c_diary_list', db_diary_get_c_diary_list4c_member_id($target_c_member_id, 5, null, 'friend')); //フレンドランダム5人 $this->set("c_friend_list", db_friend_c_friend_list_random4c_member_id($target_c_member_id, 5)); //参加コミュニティ最新書き込み5件 $this->set("c_commu_list", db_commu_c_commu_list_lastupdate4c_member_id($target_c_member_id, 5)); //共通コミュニティ $this->set('common_commu_count', count(db_common_commu_common_commu_id4c_member_id($target_c_member_id, $u))); $this->set('profile_list', db_member_c_profile_list()); // 誕生日まであと何日? $this->set('days_birthday', db_member_count_days_birthday4c_member_id($target_c_member_id)); if (OPENPNE_USE_POINT_RANK) { // ポイント $point = db_point_get_point($target_c_member_id); $this->set("point", $point); // ランク $this->set("rank", db_point_get_rank4point($point)); } // inc_entry_point $this->set('inc_ktai_entry_point', fetch_inc_entry_point($this->getView(), 'ktai_f_home')); return 'success'; }
function execute($requests) { $u = $GLOBALS['KTAI_C_MEMBER_ID']; // --- リクエスト変数 $target_c_member_id = $requests['target_c_member_id']; // ---------- $is_h = 0; if ($target_c_member_id == $u || empty($target_c_member_id)) { $target_c_member_id = $u; $is_h = 1; } if (!$is_h) { if (!db_member_is_active_c_member_id($target_c_member_id)) { ktai_display_error('該当するメンバーが見つかりません。'); } if (db_member_is_access_block($u, $target_c_member_id)) { openpne_redirect('ktai', 'page_h_access_block'); } //あしあとをつける db_ashiato_insert_c_ashiato($target_c_member_id, $u); } $is_friend = db_friend_is_friend($u, $target_c_member_id); if ($is_h || $is_friend) { $target_c_member = db_member_c_member_with_profile($target_c_member_id, 'friend'); } else { $target_c_member = db_member_c_member_with_profile($target_c_member_id, 'public'); } if ($target_c_member['birth_year']) { $target_c_member['age'] = getAge($target_c_member['birth_year'], $target_c_member['birth_month'], $target_c_member['birth_day']); } $this->set('is_h', $is_h); $this->set('target_c_member', $target_c_member); $this->set('profile_list', db_member_c_profile_list()); $this->set('relation', db_friend_relationship4two_members($u, $target_c_member_id)); return 'success'; }
$URL .= "&addReturn=fail2"; header("Location: {$URL}"); break; } if ($result->rowCount() > 0) { //Fail 4 $URL .= "&addReturn=fail4"; header("Location: {$URL}"); } else { //Check publicRegistrationMinimumAge $publicRegistrationMinimumAge = getSettingByScope($connection2, 'User Admin', 'publicRegistrationMinimumAge'); $ageFail = FALSE; if ($publicRegistrationMinimumAge == "") { $ageFail = TRUE; } else { if ($publicRegistrationMinimumAge > 0 and $publicRegistrationMinimumAge > getAge(dateConvertToTimestamp($dob), TRUE, TRUE)) { $ageFail = TRUE; } } if ($ageFail == TRUE) { //Fail 5 $URL .= "&addReturn=fail5"; header("Location: {$URL}"); } else { //Write to database try { $data = array("surname" => $surname, "firstName" => $firstName, "preferredName" => $preferredName, "officialName" => $officialName, "gender" => $gender, "dob" => $dob, "email" => $email, "username" => $username, "passwordStrong" => $passwordStrong, "passwordStrongSalt" => $salt, "status" => $status, "gibbonRoleIDPrimary" => $gibbonRoleIDPrimary, "gibbonRoleIDAll" => $gibbonRoleIDAll); $sql = "INSERT INTO gibbonPerson SET surname=:surname, firstName=:firstName, preferredName=:preferredName, officialName=:officialName, gender=:gender, dob=:dob, email=:email, username=:username, password='', passwordStrong=:passwordStrong, passwordStrongSalt=:passwordStrongSalt, status=:status, gibbonRoleIDPrimary=:gibbonRoleIDPrimary, gibbonRoleIDAll=:gibbonRoleIDAll"; $result = $connection2->prepare($sql); $result->execute($data); } catch (PDOException $e) {
print "</tr>"; print "<tr>"; print "<td style='width: 33%; padding-top: 15px; vertical-align: top'>"; print "<span style='font-size: 115%; font-weight: bold'>" . _('Gender') . "</span><br/>"; print $row["gender"]; print "</td>"; print "<td style='width: 33%; padding-top: 15px; vertical-align: top'>"; print "<span style='font-size: 115%; font-weight: bold'>" . _('Date of Birth') . "</span><br/>"; if (is_null($row["dob"]) == FALSE and $row["dob"] != "0000-00-00") { print dateConvertBack($guid, $row["dob"]); } print "</td>"; print "<td style='width: 33%; padding-top: 15px; vertical-align: top'>"; print "<span style='font-size: 115%; font-weight: bold'>" . _('Age') . "</span><br/>"; if (is_null($row["dob"]) == FALSE and $row["dob"] != "0000-00-00") { print getAge(dateConvertToTimestamp($row["dob"])); } print "</td>"; print "</tr>"; print "</table>"; print "<h4>"; print _("Contacts"); print "</h4>"; print "<table class='smallIntBorder' cellspacing='0' style='width: 100%'>"; $numberCount = 0; if ($row["phone1"] != "" or $row["phone2"] != "" or $row["phone3"] != "" or $row["phone4"] != "") { print "<tr>"; for ($i = 1; $i < 5; $i++) { if ($row["phone" . $i] != "") { $numberCount++; print "<td width: 33%; style='vertical-align: top'>";
<td><?php echo getStrCut($MB[MB_NIC], 10, '..'); ?> </td> <td>[<?php echo $MB[MB_TYPE]; ?> ]<?php echo $MB_GROUP[$MB[MB_TYPE] - 1]; ?> </td> <td><?php echo getSex($MB[MB_SEX]); ?> ,<?php echo getAge($MB[MB_BIRTH]); ?> 세</td> <td><?php echo substr($MB[MB_ADDR1], 0, 4); ?> </td> <td> <?php if ($MB[MB_HOME_TEL]) { ?> <img src='./image/ico_tel.gif' style='cursor:pointer;' onclick="alert('전화번호 : <?php echo $MB[MB_HOME_TEL]; ?> ')"> <?php
// function to convert date of birth into age. function getAge($Birthdate) { // Explode the date into meaningful variables list($BirthMonth, $BirthDay, $BirthYear) = explode("/", $Birthdate); // Find the differences $YearDiff = date("Y") - $BirthYear; $MonthDiff = date("m") - $BirthMonth; $DayDiff = date("d") - $BirthDay; // If the birthday has not occured this year if ($DayDiff < 0 || $MonthDiff < 0) { $YearDiff--; } return $YearDiff; } $age = getAge($Birthdate); // calls getAge function and stores the age in $age. $res = mysql_query("SELECT user_email FROM user_details WHERE user_email='{$user_profile['email']}'"); $row = mysql_num_rows($res); // gives the number of rows selected if ($row > 0) { $update_fb = "UPDATE \n\t\t\t\t\t\t\t\t\tuser_details \n\t\t\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t\t\tuser_name = '" . $user_profile[name] . "',\n\t\t\t\t\t\t\t\t\tuser_email = '" . $user_profile[email] . "',\n\t\t\t\t\t\t\t\t\tuser_age = '" . $age . "',\n\t\t\t\t\t\t\t\t\tuser_gender = '" . $user_profile[gender] . "',\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\tuser_email = " . $user_profile[email]; mysql_query($update_fb); } else { $sql_insert = "INSERT INTO user_details (user_name,user_email,user_age,user_gender) VALUES ('{$user_profile['name']}','{$user_profile['email']}','{$age}','{$user_profile['gender']}')"; mysql_query($sql_insert) or die("Error: " . mysql_error() . " with query " . $query); } } ?> <!DOCTYPE html PUBLIC "-//W3Czz//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php if (isset($get_talents)) { foreach ($get_talents as $talent) { ?> <div class="col-md-4 col-sm-6" > <!-- Widget: user widget style 1 --> <div class="box box-widget widget-user"> <!-- Add the bg color to the header using any of the bg-* classes --> <div class="widget-user-header bg-aqua-active"> <h3 class="widget-user-username"><?php echo $talent['first_name'] . " " . $talent['last_name']; ?> </h3> <h5 class="widget-user-desc"><?php echo $talent['sex'] . ", " . getAge($talent['dob']); ?> Years</h5> </div> <div class="widget-user-image"> <img class="img-circle card" src="<?php echo $talent['photo1_url']; ?> " alt="talent_photo" /> </div> <div class="box-footer"> <div class="row"> <?php $events = $talent['events']; if (is_null($events) or $events == "") { $events = " - not set - ";
echo "<img src=\"elements/default_avatar.png\"/>"; } else { echo "<img src=\"foto/" . $row['foto_user'] . "\"/>"; } echo "<div id=\"emer\">" . $row['emer_user'] . " " . $row['mbiemer_user'] . "</div></a> </div>"; if ($row['roli'] == 0) { echo "<div>Student</div>"; } else { echo "<div>Profesor</div>"; } if (strcasecmp($row['gjinia'], "m") == 0) { echo "<div>Mashkull</div>"; } else { echo "<div>Femër</div>"; } $mosha = getAge($row['dtl_user']); echo "<div>" . $mosha . " vjeç</div><br/>"; $query2 = "SELECT `dega`.`emer_dega`\n\t\t\t\t\t\t\t, `fakultet`.`emer_shkurt_fak`\n\t\t\t\t\t\t\t, `universitet`.`emer_shkurt_uni`\n\t\t\t\t\t\tFROM `user`\n\t\t\t\t\t\tINNER JOIN `dega` \n\t\t\t\t\t\tON (`user`.`user_id_dega` = `dega`.`id_dega`)\n\t\t\t\t\t\tINNER JOIN `fakultet` \n\t\t\t\t\t\tON (`dega`.`dega_id_fak` = `fakultet`.`id_fak`)\n\t\t\t\t\t\tINNER JOIN `universitet` \n\t\t\t\t\t\tON (`fakultet`.`fak_id_uni` = `universitet`.`id_uni`)\n\t\t\t\t\t\tWHERE id_user={$_SESSION['id']} \n\t\t\t\t\t\tLIMIT 1;"; $result2 = mysqli_query($connection, $query2); $row2 = mysqli_fetch_array($result2); echo "<div>" . $row2['emer_dega'] . ", " . $row2['emer_shkurt_fak'] . ", " . $row2['emer_shkurt_uni'] . "</div>"; echo "<div>Vendlindja: " . $row['vendlindja_user'] . "</div>"; if (isset($row['informacion_user'])) { echo "<div>Informacion shtesë: " . $row['informacion_user'] . "</div>"; } ?> <a href="#" data-role="button" data-inline="false" data-rel="back"> OK </a> <a href="includes/logout.php" data-ajax="false" data-role="button" data-inline="false">Logout</a> </div>
public function get_users_info_by_ids($ids) { $user_info = array(); $cond = array('table' => 'user_info', 'fields' => 'user_id,nick_name,sex,headimg,birthday', 'where' => 'user_id IN (' . $ids . ')'); $rs = $this->get_all($cond); if ($rs) { foreach ($rs as $key => $row) { $row['age'] = getAge($row['birthday']); unset($row['birthday']); $user_info[$row['user_id']] = $row; } } return $user_info; }
if (data($get['id'], "level") > 1) { $status = $getstatus; } else { $status = ""; } $class = $color % 2 ? "contentMainSecond" : "contentMainFirst"; $color++; if (permission("editusers")) { $edit = show("page/button_edit", array("id" => "", "action" => "action=admin&edit=" . $get['id'], "title" => _button_title_edit)); $edit = str_replace("&id=", "", $edit); $delete = show("page/button_delete", array("id" => $get['id'], "action" => "action=admin&do=delete", "title" => _button_title_del)); } else { $edit = ""; $delete = ""; } $userliste .= show($dir . "/userliste_show", array("nick" => autor($get['id'], '', '', 10), "level" => getrank($get['id']), "status" => $status, "email" => $email, "age" => getAge($get['bday']), "mf" => $sex, "edit" => $edit, "delete" => $delete, "class" => $class, "icq" => $icq, "icquin" => $get['icq'], "onoff" => onlinecheck($get['id']), "hp" => $hp, "hlsw" => $hlsw)); } $seiten = nav($entrys, $maxuserlist, "?action=userlist&show=" . $_GET['show'] . ""); if (permission("editusers")) { $edel = '<td class="contentMainTop" colspan="2"> </td>'; } if (isset($_GET['search']) && !empty($_GET['search'])) { $search = $_GET['search']; } else { $search = _nick; } $index = show($dir . "/userliste", array("userlistehead" => _userlist, "nickhead" => _nick, "normal" => _ulist_normal, "country" => _ulist_country, "sex" => _ulist_sex, "cnt" => $entrys . " " . _user, "lastreg" => _ulist_lastreg, "online" => _ulist_online, "age" => _ulist_age, "login" => _ulist_last_login, "bday" => _ulist_bday, "sort" => _ulist_sort, "banned" => _ulist_acc_banned, "edel" => $edel, "search" => $search, "value" => _button_value_search, "mficon" => _mficon_blank, "nav" => $seiten, "statushead" => _status, "emailicon" => _emailicon_blank, "addbuddyicon" => _addbuddyicon_blank, "agehead" => _profil_age, "icqicon" => _icqicon_blank, "pnicon" => _pnicon_blank, "hpicon" => _hpicon_blank, "hlswicon" => _hlswicon_blank, "show" => $userliste)); break; case 'buddys': $where = _site_user_buddys; if ($chkMe == "unlogged") {
public function user_ping() { if (!checkpost()) { exit('error'); } if (!$GLOBALS['islogin']) { exit('{"stat":9, "errno":"未登录", "error":"未登录}'); } $msgModel = D('Msg'); $u = $msgModel->check_contact('uid', 'uid, username, sex, default_pic, score_impress, score_impress_num, hometown_prov, hometown_city'); $ping_score = round(floatval($_POST['score']), 1); $ping_score = min(max(1, $ping_score), 10); $score = ($ping_score - $u['score_impress']) / ($u['score_impress_num'] + 1) + $u['score_impress']; $score = round($score, 1); //visit表中记录打分 $visit = M('visit'); $data['uid'] = $GLOBALS['i']['uid']; $data['visit_uid'] = $u['uid']; $data['score_impress'] = $ping_score; $data['add_time'] = time(); $hot = $visit->where("uid={$GLOBALS['i']['uid']} AND visit_uid={$u['uid']}")->find(); if ($hot) { $visit->where("id={$hot['id']}")->save($data); } else { $visit->add($data); } //member表和member_field记录变化 $member = M('member'); $edit['score_impress'] = $score; $edit['score_impress_num'] = array('exp', "score_impress_num+1"); $member->where("uid={$u['uid']}")->save($edit); //echo $member->getLastSql(); $member_field = M('member_field'); $data1['new_receive_score'] = array('exp', 'new_receive_score+1'); $data1['receive_score_num'] = array('exp', 'receive_score_num+1'); $member_field->where("uid={$u['uid']}")->save($data1); //调整打分的指针 $offset = $GLOBALS['i']['user_ping_offset'] + 1; $sex = 3 - $GLOBALS['i']['sex']; $count = $member->where("sex={$sex} AND default_photonum>0 AND group_type>0")->count(); $offset = $offset > $count - 1 ? 0 : $offset; $member->where("uid={$GLOBALS['i']['uid']}")->setField('user_ping_offset', $offset); $rs = $member->field('uid, sex, username, default_pic, photonum, hometown_prov, hometown_city, want_content')->where("sex={$sex} AND default_photonum>0 AND group_type>0")->limit("{$offset}, 2")->select(); $u1 = $rs[0]; $offset = $offset + 11 > $count - 1 ? $offset - $count : $offset; $u2 = $member->field('uid, default_pic, username')->where("sex={$sex} AND default_photonum>0 AND group_type>0")->limit($offset + 11 . ",1")->select(); $u2 = $u2[0]; $u3 = $rs[1]; $accurate = $is_play = ''; if ($ping_score > $score) { $accurate = '谢谢你啊!'; } elseif ($ping_score == $score) { $accurate = '太准了!'; $is_play = 1; } elseif ($ping_score > $score - 0.5) { $accurate = '不错哦!'; } else { $accurate = '欠你钱啊!'; } $do_things = do_things($u1['want_content'], $u1['sex']); $next_ping_user = array("key" => "2Nsk3l", "uid" => $u1['uid'], "sex" => $u1['sex'] + 1, "photo_count" => $u1['photonum'], "face_url" => $GLOBALS['s']['urlupload'] . $u1['default_pic'] . '_240x240.jpg', "nickname" => $u1['username'], "age_show" => getAge($u1['birth_y']) . '岁,', "location_country" => '中国', "location_prov" => $u1['hometown_prov'], "location_city" => $u1['hometown_city'], "do_things" => $do_things); $end_ping_user = array("uid" => $u2['uid'], "face_url" => $GLOBALS['s']['urlupload'] . $u2['default_pic'] . '_72x72.jpg', "nickname" => $u2['username']); $last_ping_user = array("photo_count" => $u['photonum'], "ta" => ui_sex($u['sex']), "ping_score" => $ping_score, "score" => $score, "home_url" => $GLOBALS['s']['urldomain'] . "/{$u['uid']}", "face_url" => $GLOBALS['s']['urlupload'] . $u['default_pic'] . '_72x72.jpg', "nickname" => $u['username'], "age_show" => getAge($u['birth_y']) . '岁,', "location_country" => '中国', "location_prov" => $u['hometown_prov'], "location_city" => $u['hometown_city'], "ico_button" => "", "is_play" => $is_play, "accurate" => $accurate); $arr = array("next_ping_user" => $next_ping_user, "end_ping_user" => $end_ping_user, "last_ping_user" => $last_ping_user, "preload_img_url" => $GLOBALS['s']['urlupload'] . $u3['default_pic'] . '_240x240.jpg'); echo json_encode($arr); }
function loadColumnData($key, $row, $quantity = 1) { global $areport, $arr_titles, $form_content, $from_date, $to_date, $arr_show; // If first instance of this key, initialize its arrays. if (empty($areport[$key])) { $areport[$key] = array(); $areport[$key]['.prp'] = 0; // previous pid $areport[$key]['.wom'] = 0; // number of services for women $areport[$key]['.men'] = 0; // number of services for men $areport[$key]['.age2'] = array(0, 0); // age array $areport[$key]['.age9'] = array(0, 0, 0, 0, 0, 0, 0, 0, 0); // age array foreach ($arr_show as $askey => $dummy) { if (substr($askey, 0, 1) == '.') { continue; } $areport[$key][$askey] = array(); } } // Skip this key if we are counting unique patients and the key // has already seen this patient. if ($form_content == '2' && $row['pid'] == $areport[$key]['.prp']) { return; } // If we are counting new acceptors, then require a unique patient // whose contraceptive start date is within the reporting period. if ($form_content == '3') { // if ($row['pid'] == $areport[$key]['prp']) return; if ($row['pid'] == $areport[$key]['.prp']) { return; } // Check contraceptive start date. if (!$row['contrastart'] || $row['contrastart'] < $from_date || $row['contrastart'] > $to_date) { return; } } // If we are counting new clients, then require a unique patient // whose registration date is within the reporting period. if ($form_content == '4') { if ($row['pid'] == $areport[$key]['.prp']) { return; } // Check registration date. if (!$row['regdate'] || $row['regdate'] < $from_date || $row['regdate'] > $to_date) { return; } } // Flag this patient as having been encountered for this report row. // $areport[$key]['prp'] = $row['pid']; $areport[$key]['.prp'] = $row['pid']; // Increment the correct sex category. if (strcasecmp($row['sex'], 'Male') == 0) { $areport[$key]['.men'] += $quantity; } else { $areport[$key]['.wom'] += $quantity; } // Increment the correct age categories. $age = getAge(fixDate($row['DOB']), $row['encdate']); $i = min(intval(($age - 5) / 5), 8); if ($age < 11) { $i = 0; } $areport[$key]['.age9'][$i] += $quantity; $i = $age < 25 ? 0 : 1; $areport[$key]['.age2'][$i] += $quantity; foreach ($arr_show as $askey => $dummy) { if (substr($askey, 0, 1) == '.') { continue; } $status = empty($row[$askey]) ? 'Unspecified' : $row[$askey]; $areport[$key][$askey][$status] += $quantity; $arr_titles[$askey][$status] += $quantity; } }
function loadColumnData($key, $row) { global $areport, $arr_titles, $from_date, $to_date, $arr_show; // If no result, do nothing. if (empty($row['abnormal'])) { return; } // If first instance of this key, initialize its arrays. if (empty($areport[$key])) { $areport[$key] = array(); $areport[$key]['.prp'] = 0; // previous pid $areport[$key]['.wom'] = 0; // number of positive results for women $areport[$key]['.men'] = 0; // number of positive results for men $areport[$key]['.neg'] = 0; // number of negative results $areport[$key]['.age'] = array(0, 0, 0, 0, 0, 0, 0, 0, 0); // age array foreach ($arr_show as $askey => $dummy) { if (substr($askey, 0, 1) == '.') { continue; } $areport[$key][$askey] = array(); } } // Flag this patient as having been encountered for this report row. $areport[$key]['.prp'] = $row['pid']; // Collect abnormal results only, except for a column of total negatives. if ($row['abnormal'] == 'no') { ++$areport[$key]['.neg']; return; } // Increment the correct sex category. if (strcasecmp($row['sex'], 'Male') == 0) { ++$areport[$key]['.men']; } else { ++$areport[$key]['.wom']; } // Increment the correct age category. $age = getAge(fixDate($row['DOB']), $row['date_ordered']); $i = min(intval(($age - 5) / 5), 8); if ($age < 11) { $i = 0; } ++$areport[$key]['.age'][$i]; // For each patient attribute to report, this increments the array item // whose key is the attribute's value. This works well for list-based // attributes. A key of "Unspecified" is used where the attribute has // no assigned value. foreach ($arr_show as $askey => $dummy) { if (substr($askey, 0, 1) == '.') { continue; } $status = empty($row[$askey]) ? 'Unspecified' : $row[$askey]; $areport[$key][$askey][$status] += 1; $arr_titles[$askey][$status] += 1; } }
/** * displayProfile * * @return void */ function displayProfile() { $memberId = (int) $_GET['member']; $this->displayHeader($memberId); // handle unknown user if ($memberId == 0) { echo ' <p class="error-alert"> <b>' . T_('Unknown member.') . '</b><br/> </p>'; $this->displayFooter(); return; } $sql = "SELECT u.fname, u.lname, u.email, u.`bio`, u.`dob_year`, u.`dob_month`, u.`dob_day`, \n u.`dod_year`, u.`dod_month`, u.`dod_day`, u.avatar, u.username, u.joindate, \n u.`activity`, u.`sex`, a.`id` AS aid, a.`address`, a.`city`, a.`state`, a.`zip`, \n a.`home`, a.`cell`, a.`work` \n FROM fcms_users AS u, fcms_address AS a \n WHERE u.id = ?\n AND u.id = a.user"; $row = $this->fcmsDatabase->getRow($sql, $memberId); if ($row === false) { $this->fcmsError->displayError(); $this->displayFooter(); return; } $tzOffset = getTimezone($memberId); $joinDate = fixDate(T_('F j, Y'), $tzOffset, $row['joindate']); $address = formatAddress($row); $contact = ''; $activityDate = T_('Never visited'); $points = getUserParticipationPoints($memberId); $level = getUserParticipationLevel($points); // Contacts - Email if (!empty($row['cell'])) { $contact .= '<p><span>' . T_('Email') . '</span> ' . $row['email'] . '</p>'; } // Contacts - Phone if (!empty($row['cell'])) { $contact .= '<p><span>' . T_('Cell') . '</span> ' . formatPhone($row['cell']) . '</p>'; } if (!empty($row['home'])) { $contact .= '<p><span>' . T_pgettext('The beginning or starting place.', 'Home') . '</span> ' . formatPhone($row['home']) . '</p>'; } if (!empty($row['work'])) { $contact .= '<p><span>' . T_('Work') . '</span> ' . formatPhone($row['work']) . '</p>'; } // Call $hasPhone = false; $call = ''; $tel = ''; if (!empty($row['cell'])) { $tel = $row['cell']; $hasPhone = true; } else { if (!empty($row['home'])) { $tel = $row['home']; $hasPhone = true; } else { if (!empty($row['work'])) { $tel = $row['work']; $hasPhone = true; } } } if ($hasPhone) { $call = '<li><a class="call" href="tel:' . $tel . '">' . sprintf(T_pgettext('%s is the name of a person. Call Bob. etc.', 'Call %s'), $row['fname']) . '</a></li>'; } // Activity if ($row['activity'] != '0000-00-00 00:00:00') { $activityDate = fixDate(T_('F j, Y g:i a'), $tzOffset, $row['activity']); } $bday = formatDate('F j, Y', $row['dob_year'] . '-' . $row['dob_month'] . '-' . $row['dob_day']); $age = getAge($row['dob_year'], $row['dob_month'], $row['dob_day']); $gender = $row['sex'] == 'M' ? T_('Male') : T_('Female'); echo ' <div id="avatar"> <h1><img class="avatar" src="' . getCurrentAvatar($memberId) . '" alt="avatar"/></h1> ' . $level . ' </div> <div class="name-contacts"> <h1>' . cleanOutput($row['fname']) . ' ' . cleanOutput($row['lname']) . '</h1> <h2>' . cleanOutput($row['username']) . '</h2> <ul> ' . $call . ' <li><a class="email" href="mailto:' . $row['email'] . '">' . T_('Send Email') . '</a></li> <li><a class="pm" href="privatemsg.php?compose=new&id=' . $memberId . '">' . T_('Send Private Message') . '</a></li> </ul> </div> <ul> <li> <ul> <li> <b>' . T_('Birthday') . '</b> <div>' . $bday . ' (' . sprintf(T_('%s years old'), $age) . ')</div> </li> <li> <b>' . T_('Gender') . '</b> <div>' . $gender . '</div> </li> </ul> </li> <li> <ul> <li> <b>' . T_('Location') . '</b> <div>' . $address . '</div> </li> <li> <b>' . T_('Contact') . '</b> <div>' . $contact . '</div> </li> </ul> </li> <li> <b>' . T_('Bio') . '</b> <div>' . cleanOutput($row['bio']) . '</div> </li> <li> <ul> <li> <b>' . T_('Join Date') . '</b> <div>' . $joinDate . '</div> </li> <li> <b>' . T_('Last Visit') . '</b> <div>' . $activityDate . '</div> </li> </ul> </li> </ul>'; $this->displayFooter($memberId); }
$profession = $_POST['profession']; $employer = $_POST['employer']; $jobTitle = $_POST['jobTitle']; $graduatingYear = $_POST['graduatingYear']; $formerRole = $_POST['formerRole']; if ($surname == '' or $firstName == '' or $officialName == '' or $gender == '' or $dob == '' or $email == '' or $formerRole == '') { //Fail 3 $URL .= '&return=error3'; header("Location: {$URL}"); } else { //Check publicRegistrationMinimumAge $publicRegistrationMinimumAge = getSettingByScope($connection2, 'User Admin', 'publicRegistrationMinimumAge'); $ageFail = false; if ($publicRegistrationMinimumAge == '') { $ageFail = true; } elseif ($publicRegistrationMinimumAge > 0 and $publicRegistrationMinimumAge > getAge(dateConvertToTimestamp($dob), true, true)) { $ageFail = true; } if ($ageFail == true) { //Fail 5 $URL .= '&return=error5'; header("Location: {$URL}"); } else { //Write to database try { $data = array('title' => $title, 'surname' => $surname, 'firstName' => $firstName, 'officialName' => $officialName, 'maidenName' => $maidenName, 'gender' => $gender, 'username' => $username, 'dob' => $dob, 'email' => $email, 'address1Country' => $address1Country, 'profession' => $profession, 'employer' => $employer, 'jobTitle' => $jobTitle, 'graduatingYear' => $graduatingYear, 'formerRole' => $formerRole); $sql = 'INSERT INTO alumniAlumnus SET title=:title, surname=:surname, firstName=:firstName, officialName=:officialName, maidenName=:maidenName, gender=:gender, username=:username, dob=:dob, email=:email, address1Country=:address1Country, profession=:profession, employer=:employer, jobTitle=:jobTitle, graduatingYear=:graduatingYear, formerRole=:formerRole'; $result = $connection2->prepare($sql); $result->execute($data); } catch (PDOException $e) { //Fail 2