S.A.
Bir site var elimizde yapmamız gereken,
Müşteri bizden ürün eklemeyi kendi yapacağı için bende ona kontrol panelli bi ürün yönetim modülü buldum, herşeyini ayarladık derken.
Müşteri ürünlerin aranması için arama modülü istedi..
Netten araştırdım ve en işe yarayanını ekledim;
ancak arama kısmına "a" yazıyorum bana kategoride bulunan ürünlerin isimlerini değil, aynı dizinde bulunan admin.php ve admin_popup.php dosyalarındaki bildirim yazılarını gösteriyor..
ne yapmam lazım?
http://www.mobilyamecmua.com/kedicollection/index.php
Yardım etmek isteyenler demo olarak kullandığım siteyi kullanabilir.
PHP Arama Sorunu
6
●531
- 10-12-2009, 16:58:32Kodlar
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="author" content="Tim Henderson">
<style type="text/css">
<!--
bOdy {font-family:arial, helvetica; font-style:normal}
p {font-size:10pt; font-weight:normal; color:#004}
td {font-size:9pt; font-weight:normal; color:#005; padding:8}
h1 {font-size:14pt; font-weight:bold; color:#400}
h3 {font-size:10pt; font-weight:bold; color:#006}
table {border-style:solid; border-color:#000000; border-width:1px}
#search {font-size:9pt; font-weight:normal; color:#030; background:#FFFFFB}
#search a {font-size:9pt; font-weight:normal}
#search th {font-size:10pt; font-weight:bold; color:#FFF; background:#006db2; padding:2}
#copyright {font-size:7pt; color:#006}
-->
</style>
</head>
<bOdy bgcolor="#FFFFFF">
<?
$search_term = $_REQUEST[’search_term’];
function search_dir () {
global $cur_path, $dir_depth, $matches;
if ($matches > 100) { return; }
$s_dir="";
for ($c=0; $c<=$dir_depth; $c++) { $s_dir .= $cur_path[$c]; }
$dhandle=opendir("$s_dir");
while ($file = readdir($dhandle)) {
if (($file!=".") && ($file!="..")) {
if (is_file($s_dir.$file)) {
$file_ext = substr($file, strlen($file)-3, 3);
if ($file_ext == "php") search_file($s_dir.$file);
}
elseif (is_dir($file)) {
$cur_path[++$dir_depth] = ($file."/");
search_dir();
$dir_depth--;
}
}
}
}
function search_file ($file) {
global $cur_path, $dir_depth, $search_term, $results, $r_text, $r_title, $matches;
$s_dir="";
for ($c=0; $c<=$dir_depth; $c++) $s_dir .= $cur_path[$c];
$f_size = filesize($file);
$f_handle = fopen($file, "r");
$f_data = fread($f_handle, $f_size);
if ($text = strstr($f_data, ’SSIGNORE’)) return;
$f_dlc = strtolower($f_data);
$t_text = "";
$in_tag = 0;
if ($text = strstr(strip_tags($f_dlc), $search_term)) {
$results[$matches] = $file;
$text = substr($text, 0, 500);
$text = str_replace ($search_term, "<font color=\\"#FF0000\\"><b>".$search_term. "</b></font>", $text);
$r_text [$matches] = "...". $text. "...";
$t_start = strpos ($f_dlc, "<title>") + 7;
$t_end = strpos ($f_dlc, "</title>");
$r_title[$matches++] = substr($f_data, $t_start, $t_end-$t_start);
}
fclose($f_handle);
}
?>
<center><h1>Ürün Ara</h1><br>
<p>
<table id="layout"><tr valign="top">
<td bgcolor="#FFFFF5">
<h3>Aramak istediğiniz ürünün adını yazarak arayabilirsiniz</h3>
<form action="<? echo $PHP_SELF; ?>" method="post">
<input type="text" name="search_term" size="40" maxlength="40" value="<? echo $search_term ?>">
<input type="submit" value="Search">
</form>
</td></tr></table>
<br>
<table id="search" cellpadding=8 bgcolor="#FFFFEE">
<tr><td align="center" colspan=2>
<h4>Aranan Kelime: <?echo $search_term; ?></h4>
</td></tr>
<tr><th>Sayfa</th><th>Çıkan Sonuçlar</th></tr>
<?
$dir_depth=0;
$matches=0;
$cur_path = array("././");
$results = array("");
$r_text = array("");
$r_title = array("");
$search_term=strtolower($search_term);
if (strcmp($search_term, "")!=0) { search_dir(); }
$c="#FFFFF8";
for ($a=0; $a<$matches; $a++) {
if ($c=="#FFFFF8") {$c="#F8F8F8";} else {$c="#FFFFF8";}
echo "<tr><td align=\\"left\\" bgcolor=\\"$c\\">";
echo "<a href=\\"$results[$a]\\" title=\\"Go To This Page\\">$r_title[$a]</a>";
echo "<br> <code>$results[$a]</code>";
echo "</td><td align=\\"left\\" bgcolor=\\"$c\\">$r_text[$a]</td></tr>";
}
echo "</table><br><p>$matches Matches.<br><br>";
?> - 10-12-2009, 19:44:05Üyeliği durduruldueditmi yapıyorsunuz scriptmi kodluyorsunuz ?
kodluyorsanız afedersınızde neden hep ingilizce kullanıyorsunuz ? bi yerde Çıkan sonuclar yazıyor altta $matchec Matches deniyor.. bi garip ?