当前位置:  编程技术>php
本页文章导读:
    ▪图书管理程序(三)       图书查询部分: <? if(!$UploadAction): ?> <? //本程序是为输出书名,作者、出版社资料而设。 //编者:孔秀祥。日期:2001/3/25 ?> <HTML><HEAD> <TITLE>书目查询 </TITLE> </HEAD.........
    ▪一个从别的网站抓取信息的例子(域名查询)       <?   if (isset($xx)) { $dodo=@file("http://www.e9china.com/cgi-bin/comdns.pl?raw=1&lookup=OK&fqdn=".$fqdn."&domain=".$domain."&root=".$root."&cdomain=2.7");    $i=0; while($dodo[$i]) {    echo $dodo[$i];    $i++; .........
    ▪一个PHP+MSSQL分页的例子       <? require "config.php"; dl("extensions/php_mssql70.dll"); if (!isset($page)) { $page=1; } if ($page<=0) { $page=1; }      $db=mssql_connect($local,$user,$pass);      mssql_select_db($name,$db);      $query=mssql_query("select.........

[1]图书管理程序(三)
    来源: 互联网  发布时间: 2013-11-30
图书查询部分:
<?
if(!$UploadAction):
?>
<?
//本程序是为输出书名,作者、出版社资料而设。
//编者:孔秀祥。日期:2001/3/25
?>
<HTML><HEAD>
<TITLE>书目查询 </TITLE>
</HEAD>
<BODY><TABLE align=CENTER>
<FORM ENCTYPE= "multipart/form-data" NAME = "SubmitForm"
ACTION= "<? $PHP_SELF ?>" METHOD = "POST">
<INPUT TYPE= "hidden" NAME = "MAX_FILE_SIZE" VALUE ="20000000">
<INPUT TYPE= "hidden" NAME = "UploadAction" VALUE = "1">

<!--TR><TD>文件名<TD><INPUT NAME = "UploadFile" TYPE = "file" VALUE="" SIZE = "30"></TR-->
<TR><TD align=center>著作名<TD><INPUT NAME = "b_name" TYPE = "text" VALUE="" SIZE = "30" maxlength=100></TD></TR>
<TR><TD align=center>作者<TD>姓<INPUT NAME = "a_first1" TYPE = "text" VALUE="" SIZE = "6" maxlength=20>
名<INPUT NAME = "a_last1" TYPE = "text" VALUE="" SIZE = "6" maxlength=20></TD></TR>
<TR><TD align=center>出版社<TD><INPUT NAME = "p_name" TYPE = "text" VALUE="" SIZE = "30" maxlength=100></TD></TR>
<TR><TD>出版日期<TD><INPUT NAME = "p_year" TYPE = "text" VALUE="" SIZE = "4">年
<!--INPUT NAME = "p_month" TYPE = "text" VALUE="" SIZE = "2">月 <-->
<TR><TD>ISBN<TD><INPUT NAME = "isbn" TYPE = "text" VALUE="" SIZE = "25">

</TABLE><TABLE align=center>
<TR><TD align=center>
<INPUT NAME = "submit" VALUE = "提交" TYPE = "submit">
<TD><INPUT NAME = "reset" VALUE = "重置" TYPE = "reset">
</TD></TR>
</FORM></CENTER></TABLE></BODY>

</HTML>

<?

else:
session_start();
require "config.php3";

$b_price=$b_price_a.".".$b_price_b;

$UploadAction=0;
$repeat=0;      //是不是重复了。
$TimeLimit=0; //设置超时限制时间缺省时间为 30秒设置为0时为不限时
set_time_limit($TimeLimit);
@MYSQL_CONNECT($hostname,$dbusername,$dbpassword) OR DIE("不能连接数据库!");
@mysql_select_db("$dbname") or die("不能选择数据库!");
//$q="select books.books_id, books.books_name,author.first_name,author.last_name,publisher.publisher_name from books,author,books_author,publisher where books.books_name="$b_name" and books.publisher_id=publisher.publisher_id and books.books_id=books_author.books_id and books_author.author_id=author.author_id";
if($b_name!="")
    $bn="books.books_name="$b_name" and ";
if($p_name!="")
    $pn="publisher.publisher_name="$p_name" and ";
if($a_first1!="")
    $af="author.first_name="$a_first1" and ";
if($a_last1!="")
    $al="author.last_name="$a_last1" and ";
if($p_year!=""){
    $date_p="books.date_pub rlike '^$p_year.*' and ";
    }
if($isbn!="")
    $is="books.ISBN="$isbn" and ";
$q="select books.books_id, books.books_name,author.first_name,author.last_name,publisher.publisher_name from books,author,books_author,publisher  
where $bn $pn $af $al $date_p $is books.publisher_id=publisher.publisher_id and books.books_id=books_author.books_id and books_author.author_id=author.author_id order by books.books_name";


$r = @mysql_query($q);
if(!$r){
    echo "查询无效 <BR>";
    exit;
}
if(mysql_num_rows($r)<1){
    $msg="没有符合要求的记录。";
    xueroom_error_exit($msg,$PHP_SELF);

}

while($count=mysql_fetch_array($r)){  
    $books_id=$count[0];
    $books_name=$count[1];
    $first_name=$count[2];
    $last_name=$count[3];
    $publisher_name=$count[4];
    if($book!=$books_id){
        $repeat++;
        echo "<BR>".$repeat."、";
        echo "《".$books_name."》";
        echo "出版社:".$count[4];
        echo "  作者:";
    }
    echo "$first_name$last_name ";
    $book=$books_id;
}

echo"<BR><A HREF = $PHP_SELF>返回 </A>";
echo"</BODY></HTML>";

?>
<?
endif;
?>



    
[2]一个从别的网站抓取信息的例子(域名查询)
    来源: 互联网  发布时间: 2013-11-30
<?
  if (isset($xx)) {
$dodo=@file("http://www.e9china.com/cgi-bin/comdns.pl?raw=1&lookup=OK&fqdn=".$fqdn."&domain=".$domain."&root=".$root."&cdomain=2.7");
   $i=0;
while($dodo[$i]) {
   echo $dodo[$i];
   $i++;
                   }
exit;
                 }
?>
<?
  if (isset($submit)) {
  if ($domain=="") { echo "请输入域名"; exit; }
$dom=@file("http://www.e9china.com/cgi-bin/comdns.pl?cdomain=2.7&lookup=OK&domain=".$domain."&root=".$root);
$dom1=substr("$dom[13]",19);
$dom1=chop($dom1);
    switch($dom1) {
  case "对不起!该域名已被注册</FONT>":
   for($i=0;$i<32;$i++) { #i
    echo $dom[$i];
                        }
?>
<CENTER>
<FORM METHOD=POST ACTION="/blog_article/</ echo $PHP_SELF; /gt;.html">
<INPUT TYPE="hidden" NAME="fqdn" VALUE="<? echo "$domain.$root" ?>">
<INPUT TYPE="hidden" NAME="domain" VALUE="<? echo "$domain.$root" ?>">
<INPUT TYPE="hidden" NAME="root" VALUE="<? echo $root ?>">
<INPUT TYPE="submit" VALUE="显示域名注册的详细信息" name="xx">
</FORM>
</CENTER>  
<?
exit;
break;
   case "对不起!您所输入的是域名名称错误</FONT>":
   $i=0;
   while($i<42) {
   echo $dom[$i];
   $i++;
                   }
   $i=51;
   while($dom[$i])   {
   echo $dom[$i];
   $i++;
                     }
  exit;
  break;

   case "恭喜您:该域名还未被注册过,可供注册</FONT>":
?>
    <HTML>
    <HEAD>
    <TITLE>国际域名注册查询结果</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FFFFFF">
<CENTER>
<TABLE BORDER=0 CELLPADDING=3 WIDTH=75%>
<TR>    
<TD>
        <TABLE BORDER=0 CELLPADDING=3 WIDTH=100%>
        <TR>
        <TD BGCOLOR="#000000">
        <FONT  COLOR=#FFFFFF SIZE=3 SIZE   
    FACE="Arial,宋体">恭喜您:该域名还未被注册过,可供注册</FONT>
        <BR>
        </TD>
        </TR>
        </TABLE>
<BR><BR>
</TD>    
</TR>
<TR>
<TD>

<BLOCKQUOTE>
<span >2</span>
<span ><FONT FACE="Arial,宋体" SIZE=-1>
您所查询的国际域名<strong>"djdjdjdd.com"</strong>尚未被注册。您可以注册该域名。
</span>
    您可继续查询其它可注域名。
</FONT>
</BLOCKQUOTE>
<p>      
<p>

    <P>
    </BODY>
    </HTML>
<?
exit;
break;
                   }
                       }
?>


<form method="POST" action="<? echo $PHP_SELF; ?>">
  <input type="hidden" name="cdomain" value="2.7"><input type="hidden" name="lookup"
  value="OK"><table cellpadding="0" border="0" width="100%" cellspacing="0">
    <tr align="center">
      <td valign="middle">www. <input name="domain" size="10" maxlength="256"> <font
      size="+1"><select name="root" size="-1">
        <option value="com">.com</option>
        <option value="net">.net</option>
        <option value="org">.org</option>
      </select> </font><br>
      <br>
      <input type="submit" value="国际域名查询" name="submit"> </td>
    </tr>
  </table>
</form> 

    
[3]一个PHP+MSSQL分页的例子
    来源: 互联网  发布时间: 2013-11-30
<?
require "config.php";
dl("extensions/php_mssql70.dll");
if (!isset($page)) { $page=1; }
if ($page<=0) { $page=1; }
     $db=mssql_connect($local,$user,$pass);
     mssql_select_db($name,$db);
     $query=mssql_query("select count(*) as date from news",$db);
     $query=mssql_fetch_array($query);
     $pages=ceil($query[0]/$userperpage);
      if ($page>$pages) { $page=$pages;}
      if ($query[0]<$userperpage) { $userperpage=$query[0]; }
$dangqian=($page-1)*$userperpage;
echo "<title>News</title>";
echo "<style type=text/css>\n";
echo "<!--\n";
echo "A{text-decoration:none}\n";
echo "A:hover         {color:blue;; text-decoration: underline}\n";
echo "td {  font-size: 9pt}\n";
echo "--></style>\n";
echo "<div align=center><center>\n";
echo "<table border=0 width=100% cellspacing=0 cellpadding=0 height=19\n";
echo "<tr>";
echo " <td width=52% colspan=5><img src=/blog_article/xw.gif width=100%></td></tr>\n";
echo "<tr>";
echo "    <td width=52% height=19 valign=bottom bgcolor=#B5C6B0><p align=center><font\n";
echo "    color=#408080>新闻标题</font></td>\n";
echo "    <td width=14% height=19 valign=bottom align=center bgcolor=#B5C6B0><font\n";
echo "    color=#408080>发表日期</font></td>\n";
echo "    <td width=19% height=19 valign=bottom align=center bgcolor=#B5C6B0><font\n";
echo "    color=#408080>发表部门</font></td>\n";
echo "    <td width=7% height=19 valign=bottom align=center bgcolor=#B5C6B0><font\n";
echo "    color=#408080>阅读</font></td>\n";
echo "    <td width=8% height=19 valign=bottom align=center bgcolor=#B5C6B0><font\n";
echo "    color=#408080>图像</font></td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "</center></div>\n";
echo "<div align=center><center>\n";
echo "<table border=0 width=100% cellspacing=0 cellpadding=0 height=19>\n";
     $db=mssql_connect($local,$user,$pass);
     mssql_select_db($name,$db);
     $query=mssql_query("select * from news order by date desc",$db);
     $roro=mssql_num_rows($query);
      if ($roro==0) {
echo "<br><br><p align=\"center\"><font color=\"#FF0000\" size=\"2\"><marquee behavior=\"alternate\" border=\"0\" width=\"300\" height=\"16\" scrolldelay=\"70\">目前数据库中无任何记录!</marquee></font></p>";
       exit;
                    }
     mssql_data_seek($query,$dangqian);
     $i=0;
     while ($arr=mssql_fetch_array($query)) {
      if ($i>=$userperpage) { break;}
echo "<tr>\n";
echo "    <td width=52% bgcolor=#F3F3F3 height=19 valign=bottom><p align=left><a href=/index.html"readnews.php?id=$arr[date]\" target=\"_blank\"><font color=#3D5449>$arr[title]</font></a></td>\n";
$datee=date("Y-m-d",$arr[date]);
echo "    <td width=14% bgcolor=#F3F3F3 height=19 valign=bottom align=center><font color=#3D5449>$datee</font></td>\n";
echo "    <td width=19% bgcolor=#F3F3F3 height=19 valign=bottom align=center><font color=#3D5449>$arr[type]</font></td>\n";
echo "    <td width=7% bgcolor=#F3F3F3 height=19 valign=bottom align=center><font color=#808080>$arr[click]</font></td>\n";
echo "    <td width=8% bgcolor=#F3F3F3 height=19 valign=bottom align=center>\n";
  $arr[photo]=trim($arr[photo]);
   if (($arr[photo]<>"") || (file_exists($arr[photo]))) {
echo "<img src=/blog_article/picture.gif";
                                                        }
   else { echo " "; }
echo "</td>\n";
echo "</tr>\n";
    $i++;
                                             }  //while
echo "<tr>\n";
echo "<td width=100% height=20 colspan=5></td>\n";
echo "</tr>\n";
echo "<tr><td width=100% colspan=5><center>\n";
   if ($page<>1) {
echo "<a href=/blog_article/$PHP_SELF/page/1/gt;/lt;font.html color=#408080>首页</font></a>\n";
                 }
  if ($page>1) {  
  $upage=$page-1;  
echo "<a href=/blog_article/$PHP_SELF/page/$upage/gt;/lt;font.html color=red>上一页</font></a>\n";
               }
  for($y=1;$y<=$pages;$y++) {
   echo "<a href=/blog_article/$PHP_SELF/page/$y/gt;$y/lt;/a/gt;_n.html";
                             }
  if ($page<$pages) {
  $npage=$page+1;
echo "<a href=/blog_article/$PHP_SELF/page/$npage/gt;/lt;font.html color=red>下一页</font></a>\n";
                    }
  if ($page<>$pages)  {
echo "<a href=/blog_article/$PHP_SELF/page/$pages/gt;/lt;font.html color=#408080>尾页</font></a>\n";
                      }
echo "</center></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</center></div>\n";
?> 

    
最新技术文章:
▪PHP函数microtime()时间戳的定义与用法
▪PHP单一入口之apache配置内容
▪PHP数组排序方法总结(收藏)
▪php数组排序方法大全(脚本学堂整理奉献)
▪php数组排序的几个函数(附实例)
▪php二维数组排序(实例)
▪php根据键值对二维数组排序的小例子
▪php验证码(附截图)
▪php数组长度的获取方法(三个实例)
▪php获取数组长度的方法举例
▪判断php数组维度(php数组长度)的方法
▪php获取图片的exif信息的示例代码
▪PHP 数组key长度对性能的影响实例分析
▪php函数指定默认值的方法示例
▪php提交表单到当前页面、提交表单后页面重定...
▪php四舍五入的三种实现方法
▪php获得数组长度(元素个数)的方法
▪php日期函数的简单示例代码
▪php数学函数的简单示例代码
▪php字符串函数的简单示例代码
▪php文件下载代码(多浏览器兼容、支持中文文...
▪php实现文件下载、支持中文文件名的示例代码...
▪php文件下载(防止中文文件名乱码)的示例代码
▪解决PHP文件下载时中文文件名乱码的问题
▪php数组去重(一维、二维数组去重)的简单示例
▪php小数点后取两位的三种实现方法
▪php Redis 队列服务的简单示例
▪PHP导出excel时数字变为科学计数的解决方法
▪PHP数组根据值获取Key的简单示例
▪php数组去重的函数代码示例
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3