bbsal.php
来自「linux/unix环境下的建站系统」· PHP 代码 · 共 504 行 · 第 1/2 页
PHP
504 行
if( $_POST["t_email"] ){ $t_email = $_POST["t_email"]; $t_email = substr($t_email,0,29); //$t_email[29]=0; }else{ $t_email=""; } if( $_POST["t_qq"] ){ $t_qq = $_POST["t_qq"]; $t_qq = substr($t_qq,0,9); //$t_qq[9]=0; }else{ $t_qq=""; } if( $_POST["t_birth_year"] ){ $t_birth_year = $_POST["t_birth_year"]; settype($t_birth_year, "integer"); if( $t_birth_year < 1000 || $t_birth_year > 9000 ) $t_birth_year=1900; }else{ $t_birth_year = 1900; } if( $_POST["t_birth_month"] ){ $t_birth_month = $_POST["t_birth_month"]; settype($t_birth_month, "integer"); if( $t_birth_month < 1 || $t_birth_month > 12 ) $t_birth_month=1; }else{ $t_birth_month = 1; } if( $_POST["t_birth_day"] ){ $t_birth_day = $_POST["t_birth_day"]; settype($t_birth_day, "integer"); if( $t_birth_day < 1 || $t_birth_day > 12 ) $t_birth_day=1; }else{ $t_birth_day = 1; } if( $_POST["t_memo"] ){ $t_memo = $_POST["t_memo"]; $t_memo = substr( $t_memo, 0, 99); //$t_memo{99}=0; }else{ $t_memo=""; } if( $action == "add" ){ $sqlstr = "INSERT INTO addr VALUES (NULL, '".$currentuser["userid"]."', '".addslashes($t_name)."','".addslashes($t_bbsid)."','".addslashes($t_school)."','".addslashes($t_zipcode)."','".addslashes($t_homeaddr)."','".addslashes($t_companyaddr)."','".addslashes($t_tel_o)."','".addslashes($t_tel_h)."','".addslashes($t_mobile)."','".addslashes($t_email)."','".addslashes($t_qq)."',\"".$t_birth_year."-".$t_birth_month."-".$t_birth_day."\",'".addslashes($t_memo)."','".addslashes($t_group)."' );"; }else{ $sqlstr = "UPDATE addr SET name='".addslashes($t_name)."',bbsid='".addslashes($t_bbsid)."',school='".addslashes($t_school)."',zipcode='".addslashes($t_zipcode)."',homeaddr='".addslashes($t_homeaddr)."',companyaddr='".addslashes($t_companyaddr)."',tel_o='".addslashes($t_tel_o)."',tel_h='".addslashes($t_tel_h)."',mobile='".addslashes($t_mobile)."',email='".addslashes($t_email)."',qq='".addslashes($t_qq)."',birthday=\"".$t_birth_year."-".$t_birth_month."-".$t_birth_day."\",memo='".addslashes($t_memo)."',groupname='".addslashes($t_group)."' WHERE id=$edit_id AND userid='".$currentuser["userid"]."' ;"; } //echo $sqlstr; $result = mysql_query($sqlstr) or die(mysql_error()); if( !$result ){ html_error_quit("失败"); }else{?><a href="bbsal.php?start=<?php echo $startnum;?>&count=<?php echo $count;?>&order=<?php echo $order;?>&desc=<?php echo $desc;?>"><?php if($action == "add") echo "添加"; else echo "修改"; ?>成功,返回</a><?php page_footer(FALSE); } }else if($action == "add"){?><center><p><?php echo BBS_FULL_NAME; ?> -- 通讯录条目增加 [用户: <?php echo $currentuser["userid"]; ?>]</p></center><hr class=default><form action="bbsal.php?start=<?php echo $startnum;?>&count=<?php echo $count;?>&order=<?php echo $order;?>&desc=<?php echo $desc;?>&action=add" method=post><?php al_print_form($al); page_footer(FALSE); }else{ $sqlstr = "SELECT * FROM addr WHERE userid=\"".$currentuser["userid"]."\" AND id=".$edit_id; $result = mysql_query($sqlstr) or die(mysql_error()); if( ! $result ){ html_error_quit("数据错误"); }else{ $row = mysql_fetch_row($result); if( ! $row ) html_error_quit("数据错误1");?><center><p><?php echo BBS_FULL_NAME; ?> -- 通讯录条目修改 [用户: <?php echo $currentuser["userid"]; ?>]</p></center><hr class=default><form action="bbsal.php?start=<?php echo $startnum;?>&count=<?php echo $count;?>&order=<?php echo $order;?>&desc=<?php echo $desc;?>&action=edit&id=<?php echo $edit_id;?>" method=post><?php al_print_form($row); page_footer(FALSE); } } } $sqlstr = "SELECT * FROM addr WHERE userid=\"".$currentuser["userid"]."\" ORDER BY ".$order." ".$descstr." LIMIT ".$startnum.",".$count; $result = mysql_query($sqlstr) or die(mysql_error()); if( ! $result ){ html_error_quit("没有数据"); }else{ page_header("通讯录管理");?><a href="javascript:location.reload()">刷新</a></center><hr class=default><table border="1" width="613" align="center" cellpadding="0" cellspacing="0"><tr><td>序号</td><td>姓名</td><td>bbsid</td><td>分组</td><td>注释</td><td></td></tr><?php $i=0; while($row = mysql_fetch_row($result)){?><tr><td><?php echo $startnum+$i+1;?></td><td><a href="bbsal.php?start=<?php echo $startnum;?>&count=<?php echo $count;?>&action=detail&id=<?php echo $row[0];?>&order=<?php echo $order;?>&desc=<?php echo $desc;?>"><?php echo htmlspecialchars($row[2]);?></a></td><td><?php echo htmlspecialchars($row[3]);?></td><td><?php echo htmlspecialchars($row[15]);?></td><td><pre><?php echo $row[14];?></pre></td><td><a onclick="return confirm('你真的要删除这条记录吗?')" href="bbsal.php?start=<?php if($i==0 && $startnum > 0) echo ($startnum-1); else echo $startnum;?>&count=<?php echo $count;?>&action=del&id=<?php echo $row[0];?>&order=<?php echo $order;?>&desc=<?php echo $desc;?>">删除</a><a href="bbsal.php?start=<?php echo $startnum;?>&count=<?php echo $count;?>&action=edit&id=<?php echo $row[0];?>&order=<?php echo $order;?>&desc=<?php echo $desc;?>">编辑</a></td></tr><?php $i++; } mysql_free_result($result); }?></table><center><hr class=default><a href="javascript:location.reload()">刷新</a><?php if( $startnum > 0 ){?><a href="bbsal.php?start=<?php if($startnum - $count > 0) echo ($startnum-$count); else echo "0";?>&count=<?php echo $count;?>&order=<?php echo $order;?>&desc=<?php echo $desc;?>">上一页</a><?php }else{?>上一页<?php } if( $i >= $count ){?><a href="bbsal.php?start=<?php echo ($startnum+$count-1);?>&count=<?php echo $count;?>&order=<?php echo $order;?>&desc=<?php echo $desc;?>">下一页</a><?php }else{?>下一页<?php }?><a href="bbsal.php?start=<?php echo $startnum;?>&count=<?php echo $count;?>&order=<?php echo $order;?>&desc=<?php echo $desc;?>&action=add">增加条目</a><input type="button" name="csv" value="从csv文件导入" onclick="return GoAttachWindow()" /><script type="text/javascript"><!-- function GoAttachWindow(){ var hWnd = window.open("bbsloadcsv.php","_blank","width=300,height=100,scrollbars=yes"); hWnd.focus(); return false; }--></script><script type="text/javascript"><!--//function doOrder(){ var oSelectType=document.getElementById("oOrder"); var type=oSelectType.value; if(type=="name") window.location="bbsal.php?start=<?php echo ($startnum);?>&count=<?php echo $count;?>&order=name&desc=<?php echo $desc;?>"; else if(type=="bbsid") window.location="bbsal.php?start=<?php echo ($startnum);?>&count=<?php echo $count;?>&order=bbsid&desc=<?php echo $desc;?>"; else window.location="bbsal.php?start=<?php echo ($startnum);?>&count=<?php echo $count;?>&order=groupname&desc=<?php echo $desc;?>"; return;}//--></script> 按<select name="type" class="input" style="WIDTH: 55px" id="oOrder" onChange="doOrder();"><option value="name"<?php if( $order=="name" ) { ?> selected="selected"<?php } ?>>姓名</option><option value="bbsid"<?php if( $order=="bbsid" ) { ?> selected="selected"<?php } ?>>bbsid</option><option value="groupname"<?php if( $order=="groupname" ) { ?> selected="selected"<?php } ?>>分组</option></select><script type="text/javascript"><!--//function doRefresh(){ var oSelectType=document.getElementById("oType"); var type=oSelectType.value; if(type=="1") window.location="bbsal.php?start=<?php echo ($startnum);?>&count=<?php echo $count;?>&order=<?php echo $order;?>&desc=0"; else window.location="bbsal.php?start=<?php echo ($startnum);?>&count=<?php echo $count;?>&order=<?php echo $order;?>&desc=1"; return;}//--></script><select name="type" class="input" style="WIDTH: 48px" id="oType" onChange="doRefresh();"><option value="1"<?php if( $desc==0 ) { ?> selected="selected"<?php } ?>>增序</option><option value="2"<?php if( $desc==1 ) { ?> selected="selected"<?php } ?>>倒序</option></select>排列<script type="text/javascript"><!--//function doCount(){ var oSelectType=document.getElementById("oCount"); var type=oSelectType.value; if(type=="10") window.location="bbsal.php?start=<?php echo ($startnum);?>&count=10&order=<?php echo $order;?>&desc=<?php echo $desc;?>"; else if(type == "50") window.location="bbsal.php?start=<?php echo ($startnum);?>&count=50&order=<?php echo $order;?>&desc=<?php echo $desc;?>"; else if(type == "30") window.location="bbsal.php?start=<?php echo ($startnum);?>&count=30&order=<?php echo $order;?>&desc=<?php echo $desc;?>"; else window.location="bbsal.php?start=<?php echo ($startnum);?>&count=20&order=<?php echo $order;?>&desc=<?php echo $desc;?>"; return;}//--></script>每页显示<select name="type" class="input" style="WIDTH: 40px" id="oCount" onChange="doCount();"><option value="10"<?php if( $count==10 ) { ?> selected="selected"<?php } ?>>10</option><option value="20"<?php if( $count==20 ) { ?> selected="selected"<?php } ?>>20</option><option value="30"<?php if( $count==30 ) { ?> selected="selected"<?php } ?>>30</option><option value="50"<?php if( $count==50 ) { ?> selected="selected"<?php } ?>>50</option></select>个</center></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?