1. PHP / Говнокод #19073

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    <title>Обработчик</title>
    <?php     
    
    include ("blocks/bd.php");
        if (isset($_POST['name'])) { $name = $_POST['name']; if ($name == '') { unset($name);} }
        if (isset($_POST['dolzhnost'])) { $dolzhnost = $_POST['dolzhnost']; if ($dolzhnost == '') { unset($dolzhnost);} }
        if (isset($_POST['email'])) { $email = $_POST['email']; if ($email == '') { unset($email);} }
        if (isset($_POST['website'])) { $website = $_POST['website']; if ($website == '') { unset($website);} }
        if (isset($_POST['stazh'])) { $stazh = $_POST['stazh']; if ($stazh == '') { unset($stazh);} }
        if (isset($_POST['obrazovanie'])) { $obrazovanie = $_POST['obrazovanie']; if ($obrazovanie == '') { unset($obrazovanie);} }
        if (isset($_POST['kategoria'])) { $kategoria = $_POST['kategoria']; if ($kategoria == '') { unset($kategoria);} }
        if (isset($_POST['cat'])) { $cat = $_POST['cat']; if ($cat == '') { unset($cat);} }
    	if (isset($_POST['id']))        {$id = $_POST['id'];}
    
    if (isset($name) && isset($dolzhnost) && isset($email) && isset($website) && isset($stazh) && isset($obrazovanie) && isset($kategoria) && isset($cat))
    {
    $result = mysql_query ("UPDATE personal SET name='$name', dolzhnost='$dolzhnost', email='$email', website='$website', stazh='$stazh', obrazovanie='$obrazovanie', kategoria='$kategoria', cat='$cat' WHERE id='$id'");
    
    if ($result == 'true') {echo ("<p>Успешно изменено! <a href='edit_personal.php'>Назад...</a></p>");} 
    
    
    else {
      echo ("<p>Не изменено!</p>");} 
    }
    else
    {
     echo ("<p>Вы заполнили не все поля! </p>");			
    }
    
    	?>

    Адепты пРуссакова(Жопов number 2) http://vk.com/sitemyrusakov?w=wall-25691304_1204%2Fall

    Keeper, 24 Ноября 2015

    Комментарии (6)
  2. Куча / Говнокод #19072

    +5

    1. 1
    2. 2
    WCT воскрес.
    http://habrahabr.ru/post/271519/

    Abbath, 24 Ноября 2015

    Комментарии (47)
  3. PHP / Говнокод #19071

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    <?php
            $gudir = opendir("../text/$book");
            $guarray = Array();
            while(false != ($gufile = readdir($gudir)))
            {
                    if(strstr($gufile, "gu@"))
                    {
                            $guarray[count($guarray)] = $gufile;
                    }
            }
            closedir($gudir);
            if(count($guarray))
            {
                    rsort($guarray);
                    foreach($guarray as $gucomment)
                    {
                            /*Здесь движок отображения комментариев*/
                            include "../text/$book/$gucomment";
                    }
            }
    ?>

    Я не знаю, что делает этот код. Никаких файлов с символами gu@ в каталогах не осталось. Лет 8 назад с другом книгу писали, решили замутить сайт. Ту книгу мы потом посчитали фигней и забросили. Про БД я тогда и не подозревал. Все хранилось в таких файлах:

    chapter#prae#prae#Предисловие#previous#0 #0#next#1#1
    chapter#1#1#Глава 1.1#previous#prae#prae#next#1#2
    chapter#1#2#Глава 1.2#previous#1#1#next#0#0

    kgm-rj, 23 Ноября 2015

    Комментарии (13)
  4. JavaScript / Говнокод #19070

    +3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    function getNameBrouser()
    {
    	ua = navigator.userAgent.toLowerCase();
    	//Internet Explorer
    	if (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1 && ua.indexOf("webtv") == -1)
    	{
    		return 1;//"msie";;
    	}
    	// Opera
    	if (ua.indexOf("opera") != -1)
    	{
    		return 2;//"opera";
    	}
    	// Mozilla + Firefox + Netscape
    	if (ua.indexOf("mfn") != -1)
    	{
    		return 3;//"mfn";
    	}
    	// Safari
    	if (ua.indexOf("safari") != -1)
    	{
    		return 4;//"safari";
    	}
    	// Konqueror
    	if (ua.indexOf("konqueror") != -1)
    	{
    		return 5;//"konqueror";
    	}
    	return 6;//"unknown";
    }

    Студенческие сайтики.

    nihau, 23 Ноября 2015

    Комментарии (4)
  5. PHP / Говнокод #19069

    +3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    public function calculateSum($products) {
            $sum = 0.0;
            array_map(function($product) use (&$sum)
            {
                    $sum += $product->hasSale() ? $product->getPriceWithSale() : $product->getPrice();
            }, $products);
            return $sum;
    }

    Человек начитался, что функциональщина это модно, но вот про её основу, immutable states, он не слышал. В общем, человек открыл для себя ещё foreach.

    Strannik1941, 23 Ноября 2015

    Комментарии (33)
  6. Куча / Говнокод #19068

    +3

    1. 1
    <image_block class="inner" interactivity="no" list_entry_id="da vi uporolis">

    Fai, 23 Ноября 2015

    Комментарии (1)
  7. PHP / Говнокод #19067

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    $routeAnalyze = new TaxiRouteAnalyzerLite();
    $options = array(
    	'fromLat'     => $fromLat,
    	'fromLon'     => $fromLon,
    	'toLat'       => $toLat,
    	'toLon'       => $toLon,
    	'cityPolygon' => $this->cityPolygon,
    	'costPos'     =>$costPos,
    	'costPosOut'  => $costPosOut,
    	'costKm'      => $costKm,
    	'costKmOut'   => $costKmOut,
    	'includedKm'  => $includedKm,
    	'meas'        => 'distance',
    	'costKmOutIn' => $costKmOutIn,
    );
    $this->writeLog('options', $options);
    $cost = $routeAnalyze->calcCost($fromLat, $fromLon, $toLat, $toLon, $this->cityPolygon, $costPos, $costPosOut, $costKm, $costKmOut, $includedKm, 'distance', $costKmOutIn);
    $this->writeLog('cost', $cost);
    return $cost;

    Неужели нужно создавать отдельно переменную чтобы вывести в лог, а при этом метод должен быть таким громоздким?!

    akanit, 23 Ноября 2015

    Комментарии (2)
  8. PHP / Говнокод #19065

    +7

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    <?php
    $a=$_POST['a'];
    $b=$_POST['b'];
    $c=$_POST['c'];
    if $_POST['a']*x*2+$_POST['b']*x+$_POST['c']
    {
    else $y=$_POST['b']*2-4*$_POST['a']*$_POST['c'];
    nl2br('</n>')
    echo $y;
    $k1=$_POST['b']+$y/2*$_POST['a'];
    nl2br('</n>')
    echo $k1;
    $k2=$_POST['b']-$y/2*$_POST['a'];
    nl2br('</n>')
    echo $k2;
    
    }
    echo $k1;
    echo $k2;
    ?>

    http://www.cyberforum.ru/php/thread1589333.html

    wiox, 22 Ноября 2015

    Комментарии (7)
  9. Куча / Говнокод #19063

    +5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <div class="map">
        <span style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 13px;"><br></span>
        <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
        <br>&nbsp;
        <iframe src="https://maps.google.com/maps/MYMAP"></iframe>
         </p>
    </div>

    Попросили меня разобраться в верстве, и вот как карту сдвинули направо

    kschingiz, 22 Ноября 2015

    Комментарии (13)
  10. C++ / Говнокод #19061

    +4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    typedef std::map<std::string, WORD> Values;
    
    struct Less {
    	bool operator()(Values::value_type const& left
    	, Values::value_type const& right) const {
    	   if (right.second == TEMPERATURE_UNKNOWN 
    		  || left.second == TEMPERATURE_UNKNOWN) {
    			 return false;
    	   }
    	   short const signed_left = *reinterpret_cast<short const*>(&left.second);
    	   short const signed_right = *reinterpret_cast<short const*>(&right.second);
    	   bool const result = signed_left < signed_right;
    	   return result;
    	}
    };

    Строки 10 и 11.
    20+ опыта в С++ у чувачка.

    blackhearted, 21 Ноября 2015

    Комментарии (89)