Copy data processing procedure of NPC

Source: Internet
Author: User
Tags date config count header connect readfile require strlen
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>
<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>
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" >
&LT;TR BORDER=1&GT;&LT;TD colspan=2 align=center> Query Project
&LT;TR&GT;&LT;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>
<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-->
&LT;TR&GT;&LT;TD colspan=3 align=center>
<input NAME = "submit" VALUE = "submit" TYPE = "Submit" >
<input NAME = "reset" VALUE = "reset" TYPE = "Reset" ></TD>




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;
$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))
$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;

$html _header= "$html _header.= "$dte _created=date (' y-m-d h:i:s ');
$html _header.= "<font color= ' maroon ' face= ' italics ' size=1> $index _describe found $count bar/query Date: $dte _created</font >$html _header.= "<table>rn";
$data = $html _header. $index _data;
$data. = "<TABLE></body>/*if (strlen ($index _file) ==0) {
Header ("content-type:text/html");
Echo $data;
$in _file= "$index _file";
$index _file= "\index\". $index _file;
$FP =indexfile ($index _file, $index _title, $index _describe);
Fputs ($fp, "found $count");
Fputs ($fp, "Query date: $dte _created</font>Fputs ($fp, "<table>rn");
Fputs ($fp, $index _data);
Fputs ($fp, "<TABLE></body>Fclose ($FP);
echo "Dot <a href= $index _url$in_file> here </a> see the newly added file index <BR>";
If (strlen ($index _file)!=0) {
$in _file= "$index _file";
$index _file= "\index\". $index _file;
$in _file= "temp.html";
$FP =indexfile ($index _file, $index _title, $index _describe);
Fputs ($fp, "found $count");
Fputs ($fp, "Query date: $dte _created</font>Fputs ($fp, "<table>rn");
Fputs ($fp, $index _data);
Fputs ($fp, "<TABLE></body>Fclose ($FP);

echo "Dot <a href= $index _url$in_file> here </a> see the newly added file index <BR>";
Header ("Location: $index _url$in_file");

echo "index file is $index _file";
echo "<br><a HREF = $PHP _self> return </A>";


Contact Us

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: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.