Johncms bo'yicha umumiy savollar (3101)
8125
code_one
#2841
User ga bir marta kurinadigan link qanday qilinadi yani


fc-arsenal.u z dagidek regdan utgandan kiyin link beradi
0
Qobilov_Sardor
#2842
Mahmudjon, # Mahmudjon (02.06.2020 / 12:51)
Xikoyalar.r u ni bosh sahifasida chiqib turgan maqolalarda Fikrlar (0) degan joyi bor. Maqoladagi fikrlarni sanaydigan kodni bervorilar, bosh sahifaga chiqargani.
Mysql kodi



Yozilishi
2
Kod · PHP1 qator
$izoh= mysql_result( mysql_query("SELECT COUNT(*) FROM `cms_library_comments` WHERE `sub_id` = '".$row['id']."' "),0);
Kod · PHP1 qator
<a href="?act=comments&amp;id=' . $row['id'] . '">Fikrlar:</a>'.$izoh.'
sobirjonovv
#2843
uzb_master, # uzb_master (02.06.2020 / 18:24)
Mahmudjon, Mysql kodi

$izoh= mysql_result( mysql_query("SELECT COUNT(*) FROM `cms_library_comments` WHERE `sub_id` = '".$row['id']."' "),0);


Yozilishi

<a href="?act=comments&amp;id=' . $row
Kod ishlamadi sardorjon :-(
0
Qobilov_Sardor
#2844
Mahmudjon, # Mahmudjon (02.06.2020 / 19:38)
uzb_master, Kod ishlamadi sardorjon :-(
Mysql koddagi

$izoh= mysql_result( mysql_query("SELECT COUNT(*) FROM `cms_library_comments` WHERE `sub_id` = '".$row['id']."' "),0);

shu qizil joyni sahifayizga moshlab oling
7 daqiqa 58 soniyadan keyin yozdi:
Men tepada yozganim faqat mysql va kodi uni sahifayizga moshlab olasiz
0
7956
@uMansurov
#2845
Mahmudjon, # Mahmudjon (02.06.2020 / 19:38)
uzb_master, Kod ishlamadi sardorjon :-(
row['id'] sizda maqolararni bosh sahifaga chiraqishda maqola nomida qanaqa mysql kod yozilgan masalan < a href="http//maqola.ru/library/index.php?id=1"> . '$row['library_name'] . '</a> shunaqami sizda . '$row['library_name'] . ' örniga nima yozilgan
0
TimX
#2846
Mahmudjon, Mana umumiy kod (namuna: yurakcha.ru):
1
Kod · PHP55 qator
<?php



echo '<div class="phdr"><b>Yangi maqolalar</b></div>';

$kmess = '7';



$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `library_texts` WHERE `time` AND `premod`=1"), 0);

$page = $page >= ceil($total / $kmess) ? ceil($total / $kmess) : $page;

$start = $page == 1 ? 0 : ($page - 1) * $kmess;

$sql = mysql_query("SELECT `id`, `name`, `time`, `uploader`, `uploader_id`, `count_views`, `comments`, `count_comments`, `cat_id`, `announce` FROM `library_texts` WHERE `premod`=1 ORDER BY `time` DESC LIMIT " . $start . "," . $kmess);

$nav = ($total > $kmess) ? '<div class="menu"><center>' . functions::display_pagination('?act=new&amp;', $start, $total, $kmess) . '</center></div>' : '';

if ($total) {

    $i = 0;

    while ($lib = mysql_fetch_assoc($sql)) {

$comm = mysql_result( mysql_query("select count(*)  from `cms_library_comments` where `refid` = '".$lib['id']."'"),0);

echo '<div class="menu"><a href="' . $set['homeurl'] . '/library/index.php?id=' . $lib['id'] . '"><b>' . $lib['name'] . '</b></a> ['. functions::display_date($lib['time']) . ']<br>'.mb_substr($lib['announce'],0,100).'...<br>';

$catalog  = mysql_fetch_assoc(mysql_query("SELECT `id`, `name` FROM `library_cats` WHERE `id` = " . $lib['cat_id'] . " LIMIT 1"));

echo  '[<a href="/library/index.php?do=dir&amp;id=' . $catalog['id'] . '">' . functions::checkout($catalog['name']) . '</a>' . ($page > 1 ? ' | ' . functions::checkout($res['name']) : '') . ']';



echo  '[<a href="/library/index.php?act=comments&amp;id=' . $lib['id'] . '">Fikrlar:</a> (' . $lib['count_comments'] . ')]';

echo '<span style="float:right;"><b>[' . $lib['count_views'] . ']</b></span></div>';



  $i; 

}

}



echo $nav;



?>
sobirjonovv
#2847
Улугбек, # Улугбек (02.06.2020 / 20:50)
Mahmudjon, row['id'] sizda maqolararni bosh sahifaga chiraqishda maqola nomida qanaqa mysql kod yozilgan masalan < a href="http//maqola.ru/library/index.php?id=1"> . '$row['library_name'] . '</a> shun
$row['id'] manda
0
tahrirlandi · лет oldin

#2848
JohnCMS uchun maqolalarga like va dislike bosish kimda bor? Bazaga likelar va dislikelarni sanab yozadigani? Forumdagi ko'pchilikga kerak bo'lsa kerak
1
Akbarali
#2849
Mahmudjon, # Mahmudjon (02.06.2020 / 23:08)
JohnCMS uchun maqolalarga like va dislike bosish kimda bor? Bazaga likelar va dislikelarni sanab yozadigani? Forumdagi ko'pchilikga kerak bo'lsa kerak
Ёзиш осон нарсаку. Алохида базада устун очиб мақола ид рақами бўйича сақлаб кетаверасиз.
0
sobirjonovv
#2850
Akbarali, # Akbarali (03.06.2020 / 16:20)
Mahmudjon, Ёзиш осон нарсаку. Алохида базада устун очиб мақола ид рақами бўйича сақлаб кетаверасиз.
Php, mysqldan uquvim yo'q. Sizga oson bo'lsa yozib tarqating
0

#2851
Maqolaga plus, minus bosish bu arxivni ichida bor edi. 1 oy oldin titkilab ishlatolmagandim. O'sha plus, minusga screen ham bor ekan.

Kimdir ishlatolsa kodni yozinglar :-)
0
Besthakker
#2852
Mahmudjon, # Mahmudjon (03.06.2020 / 16:57)
Maqolaga plus, minus bosish bu arxivni ichida bor edi. 1 oy oldin titkilab ishlatolmagandim. O'sha plus, minusga [url=https://uzfor
Yoqdi Yoqmadini kodini bersak buladimi
0
sobirjonovv
#2853
Besthakker, # Besthakker (03.06.2020 / 17:17)
Mahmudjon, Yoqdi Yoqmadini kodini bersak buladimi
U oddiyku. Uni likebtn.com midiye, shunaqa saytdan yasasa bo'lardi. Man bazaga yozib boradiganini aytvomman.
0
Besthakker
#2854
Mahmudjon, # Mahmudjon (03.06.2020 / 17:23)
Besthakker, U oddiyku. Uni likebtn.com midiye, shunaqa saytdan yasasa bo'lardi. Man bazaga yozib boradiganini aytvomman.
Likebtn dagi yozadimi bazaga
0
sobirjonovv
#2855
Besthakker, # Besthakker (03.06.2020 / 17:24)
Mahmudjon, Likebtn dagi yozadimi bazaga
Yo'q yozmaydi. U likebtn dagi larkdagi saytga xam tushib ketaveradi
0
TimX
#2856
Bir-birilani chunmepslar
1
933
??zokirjon??
#2857
video bolimide videolardi bosh sahifaga qana chiqarsa boladi
0
sobirjonovv
#2858
John cms da downloaddagi top 10 yuklamani bosh sahifaga chiqarish kodi bormi? Bosa yozilar
0
Kamron
#2859



Shunda rasmlarga qanday o'lcham qo'ysa bo'ladi? Width va height qo'yish kerak
0
Kod · PHP695 qator
<?php



/**

 * @package     JohnCMS

 * @link        http://johncms.com

 * @copyright   Copyright (C) 2008-2011 JohnCMS Community

 * @license     LICENSE.txt (see attached file)

 * @version     VERSION.txt (see attached file)

 * @author      http://johncms.com/about

 */



define('_IN_JOHNCMS', 1);



require('../incfiles/core.php');

$headmod = 'gallery';

$lng_gal = core::load_lng('gallery');

$textl = $lng['gallery'];

require('../incfiles/head.php');



// Ограничиваем доступ к Галерее

$error = '';

if (!$set['mod_gal'] && $rights < 7) {

    $error = $lng_gal['gallery_closed'];

} elseif ($set['mod_gal'] == 1 && !$user_id) {

    $error = $lng['access_guest_forbidden'];

}

if ($error) {

    require_once('../incfiles/head.php');

    echo '<div class="rmenu"><p>' . $error . '</p></div>';

    require_once('../incfiles/end.php');

    exit;

}



function setTransparency($new_image, $image_source)

{

    $transparencyIndex = imagecolortransparent($image_source);

    $transparencyColor = array('red' => 255, 'green' => 255, 'blue' => 255);



    if ($transparencyIndex >= 0) {

        $transparencyColor = imagecolorsforindex($image_source, $transparencyIndex);

    }



    $transparencyIndex = imagecolorallocate($new_image, $transparencyColor['red'], $transparencyColor['green'],

        $transparencyColor['blue']);

    imagefill($new_image, 0, 0, $transparencyIndex);

    imagecolortransparent($new_image, $transparencyIndex);

}



$array = array(

    'new',

    'edf',

    'delf',

    'edit',

    'del',

    'load',

    'upl',

    'cral',

    'razd'

);



if (in_array($act, $array) && file_exists($act . '.php')) {

    require_once($act . '.php');

} else {

    if (!$set['mod_gal']) {

        echo '<p><font color="#FF0000"><b>' . $lng_gal['gallery_closed'] . '</b></font></p>';

    }

    if ($id) {

        $type = mysql_query("SELECT * FROM `gallery` WHERE `id` = '$id' LIMIT 1");

        $ms = mysql_fetch_assoc($type);

        switch ($ms['type']) {

            case 'rz':

                /*

                -----------------------------------------------------------------

                Просмотр раздела

                -----------------------------------------------------------------

                */

                echo '<div class="phdr"><i class="fa fa-picture-o" style="color:#ffffff;"></i> <a href="index.php"><b>' . $lng['gallery'] . '</b></a> | ' . $ms['text'] . '</div>';

                $total = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `type` = 'al' AND `refid` = '$id'"),

                    0);

                if ($total) {

                    $req = mysql_query("SELECT * FROM `gallery` WHERE `type` = 'al' AND `refid` = '$id' ORDER BY `time` DESC LIMIT $start, $kmess");

                    while ($res = mysql_fetch_assoc($req)) {

                        echo $i % 2 ? '<div class="list2">' : '<div class="list1">';

                        $total_f = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `type` = 'ft' AND `refid` = '" . $res['id'] . "'"),

                            0);

                        echo '<a href="index.php?id=' . $res['id'] . '">' . $res['text'] . '</a> (' . $total_f . ')</div>';

                        ++$i;

                    }

                } else {

                    echo '<div class="menu"><p>' . $lng['list_empty'] . '</p></div>';

                }

                echo '<div class="phdr"><i class="fa fa-spinner" style="color:#ffffff;"></i> ' . $lng['total'] . ': ' . $total . '</div><p>';

                if ($total > $kmess) {

                    echo '<p>' . functions::display_pagination('index.php?id=' . $id . '&amp;', $start, $total,

                            $kmess) . '</p>' .

                        '<p><form action="index.php?id=' . $id . '" method="post">' .

                        '<input type="text" name="page" size="2"/>' .

                        '<input type="submit" value="' . $lng['to_page'] . ' &gt;&gt;"/>' .

                        '</form></p>';

                }

                if ($rights >= 6) {

echo "<div class='menu'><i class='fa fa-plus-square' style='color:red;'></i> <a href='index.php?act=cral&amp;id=" . $id . "'>" . $lng_gal['create_album'] . "</a><br/>";







echo "<i class='fa fa-trash-o' style='color:red;'></i> <a href='index.php?act=del&amp;id=" . $id . "'>" . $lng_gal['delete_section'] . "</a><br/>";

echo "<i class='fa fa-wrench' style='color:red;'></i> <a href='index.php?act=edit&amp;id=" . $id . "'>" . $lng_gal['edit_section'] . "</a><br/>";

                }

echo "<i class='fa fa-share-square-o' style='color:red;'></i> <a href='index.php'>Galereya</a></p>";

                break;



            case 'al':

                /*

                -----------------------------------------------------------------

                Просмотр альбома

                -----------------------------------------------------------------

                */

                $delimag = opendir("temp");

                while ($imd = readdir($delimag)) {

                    if ($imd != "." && $imd != ".." && $imd != "index.php") {

                        $im[] = $imd;

                    }

                }

                closedir($delimag);

                $totalim = count($im);

                for ($imi = 0; $imi < $totalim; $imi++) {

                    $filtime[$imi] = filemtime("temp/$im[$imi]");

                    $tim = time();

                    $ftime1 = $tim - 10;

                    if ($filtime[$imi] < $ftime1) {

                    }

                }



                $rz = mysql_query("SELECT * FROM `gallery` WHERE type='rz' AND  id='" . $ms['refid'] . "';");

                $rz1 = mysql_fetch_array($rz);

                echo '<div class="phdr"><i class="fa fa-picture-o" style="color:#ffffff;"></i> <a href="index.php"><b>' . $lng['gallery'] . '</b></a> | <a href="index.php?id=' . $ms['refid'] . '">' . $rz1['text'] . '</a> | ' . $ms['text'] . '</div>';

                $total = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `type` = 'ft' AND `refid` = '$id'"),

                    0);

                $req = mysql_query("SELECT * FROM `gallery` WHERE `type` = 'ft' AND `refid` = '$id' ORDER BY `time` DESC LIMIT $start, $kmess");

                while ($fot1 = mysql_fetch_array($req)) {

                    echo $i % 2 ? '<div class="list2">' : '<div class="list1">';

                    if (file_exists('foto/' . $fot1['name'])) {

                        echo '<a href="index.php?id=' . $fot1['id'] . '">';

                        $infile = "foto/$fot1[name]";

                        if (!empty($_SESSION['frazm'])) {

                            $razm = $_SESSION['frazm'];

                        } else {

                            $razm = 100;

                        }

                        $sizs = GetImageSize($infile);

                        $width = $sizs[0];

                        $height = $sizs[1];

                        $quality = 80;

                        $x_ratio = $razm / $width;

                        $y_ratio = $razm / $height;

                        if (($width <= $razm) && ($height <= $razm)) {

                            $tn_width = $width;

                            $tn_height = $height;

                        } else {

                            if (($x_ratio * $height) < $razm) {

                                $tn_height = ceil($x_ratio * $height);

                                $tn_width = $razm;

                            } else {

                                $tn_width = ceil($y_ratio * $width);

                                $tn_height = $razm;

                            }

                        }

                        $format = functions::format($infile);

                        switch ($format) {

                            case "gif":

                                $im = ImageCreateFromGIF($infile);

                                break;



                            case "jpg":

                            case "jpeg":

                                $im = ImageCreateFromJPEG($infile);

                                break;



                            case "png":

                                $im = ImageCreateFromPNG($infile);

                                break;

                        }

                        $im1 = imagecreatetruecolor($tn_width, $tn_height);

                        setTransparency($im1, $im);

                        $namefile = "$fot1[name]";

                        imagecopyresized($im1, $im, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);

                        switch ($format) {

                            case "gif":

                                $imagnam = "temp/$namefile.temp.gif";

                                ImageGif($im1, $imagnam);

                                echo "<img src='" . $imagnam . "' alt=''/><br/>";

                                break;



                            case "jpg":

                            case "jpeg":

                                $imagnam = "temp/$namefile.temp.jpg";

                                imageJpeg($im1, $imagnam, 75);

                                echo "<img src='" . $imagnam . "' alt=''/><br/>";

                                break;



                            case "png":

                                $imagnam = "temp/$namefile.temp.png";

                                imagePng($im1, $imagnam, 5);

                                echo "<img src='" . $imagnam . "' alt=''/><br/>";



                                break;

                        }

                        imagedestroy($im);

                        imagedestroy($im1);

                        $fotsz = filesize("foto/$ms[name]");

                        echo '</a>';

                        if (!empty($fot1['text'])) {

                            echo "$fot1[text]<br/>";

                        }

                        if ($rights >= 6) {

echo "<a href='index.php?act=edf&amp;id=" . $fot1['id'] . "'>" . $lng['edit'] . "</a> | <a href='index.php?act=delf&amp;id=" . $fot1['id'] . "'>" . $lng['delete'] . "</a><br/>";

                        }

                    } else {

                        echo $lng_gal['image_missing'] . '<br /><a href="index.php?act=delf&amp;id=' . $fot1['id'] . '">' . $lng['delete'] . '</a>';

                    }

                    echo "</div>";

                    ++$i;

                }

echo '<div class="phdr"><i class="fa fa-spinner" style="color:#ffffff;"></i> ' . $lng['total'] . ': ' . $total . '</div><p>';

                if ($total > $kmess) {

                    echo '<p>' . functions::display_pagination('index.php?id=' . $id . '&amp;', $start, $total,

                            $kmess) . '</p>' .

                        '<p><form action="index.php?id=' . $id . '" method="post">' .

                        '<input type="text" name="page" size="2"/>' .

                        '<input type="submit" value="' . $lng['to_page'] . ' &gt;&gt;"/>' .

                        '</form></p>';

                }

                if (($user_id && $rz1['user'] == 1 && $ms['text'] == $login && !$ban['1'] && !$ban['14']) || $rights >= 6) {

echo '<div class="menu"><i class="fa fa-download" style="color:red;"></i> <a href="index.php?act=upl&amp;id=' . $id . '">' . $lng_gal['upload_photo'] . '</a><br/>';

                }

                if ($rights >= 6) {

echo "<i class='fa fa-trash' style='color:red;'></i> <a href='index.php?act=del&amp;id=" . $id . "'>" . $lng_gal['delete_album'] . "</a><br/>";

echo "<i class='fa fa-pencil' style='color:red;'></i> <a href='index.php?act=edit&amp;id=" . $id . "'>" . $lng_gal['edit_album'] . "</a><br/>";

                }

echo "<i class='fa fa-share-square-o' style='color:red;'></i> <a href='index.php'>" . $lng_gal['to_gallery'] . "</a></p>";

                break;



            case 'ft':

                /*

                -----------------------------------------------------------------

                Просмотр фото

                -----------------------------------------------------------------

                */

                echo "<br/>&#160;";

                $infile = "foto/$ms[name]";

                if (!empty($_SESSION['frazm'])) {

                    $razm = $_SESSION['frazm'];

                } else {

                    $razm = 50;

                }

                $sizs = GetImageSize($infile);

                $width = $sizs[0];

                $height = $sizs[1];

                $format = functions::format($infile);

                switch ($format) {

                    case "gif":

                        $im = ImageCreateFromGIF($infile);

                        break;



                    case "jpg":

                        $im = ImageCreateFromJPEG($infile);

                        break;



                    case "jpeg":

                        $im = ImageCreateFromJPEG($infile);

                        break;



                    case "png":

                        $im = ImageCreateFromPNG($infile);

                        break;

                }

                $im1 = imagecreatetruecolor($width, $height);

                setTransparency($im1, $im);

                $namefile = "$ms[name]";

                imagecopy($im1, $im, 0, 0, 0, 0, $width, $height);

                switch ($format) {

                    case "gif":

                        $imagnam = "temp/$namefile.gif";

                        imagegif($im1, $imagnam);

                        echo "<img src='" . $imagnam . "' alt=''/><br/>";

                        break;



                    case "jpg":

                    case "jpeg":

                        $imagnam = "temp/$namefile.jpg";

                        imagejpeg($im1, $imagnam, 75);

                        echo "<img src='" . $imagnam . "' alt=''/><br/>";

                        break;



                    case "png":

                        $imagnam = "temp/$namefile.png";

                        imagePng($im1, $imagnam, 5);

                        echo "<img src='" . $imagnam . "' alt=''/><br/>";



                        break;

                }

                imagedestroy($im);

                imagedestroy($im1);

                $fotsz = filesize("foto/$ms[name]");

                $fotsz = round($fotsz / 1024, 2);

                $sizs = GetImageSize("foto/$ms[name]");

                $fwidth = $sizs[0];

                $fheight = $sizs[1];

                echo "<p>" . $lng['description'] . ": $ms[text]<br/>";

                echo $lng_gal['dimensions'] . ": $fwidth*$fheight пкс.<br/>";

                echo $lng_gal['weight'] . ": $fotsz кб.<br/>";

                echo $lng['date'] . ': ' . functions::display_date($ms['time']) . '<br/>';

                echo $lng_gal['posted_by'] . ": $ms[avtor]<br/>";

                echo "<a href='foto/$ms[name]'>" . $lng['download'] . "</a><br /><br />";

                echo "<a href='index.php?id=" . $ms['refid'] . "'>" . $lng['back'] . "</a><br/>";

                echo "<a href='index.php'>" . $lng_gal['to_gallery'] . "</a></p>";

                break;

            default :

                header("location: index.php");

                break;

        }

    } else {

        /*

        -----------------------------------------------------------------

        Главная страница Галлереи

        -----------------------------------------------------------------

        */

echo '<p><a href="index.php?act=new">' . $lng_gal['new_photo'] . '</a> (' . counters::gallery(1) . ')</p>';

echo '<div class="phdr"><i class="fa fa-image" style="color:#ffffff;"></i> <b>' . $lng['gallery'] . '</b></div>';

        $req = mysql_query("SELECT * FROM `gallery` WHERE `type` = 'rz'");

        $total = mysql_num_rows($req);

        while ($res = mysql_fetch_assoc($req)) {

            echo $i % 2 ? '<div class="list2">' : '<div class="list1">';

            $al = mysql_query("SELECT * FROM `gallery` WHERE type='al' AND  refid='" . $res['id'] . "'");

            $countal = mysql_num_rows($al);

            echo '<a href="index.php?id=' . $res['id'] . '">' . $res['text'] . '</a> (' . $countal . ')</div>';

            ++$i;

        }

        echo '<div class="phdr"><i class="fa fa-spinner" style="color:#ffffff;"></i> ' . $lng['total'] . ': ' . $total . '</div><p>';

        if ($rights >= 6) {

echo "<div class='menu'><i class='fa fa-plus-square' style='color:red;'></i> <a href='index.php?act=razd'>" . $lng_gal['create_section'] . "</a><br/>";

        }

        echo "</p>";

    }

}



require('../incfiles/end.php');

?>
TimX
#2860
Kamron, 246-strogadan keyingi kodlarni qo'ysangiz shuni o'zi yetarli bo'lardi tushunish uchun. Bu yerda yozgan kodlarizdan 1ta sayt qurib olsa bo'ladiku :sweet_smile:
0