Линкове

nanov_91

Registered
Кажете как на системата за линкове на жоро да се направи така,че когато влезнеш в индекс да ми индексира всички файлове,а не само търсене?
 
Нали когато влезеш във индекса има само една форма за търсене,след това трябва да напишеш нешто да търси и така индексира намерените,а аз искам когато вляза да има формата за търсене и под нея всички файлове.
 
Ако съм те разбрал правилно искаш при самото зареждане скрипта да се изпълнява без критерии, въведени във формата...

Дай линк към системата на Жоро, ще се опитам да помогна...
 
Здравей!

Да не свалям цялата система и да ровя в чуждия код, би ли ми пуснал скрипта на самото търсене + формата?

Целия ден съм на линия, така че давай :)
 
Ето заповядай!
Код:
<?php

include "config.php";

//Set the page size

$StartRow = 0;

//Set the page no
if(empty($_GET['PageNo'])){
    if($StartRow == 0){
        $PageNo = $StartRow + 1;
    }
}else{
    $PageNo = $_GET['PageNo'];
    $StartRow = ($PageNo - 1) * $PageSize;
}

//Set the counter start
if($PageNo % $PageSize == 0){
    $CounterStart = $PageNo - ($PageSize - 1);
}else{
    $CounterStart = $PageNo - ($PageNo % $PageSize) + 1;
}

//Counter End
$CounterEnd = $CounterStart + ($PageSize - 1);
?>

<html>
<head>
<title>Free Search Engine</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<style type="text/css">

BODY {
	FONT-SIZE: 8pt; COLOR: #526ba5; FONT-FAMILY: Arial
}
H3 {
	COLOR: #526ba5
}
H4 {
	COLOR: #526ba5
}
.Issue {
	BACKGROUND-COLOR: #c6c6ce
}
.NormalField {
	FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: Verdana;BACKGROUND-COLOR: #ffffff
}
.NormalFieldTwo {
	FONT-SIZE: 7pt;

	FONT-FAMILY: Verdana;
	background : #E4E4E4;
	font-weight : bold
}
.NormalFieldThree {
	FONT-SIZE: 10pt;
	COLOR: Yellow;
	FONT-FAMILY: Verdana;
	background : #0C79B4;
	font-weight : bold;
	text-align : center;
}

.NormalFieldFour {
	FONT-SIZE: 10pt;
	COLOR: Yellow;
	FONT-FAMILY: Verdana;
	background : Black;
	font-weight : bold;
	text-align : center;
}
.NormalFieldFive {
	FONT-WEIGHT: bold;
	FONT-SIZE: 10pt;
	COLOR: Navy;
	FONT-FAMILY: Verdana;
	BACKGROUND-COLOR: #ffffff
}
.NormalFieldSix {
		FONT-WEIGHT: bold; FONT-SIZE: 8pt; COLOR: #526ba5; FONT-FAMILY: Arial
}

.TableText {
	FONT-SIZE: 8pt; COLOR: #000000; FONT-FAMILY: Arial
}
.TableBorder{
	border-color : Black;
}
.NormalTable {
	BACKGROUND-COLOR: #ffffff
}
.NormalTableTwo {
	BACKGROUND-COLOR: #eeeeee
}
.UsePageBG {
	BACKGROUND-COLOR: #cccccc
}
.UseTableBG {
	BACKGROUND-COLOR: #526ba5
}
.UseDialogBG {
	BACKGROUND-IMAGE: url(../Graphics/Images/DialogBackGround.gif)
}
.ReadOnlyField {
	FONT-WEIGHT: bold; FONT-SIZE: 8pt; COLOR: #526000; FONT-FAMILY: Arial
}
.InternalHeader {
	FONT-WEIGHT: bold; FONT-SIZE: 8pt; COLOR: #ffffff; FONT-FAMILY: Arial; BACKGROUND-COLOR: #526ba5;
}
.AttachedFiles {
	BACKGROUND-COLOR: #99ccff;
	color : Black
}
.SpecialAnchor {
	FONT-FAMILY: Arial; TEXT-DECORATION: none
}
UNKNOWN {
	FONT-WEIGHT: lighter; FONT-SIZE: 8pt; TEXT-TRANSFORM: capitalize; COLOR: navy; FONT-STYLE: normal; FONT-FAMILY: 'Arial', Times New Roman, Verdana; FONT-VARIANT: normal; TEXT-DECORATION: underline
}
.SearchResults {
	FONT-WEIGHT: normal; FONT-SIZE: 8pt; COLOR: #000000; FONT-STYLE: normal; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.MandatoryFields {
	FONT-WEIGHT: normal; FONT-SIZE: 10pt; COLOR: #ff0000; FONT-STYLE: normal; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.tab-above-heading {
	FONT-WEIGHT: bold; FONT-SIZE: 12pt; COLOR: #000000; FONT-STYLE: normal; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.textareaLabel {
	FONT-WEIGHT: bolder; FONT-SIZE: 10pt; COLOR: #526ba5; FONT-FAMILY: Arial
}
.linkStyle {
	TEXT-DECORATION: none
}
.PageTitle {
	FONT-WEIGHT: bold; FONT-SIZE: 16pt; COLOR: #526ba5; FONT-FAMILY: Tahoma
}
.smallfont {
	FONT-SIZE: 7.5pt; COLOR: #000000; FONT-FAMILY: Arial
}
A {
	COLOR: Red;
	TEXT-DECORATION: none
}

 #nav {
background-color: #D5D5D5;
border: 1px solid #B8B8B8;
padding-top: 8px;
height: 21px;
padding-left: 3px;
}
#nav a {
border: 1px solid #B7B7B7;
padding: 4px;
background-color: #F3F3F3;
color: #0077B4;
font-weight: bold;
text-decoration: none;
font-family: Verdana, Sans-Serif;
font-size: 12px;
}
#nav a:hover {
color: #00A8FF;
background-color: #ffffff;
border: 1px solid #727272;
border-bottom: 1px solid #ffffff;
}
</style>
</head>
<body class="UsePageBg">
<form method="GET" action="">
<table cellpadding="0" cellspacing="0" width="300px" align="center" cellpadding="0" >
<tr>
<td align="right" width="200px"><input type="text" name="q" size="30"></td>
<td align="right" width="100px"><input type="submit" value="Търсене"></td>
</tr>
</table>
</form>
<?php
$tarsene = $_GET['q'];

if($_GET['q'])
{
$trimmed = trim($tarsene); 
$var = explode(" ",$trimmed); 
$count = count($var); 


for($i = $count-1;$i < sizeof($var); $i++) {

$abc = $var[$i]; 

 mysql_connect($server, $dbusername, $dbpassword)or die("Сайтът не може да се свърже към базата данни");
 @mysql_select_db($db_name) or die("Грешна база данни");
 $TRecord = mysql_query("SELECT * FROM `linkove` WHERE `files` LIKE '%$abc%'");
 $result = mysql_query("SELECT * FROM `linkove` WHERE `files` LIKE '%$abc%' ORDER BY `id` DESC LIMIT $StartRow,$PageSize");

 //Total of record
 $RecordCount = mysql_num_rows($TRecord);

 //Set Maximum Page
 $MaxPage = $RecordCount % $PageSize;
 if($RecordCount % $PageSize == 0){
    $MaxPage = $RecordCount / $PageSize;
 }else{
    $MaxPage = ceil($RecordCount / $PageSize);
 }
?>

<table width="100%" border="0" class="InternalHeader">
  <tr>
    <td width="24%"></td>
    <td width="76%">
      <div align="right"> 
        <?php print "$RecordCount запис(а) намерен(и) - Вие сте на страница $PageNo от $MaxPage" ?></div>
    </td>
  </tr>
</table>
<br>
<table width="100%" border="0" class="NormalTableTwo">
  <tr> 
    <td class="InternalHeader" width="5%">Номер</td>
    <td class="InternalHeader" width="60%">Име</td>
	<td class="InternalHeader" width="20%">Тип</td>
    <td class="InternalHeader" width="15%">Добавен</td>
  </tr>
<?php
$i = 1;
while($row = mysql_fetch_array($result))
{
$id=$row[id]; 
$data=$row[data]; 
$fulllinks=$row[fulllinks]; 
$files=$row[files];
$tipfail=$row[tipfail];

 
    $bil = $i + ($PageNo-1)*$PageSize;
	
?>

  <tr> 
    <td class="NormalFieldTwo" width="5%"><?php echo $bil ?></td>
    <td class="NormalFieldTwo" width="60%"><a href="s.php?id=<?php echo $id; ?>" target="_new"><?php echo $files ?></a></td>
	<td class="NormalFieldTwo" width="20%"><?php echo $tipfail ?></td>
	<td class="NormalFieldTwo" width="15%"><?php echo $data ?></td>
 </tr>
<?php
  $i++;
}?>
</table><br>
<table width="100%" border="0" class="InternalHeader">
  <tr>
    <td>

      <div align="center">
      <?php
        //Print First & Previous Link is necessary
        if($CounterStart != 1){
            $PrevStart = $CounterStart - 1;
            print "<a href=?q=$tarsene&PageNo=1>Първи </a>: ";
            print "<a href=?q=$tarsene&PageNo=$PrevStart>Предишни $PageSize </a>";
        }
        print " [ ";
        $c = 0;

        //Print Page No
        for($c=$CounterStart;$c<=$CounterEnd;$c++){
            if($c < $MaxPage){
                if($c == $PageNo){
                    if($c % $PageSize == 0){
                        print "$c ";
                    }else{
                        print "$c ,";
                    }
                }elseif($c % $PageSize == 0){
                    echo "<a href=?q=$tarsene&PageNo=$c>$c</a> ";
                }else{
                    echo "<a href=?q=$tarsene&PageNo=$c>$c</a> ,";
                }//END IF
            }else{
                if($PageNo == $MaxPage){
                    print "$c ";
                    break;
                }else{
                    echo "<a href=?q=$tarsene&PageNo=$c>$c</a> ";
                    break;
                }//END IF
            }//END IF
       }//NEXT

      echo "] ";

      if($CounterEnd < $MaxPage){
          $NextPage = $CounterEnd + 1;
          echo "<a href=?q=$tarsene&PageNo=$NextPage>Следващи $PageSize</a>";
      }
      
      //Print Last link if necessary
      if($CounterEnd < $MaxPage){
       $LastRec = $RecordCount % $PageSize;
        if($LastRec == 0){
            $LastStartRecord = $RecordCount - $PageSize;
        }
        else{
            $LastStartRecord = $RecordCount - $LastRec;
        }

        print " : ";
        echo "<a href=?q=$tarsene&PageNo=$MaxPage>Последни</a>";
        }
      ?>
      </div>
    </td>
  </tr>
</table>
<?php
    mysql_free_result($result);

    mysql_free_result($TRecord);
	}}
?>
<br>
<center>Powered from <a href="http://webjo.no-ip.org" target="_new">Web Journal</a></center>

</body>
</html>
 
<?php

include "config.php";

//Set the page size

$StartRow = 0;

//Set the page no
if(empty($_GET['PageNo'])){
if($StartRow == 0){
$PageNo = $StartRow + 1;
}
}else{
$PageNo = $_GET['PageNo'];
$StartRow = ($PageNo - 1) * $PageSize;
}

//Set the counter start
if($PageNo % $PageSize == 0){
$CounterStart = $PageNo - ($PageSize - 1);
}else{
$CounterStart = $PageNo - ($PageNo % $PageSize) + 1;
}

//Counter End
$CounterEnd = $CounterStart + ($PageSize - 1);
?>

<html>
<head>
<title>Free Search Engine</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<style type="text/css">

BODY {
FONT-SIZE: 8pt; COLOR: #526ba5; FONT-FAMILY: Arial
}
H3 {
COLOR: #526ba5
}
H4 {
COLOR: #526ba5
}
.Issue {
BACKGROUND-COLOR: #c6c6ce
}
.NormalField {
FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: Verdana;BACKGROUND-COLOR: #ffffff
}
.NormalFieldTwo {
FONT-SIZE: 7pt;

FONT-FAMILY: Verdana;
background : #E4E4E4;
font-weight : bold
}
.NormalFieldThree {
FONT-SIZE: 10pt;
COLOR: Yellow;
FONT-FAMILY: Verdana;
background : #0C79B4;
font-weight : bold;
text-align : center;
}

.NormalFieldFour {
FONT-SIZE: 10pt;
COLOR: Yellow;
FONT-FAMILY: Verdana;
background : Black;
font-weight : bold;
text-align : center;
}
.NormalFieldFive {
FONT-WEIGHT: bold;
FONT-SIZE: 10pt;
COLOR: Navy;
FONT-FAMILY: Verdana;
BACKGROUND-COLOR: #ffffff
}
.NormalFieldSix {
FONT-WEIGHT: bold; FONT-SIZE: 8pt; COLOR: #526ba5; FONT-FAMILY: Arial
}

.TableText {
FONT-SIZE: 8pt; COLOR: #000000; FONT-FAMILY: Arial
}
.TableBorder{
border-color : Black;
}
.NormalTable {
BACKGROUND-COLOR: #ffffff
}
.NormalTableTwo {
BACKGROUND-COLOR: #eeeeee
}
.UsePageBG {
BACKGROUND-COLOR: #cccccc
}
.UseTableBG {
BACKGROUND-COLOR: #526ba5
}
.UseDialogBG {
BACKGROUND-IMAGE: url(../Graphics/Images/DialogBackGround.gif)
}
.ReadOnlyField {
FONT-WEIGHT: bold; FONT-SIZE: 8pt; COLOR: #526000; FONT-FAMILY: Arial
}
.InternalHeader {
FONT-WEIGHT: bold; FONT-SIZE: 8pt; COLOR: #ffffff; FONT-FAMILY: Arial; BACKGROUND-COLOR: #526ba5;
}
.AttachedFiles {
BACKGROUND-COLOR: #99ccff;
color : Black
}
.SpecialAnchor {
FONT-FAMILY: Arial; TEXT-DECORATION: none
}
UNKNOWN {
FONT-WEIGHT: lighter; FONT-SIZE: 8pt; TEXT-TRANSFORM: capitalize; COLOR: navy; FONT-STYLE: normal; FONT-FAMILY: 'Arial', Times New Roman, Verdana; FONT-VARIANT: normal; TEXT-DECORATION: underline
}
.SearchResults {
FONT-WEIGHT: normal; FONT-SIZE: 8pt; COLOR: #000000; FONT-STYLE: normal; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.MandatoryFields {
FONT-WEIGHT: normal; FONT-SIZE: 10pt; COLOR: #ff0000; FONT-STYLE: normal; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.tab-above-heading {
FONT-WEIGHT: bold; FONT-SIZE: 12pt; COLOR: #000000; FONT-STYLE: normal; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.textareaLabel {
FONT-WEIGHT: bolder; FONT-SIZE: 10pt; COLOR: #526ba5; FONT-FAMILY: Arial
}
.linkStyle {
TEXT-DECORATION: none
}
.PageTitle {
FONT-WEIGHT: bold; FONT-SIZE: 16pt; COLOR: #526ba5; FONT-FAMILY: Tahoma
}
.smallfont {
FONT-SIZE: 7.5pt; COLOR: #000000; FONT-FAMILY: Arial
}
A {
COLOR: Red;
TEXT-DECORATION: none
}

#nav {
background-color: #D5D5D5;
border: 1px solid #B8B8B8;
padding-top: 8px;
height: 21px;
padding-left: 3px;
}
#nav a {
border: 1px solid #B7B7B7;
padding: 4px;
background-color: #F3F3F3;
color: #0077B4;
font-weight: bold;
text-decoration: none;
font-family: Verdana, Sans-Serif;
font-size: 12px;
}
#nav a:hover {
color: #00A8FF;
background-color: #ffffff;
border: 1px solid #727272;
border-bottom: 1px solid #ffffff;
}
</style>
</head>
<body class="UsePageBg">
<form method="GET" action="">
<table cellpadding="0" cellspacing="0" width="300px" align="center" cellpadding="0" >
<tr>
<td align="right" width="200px"><input type="text" name="q" size="30"></td>
<td align="right" width="100px"><input type="submit" value="Търсене"></td>
</tr>
</table>
</form>
<?php
$tarsene = $_GET['q'];

if($_GET['q'])
{

$trimmed = trim($tarsene);
$var = explode(" ",$trimmed);
$count = count($var);


for($i = $count-1;$i < sizeof($var); $i++) {

$abc = $var[$i];

mysql_connect($server, $dbusername, $dbpassword)or die("Сайтът не може да се свърже към базата данни");
@mysql_select_db($db_name) or die("Грешна база данни");
$TRecord = mysql_query("SELECT * FROM `linkove` WHERE `files` LIKE '%$abc%'");
$result = mysql_query("SELECT * FROM `linkove` WHERE `files` LIKE '%$abc%' ORDER BY `id` DESC LIMIT $StartRow,$PageSize");

//Total of record
$RecordCount = mysql_num_rows($TRecord);

//Set Maximum Page
$MaxPage = $RecordCount % $PageSize;
if($RecordCount % $PageSize == 0){
$MaxPage = $RecordCount / $PageSize;
}else{
$MaxPage = ceil($RecordCount / $PageSize);
}
?>

<table width="100%" border="0" class="InternalHeader">
<tr>
<td width="24%"></td>
<td width="76%">
<div align="right">
<?php print "$RecordCount запис(а) намерен(и) - Вие сте на страница $PageNo от $MaxPage" ?></div>
</td>
</tr>
</table>
<br>
<table width="100%" border="0" class="NormalTableTwo">
<tr>
<td class="InternalHeader" width="5%">Номер</td>
<td class="InternalHeader" width="60%">Име</td>
<td class="InternalHeader" width="20%">Тип</td>
<td class="InternalHeader" width="15%">Добавен</td>
</tr>
<?php
$i = 1;
while($row = mysql_fetch_array($result))
{
$id=$row[id];
$data=$row[data];
$fulllinks=$row[fulllinks];
$files=$row[files];
$tipfail=$row[tipfail];


$bil = $i + ($PageNo-1)*$PageSize;

?>

<tr>
<td class="NormalFieldTwo" width="5%"><?php echo $bil ?></td>
<td class="NormalFieldTwo" width="60%"><a href="s.php?id=<?php echo $id; ?>" target="_new"><?php echo $files ?></a></td>
<td class="NormalFieldTwo" width="20%"><?php echo $tipfail ?></td>
<td class="NormalFieldTwo" width="15%"><?php echo $data ?></td>
</tr>
<?php
$i++;
}?>
</table><br>
<table width="100%" border="0" class="InternalHeader">
<tr>
<td>

<div align="center">
<?php
//Print First & Previous Link is necessary
if($CounterStart != 1){
$PrevStart = $CounterStart - 1;
print "<a href=?q=$tarsene&PageNo=1>Първи </a>: ";
print "<a href=?q=$tarsene&PageNo=$PrevStart>Предишни $PageSize </a>";
}
print " [ ";
$c = 0;

//Print Page No
for($c=$CounterStart;$c<=$CounterEnd;$c++){
if($c < $MaxPage){
if($c == $PageNo){
if($c % $PageSize == 0){
print "$c ";
}else{
print "$c ,";
}
}elseif($c % $PageSize == 0){
echo "<a href=?q=$tarsene&PageNo=$c>$c</a> ";
}else{
echo "<a href=?q=$tarsene&PageNo=$c>$c</a> ,";
}//END IF
}else{
if($PageNo == $MaxPage){
print "$c ";
break;
}else{
echo "<a href=?q=$tarsene&PageNo=$c>$c</a> ";
break;
}//END IF
}//END IF
}//NEXT

echo "] ";

if($CounterEnd < $MaxPage){
$NextPage = $CounterEnd + 1;
echo "<a href=?q=$tarsene&PageNo=$NextPage>Следващи $PageSize</a>";
}

//Print Last link if necessary
if($CounterEnd < $MaxPage){
$LastRec = $RecordCount % $PageSize;
if($LastRec == 0){
$LastStartRecord = $RecordCount - $PageSize;
}
else{
$LastStartRecord = $RecordCount - $LastRec;
}

print " : ";
echo "<a href=?q=$tarsene&PageNo=$MaxPage>Последни</a>";
}
?>
</div>
</td>
</tr>
</table>
<?php
mysql_free_result($result);

mysql_free_result($TRecord);
}}
?>
<br>
<center>Powered from <a href="http://webjo.no-ip.org" target="_new">Web Journal</a></center>

</body>
</html>


Изтриваш маркираното в червено - проверката дали има изпратени данни с ГЕТ и скрипта ще се изпълнява и без да е въведена информация във формата. Ако ще махаш иф-условието, да не пропуснеш затварящата му скоба...
Би могло да се поусложни малко, но мисля, че и така те устройва :)
 

Back
Горе