Server 400 bad request(yomon xatolik)

0 ovoz
23 marta ko‘rilgan
so‘radi 6 kun avval parmonov98 (878 bal)
tahrirlandi 5 kun avval Saidolim

#savol  so'rovdan shunday javob qaytmoqda /ajax/search.php?query=matn Failed to load resource: the server responded with a status of 400 ()
js da. Apache.
 

RewriteEngine On
AddDefaultCharset utf-8
ErrorDocument 404 https://www.domain.uz/uz/page/404/
#<FilesMatch "robots.txt$">
#RewriteEngine off
#</FilesMatch>

#First rewrite any request to the wrong domain to use the correct one (here www.)
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^ajax/search.php
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=302]

php_flag  display_errors        off

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ /?mainurl=$1 [QSA,L]

yana nimadan bo'lishi mumkin? 

izoh qoldirdi 5 kun avval MasterC (1 ball)
ko‘chirildi 5 kun avval Saidolim

Bu apache dan emas siz ishlatayotgan frameworkdan bo'lishi mumkin, /ajax/search.php?query=matn controller ini ko'rsata olasizmi?

izoh qoldirdi 2 kun avval parmonov98 (878 bal)
<?php

require_once "connection.php";


if(isset($_GET['query'])){
    $search = new search();
   

    $string = is_string($_GET['query'])?$_GET['query']:false;
    $result = $search->search_posts('uz', $string);

   

    $matchpost[][] = 0;

    for($i = 0; $i < count($result); $i++){
    $matchpost[$i][]++;
    if(isset($result[$i][1])){
        unset($result[$i]);
    }

    echo "<div class='flex flex-space middle search-item' style='* {padding: 5px;}'>";     
    echo '<i class="fa fa-newspaper-o" title="maqola" aria-hidden="true"></i>';
    echo "<img class='result-img' src='https://www.domain.uz/open/imgs/".$result[$i]['post_img']."' width='25' height='25'>";   
    echo "<p> <author>".$result[$i]['post_author'].": </author><a href='https://www.domain.uz/uz/post/".$result[$i]['post_link'].".py'>" .$result[$i]['post_title']." </a></p>";
    echo "</div>";   
    }

   
   
}else{
   
    echo 2;

}


class search{
    private $conn;

     function __construct(){
       
        $this->conn = new connection();
       
     }
     

     
     function explode_string($str){
         return $result = explode(' ',  $str);
         
     }
     // searching posts by keywords LIKE searchingg
     function search_posts(string $lang = 'uz', string $items){
         $items = $this->explode_string($items);
         
         $subquery = "";
                for($i = 0; $i < count($items); $i++){
                    $subquery .= "pt.post_tags LIKE "."'%".$items[$i]."% ' OR ";
                    if(isset($items['keywords'][$i+1]))
                        $subquery .= "pt.post_tags LIKE "."'%".$items[$i].$items[$i+1]."% ' OR ";
                    $subquery .= "pt.post_description LIKE "."'%".$items[$i]."%' OR ";
                    if(isset($items[$i+1]))
                        $subquery .= "pt.post_description LIKE "."'%".$items[$i].$items[$i+1]."%' OR ";
                   
                    $subquery .= "pt.post_title LIKE "."'%".$items[$i]."%' OR ";
                    if(isset($items['keywords'][$i+1]))
                        $subquery .= "pt.post_title LIKE "."'%".$items[$i].$items[$i+1]."%' OR ";
                }
                $subquery = rtrim($subquery, ' OR ');
                #$subquery .= ")";
                $lang = 'uz';
                "SELECT distinct ct.id, ct.cat_title, ct.cat_link, pt.id,
                       pt.post_title, pt.post_link, pt.post_author, pt.post_img, pt.post_date, pt.post_cat_id
                FROM `cates_of_site` as ct, en_posts_of_site as pt
                WHERE (
                  pt.post_tags LIKE '%hello%' OR
                  pt.post_tags LIKE '%hi%' OR
                  pt.post_description LIKE '%hello%' OR
                  pt.post_description LIKE '%hi%'
                ) AND ct.id = pt.post_cat_id
                ";


                $sql = "SELECT distinct ct.id,  ct.cat_link, pt.id,
                 pt.post_title,    pt.post_link, pt.post_author, pt.post_img,pt.post_date, pt.post_cat_id
                FROM `cates_of_site` as ct, `".$lang."_posts_of_site` as pt,
                `".$lang."_cat_info` as lng_ct, `".$lang."_subcates_of_site` as sub_ct
                WHERE sub_ct.subcat_id = pt.post_cat_id AND ct.id = sub_ct.parent_id AND  (".$subquery.")     ";
               
                "
                SELECT distinct ct.id, ct.cat_link, pt.id, pt.post_title, pt.post_link, pt.post_author,
                pt.post_img,pt.post_date, pt.post_cat_id FROM `cates_of_site` as ct,
                `uz_subcates_of_site` as sub_ct, `uz_posts_of_site` as pt, `uz_cat_info` as lng_ct
                WHERE sub_ct.subcat_id = pt.post_cat_id AND ct.id = sub_ct.parent_id AND
                (pt.post_tags LIKE '%ht% ' OR pt.post_description LIKE '%ht%' OR pt.post_title LIKE '%ht%')
                ";
               
               
            return $this->conn->select($sql);
     }
     
}

?>

Iltimos, saytga kiring yoki ro‘yxatdan o‘ting va shunda ushbu savolga javob berishingiz mumkin bo‘ladi.

Assalomu alaykum, yordam.uz saytimizga xush kelibsiz.

Bu saytda o`zingizni qiziqtirgan savollarga javob olishingiz va o`z sohangiz bo`yicha savollarga javob berishingiz mumkin.

Bizning Oilamizga a'zo bo`lganingiz uchun chuqur Minnatdorchilik bildiramiz !!!

Telegram kanal YordamUzRss

...