?
This procedure for a search, the current design services in the article library.
Editor: Kong Xiuxiang. Date: 2001/4/10
if (! $UploadAction):
Require "CONFIG.PHP3";
if (!isset ($table)) {
$table = "artical";
}
/*
$link _id= @MYSQL_CONNECT ($hostname, $dbusername, $dbpassword) OR DIE ("Cannot connect to the database!") ");
@mysql_select_db ("$dbname") or Die ("Cannot select a database!") ");
$q = "SELECT count (id) from $table where 1";
$result = @mysql_query ($q);
$row = @mysql_fetch_array ($result);
$r _count= $row ["Count (artical_id)"];
*/
?>
<HTML><HEAD><TITLE> Database Search </TITLE>
</HEAD>
<body><table align=center cellpadding= "0" cellspacing= "0" width= 420 "style=" border-style:outset; Border-bottom-width:thin; Border-left-width:thin;border-right-width:thin;border-top-width:thin; Border-color: #fefefe; " >
<th colspan=2 bgcolor=726cc5>
<!--tr><td colspan=2 bgcolor=726cc5-->
<font Color=white Face=arial,helvetica size=2>
<CENTER>
This program to run more time, need to wait patiently. </TH>
<form enctype= "multipart/form-data" NAME = "SubmitForm"
Action= ". $PHP _self?> "method =" POST ">
<!--INPUT type= "hidden" NAME = "max_file_size" VALUE = "2500000"-->
<input type= "hidden" NAME = "uploadaction" VALUE = "1" >
<input type= "hidden" NAME = "table" VALUE = " echo $table?> ">
<input type= "hidden" name=table value= "artical" >
<TR BORDER=1><TD colspan=2 align=center> Query Project
<TR><TD colspan=2 align=center><input type= "Radio" Name=a_data value= "data" checked> article content
<input type= "Radio" Name=a_data value= "title" > article title
<input type= "Radio" Name=a_data value= "author" > article author
<input type= "Radio" Name=a_data value= "month" > Periodical name
<!--input type= "Radio" Name=a_data value= "type" > Category number <BR-->
<TR><TD> search Content <td><input NAME = "Data_search" TYPE = "text" value= "" SIZE = "></TD>"
<TR><TD> index filename <td><input name = "Index_file" TYPE = "text" value= "" SIZE = "></TD>"
<TR><TD> Index title <td><input NAME = "Index_title" TYPE = "text" value= "" SIZE = "></TD>"
<!--tr><td> from <input NAME = "s_id" TYPE = "text" value= "1" SIZE = "4" ><td>
The start <input NAME = "Step" TYPE = "text" value= "SIZE" = "4" >, altogether. Echo $r _count?> record. </TD></TR-->
<TR><TD> Article Classification </TD>
<TD>
<select size= "1" name= "Catalog" TYPE = "int" >
<option selected value= "One" > Language theory </OPTION>
<option value= > History </OPTION>
<option value= > Chinese philosophy </OPTION>
<option value= "A" > Other </OPTION>
?<!--OPTION selected value= "One" > Language theory </OPTION-->
</SELECT>
</TR>
<TR><TD colspan=3 align=center>
<input NAME = "submit" VALUE = "submit" TYPE = "Submit" >
<input NAME = "reset" VALUE = "reset" TYPE = "Reset" ></TD>
</TD></TR>
</FORM></CENTER></TABLE></BODY>
</HTML>
?
Else
Require "CONFIG.PHP3";
$UploadAction = 0;
$added = 0;
$die = 0;
$single _chinese=0;
$TimeLimit = 0; /* Set timeout limit time of 30 seconds set to 0 when unlimited * *
Set_time_limit ($TimeLimit);
if ($data _search== "") {
Do the entire library index
Header ("location:\progs\data_index.php3");
$msg = "The search content cannot be empty. ";
Xueroom_error_exit ($msg, $PHP _self);
}
$link _id= @MYSQL_CONNECT ($hostname, $dbusername, $dbpassword) OR DIE ("Cannot connect to the database!") ");
@mysql_select_db ("$dbname") or Die ("Cannot select a database!") ");
SELECT Id,file_name,artical_author from Textfile where 1 LIMIT 0, 30
if ($table = = "artical")
{
$sid = "artical_id";
$stitle = "Artical_title";
$sauthor = "Artical_author";
$sdata = "Artical_data";
$prog = "READFILE.PHP3";
if ($a _data== "month")
$key _where= "where origin_periodical rlike ' ^.* $data _search.* '";
}
if ($a _data== "data")
$key _where= "where $sdata rlike ' ^.* $data _search.* '";
if ($a _data== "title")
$key _where= "where $stitle rlike ' ^.* $data _search.* '";
if ($a _data== "author")
$key _where= "where $sauthor rlike ' ^.* $data _search.* '";
$q = "Select $sid, $stitle, $sauthor from $table where $sdata rlike ' ^.* $data _search.* ' ORDER by $stitle";
if (($a _data== "data") && (strlen ($data _search) ==2)) {
$q = "Select $sid, $stitle, $sauthor, $sdata from $table $key _where order by $stitle";
$single _chinese=1;
}
else{
$q = "Select $sid, $stitle, $sauthor from $table $key _where order by $stitle";
}
$index _data= "";
$count = 0;
$result =@ mysql_query ($q);
if (! $result) {
$msg = "There are no records to meet the requirements. ";
Xueroom_error_exit ($msg, $PHP _self);
}
while ($row = @mysql_fetch_array ($result)) {
if ($single _chinese) && (!mystrpos ($row [$sdata], $data _search))
Continue
Else
{
$id = $row [$sid];
$title = $row [$stitle];
$author = $row [$sauthor];
if ($table = = "Textfile")
$title =preg_replace ("/.txt/", "", $title);
$data = $row ["Artical_data"];
if (Mystrpos ($data, $data _search))//can be used to find single Chinese characters.
if (Strpos ($data, $data _search)) {//is greater than a Chinese character using this judgment, faster.
$index _data.= "<tr><td><a href=". $dataurl. " $prog? $sid = $id > $title </a><TD> Author: $author </TR> ";
$count + +;
Fputs ($fp, "<tr><td><a href=". $dataurl. " readfile.php3?artical_id= $id > $title </a><TD> Author: $author </TR> ");
// }
}
}
@mysql_free_result ($result);
Mysql_close ($link _id);
Set_time_limit (30);
if ($index _title== "") {
$index _title= "Learning and fasting information";
}
$index _title= $index _title. " _ ". $data _search;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.