// news.css
a.link { color:#006699 ;text-decoration:underline;}
a.visited {color:#cc0000;text-decoration:underline;}
a.hover {color:#006699;text-decoration:underline;}
#news{ //层通用代码
margin:0px ;padding:0px ;
border-top: 0px ;
border-right: 0px;
border-bottom: 1px #C0C0C0 dotted ;//#C0C0C0是银色
border-left: 0px ;
font-size:14px ;
text-align:center ;
text-height:6px ;
color:#000000 ;
width=200;
}
#new ul{type:none; border=0px ; margin:0px ;padding:0px ;}
#news ul li{ margin:0px ; padding:0px ;}
#news ul li a.link{font-size:16px ;color:#006699 ;text-
decoration:underline;}
#news ul li a.visited {font-size:16px ;color:#cc0000;text-
decoration:underline;}
#news ul li a.hover {font-size:16px ;color:#006699;text-
decoration:underline;}
//page.php
<?
//新闻列表分页显示php
include"news/include/conn.inc.php";
include_once "news/include/zijie.php";
$sql="select * from new_f where kind='dekt' order by id DESC limit 0,10";
$result=mysql_query($sql);
while($res=mysql_fetch_array($result)){
$p="...";
$title=zijie($res["title"],24,$p);
echo "
<div id='news'>
<ul style='list-style-type:none'>
<li>
<a href='http://mail.yahoo.com/config/login?/news/detail.php?id=".base64_encode($res["id"])."&kind=".base64_encode($res["kind"])."'
target='_blank'
title='标题:".$res["title"]."(发布时间:".$res["addtime"].")'>".$title."</a>
</ul>
</div>" ;
}
mysql_free_result($result);
?>
前天在喜悦村上发帖,快被他们那帮"老鸟"笑死^^^
那天我在网吧写了个网页分页类(class),不好意思其实我也是有一次在测试我
老兄那个狗屁垃圾学校"天津师范大学"的网站漏洞时发现一同学写的类.是用于数据库查询分页.
202.113.**.** Apache/1.3.28 Server at localhost Port 80
news-img-user-main/login.asp-inc
c:/program files/apache group/apache/htdocs/dangwei/user/register.php
inc:
setup.inc:
<?
$dbname="****";
$dbuser="^^^";
$dbpass='';
$dbserver="localhost";
$connect=mysql_connect($dbserver,$dbuser,$dbpass);
If(!Mysql_connect($dbserver,$dbuser,$dbpass))
echo "连接数据库失败";
Elseif(!Mysql_select_db($dbname))
echo "打开数据库失败";
?>
function.inc:
<?
$datetime=date("Y").date("n").date("j").date("G").date("i").date("s");
?>
<?
class datalist{
var $set;
var $table_name;
var $perpage;
var $order;
var $condition;
var $sql;
var $num;
var $filename;
var $max_row;
var $key;
var $url;
var $master;
function input_table($data1)
{
for($i=0;$i<=$this->num;$i++)
{
$this->set[$i][0]=$data1[$i]['table'];
$this->set[$i][1]=$data1[$i]['name'];
}
//return $i;
}
function input_data($data2)
{
$this->table_name=$data2['table_name'];
$this->perpage=$data2['perpage'];
$this->order=$data2['order'];
$this->condition=$data2['condition'];
$this->num=$data2['num'];
$this->filename=$data2['filename'];
$this->key=$data2['key'];
$this->url=$data2['url'];
$this->master=$data2['master'];
return $this->perpage;
}
function creat_sql($n)
{
$this->sql="select * from ".$this->table_name." where ".$this->condition." order by ".$this->order." limit $n,".$this->perpage;
// echo $this->sql;
}
function test_row()
{
$sql="select * from ".$this->table_name." where ".$this->condition." order by ".$this->order;
$result=mysql_query($sql);
$this->max_row=mysql_num_rows($result);
return $this->max_row;
//echo "dsjfaio ".$this->max_row;
}
function run_sql()
{
//echo "<br>".$i;
$n=0;
$result=mysql_query($this->sql);
if($this->master==1)
{echo "<form name=form1 method=post action=delnews.php>";}
echo "<table border=1 bordercolorlight='#000000' bordercolordark='#FFFFFF'>";
echo "<tr>";
if($this->master==1)
{echo "<td> </td>";}
while($n<=$this->num)
{
echo "<td align=center >";
echo $this->set[$n][1];
echo "</td>";
$n++;
}
if($this->master==1 or $this->master==2) {
echo "<td> </td>"; }
echo "</tr>";
$checkbox_number=1;
while($row=mysql_fetch_array($result))
{
echo "<tr>";
// if(($row['new']==1)&&($this->master==1))
// {
if($this->master==1 or $this->master==2) {
echo "<td> <input type=checkbox name=checkbox".$checkbox_number." value=".$row['id']."></td>";}
$checkbox_number++;
// }
//else if($this->master==1) {echo "<td>☆</td>";}
for($n=0;$n<=$this->num;$n++)
{
echo "<td>";
if($n==$this->key) {
if($this->master==1){
echo "<a href=../document/rule/".$row['filename'].">".$row[$this->set[$n][0]]."</a>";
}
}
else {echo $row[$this->set[$n][0]];}
echo "</td>";
}
//echo "<td> </td>";
if($this->master==1)
{
echo "<td>";
echo "<a href=editnews.php?id=".$row['id'].">编辑</a>";
echo "</td>";
}
/*if($this->master==1){
echo "<td>公开回复</td>";
echo "<td>个别回复</td>";
echo "<td>删除</td>";
echo "</tr>";
} */
}
echo "</table>";
echo "<table align=left><tr><td>";
if($this->master==1)
{
echo "<br><input type='submit' name='Submit' value='删除'> 选中的内容";}
else if($this->master==2)
{echo "<br><input type='submit' name='Submit' value='还原'> 选中的内容";}
echo "</td></tr></table>";
echo "<input type=hidden name=checkbox_number value=".$checkbox_number.">";
echo "</form>";
}
function output($i)
{
if($i==""){$i=0;}
$this->creat_sql($i*$this->perpage-$i);
$this->test_row();
$file=$this->filename;
$n=$this->perpage;
$this->run_sql();
$page=ceil($this->max_row/$this->perpage)-1;
//echo $this->max_row;
echo "<table>";
echo "<tr>";
echo "<td>";
if(($i==0)&&($page>0)){
echo"(".$i."/".$page.")";
echo "上一页|";
// $n="<a href=$file?i=".$i+$n.">下一页 </a>";
//echo $n;
$i++;
echo "<a href=$file".$i.">下一页 </a>";
}
else if(($i==$page)&&($page>0)){
echo"(".$i."/".$page.")";
$i--;
echo "<a href=$file".$i.">上一页</a>|";
echo "下一页";
}
else if($page>0) {
echo"(".$i."/".$page.")";
$m=$i;
$i=$m-1;
echo "<a href=$file".$i.">上一页</a>|";
$i=$m+1;
echo "<a href=$file".$i.">下一页</a>";
}
echo "</td>";
echo "</tr>";
echo "</table>";
}
function output_table($i)
{
return array($this->set[$i][0],$this->set[$i][1]);
}
function output_data2()
{
return array($this->table_name,$this->perpage,$this->order,$this->condition);
}
}
/* hwo to use this class:
$data1=array($data1[0]=array("table"=>"author","name"=>"作者"),$data1[1]=array("table"=>"title","name"=>"标题"),$data1[2]=array("table"=>"datetime","name"=>"发表日期"),$data1[3]=array("table"=>"visited","name"=>"访问"));
$data2=array("table_name"=>"leadermail","perpage"=>5,"order"=>"datetime","condition"=>"reply=0","num"=>3,"filename"=>"readdata.php");
$open=new readdata;
$perpage=$open->input_data($data2);
$open->input_table($data1);
$open->output($i);
*/
?>
<?
//简单排版
function easy_typeset($p)
{
$p=nl2br($p);
$p=str_replace(" "," ",$p);
return $p;
}
?>
如果我要在他们学校的话那网站死定了.但那数据库只对校园网ip开放.除非你找个他们学校的代理.那就ok.
我们学校的mysql:phpmyadmin和ftp只对校园网开放的.
我在看了点教成后,也写了类,不知道怎么去调用的.
有时间在写吧,先写到这里的
//青年网首页部分代码
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
<title>民大共青团|心里装着青年--凡事想着情年--工作靠青年--一切为了青年</title>
<link href="http://www.bjyouth.gov.cn/css/css.css"
rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.bg1
{background-image:url('http://www.bjyouth.gov.cn/images/index_bg_tpbf.gif');
background-repeat: repeat-x;}
.bg2
{background-image:url('http://www.bjyouth.gov.cn/images/index_bg_tpbf.gif');
background-repeat: no-repeat;}
.bg3
{background-image:url('http://www.bjyouth.gov.cn/images/index_ll.gif');
background-repeat: repeat-y;}
.bg4
{background-image:url('http://www.bjyouth.gov.cn/images/index_l_ggl.gif');
background-repeat: repeat-x;}
.bg5
{background-image:url('http://www.bjyouth.gov.cn/images/index_bg_ggl.gif');
background-repeat: repeat-x;}
.bg6
{background-image:url('http://www.bjyouth.gov.cn/images/index_bg_gzdt.gif');
background-repeat: repeat-y;}
.bg7
{background-image:url('http://www.bjyouth.gov.cn/images/index_l_zthd.gif');
background-repeat: repeat-x;}
.bg8
{background-image:url('http://www.bjyouth.gov.cn/images/index_bg_zthd.gif');
background-repeat: repeat-x;}
.line1 {border-top:1px solid #949494;border-bottom:1px
solid #949494;}
.line2 {border-top:2px #C4C4C4 solid;
border-bottom:2px #C4C4C4 solid;
background-color:#F4F4F4;}
.line3 {border-collapse:collapse;border:1px #C2C2C2
solid;}
.line4 {border-top:1px #000000 solid;}
.rf {padding-left:10px; color:#FFFFFF;
font-weight:bold;}
.r4 {padding-top:6px;}
.right1 {border-collapse:collapse;border:2px #FFFFFF
solid;}
-->
</style>
<script language="javascript"
src="http://www.bjyouth.gov.cn/js/index.js"></script>
<base target="_blank">
</head>
<body leftmargin="0" topmargin="0" bgcolor="#FFFFFF"">
<!--Top -->
<table width="776" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td>
<table width="776" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src=http://www.bjyouth.gov.cn/images/topleft.jpg width=276 height=129>
</td>
<td>
<SCRIPT LANGUAGE=JavaScript1.1>
<!--
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words[i])))
continue;
var MM_PluginVersion = words[i];
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
&& (navigator.appVersion.indexOf("Win") != -1)) {
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next \n');
document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}
if ( MM_FlashCanPlay ) {
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
document.write(' ID="flashIntro" WIDTH="500" HEIGHT="129" ALIGN="">');
document.write(' <PARAM NAME=movie VALUE="images/swf/intro.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=menu VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=scale VALUE=noscale> <PARAM NAME=salign VALUE=LT> <PARAM NAME=bgcolor VALUE=#FFFFFF> ');
document.write('<EMBED src="images/swf/intro.swf" menu=false quality=high scale=noscale salign=LT bgcolor=#FFFFFF WIDTH="500" HEIGHT="129" NAME="flashIntro" ALIGN="" swliveconnect=true TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> ');
document.write(' </EMBED>');
document.write(' </OBJECT>');
} else{
document.write('<img src="images/swf/intro.gif" border="0" width="500" height="129">');
}
//-->
</SCRIPT><NOSCRIPT>
<img src="images/swf/intro.gif" border="0" width="500" height="129">
</NOSCRIPT>
<script language="JavaScript">
<!--
//通知flashintro开始下载动画
function passVarToFlash(args){
if (window.document.flashIntro != null){
window.document.flashIntro.SetVariable("inputVar", args);
}
}
setTimeout("passVarToFlash('htmlLoadOk');",2000);
// -->
</script></td>
</tr>
</table>
<table width="776" border="0" align="center"
cellpadding="0" cellspacing="0">
<tr height="25" align="center">
<td>
<div id="topmenu">
<ul>
<li><a
href="/zzjg/index.html">组织机构</a></li>
<li><a href="/qgzx/index.htm">勤工助学</a></li>
<li><a
href="/xsh/index.html">学生会</a></li>
<li><a
href="/ghlc/index.html">光辉历程</a></li>
<li><a
href="/ppxm/index.html">品牌项目</a></li>
<li><a
href="/wstx/index.html">网上团校</a></li>
<li><a
href="/stst/index.html">学生社团</a></li>
<li><a
href="/fwdh/index.html">服务导航</a></li>
</ul>
</div>
</td>
<td width="256"
background="http://www.bjyouth.gov.cn/images/dlm_1.gif"></td>
</tr>
</table>
<table width="776" border="0" align="center"
cellpadding="0" cellspacing="0">
<tr>
<td height="52" colspan="8" valign="bottom"
background="http://www.bjyouth.gov.cn/images/dlm_3.gif">
<table width="514" border="0" align="left"
cellpadding="0" cellspacing="0">
<tr>
<td align="left"><font color="FFD67E"><a
href="/gzdt/index.html" class="AW">工作动态</a>
| <a href="/dekt/default.html"
class="AW">第二课堂</a>
| <a href="/tzbfc/index.html"
class="AW">团支风采</a>
| <a href="/tyfc/default.html"
class="AW">团员风采</a>
| <a href="/zthd/default.html"
class="AW">专题活动</a>
| <a href="/gzdjs/index.html"
class="AW">工作记事</a>
| <a href="/ldjh/index.html"
class="AW">领导讲话</a>
| <a href="/yjsh/index.html" class="AW"
target="_blank">研究生会</a></font></td>
</tr>
<tr>
<td background="http://www.bjyouth.gov.cn/images/dlm_2.jpg"
height="6"></td>
</tr>
<tr>
<td align="center"><font color="FFD67E"><a
href="/dwjs/index.html"
class="AW">队伍建设</a>
| <a href="/gzyj/index.html"
class="AW">工作研究</a>
| <a href="/dztx/index.html"
class="AW">大学四年</a>
| <a href="/qnxx/default.html"
class="AW">青年聚焦</a>
| <a href="/dspd/index.html"
class="AW">读书频道</a>
| <a href="/shsj/index.html"
class="AW">社会实践</a>
| <a href="/wjzy/index.html"
class="AW">文件资料</a>
| <a href="/wsdy.index.html"
class="AW">网上调研</a></font></td>
</tr>
</table></td>
</table></td>
<table width="776" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="296" valign="top">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="306" height="272">
<param name="movie" value="images/swf/news.swf">
<param name="quality" value="high">
<embed src="images/swf/news.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="306" height="272">
</embed>
</object>
</td>
<td width="5" class="bg1">
</td>
</table>
<!--
//最新新闻
<table width="269" height="26" border="0" cellpadding="0" cellspacing="0" bgcolor="#AEC200">
<tr>
<td align="center"><img src="http://www.bjyouth.gov.cn/images/index_a_ywdd.gif" width="15" height="15"></td>
<td><a href="/ywdd/"><img src="http://www.bjyouth.gov.cn/images/index_ywdd.gif" width="58" height="16" border="0"></a></td>
<td width="75" align="center"><a href="/ywdd/" class="AW2">更 多</a>
<img src="http://www.bjyouth.gov.cn/images/biao.gif" width="11" height="11" align="absmiddle"></td>
</tr>
</table>
<?
//新闻列表分页显示php
include"news/include/conn.inc.php";
include_once "news/include/zijie.php";
$sql="select * from new_f where kind='dekt' order by id DESC limit 0,10";
$result=mysql_query($sql);
while($res=mysql_fetch_array($result)){
$p="...";
$title=zijie($res["title"],24,$p);
echo "<table width="95%" border="0" align="center" cellpadding="0" cellspacing="2">
<tr><td class="td1"><img src='images/icon/syxw1.gif'></td><td>
<a href='news/detail.php?id=".base64_encode($res["id"])."&kind=".base64_encode($res["kind"])."' target='_blank'
title='标题:".$res["title"]."(发布时间:".$res["addtime"].")'>".$title."</a></td></tr></table>" ;
}
mysql_free_result($result);
?>
团委上面又交下任务,要我重新设计开发青年网.
我想找人"合伙",可我认识的人都不会.只有自己做了.还好,不管怎么样,反正有个思路了.
<?php
//新闻列表显示php
include"news/include/conn.inc.php";
include_once "news/include/zijie.php";
$sql="select * from new_f where kind='dekt' order by id DESC limit 0,10";
$result=mysql_query($sql);
while($res=mysql_fetch_array($result)){
$p="...";
$title=zijie($res["title"],24,$p);
echo "<table width="95%" border="0" align="center" cellpadding="0" cellspacing="2">
<tr><td class="td1"><img src='images/icon/syxw1.gif'></td><td>
<a href='news/detail.php?id=".base64_encode($res["id"])."&kind=".base64_encode($res["kind"])."' target='_blank'
title='标题:".$res["title"]."(发布时间:".$res["addtime"].")'>".$title."</a></td></tr></table>" ;
}
mysql_free_result($result);
?>
//保存为page.php,
//传到服务器上执行报错
//根据报错消息发现在php程序中不能"<table width="95%" border="0" align="center" cellpadding="0" cellspacing="2">
//要把属性值""该成''ok