function edit_member() { $arr = $_POST; // return print_r($arr); $mid = $arr['mid']; if (empty($arr['name'])) { $msg = "成员姓名是必填项哦!<meta http-equiv='refresh' content='1;url=" . $_SERVER['HTTP_REFERER'] . "'/>"; return $msg; exit; } //头像不是必填项,检测是否上传成员头像,若没有(error=4)则不处理头像 if ($_FILES['avatar']['error'] != 4) { // 上传头像,并生成80*80和150*150的两张缩略图 $uploadFile = uploadFile('images/uploads/avatar/'); if ($uploadFile && is_array($uploadFile)) { $arr['avatar'] = $uploadFile[0]['name']; } else { return "添加成员失败<meta http-equiv='refresh' content='1;url=" . $_SERVER['HTTP_REFERER'] . "'/>"; } thumb("images/uploads/avatar/" . $uploadFile[0]['name'], "images/uploads/avatar_150/" . $uploadFile[0]['name'], 150, 150); thumb("images/uploads/avatar/" . $uploadFile[0]['name'], "images/uploads/avatar_80/" . $uploadFile[0]['name'], 80, 80); // 删除旧头像 $filename = "images/uploads/avatar/" . $arr['avatar_old']; if (file_exists($filename)) { unlink($filename); } $filename = "images/uploads/avatar_80/" . $arr['avatar_old']; if (file_exists($filename)) { unlink($filename); } $filename = "images/uploads/avatar_150/" . $arr['avatar_old']; if (file_exists($filename)) { unlink($filename); } } //电话号不是必填项,检测是否输入,若没有则不创建$arr_phone数组 if (!empty($arr['phone'])) { $arr_phone['phone'] = $arr['phone']; $arr_phone['owner'] = $arr['owner']; } //推荐人不是必填项,检测是否有值,若不为false则创建$arr_father数组 if ($arr['father_mid'] !== 'false') { $arr_father['mid'] = $arr['father_mid']; } unset($arr['father_mid']); unset($arr['phone']); unset($arr['owner']); unset($arr['avatar_old']); unset($arr['mid']); // return print_r($arr); // return print_r($arr_phone); update('hh_member', $arr, "mid={$mid}"); //若$arr_phone数组不存在(用户没有输入电话号),则不进行写入hh_phone数据库的操作 if (isset($arr_phone)) { $arr_phone['mid'] = $mid; // 如果第一次添加成员时没有输入电话,而修改时输入了,那么使用insert而不是update if (update('hh_phone', $arr_phone, "mid={$mid}") == 0) { insert('hh_phone', $arr_phone); } } //若$arr_father数组不存在(用户没有推荐人),则不进行写入hh_son数据库的操作 if (isset($arr_father)) { $arr_father['child'] = $mid; //如果第一次添加成员时推荐人为无(who_is_the_father返回空值),则进行insert操作,否则进行update if (empty(who_is_the_father($mid))) { insert('hh_son', $arr_father); } else { update('hh_son', $arr_father, "child={$mid}"); } } $msg = "成功修改了 " . $arr['name'] . " 成员的信息!<br/>2秒钟后跳转到成员信息页面!<meta http-equiv='refresh' content='2;url=member.php?mid=" . $mid . "'/>"; return $msg; }
<li>身高: <?php echo $rows['height']; ?> CM</li> <li>体重: <?php echo $rows['weight']; ?> KG</li> <li>入营时间: <?php echo $rows['regTime']; ?> </li> <?php if ($father) { echo "<li>入营介绍人: <span><a href='member.php?mid=" . who_is_the_father($mid) . "' class='ui-link' rel='external'>" . $father['name'] . "</a></span></li>"; } ?> <li data-role="list-divider">学校</li> <li>学校: <?php echo $rows['school']; ?> </li> <li>年级: 初<?php echo $rows['grade']; ?> </li> <li>班级: <?php echo $rows['class']; ?>
<?php require_once "includes/head.php"; $mid = $_REQUEST['mid']; $rows = getMemberInfo($mid); //获取介绍人信息 $father = getMemberInfo(who_is_the_father($mid)); ?> <!-- member page --> <div id="member" data-role='page' data-title='member'> <div data-role='header' data-position='fixed' class="header" data-tap-toggle="false"> <h2><?php echo $rows['name']; ?> </h2> <a href="doAction.php?act=logout" rel='external' data-icon='power' data-iconpos='notext' data-direction='reverse' class='ui-btn-left' data-transition="none" > 退出</a> <a href="do_member_edit.php?mid=<?php echo $mid; ?> " rel="external"
<?php require_once 'include.php'; $temp['mid'] = who_is_the_father(34); $father = getMemberInfo($temp['mid']); $father['mid'] = $temp['mid']; print_r($father);
<?php require_once "includes/head.php"; $mid = $_REQUEST['mid']; $row = getMemberInfo($mid); $school_arr = getAllSchool(); $member_arr = getAllMemberName($mid); $father_mid = who_is_the_father($mid); ?> <div id="do_member_info" data-role='page' data-title='修改成员信息'> <div data-role='header' data-position='fixed' class="header" data-tap-toggle="false"> <h2>修改成员信息</h2> <a href="<?php echo 'member.php?mid=' . $mid; ?> " rel="external" data-icon='delete' data-iconpos='notext' data-direction='reverse' class='ui-btn-left' data-transition="none" > 取消</a> <a href="#" rel="external" data-icon='check' data-iconpos='notext' data-direction='reverse' class='ui-btn-right' data-transition="none" id="do_member_edit_btn" >