www.gusucode.com > 仿51.com的php源码 1.1 > User/MyFriends.php
<?php include("CheckLogined.php"); include("../include/dbclass.php"); include("../include/global.php"); require_once "../include/page.php"; $dbc=new DbConn(); $uid=$_COOKIE["uid"]; $skey=$_GET["skey"]; $refer=$_GET["refer"]; $page=(int)$_GET["page"]; if ($_GET["act"]=="swapOrder") { //r&user_list=qbxk&page=1&tiao=1&refer=MyFriends.php%3Fpage%3D1%26skey%3D $tiao=(int)$_GET["tiao"]; $user_list=$_GET["user_list"]; $sql="Update myfriend set IntOrder=IntOrder+'$tiao' where User_Account='$uid' and myfriendname='$user_list'"; $dbc->Execute($sql); header("Location:$refer"); //echo $_GET["tiao"];echo $_GET["refer"]; //act=swapOrder } if ($_GET["act"]=="hidden") { $user_list=$_GET["user_list"]; if ($user_list=="") { echo "<script>alert('还没有选择');history.back();</script>"; exit(); } $i=strpos($user_list,','); //echo $i; //exit(); if ($i>1) { $split_user_list= explode(',',$user_list); $extcount = count($split_user_list); for($j=0;$j<$extcount;$j++) { $sql="update myfriend set OrderType=1 where User_Account='$uid' and myfriendname='$split_user_list[$j]'"; //echo $sql; //exit(); $dbc->Execute($sql); } } else { $sql="update myfriend set OrderType=1 where User_Account='$uid' and myfriendname='$user_list'"; $dbc->Execute($sql); } header("Location:$refer"); } if ($_GET["act"]=="delFriend") { $user_list=$_GET["user_list"]; if ($user_list=="") { echo "<script>alert('还没有选择');history.back();</script>"; exit(); } $i=strpos($user_list,','); //echo $i; //exit(); if ($i>1) { $split_user_list= explode(',',$user_list); $extcount = count($split_user_list); for($j=0;$j<$extcount;$j++) { $sql="delete from myfriend where User_Account='$uid' and myfriendname='$split_user_list[$j]'"; //echo $sql; //exit(); $dbc->Execute($sql); } } else { $sql="delete from myfriend where User_Account='$uid' and myfriendname='$user_list'"; $dbc->Execute($sql); } header("Location:$refer"); } $maxline = 10; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>村委会档案管理中心 - 好友管理</title> <link href="../images/User_Main.css" rel="stylesheet" type="text/css" /> <script> /*********Js Function Begin*********/ function AppLoadConfirmPhoto(user) { if ((typeof(user) == "undefined") || (user == "")) { user = ""; } window.open('ConfirmPhoto.php?user=' + user, 'ConfirmPhoto', 'height=220, width=320, top=0, screenX=200, screenY=200, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no, z-look=yes'); return false; } /*********Js Function End*********/ </script> <script src="../js/global.js" language="javascript"></script> <script> try{ if(top!=window){ document.domain ="www.wu-liao.com"; }else{ top.location.href="/webin.php?refer=%2FUser%2FMyFriends.php"; } }catch(e){} function showNewMessage(user){ top.showNewMessage(user); } </script> </head> <body> <body><div id="top"><?php require("../top.php"); ?> </div> <div id="nav"> <div id="navt"></div> </div> <div id="mjx"></div> <div id="main"> <div id="left"> <div class="leme"> <div class="imxle"><a href="MyPersonalInfo.php">个人资料设置</a></div><div class="imxle"><a href="MyHomepageTemplate.php">个人主页设置</a></div><div class="imxle"><a href="MyAccessRight.php">高级权限设置</a></div> <div class="pawo"><!-- <a href="http://pay.51.com" target="_blank">支付中心</a>--><br /><a href="MyPassword.php">密码设置</a></div> <div id=IdMyQun> </div> <!-- 广告 --> <!-- XML 文件读取失败! --><!-- XML 文件读取失败! --> <div style="margin-top:20px;"></div> </div> </div> <div id="right"> <div id="fenle"> <SCRIPT LANGUAGE="JavaScript"> <!-- /** * 页面导航JS类 * * 应用例子: * var plb = new PageListBar('plb', 343, 6, '?', 10); * document.write(plb); * * @author zhonggw<boy9732@msn.com> */ /** * 类初始化 * * @param string name 对象名 * @param integer total 记录总数 * @param integer pagecount 总页数 * @param integer currpage 当前页号 * @param string url 每个链接后的参数 * @param integer listlength 显示的步长 */ function PageListBar(name, total, pagecount, currpage, url, listlength) { this.name = name; this.infototal = total; this.pagecount = pagecount; //total page num this.currpage = currpage; //current page this.url = url; //link this.listlength = listlength ? listlength : 3; //number of page showed if(this.pagecount <=0) { this.pagecount = 1; } if(this.currpage > this.pagecount) { this.currpage = this.pagecount; } } PageListBar.prototype.go = function(pagenum) { window.location.href = '?page=' + pagenum + this.url; } PageListBar.prototype.goto = function() { var currpage = prompt("请输入跳转到的页号",this.currpage); if(currpage) { if(currpage <= this.pagecount && currpage>=1) { this.go(currpage); } } } PageListBar.prototype.toString = function() { var str = '', pStart = pEnd = 0; var str_begin = '<div class="fenye">' + this.infototal + ' 条记录 ' + this.currpage +' / ' + this.pagecount + '页 <a href="javascript:' + this.name + '.go(' + ((this.currpage-1)<=1?1:(this.currpage-1)) + ');void(0);">前一页</a> '; var str_begin_one = '<div class="fenye">' + this.infototal + ' 条记录 ' + this.currpage +' / ' + this.pagecount + '页 '; var str_end = ' <a href="javascript:' + this.name + '.go(' + ((this.currpage+1)>=this.pagecount?this.pagecount:(this.currpage+1)) + ');void(0);">后一页</a></div>'; var str_end_one = '</div>'; var str_body = ''; var str_onepagebody = '<div class="fenye">' + this.infototal + ' 条记录 ' + this.currpage +' / ' + this.pagecount + '页</div>'; //总页数小于4不采用...效果 if(this.pagecount < 4) { for(var i=1; i<=this.pagecount; i++) { if(i == this.currpage) { str_body += '<span class="this-page">' + i + '</span> '; }else{ str_body += '<a href="javascript:' + this.name + '.go(' + i + ');void(0);">' + i + '</a> '; } } if(this.pagecount <= 1 ) { return str_onepagebody; } else { if ( this.currpage == 1 ) { return str_begin_one + str_body + str_end; } if ( this.currpage == this.pagecount ) { return str_begin + str_body + str_end_one; } else { return str_begin + str_body + str_end; } } } //预计显示长度小于实际总页数 if((this.listlength * 2 + 1) >= this.pagecount - 2) { pStart = 2; pEnd = this.pagecount -1; }else{ pStart = this.currpage - this.listlength; if(pStart < 2) { pStart = 2; } pEnd = this.currpage + this.listlength; if(pEnd > this.pagecount- 2) { pEnd = this.pagecount- 1; } var leftSpace = this.listlength - (this.currpage - pStart); var rightSpace = this.listlength - (pEnd - this.currpage); //左余右填 if(leftSpace > 0 && rightSpace <=0) { pEnd += leftSpace; }else{ //右余左填 if(rightSpace > 0 && leftSpace <=0) { pStart -= rightSpace; } } } for(var i=pStart; i<=pEnd; i++) { if(i == this.currpage) { str_body += '<span class="this-page">' + i + '</span> '; }else{ str_body += '<a href="javascript:' + this.name + '.go(' + i + ');void(0);">' + i + '</a> '; } } if(1 == this.currpage) { str_body = '<span class="this-page">1</span><span class="break">...</span>' + str_body; }else{ str_body = '<a href="javascript:' + this.name + '.go(1);void(0);">1</a><span class="break">...</span>' + str_body ; } if(this.pagecount == this.currpage) { str_body += '<span class="break">...</span><span class="this-page">' + this.pagecount + '</span>'; }else{ str_body += '<span class="break">...</span><a href="javascript:' + this.name + '.go(' + this.pagecount + ');void(0);">' + this.pagecount + '</a>'; } return str_begin + str_body + str_end; } var total_link = "1"; var isVIP = false; var maxLink = isVIP ? 8 : 5; function delFriend(user_list) { if(confirm("确定删除用户?")) { window.location.href = "?act=delFriend&user_list=" + user_list + "&refer=MyFriends.php%3Fpage%3D<?php echo $page; ?>%26skey%3D<?php echo $skey;?>"; } } function delLink(user_list) { if(confirm("确定隐藏用户?")) { window.location.href = "?act=hidden&user_list=" + user_list + "&refer=MyFriends.php%3Fpage%3D<?php echo $page; ?>%26skey%3D<?php echo $skey;?>"; } } function addLink(user_list) { window.location.href = "?act=addLink&user_list=" + user_list + "&refer=MyFriends.php%3Fpage%3D<?php echo $page; ?>%26skey%3D<?php echo $skey;?>"; } function selectCheckBox(flag) { var obj = document.getElementsByName("user_name"); if(null != obj && obj.length) { for(var i=0;i<obj.length;i++) { if(flag) { obj.item(i).checked = true; } else { if(obj.item(i).checked) obj.item(i).checked = false; else obj.item(i).checked = true; } } } } function getCheckBoxValue() { var obj = document.getElementsByName("user_name"); var tmp = ""; if(obj && obj.length) { for(var i=0; i<obj.length; i++) { if(obj.item(i).checked) { tmp += (tmp == "" ? "" : ",") + obj.item(i).value; } } }else if(obj){ if(obj.checked) { tmp = obj.value; }else{ tmp = ""; } } return tmp } //--> </SCRIPT> <script language="JavaScript" fptype="dynamicanimation"> function show_confirm_photo(user) { AppLoadConfirmPhoto(user); return false; } var i_cfg=new Array( [99,'小婴儿','../i/level/001.gif'], [199,'可爱的宝宝','../i/level/002.gif'], [219,'小孩子×1','../i/level/c-001.gif'], [239,'小孩子×2','../i/level/c-002.gif'], [259,'小孩子×3','../i/level/c-003.gif'], [279,'小孩子×4','../i/level/c-004.gif'], [299,'小孩子×5','../i/level/c-005.gif'], [319,'小孩子×6','../i/level/c-006.gif'], [339,'小孩子×7','../i/level/c-007.gif'], [359,'小孩子×8','../i/level/c-008.gif'], [379,'小孩子×9','../i/level/c-009.gif'], [399,'小孩子×10','../i/level/c-010.gif'], [449,'少年×1','../i/level/s-001.gif'], [499,'少年×2','../i/level/s-002.gif'], [549,'少年×3','../i/level/s-003.gif'], [599,'少年×4','../i/level/s-004.gif'], [649,'少年×5','../i/level/s-005.gif'], [699,'少年×6','../i/level/s-006.gif'], [749,'少年×7','../i/level/s-007.gif'], [799,'少年×8','../i/level/s-008.gif'], [849,'少年×9','../i/level/s-009.gif'], [899,'少年×10','../i/level/s-010.gif'], [999,'少年×11','../i/level/s-011.gif'], [1099,'少年×12','../i/level/s-012.gif'], [1199,'少年×13','../i/level/s-013.gif'], [1299,'少年×14','../i/level/s-014.gif'], [1399,'少年×15','../i/level/s-015.gif'], [1499,'少年×16','../i/level/s-016.gif'], [1599,'少年×17','../i/level/s-017.gif'], [1699,'少年×18','../i/level/s-018.gif'], [1799,'少年×19','../i/level/s-019.gif'], [1899,'少年×20','../i/level/s-020.gif'], [2049,'少年×21','../i/level/s-021.gif'], [2199,'少年×22','../i/level/s-022.gif'], [2349,'少年×23','../i/level/s-023.gif'], [2499,'少年×24','../i/level/s-024.gif'], [2649,'少年×25','../i/level/s-025.gif'], [2799,'少年×26','../i/level/s-026.gif'], [2949,'少年×27','../i/level/s-027.gif'], [3099,'少年×28','../i/level/s-028.gif'], [3249,'少年×29','../i/level/s-029.gif'], [3399,'少年×30','../i/level/s-030.gif'], [3599,'成年×1','../i/level/t-001.gif'], [3799,'成年×2','../i/level/t-002.gif'], [3999,'成年×3','../i/level/t-003.gif'], [4199,'成年×4','../i/level/t-004.gif'], [4399,'成年×5','../i/level/t-005.gif'], [4599,'成年×6','../i/level/t-006.gif'], [4799,'成年×7','../i/level/t-007.gif'], [4999,'成年×8','../i/level/t-008.gif'], [5199,'成年×9','../i/level/t-009.gif'], [5399,'成年×10','../i/level/t-010.gif'], [5649,'成年×11','../i/level/t-011.gif'], [5899,'成年×12','../i/level/t-012.gif'], [6149,'成年×13','../i/level/t-013.gif'], [6399,'成年×14','../i/level/t-014.gif'], [6649,'成年×15','../i/level/t-015.gif'], [6899,'成年×16','../i/level/t-016.gif'], [7149,'成年×17','../i/level/t-017.gif'], [7399,'成年×18','../i/level/t-018.gif'], [7649,'成年×19','../i/level/t-019.gif'], [7899,'成年×20','../i/level/t-020.gif'], [8199,'中年×1','../i/level/u-001.gif'], [8499,'中年×2','../i/level/u-002.gif'], [8799,'中年×3','../i/level/u-003.gif'], [9099,'中年×4','../i/level/u-004.gif'], [9399,'中年×5','../i/level/u-005.gif'], [9699,'中年×6','../i/level/u-006.gif'], [9999,'中年×7','../i/level/u-007.gif'], [10299,'中年×8','../i/level/u-008.gif'], [10599,'中年×9','../i/level/u-009.gif'], [10899,'中年×10','../i/level/u-010.gif'], [11299,'中年×11','../i/level/u-011.gif'], [11699,'中年×12','../i/level/u-012.gif'], [12099,'中年×13','../i/level/u-013.gif'], [12499,'中年×14','../i/level/u-014.gif'], [12899,'中年×15','../i/level/u-015.gif'], [13299,'中年×16','../i/level/u-016.gif'], [13699,'中年×17','../i/level/u-017.gif'], [14099,'中年×18','../i/level/u-018.gif'], [14499,'中年×19','../i/level/u-019.gif'], [14899,'中年×20','../i/level/u-020.gif'], [15399,'老年×1','../i/level/x-001.gif'], [15899,'老年×2','../i/level/x-002.gif'], [16399,'老年×3','../i/level/x-003.gif'], [16899,'老年×4','../i/level/x-004.gif'], [17399,'老年×5','../i/level/x-005.gif'], [17899,'老年×6','../i/level/x-006.gif'], [18399,'老年×7','../i/level/x-007.gif'], [18899,'老年×8','../i/level/x-008.gif'], [19399,'老年×9','../i/level/x-009.gif'], [19899,'老年×10','../i/level/x-010.gif'], [20499,'老年×11','../i/level/x-011.gif'], [21099,'老年×12','../i/level/x-012.gif'], [21699,'老年×13','../i/level/x-013.gif'], [22299,'老年×14','../i/level/x-014.gif'], [22899,'老年×15','../i/level/x-015.gif'], [23499,'老年×16','../i/level/x-016.gif'], [24099,'老年×17','../i/level/x-017.gif'], [24699,'老年×18','../i/level/x-018.gif'], [25299,'老年×19','../i/level/x-019.gif'], [25899,'老年×20','../i/level/x-020.gif'] ); function get_user_star(Integral) { var level_photo = ""; for(var i = 0;i <= i_cfg.length - 1; i++) { if(Integral <= i_cfg[i][0]) { level_photo = i_cfg[i][2]; break; } } if(level_photo == "") { level_photo = i_cfg[i_cfg.length - 1][2]; } return level_photo; } function get_user_level_name(Integral) { var level_name = ""; for(var i = 0; i<= i_cfg.length - 1; i++) { if(Integral <= i_cfg[i][0]) { level_name = i_cfg[i][1]; break; } } if(level_name == "") { level_name = i_cfg[i_cfg.length - 1][1]; } return level_name; } function create_user_face(User){ document.write("<br><p align='left'> 用户:<a href='http://www.wu-liao.com/home.php?user="+User+"' target=_blank><font face='Arial'> "+User+"</font></a> "); var sSex=(eval(User+"_sex") == "先生")?"../images/boy.gif":"../images/girl.gif"; document.write("<img src='"+sSex+"' align='absmiddle'><br>"); document.write(" 昵称: "+eval(User+"_nickname")+" <br>"); if(eval(User+"_vip")==0) { document.write(" 等级: 普通村民 "); } if(eval(User+"_vip")==1) { document.write(" 等级: <font color=red>VIP村民</font>"); } if(eval(User+"_vip")==2) { document.write(" 等级: <font color=red>村委会成员</font>"); } if(eval(User+"_vip")==3) { document.write(" 等级: <font color=red>村副主任</font>"); } if(eval(User+"_vip")==4) { document.write(" 等级: <font color=red>村委主任</font>"); } if(eval(User+"_vip")==5) { document.write(" 等级: <font color=red>村委书记</font>"); } if(eval(User+"_confirm")>0) document.write(" <img style='cursor:hand' onclick=\"show_confirm_photo('"+User+"')\" align='absmiddle' title='通过视屏认证' src='../images/24.jpg'>"); else document.write(" <a style='cursor:hand' href='http://www.wu-liao.com/help/sprz.php' target='_blank'><img border=0 align='absmiddle' title='未通过视屏认证' src='../images/24-1.jpg'></a>"); var level_photo = get_user_star(eval(User+"_integral")); var levelinfo = get_user_level_name(eval(User+"_integral")); document.write(" <img align='absmiddle' src='"+level_photo+"' alt='"+levelinfo+"'><br><br><center>"); } //排序 function swapGroup(user_list, swap) { if(swap>0) { var num = window.prompt("向前跳几位", 1); } else var num = window.prompt("向后跳几位", 1); if (num != null){ if (parseInt(num) == num) { window.location.href = "?act=swapOrder&user_list=" + user_list+"&page="+1 +"&tiao="+num*swap+ "&refer=MyFriends.php%3Fpage%3D<?php echo $page; ?>%26skey%3D<?php echo $skey;?>"; }else{ alert('请输入数字'); return; } } } function clearinfo(obj) { if(obj.value=="请输入用户名") { obj.value=""; obj.style.color=""; } } </script> <div class="anphg"> <div class="a4" id="l">公开的好友</div> <div class="a4"><a href="MyHiddenFriends.php">隐藏的好友</a></div> <div class="a4"><a href="MyBlackList.php">黑名单</a></div> </div> <div id=txss><form> <div class="txyy">在好友里搜索: <input name="skey" type="text" onclick="clearinfo(this)" value="请输入用户名" style="color:#aaaaaa" /> <input name="Submit" type="submit" class="btn" value="搜 索" /> </div></form> </div> <div style=""> <div valign=middle style='text-align:left;valign:middle;top:-3px;width:555px;border:1px solid #000000;background:#FDFCDF;height:10px;font-size:12px;font-weight:bold;line-height:120%;padding:7px'> <font color=red>提示:排在前8位的好友,将被推荐在您的主页上展示</font> <a href=# style="font-size:12px;color:blue" onclick="window.open('friendhelp.html', 'help', 'height=500, width=650, top=100, left=200, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')">[说明]</a></font> </div> <div id="a4n"></div> </div> <div id=fenle> <?php if ($skey !=null) { $sql="select myfriendname from myfriend where User_Account='$uid' and OrderType='0' and myfriendname='$skey' order by IntOrder desc"; } else { $sql="select myfriendname from myfriend where User_Account='$uid' and OrderType='0' order by IntOrder desc"; } $news = $dbc->getGopageRs($sql,$maxline); //echo "$sql"; //$gopage = new GoPage($dbc->tpages,$dbc->total);//建立翻页程序 //$backurl = "MySysLog.php?".$dbc->getParameter(); if ($dbc->num_rows==null) { echo "<div style='text-align:center;font-size:14px;'>请输入用户名不在您公开的好友中</div>"; } else {?> <table width=570 border=0 cellpadding=0 cellspacing=1 class=hytb> <!-- 用户项 --> <?php for($i=0;$i<$dbc->num_rows;$i++) { $username=$news[$i]['myfriendname']; $sql_user="select User_Sex,nickname,huiyuan,videorz,dengji,face from userdata where User_Account='$username'"; //echo $username; //echo $sql_user; $query_id=$dbc->query($sql_user); $arr=mysql_fetch_array($query_id); ?> <tr valign=middle> <td width="117" height="110" align="center" class="hytd"><table border=0><tr><td><b><?php echo $i+1; ?></b>.</td><td> <script src='../1e/<?php echo $username; ?>/<?php echo $username; ?>.js'></script> <script> var ImgShow='<img src=../images/loadface.gif border=0 width=80 height=90>'; if(typeof(<?php echo $username; ?>_photo)!='undefined') { var ImgShow='<img src='+<?php echo $username; ?>_photo+' border=0 class=photo width=80 onLoad=reloadImage(this)>'; } </script> <A HREF="http://www.wu-liao.com/home.php?user=<?php echo $news[$i]['myfriendname']; ?>" target="_blank"><script>document.write(ImgShow);</script></a> </td></tr></table></td> <td width="254" align="left" class="hytd"><table width="193" border="0" cellpadding="0" cellspacing="0"> <tr><td> <script>create_user_face('<?php echo $username; ?>')</script> </td></tr> </table></td> <td width="153" align="center" class="hytd">排序:<a onclick="swapGroup('<?php echo $username; ?>', 1);" href="#" style="text-decoration:underline;color">↑</a> <a onclick="swapGroup('<?php echo $username; ?>', -1);" href="#" style="text-decoration:underline;color">↓</a></td> <td width="41" align="center" class="sli"><input type="checkbox" name="user_name" value="<?php echo $username; ?>"/></td> </tr> <?php }?> <!-- 用户项:结束 --> <tr> <td height="40" colspan="4" align="right"><a href="javascript:void(0)" onclick="selectCheckBox(true)" style="color:#0000cc;text-decoration:underline"/> 全选</a> <a href="javascript:void(0)" onclick="selectCheckBox(false)" style="color:#0000cc;text-decoration:underline"/> 反选</a> <input name="Submit3" type="submit" class="btn" value="隐 藏" onclick="javascript:delLink(getCheckBoxValue())"/> <input name="Submit32" type="submit" class="btn" value="删 除" onclick="javascript:delFriend(getCheckBoxValue())" /> </td> </tr> </table> </div> <div class="fenye"> <!-- 分页列表 --> <SCRIPT LANGUAGE="JavaScript"> <!-- var plb = new PageListBar('plb', <?php echo $dbc->total; ?>, <?php echo $dbc->tpages; ?>, <?php echo $page;?>, '&skey=<?php echo $skey; ?>'); document.write(plb); //--> </SCRIPT> <?php } ?> <!-- 分页列表:结束 --> </div> </div> </div> </div> <div id="bottom"> <div id="baidu" style="color:#a0a0a0;"><?php require("../foot.php"); ?></div> </div> </body> </html>