نمایش نتایج 1 تا 5 از 5

نام تاپیک: مشل کد حستحو در سایت

  1. #1
    کاربر دائمی آواتار soroush.r70
    تاریخ عضویت
    فروردین 1389
    محل زندگی
    مازندران - آمل
    پست
    1,157

    مشل کد حستحو در سایت

    در قسمت جستجوی سایت من بعضی از کلمات رو جستجو می کنه و بعضی رو جستجو نمی کنه به طور مثال وقتی می نویسم قالیشویی مونا تو نتیجه نمایش نمی ده وقتی می نویسم مونا نشون می ده یا وقتی می نویسم قالیشویی بازم نشون کلیه قالیشویی ها رو نشون نمی ده

    اینم بخشی از توابع و ساختار کد من :

    function DRAW_SEARCH($DIR){

    if(!$S_R_S = $GLOBALS['S_R_S']){
    POST_TEXT($DIR);
    return false;
    }

    $id = $DIR['id'];
    if(!$tab__func_data=tab__func_data($id))return false;
    $tr = $tab__func_data['tr'];
    $td = $tab__func_data['td'];
    $pub_height = $tab__func_data['pub_height'];
    $pub_title_len = $tab__func_data['pub_title_len'];
    $pub_text_len = $tab__func_data['pub_text_len'];
    $pay_type = $tab__func_data['pay_type'];

    $Path = _URL.'/themes/'._THEME.'/search/'.$DIR['pos'].'_';

    ?>

    <table dir="<?=_DIR ?>" class="POST_SEARCH_MAIN_TAB" width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
    <tr class="POST_SEARCH_MAIN_TAB_TITLE">
    <td colspan="3">
    <table dir="ltr" cellpadding="0" cellspacing="0" width="100%" height="19" class="POST_SEARCH_MAIN_TAB_TITLE">
    <tr>
    <td width="<?=IMGSIZE($Path.'top_left.jpg','w') ?>px" height="<?=IMGSIZE($Path.'top_left.jpg','h') ?>px"><img src="<?=$Path ?>top_left.jpg" width="<?=IMGSIZE($Path.'top_left.jpg','w') ?>px" height="<?=IMGSIZE($Path.'top_left.jpg','h') ?>px"></td>
    <td width="100%" background="<?=$Path ?>top_center.jpg"><?=$DIR['title'] ?></td>
    <td width="<?=IMGSIZE($Path.'top_right.jpg','w') ?>px" height="<?=IMGSIZE($Path.'top_right.jpg','h') ?>px"><img src="<?=$Path ?>top_right.jpg" width="<?=IMGSIZE($Path.'top_right.jpg','w') ?>px" height="<?=IMGSIZE($Path.'top_right.jpg','h') ?>px"></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td width="1" class="POST_SEARCH_PARTITION_LINE" rowspan="7"></td>
    <td></td>
    <td width="1" class="POST_SEARCH_PARTITION_LINE" rowspan="7"></td>
    </tr>
    <tr class="POST_SEARCH_MAIN_TR"><td class="POST_SEARCH_MAIN_TD"><img src="s" width="1" height="8"></td></tr>
    <tr class="POST_SEARCH_MAIN_TR"><td class="POST_SEARCH_MAIN_TD"><img src="s" width="1" height="3"></td></tr>
    <tr><td>
    <table width="100%" cellpadding="0" cellspacing="0" border="0" >
    <?
    $x=0;
    foreach($S_R_S as $id => $S_R){
    $ROW[$x]['id'] = $id;
    $ROW[$x]['S_R'] = $S_R;
    $x++;
    }
    for($i=0; $i<$tr; $i++){
    echo "<tr height=".$pub_height.">";
    $stt = GTPT('sPAG')*$tr*$td;
    for($j=$stt; $j<$td+$stt; $j++){
    if(! $tab__pub = tab__pub($ROW[$i*$td+$j]['id'])){
    if($j==$td-1)echo "<td></td>";
    $i=$tr;
    $j=$td+$stt;
    continue;
    }
    echo "<td width='".round(100/$td)."%' >";
    DESCRIBE_SEARCH_RESULT($DIR, $ROW[$i*$td+$j]['id'], $ROW[$i*$td+$j]['S_R']/*text+title*/ );
    echo "</td>";
    }
    echo "</tr>";
    }
    ?>
    </table>
    </td></tr>

    <tr class="POST_SEARCH_MAIN_TR"><td class="POST_SEARCH_MAIN_TD"><img src="s" width="1" height="10"></td></tr>
    <tr class="POST_SEARCH_MAIN_TR"><td class="POST_SEARCH_MAIN_TD" background="<? echo $Path ?>down_center.jpg"><img src="s" width="1" height="1"></td></tr>
    <tr height="1"><td class="POST_SEARCH_MAIN_SEARCHBAR"><center><?

    if(sizeof($ROW)>$tr*$td){

    $sizeof_ROW = sizeof($ROW);

    if($sizeof_ROW%($tr*$td))$sizeof_ROW+=$tr*$td;

    for($i=0; $i<=$sizeof_ROW; $i+=$tr*$td, $P++)
    if(!$_GET['sPAG']&&$P==1)echo "1 ";
    else if($_GET['sPAG']==$P-1)echo $P;
    else echo "<a href='"._URL."/index.php?DPT=S1&SRCH=".GTPT('SRCH')."&sPAG=".($P-1)."'> ".$P." </a>";

    }

    ?></center></td></tr>

    <tr class="POST_SEARCH_MAIN_TR">
    <td class="POST_SEARCH_MAIN_TD" colspan="3">
    <table dir="ltr" cellpadding="0" cellspacing="0" class="POST_SEARCH_MAIN_TAB" width="100%" height="8">
    <tr>
    <td width="<?=IMGSIZE($Path.'down_left.jpg','w') ?>px"><img src="<? echo $Path ?>down_left.jpg" height="<?=IMGSIZE($Path.'down_left.jpg','h') ?>px"></td>
    <td width="100%" background="<? echo $Path ?>down_center.jpg" ></td>
    <td width="<?=IMGSIZE($Path.'down_right.jpg','w') ?>px"><img src="<? echo $Path ?>down_right.jpg" height="<?=IMGSIZE($Path.'down_right.jpg','h') ?>px"></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr height="100%"><td colspan="3">&nbsp;</td></tr>
    </table>
    <br>
    <?
    return true;
    }










    //************************************************** ***************************____________________cle anSRCHES
    function cleanSRCHES($SRCHES,&$validExplode){

    $SRCHES=str_replace(' ',' ',$SRCHES); // for clean search url

    $SRCHES=stripcslashes($SRCHES);
    if( (substr($SRCHES,0,1)=='"') and (substr($SRCHES,strlen($SRCHES)-1,1)=='"') ){
    $validExplode=false;
    return substr($SRCHES,1,strlen($SRCHES)-2);
    } else {
    $validExplode=true;
    }
    $SRCHES=str_replace(
    array(
    ' در '
    ,' با '
    ,' از '
    ,' و '
    ,' که '
    ,' رو '
    ,' يا '
    ,' براي '
    ,' مثل '
    ,' حد '
    ,'ـ'
    ,'های '
    ,' in '
    ,' out '
    ,' for '
    ,' and '
    ,' the '
    ,' of '
    ,' from '
    )
    ,' '
    ," $SRCHES "
    );
    $tmp=explode(' ',$SRCHES);
    for($i=0; $i<sizeof($tmp); $i++){
    $tmp[$i]=trim($tmp[$i]);
    if(strlen($tmp[$i])>2){
    $tmp2[]=$tmp[$i];
    }
    }
    if(sizeof($tmp2)){
    $SRCHES=implode(' ',$tmp2);
    return trim($SRCHES);
    } else {
    return false;
    }
    }





    //************************************************** ***************************____________________SEA RCH
    function SEARCH($SRCHES='', $gid='', $pos=''){

    $_SESSION['SRCHES'] = $SRCHES;

    $validExplode = true;
    $SRCHES=FILTER_WORD($SRCHES,$validExplode);

    $SRCHES=FILTER_WORD($SRCHES);

    if(empty($SRCHES))return false;

    if($klID=$_SESSION['klID']){ // calling up a keyLog
    if(!$resS0 = @ mysql_query(" select `key` from `keyLog` where `id`='$klID' limit 1 ")){
    ;//
    } else {
    $SRCHES=mysql_result($resS0,0,0);
    $_GET['SRCH']=$SRCHES;
    }
    $_SESSION['klID']=NULL;
    } else if(!$reskl=mysql_query(" select `id` from `keyLog` where `key`='$SRCHES' limit 1 ")){ // search summary
    ;//
    } else {
    $ip=$_SERVER['REMOTE_ADDR'];
    if(mysql_num_rows($reskl)==0){
    mysql_query(" insert into `keyLog` (`key`,`rep`,`ip`) values ('$SRCHES','1','$ip') ");
    } else {
    $reckl=mysql_fetch_array($reskl);
    if(!mysql_query(" update `keyLog` set `rep`=`rep`+1 where `id`='".$reckl['id']."' limit 1 ")){
    echo "err01";
    } else {
    ;//
    }
    }
    }

    /*******************************\
    | |
    | |
    | |
    | FETCH.FROM.MySQL |
    | |
    | |
    | |
    \*******************************/

    if(strstr($SRCHES,"ي")){
    $SRCHES.= " ".str_replace("ي","ی",$SRCHES);
    }
    if(strstr($SRCHES,"ی")){
    $SRCHES.= " ".str_replace("ی","ي",$SRCHES);
    }

    echo $SRCHES;

    $SRCHES = str_replace( '+', ' ', $SRCHES);
    if($validExplode==true){
    $SRCHES = explode(' ',$SRCHES);
    } else {
    $tmp[0] = trim($SRCHES);
    $SRCHES=$tmp;
    }

    $GRADE_TTL = array();
    $GRADE_TXT = array();
    if(! $db = db_connect() ){echo "Error in MySQL connection";return false;}
    $QUERY = " SELECT * FROM pub WHERE 1 AND active<>0 ";
    ///???????S1S2S3S4S5S6
    if($gid) $QUERY .= " AND ( sgid='$gid' OR mgid='$gid' ) ";
    if($pos) $QUERY .= " AND pos=(select `city` from `city` where `id`='$pos' limit 1 ) ";
    $QUERY .= " AND ( 1 ";
    for($i=0; $i<sizeof($SRCHES); $i++){
    if($SRCHES[$i]!=''){
    $QUERY .= " AND ( 0
    OR text LIKE '% ".$SRCHES[$i]." %'
    OR text LIKE '".$SRCHES[$i]." %'
    OR text LIKE '% ".$SRCHES[$i]."'
    OR title LIKE '% ".$SRCHES[$i]." %'
    OR title LIKE '".$SRCHES[$i]." %'
    OR title LIKE '% ".$SRCHES[$i]."' )
    ";
    }
    }
    $QUERY .= " ) ";
    $QUERY.= " UNION ".str_replace(" AND ( 0 ", " OR ( 0 ", $QUERY);
    # $QUERY .= " ORDER BY star DESC ,rand() ";
    $QUERY .= " LIMIT 100 ";

    if(! $result = mysql_query( $QUERY ) )
    { echo "<center class=ER1 >Error in progress</center>"; return false; }

    for($i=0; $i<mysql_num_rows($result); $i++)
    $RES[$i]=mysql_fetch_array($result);

    //===========================================

    /*******************************\
    | |
    | |
    | |
    | OPTIMIZE.SEARCH.RESULT |
    | |
    | |
    | |
    \*******************************/
    if($RES){
    foreach($RES as $k => $record){
    $recordtext=$record['text'].' '.$record['title'];
    for($i=0; $i<sizeof($SRCHES); $i++){
    $recordtext=str_replace($SRCHES[$i],$SRCHES[0],$recordtext);
    }
    $sizeofrecordtext[$record['id']]=sizeof(explode($SRCHES[0],$recordtext));
    }
    $x=0;
    foreach($RES as $k => $record){
    foreach($sizeofrecordtext as $k2 => $r2)
    if($r2>$sizeofrecordtext[$maxRecordID])
    $maxRecordID=$k2;

    $OP_RES[$x++]=tab__pub($maxRecordID);

    $sizeofrecordtext[$maxRecordID]=0;
    $maxRecordID=0;
    }
    }
    //===========================================

    /*******************************\
    | |
    | |
    | |
    | DROP.OUT.RESULT |
    | |
    | |
    | |
    \*******************************/

    if($OP_RES)
    foreach($OP_RES as $k => $r){
    $SRCcorrectRESULT=false;
    for($i=0; $i<sizeof($SRCHES); $i++){
    if($SRCHES[$i]){
    if( (stristr($OP_RES[$k]['text'],$SRCHES[$i]))
    or (stristr($OP_RES[$k]['title'],$SRCHES[$i])) ){ // edited on 2007.12.24
    $SRCcorrectRESULT=true;
    }
    }
    $OP_RES[$k]['text'] = str_replace($SRCHES[$i],"<b style=color:red >".$SRCHES[$i]."</b>",$OP_RES[$k]['text']);
    $OP_RES[$k]['title']= str_replace($SRCHES[$i],"<b style=color:red >".$SRCHES[$i]."</b>",$OP_RES[$k]['title']);
    }

    if($SRCcorrectRESULT){
    $DRP_S_R[$OP_RES[$k]['id']]['text'] = $OP_RES[$k]['text'];
    $DRP_S_R[$OP_RES[$k]['id']]['title'] = $OP_RES[$k]['title'];
    }
    }
    //===========================================

    return $DRP_S_R;
    }









    //************************************************** ***************************____________________DES CRIBE_SEARCH_RESULT
    function DESCRIBE_SEARCH_RESULT($DIR,$id, $S_R/*text+title*/){

    if(!$tab__pub = tab__pub($id))return false;

    if(! $tab__func_data = tab__func_data($DIR['id']))return false;
    $pub_height = $tab__func_data['pub_height'];
    $pub_title_len = $tab__func_data['pub_title_len'];
    $pub_text_len = $tab__func_data['pub_text_len'];
    $pay_type = $tab__func_data['pay_type'];
    $tab__users = tab__users($tab__pub['email']);



    switch($_SESSION['LANG']){

    case 'persian' :
    $SEARCH_TIME=substr(U2Vaght($tab__pub['st_date']),5,5);
    break;

    DEFAULT :
    $SEARCH_TIME=substr(U2Time($tab__pub['st_date']),5,5);
    break;
    }


    ?>

    <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0" class="DIST"
    title="<?=SUB_STRING($tab__pub['text'], 0, $pub_title_len) ?>" >

    <tr>
    <td style="width:<?=$pub_height ?>px" align="center"><img src="s.gif" height="5" width="1"></td>
    <td><img src="s.gif" height="10" width="1"></td>
    </tr>
    <tr>
    <td style="width:<?=$pub_height ?>px" align="center"><?=$SEARCH_TIME ?></td>
    <td class="DIST15"><a href="<?=_URL?>/MGID_<?=$tab__pub['mgid']?>/SGID_<?=$tab__pub['sgid']?>/<?=$id?>-<?=urlencode($tab__pub['title'])?>.html"><? echo SUB_STRING($S_R['title'], 0, $pub_title_len+15) ?></a></td>
    </tr>
    <tr>
    <th><a href="<?=_URL?>/MGID_<?=$tab__pub['mgid']?>/SGID_<?=$tab__pub['sgid']?>/<?=$id?>-<?=urlencode($tab__pub['title'])?>.html"><img border="0" src="<? echo FIND_MY_PHOTO($id) ?>" height="<? echo ($pub_height*0.5) ?>"></a></th>
    <td class="DIST60"><span class="SEARCH_TAB"><br><?=SUB_STRING($S_R['text']/*.$tab__pub['text']*/, 0,$pub_text_len+10) ?></span></td>
    </tr>

    <tr><td></td><td height="5"></td></tr>

    <tr><td></td>
    <td dir=<?=_DIR ?> class="POST_SEARCH_PROP" class="DIST15">
    <?
    if($tab__users['name']) echo $tab__users['name'];
    if($tab__pub['pos']) echo "، ".$tab__pub['pos'];
    if($tab__pub['phone']) echo "، ".__I__SEARCH___01." : ".$tab__pub['phone'];
    ?>
    </td>
    </tr>

    <tr><td></td><td height="5"></td></tr>

    <tr><th colspan="2">
    <table class="POST_SEARCH_DISTANCE_LINE" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>
    </th></tr>
    </table>





    <?

    }
    ?>

  2. #2
    کاربر دائمی آواتار p30online
    تاریخ عضویت
    فروردین 1392
    محل زندگی
    ایــــــــــــــــران
    پست
    509

    نقل قول: مشل کد حستحو در سایت

    صفحه ام شلوغه نمیتونم تست کنم ببین این خوبه مشاهده

  3. #3
    کاربر دائمی آواتار marys_farahani
    تاریخ عضویت
    آبان 1392
    محل زندگی
    تهران
    پست
    158

    نقل قول: مشل کد حستحو در سایت

    من کل کدهای شما رو نگاه نکردم دوست عزیز فقط کوئری تون سرچ کردم این دیدم


    " select `id` from `keyLog` where `key`='$SRCHES' limit 1 "



    باید این شکلی باشه

    summery LIKE '%",_summery,"%' 


    اول از همه کوئری سرچتون مشکل داره

    یک نکته دیگه ایی هم که وجود داره شما باید کلماتی که برای سرچ وارد میشه رو به تفکیک کلمه سرچ کنید مثلا اگه عبارت این عبارت رو جستجو کن کاربرتون سرچ کرد شما باید به ازاری هر کلمه جستجو کنید. به نظر من قاعدش اینطوریه.

  4. #4
    کاربر دائمی آواتار soroush.r70
    تاریخ عضویت
    فروردین 1389
    محل زندگی
    مازندران - آمل
    پست
    1,157

    نقل قول: مشل کد حستحو در سایت

    به نظر شما چطور می تون این کد بهینه تر کنم و چیزهای اضافه رو حذف کنم و کد رو بهتر کنم شما می تونید یه کد بهینه از کدهای بالا بسازید...؟

  5. #5
    کاربر دائمی آواتار soroush.r70
    تاریخ عضویت
    فروردین 1389
    محل زندگی
    مازندران - آمل
    پست
    1,157

    نقل قول: مشل کد حستحو در سایت

    کسی نمی دونه مشکل کجاست خیلی عجیبه...؟

تاپیک های مشابه

  1. بهترین FIREWALL که تا حالا دیدید سایت داره بشه Download کرد؟
    نوشته شده توسط khonasham در بخش امنیت در شبکه
    پاسخ: 2
    آخرین پست: دوشنبه 20 آذر 1391, 22:41 عصر
  2. شمارنده کل افراد ورودی به سایت
    نوشته شده توسط lili55 در بخش VB.NET
    پاسخ: 3
    آخرین پست: یک شنبه 31 فروردین 1382, 12:37 عصر
  3. اشکالات سایت !!!
    نوشته شده توسط در بخش گفتگو با مسئولین سایت، درخواست و پیشنهاد
    پاسخ: 6
    آخرین پست: یک شنبه 17 فروردین 1382, 11:56 صبح
  4. مشکل ارسال ایمیل در سایت
    نوشته شده توسط mahmoodreza در بخش گفتگو با مسئولین سایت، درخواست و پیشنهاد
    پاسخ: 2
    آخرین پست: شنبه 16 فروردین 1382, 14:24 عصر
  5. روشی برای تقویت کاربری و جستجو در سایت
    نوشته شده توسط RezaBS در بخش گفتگو با مسئولین سایت، درخواست و پیشنهاد
    پاسخ: 0
    آخرین پست: شنبه 02 فروردین 1382, 14:26 عصر

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •