1. Список говнокодов пользователя Yurik

    Всего: 15

  2. PHP / Говнокод #4740

    +172

    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
    <?php
    	
    	( ( (float)phpversion() < 5.3 ) ) ? die ( 'fail amigo.' ) : '';
    	
    	$site = file_get_contents( "http://www.google.com.br/search?hl=pt-BR&q=VBXMCBVFKJSHDKHDKF" );
    
    	$getLocationViaGoogle = function ( $html ){
    		$regex = "#<\w+\s\w+=\"tbos\">([^<]{3,})<\/\w+>#i";
    		preg_match_all( $regex, $html, $matches );
    		return $matches[1][0];
    	};
    	
    	print $getLocationViaGoogle( $site );
    	
    ?>

    Вообще пиздец, определяет местоположение, сканировав страницу гугля и вырезав заданное ручками пользователем местоположение.

    Yurik, 24 Ноября 2010

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

    +162

    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
    // the next few lines do the fiddling required to make sure the data 
    // looks right, whether it's viewed via the RSS feed or via the database
    $longpost=str_replace("<br />", "\n", $post);
    $shortpost=substr($post,0,600);
    $shortpost=str_replace("<br />", "\n", $shortpost);
    $pass=$_POST["pass"];
    if ($pass == $password) {
    	include "db.inc";
    	// this line actually inserts the data
    	mysql_query("INSERT INTO entries VALUES (NULL, '$title', '$post')");
    	$getid=mysql_query("SELECT id FROM entries WHERE title='$title'");
    	$myrow=mysql_fetch_array($getid);
    	$postid=$myrow["id"];
    	// from here on in, we're building the RSS feed.
    	$arrFp = file("rss/feed.xml");
    	$lines = count($arrFp);
    	$insertat = $lines-2;
    	for ($i=0; $i<$insertat; $i++) {
    		$rsstext=$rsstext.$arrFp[$i];
    	}
    	$rsstext=$rsstext."<item>\n";
    	$rsstext=$rsstext."<title>".stripslashes($title)."</title>\n";
    	$rsstext=$rsstext."<description>".stripslashes($shortpost);
    	if (strlen($shortpost)<strlen($longpost)) {
    		$rsstext=$rsstext."...";
    	}
    	$rsstext=$rsstext."</description>\n";
    	$rsstext=$rsstext."<link>$url/comment.php?post=$postid</link>\n";
    	$rsstext=$rsstext."</item>\n";
    	$rsstext=$rsstext."</channel>\n";
    	$rsstext=$rsstext."</rss>";
    	$fp=fopen("rss/feed.xml", "w");
    	fwrite( $fp, $rsstext );
    	fclose($fp);
    	echo "Post successfully submitted!";
    } else {
    	echo "You are not authorised to post to this server!";
    }

    Создаём RSS-ленту.

    Yurik, 20 Ноября 2010

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

    +166

    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
    if (isset($_GET["url"])) {
    	$nombre_archivo = $_GET["url"];
    	
    	$consulta = "SELECT * FROM descargas_archivos WHERE nombre_archivo LIKE '".$nombre_archivo."' ";
    	$resultado = mysql_query($consulta);
    	
    	if (mysql_num_rows($resultado)>0) {
        	$actualiza = "UPDATE descargas_archivos SET num_descargas = num_descargas + 1 WHERE nombre_archivo LIKE '".$nombre_archivo."' ";
        	mysql_query($actualiza);
    	}
    	else {
    		$inserta_nuevo = "INSERT INTO descargas_archivos (nombre_archivo) VALUES ('".$nombre_archivo."')";
    		mysql_query($inserta_nuevo);
    	}
    	
    }

    Классика.

    Yurik, 19 Ноября 2010

    Комментарии (15)
  5. C# / Говнокод #2505

    +144.9

    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
    public class YobaButton : Button
    {
        public YobaButton ()
        {
            this.Click += (s1, e1) =>
            {
                MessageBox.Show ("Оп хуй.");
     
                this.Click -= (EventHandler)Delegate.CreateDelegate (typeof (EventHandler), this, (MethodInfo)MethodBase.GetCurrentMethod ());
     
                this.Click += (s2, e2) =>
                {
                    MessageBox.Show ("Оп тупой хуй.");
                };
            };
        }
    }

    Yurik, 30 Января 2010

    Комментарии (21)
  6. C# / Говнокод #2383

    +92.8

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    name[0].InnerText = Regex.Replace(name[0].InnerText, @"<[^>]+>", string.Empty);
    name[0].InnerText = Regex.Replace(name[0].InnerText, "a*[a-z]*A*[A-Z]*", string.Empty);
    name[0].InnerText = Regex.Replace(name[0].InnerText, ",", string.Empty);
    name[0].InnerText = Regex.Replace(name[0].InnerText, "\\.", string.Empty);
    name[0].InnerText = Regex.Replace(name[0].InnerText, ";", string.Empty);
    name[0].InnerText = Regex.Replace(name[0].InnerText, "&", string.Empty);
    name[0].InnerText = Regex.Replace(name[0].InnerText, "\\?", string.Empty); 
    name[0].InnerText = Regex.Replace(name[0].InnerText, "\n", string.Empty);
    name[0].InnerText = Regex.Replace(name[0].InnerText, " ", string.Empty);

    такие дела. кстати, как улучшить? :)) Нужно, чтобы обрезалось все, кроме чисел (положительных и отрицательных) Я какбе начинающий

    Yurik, 07 Января 2010

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