1. Поиск говнокода

    Этот поиск практически ничего не может найти! Но вы всё-таки попытайтесь, вдруг повезет.

    Найдено: 384

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

    +158

    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
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    <script src=scripts.js></script>
    <?
    
        if (isset($remove) && $user1 !="selectuser"):  //to remove user from DB
    	print "Was updated sucsessfully: user '$user1' was removed<br>";
    	print "<font color=red>If You want to reload this page use <u>our 'Reload' button only</u></font>";
    	$query="delete from users where login=\"$user1\"";
            $result=mysql_query($query);     
    
       if (!isset($reloadme) ):
    
    
       //decremet when registered users removed users.txt
    	$file_loc="users.txt";
    	chmod ($file_loc,0755);
    	$newfile = fopen($file_loc, "r");
    	$file_contents = fread($newfile, filesize($file_loc));
            $file_contents=$file_contents-1;   //value contains how many users
    	$newfile = fopen($file_loc, "w+");
    	fwrite($newfile, "$file_contents");
    	fclose($newfile);
    	chmod ($file_loc,0700);       // end of adding data to file
    	endif;
       endif;   //end of reloadme
    //counting of users
    	$file_loc = "users.txt";
    //	chmod ($file_loc,0644);
    	$whattoread = fopen($file_loc, "r");
    	$file_contents = fread($whattoread, filesize($file_loc));
    	fclose($whattoread);
    //	chmod ($file_loc,0755);       // end of adding data to file
    //end of counting
    
    
    
        $query="select * from users order by id";
        $result=mysql_query($query);     // for first while	
        $result1=mysql_query($query);   // for second while
    	print "<table border=1 cellspacing=0 cellpadding=0 bordercolor=#007898><tr><td>";   //external table
    	print "<table border=0 cellspacing=2 cellpadding=2 width=590><tr><td>
    	<form action=$PHP_SELF method=post><select name=\"user1\" class=select1><option value=\"selectuser\"> Select user ";
        while($row=mysql_fetch_object($result)):	
    	print"<option value=\"$row->login\" style=\"background-color:#FFFFFF;\">$row->login";	
    	endwhile;
    	print "</select><br>
    	<input type=hidden name=remove>
    	<input type=hidden name=show>
    	<input type=hidden name=admin_login value=$admin_login_compare>";   // to enter one more time to login.php
    	print "<input type=hidden name=admin_password value=$admin_password_compare>"; // if ($admin_password!=$admin_password_compare) etc....
    	print "<input type=submit value=\"Remove User\" class=button1></form>";
    
    //reload this page
    	print "<form action=$PHP_SELF method=post>
    	<input type=hidden name=show>
    	<input type=hidden name=admin_login value=$admin_login_compare>";   // to enter one more time to login.php
    	print "<input type=hidden name=admin_password value=$admin_password_compare>"; // if ($admin_password!=$admin_password_compare) etc....
    	print "<input type=hidden name=reloadme ><input type=submit value=Reload  class=button1></form>";
    
    
    	print "Counter: $file_contents users
    	</td>";
    
    
    	print "<td>
    	<table border=1 cellspacing=0 cellpadding=4 bordercolor=#007898><tr><td>ID</td><td>Login</td><td>Password</td><td>Email</td><td>Last visit (Y/M/D)</td></tr></tr>";
        while($row=mysql_fetch_object($result1)):	
            print "<tr>";
    	print "<td>$row->id</td>";
    	print "<td><a href=\"javascript:showuserdata('$row->login','$row->address','$row->fax','$row->tel','$row->site')\" title=\"Show about $row->login\">$row->login</td>";
    	print "<td>$row->password </td>";
    	print "<td><a href=\"mailto:$row->email\" title=\"Email to $row->login\">$row->email</td>";
    	print "<td>$row->last_date</td>";
    	print "</tr>";
    	endwhile;
    	print "</table></td></tr></table>";
    	print "	</table>";  //end of external table
    	print "<br>&nbsp; Click user name to view data about him";
    
    	exit;
    
    ?>

    ITdocer, 23 Октября 2011

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

    +165

    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
    $iDateStamp = mktime(0,0,0);
    $sDateStr   = strftime("%y%m%d");
    do {
    	$iRand = rand(1,999);
    	$s = "select * from slZakaz where iDateStamp='$iDateStamp' and iUnique='$iRand' ";
    	$iRes = mysql_query($s);
    	if ($iRes){
    		if (mysql_num_rows($iRes)==0){
    			@mysql_query("insert into slZakaz (iDateStamp, iUnique) values ('$iDateStamp', '$iRand')");
    			break;
    		}
    	}
    } while (true);
    $iRandStr = sprintf('%03d', $iRand);
    
    $sOrderStr = $sDateStr.'.'.$iRandStr;

    Мне одному страшно?

    kindofbear, 14 Октября 2011

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

    +146

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    К сожалению и к моему большому удивлению в Оракле нет такого полезного оператора LIMIT, который есть в MySQL. Аналогом ему в оракле служит псевдо-колонка rownum, которая отображает номер выбираемой записи по ходу выборки.
    
    Итак, есть такой вот простенький sql запрос для Oracle
    
    SELECT * FROM T WHERE ROWNUM BETWEEN 2 AND 20
    
    
    который по мнению автора выберет 19 строк, начиная с 2 и заканчивая 20-й.
    Вопрос знатокам: Будет ли такой вопрос выводить требуемые записи? Вроде как будет… Но раз этот пост в разделе говнокод, то надо подумать ещё.
    
    Думаем. Когда у нас выберется первая запись по нашему запросу? Когда rownum будет 2. А когда rownum будет 2? После того как выберется первая запись. Из всего этого делаем однозначный вывод — не выберется ни одной записи.

    andrei199614, 04 Октября 2011

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

    +166

    1. 1
    2. 2
    3. 3
    <?php
    $q=mysql_num_rows(mysql_query("SELECT * FROM `users`"));
    >

    Печально, но так поступают 85% кодеров..

    QarezZ, 01 Октября 2011

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

    +158

    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
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    <?php
    function bkconnect($login=FALSE,$update=FALSE){
    	function get_bk_inf($content){
    		if (strlen($content) > 0){
                        preg_match("#align=(.*)#i", $content, $returnarray['align']);
                        preg_match("#gamecity=(.*)#i", $content, $returnarray['gamecity']);
                        preg_match("#room_name=(.*)#i", $content, $returnarray['room_name']);
                        preg_match("#gamecity_url=(.*)#i", $content, $returnarray['gamecity_url']);
                        preg_match("#level=(.*)#i", $content, $returnarray['level']);
                        preg_match("#klan=(.*)#i", $content, $returnarray['klan']);
                        preg_match("#login_online=(.*)#i", $content, $returnarray['login_online']);
                        foreach($returnarray as $array_name => $array_data){
                                $returnarray[$array_name] = $returnarray[$array_name][1];
                                        }
                        }
                        return $returnarray;
                        }
    	function bklogin($login){
    		$tmp=rawurlencode(trim(strip_tags($login)));
    		$url="http://sandcity.combats.com/inf.pl?login=".$tmp."&short=1";
    		$response=get_headers($url,1);
    		if (strpos($response[0],'302'))
    		{$url=str_replace(" ","%20",$login);
    		 return file_get_contents($url);}
    		elseif (strpos($response[0],'200'))
    		{return file_get_contents($url);}
    		else {return"";}
    		return file_get_contents($url);
    		}
    	if($update==TRUE){
    		$myrow = mysql_query("select id,bk_login FROM black_list");
    		if(mysql_num_rows($myrow)){
    			while($result = mysql_fetch_array($myrow)){
    				$contents = bklogin($login);
    				$info = get_bk_inf($contents);
    				if(is_array($info)){
    				$sql="UPDATE `newblacklist` SET
                                                                align ='".$info['align']."',
                                                                gamecity ='".$info['gamecity']."',
                                                                room_name='".$info['room_name']."',
                                                                gamecity_url='".$info['gamecity_url']."',
                                                                level='".$info['level']."',
                                                                klan='".$info['klan']."',
                                                                login_online='".$info['login_online']."'
                                                                WHERE `id`='".$result['id']."'";
    				$myrow2 = mysql_query($sql);
    				}else{echo'error';}
    				}
    			}else{return;}
    		}else{
    			$contents = bklogin($login);
    			$info = get_bk_inf($contents);
    			if(is_array($info)){
    				return $info;}else{
    					return 'Чтото не так';}
    			}
    	}
    function liginviev($inf){
    function align($align){if($align>0){return '<img src="http://img.combats.com/i/align'.$align.'.gif" border="0px">';}else{return '&nbsp';}}
    function klan($klan){if(strlen($klan)>0){
    	return "<a href='http://capitalcity.combats.com/clans_inf.pl?".$klan."' target='_blank'>
    	<img src='http://img.combats.com/i/klan/".$klan.".gif' title='".$klan."'></a>";}else{
    		return '&nbsp';}}
    function room($rooms){if(strlen($rooms)>0){return $rooms;}else{return' ';}}
    function online($online){
    	if($online==1){return'<img src="/i/user_online.gif" />';}else{return'<img src="/i/user_offline.gif" />';}
    	return $on;}
    	}
    function Logs($id){
    $myrow = mysql_query("SELECT * FROM newblacklistlogs WHERE blackId='".$id."'");
    $crow['loc'] = mysql_num_rows($myrow);
    if($crow['loc']>0){
    	while($result = mysql_fetch_array($myrow)){
    		$crow['logs'] .='<a href="'.$result['file'].'" target="_blank"><img src="/i/fighttype6.gif" /></a>';
    		}
    		return $crow=array('col'=>$crow['loc'],'logs'=>$crow['logs']);
    	}else{return $crow=array('col'=>$crow['loc'],'logs'=>' ');}
    	}
    ?>

    Один ЧС для клан сайта игры combats.ru

    lans8097, 30 Сентября 2011

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

    +164

    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
    <?php 
    include "dbconfig.php"; 
    $db = mysql_connect("$dbhost","$dbuser","$dbpass");
    mysql_select_db("$dbname",$db);
    
    
    $mysqlsite = mysql_query("SELECT * FROM site WHERE id='1'");
    $site = mysql_fetch_array($mysqlsite);
    
    $titlesite = $site['title'];
    $titlesite = iconv("CP1251", "UTF-8", "$titlesite");
    
    $descriptionsite = $site['description'];
    $descriptionsite = iconv("CP1251", "UTF-8", "$descriptionsite");
    
    $keywordssite = $site['keywords'];
    $keywordssite = iconv("CP1251", "UTF-8", "$keywordssite");
    
    
    $contsite = $site['cont'];
    $contsite = iconv("CP1251", "UTF-8", "$contsite");
    ?>

    "CMS" Хостинг провайдера ultrahost.com.ua D

    SaNcHeS, 24 Сентября 2011

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

    +163

    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
    /// Здесь настройки подключения к БД
    $bd_host = "openserver";
    
    $bd_user     = "root"; // - логин
    $bd_password = ""; // - пароль
    $bd_base     = "test"; // - имя базы
    
    
    mysql_connect($bd_host, $bd_user, $bd_password) or die(mysql_error());
    mysql_select_db($bd_base);
    
    
    // параметры
    $conf = mysql_query("SELECT * FROM Settings where s='1' limit 1");	
    
    $cr=mysql_fetch_assoc($conf);
    
    
    $SITENAME  = $cr['sitename'];
    $SITENAME  = str_replace('+',"<br>",$SITENAME);
    
    $SITED     = $cr['domen'];
    $SITEDESC  = $cr['description'];
    $SITEKEYW  = $cr['keywords'];
    $SEC	   = $cr['seconds'];
    
    // другие конфигурации 
    $sys_testmode = "false"	//- режим тестирования (сайты не показываются) true-вкл | false-выкл

    Гордый файл config.php

    Мартин, 22 Сентября 2011

    Комментарии (9)
  9. Python / Говнокод #7866

    −179

    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
    def mac_search(*args):
        db = MySQLdb.connect(host="localhost",user="test",passwd="test",db="test")
        cursor = db.cursor()
        cursor.execute('SELECT * FROM ip_groups WHERE mac="%s" AND is_deleted=0;' %args[0].split()[0])
        for j in cursor.fetchall():
            cursor.execute("SELECT * FROM iptraffic_service_links WHERE ip_group_id=%s and is_deleted=0;" %j[1])
            for j1 in cursor.fetchall():
                cursor.execute("SELECT * FROM service_links WHERE id=%s AND is_deleted=0;" %j1[0])
                for j2 in cursor.fetchall():
                    cursor.execute("SELECT * FROM accounts WHERE is_deleted=0 AND id=%s AND is_blocked=0;" %j2[2])
                    for j3 in cursor.fetchall():
                        cursor.execute("SELECT * FROM service_links WHERE account_id=%s AND is_deleted=0;" %j2[2])
                        for j4 in cursor.fetchall():
                            if j4[3]==465 or j4[3]==641:
                                cursor.execute("SELECT * FROM s_multicast WHERE service_id=%s AND %s>=ip_start AND %s<=ip_end;" %(j4[3],args[0].split()[1],args[0].split()[1]))
                                for j5 in cursor.fetchall():
                                    return j5

    Я конечно понимаю, таким уже не удивить. Но все же.

    http://www.python.su/forum/viewtopic.php?pid=76855

    cutwater, 14 Сентября 2011

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

    +160

    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
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    $id = $_POST['id'];
    //$id = 194;
    $temp = $id;
    $str = "";
    for ( $incr = 0; $incr < 100; $incr++ ) {
    	$result = $dbs -> query("SELECT * FROM 
    								market_categs 
    							WHERE 
    								categid={$temp} AND 
    								published = 1 AND 
    								status = 1");
    	if ( mysql_num_rows($result) > 0 ) {
    		$categ = mysql_fetch_array($result);
    		$result2 = $dbs -> query("SELECT * FROM 
    									market_categs_trans 
    								WHERE 
    									categid={$categ[categid]}");
    		$categ_title = mysql_fetch_array( $result2 );
    		$str2 = "";
    		$temp2 = $categ[categid];
    		for ( $incr2 = 0; $incr2 < 100; $incr2++ ) {
    			$result3 = $dbs -> query("SELECT * FROM 
    										market_categs 
    									WHERE 
    										categid={$temp2} AND 
    										published = 1 AND 
    										status = 1");
    			if ( mysql_num_rows($result3) > 0 ) {
    				$categ2 = mysql_fetch_array($result3);
    				$str2 .= "/".$categ2[url];
    				$temp2 = $categ2[parent];
    			}
    		}
    		$str2 = substr($str2,1);
    		$nb2 = substr_count($str2,"/");
    		$temp_str2 = explode ("/",$str2);
    		$str2 = "";
    		$back = "";
    		for ($i2 = $nb2; $i2 >= 0; $i2--) {
    			$str2 .="/".$temp_str2[$nb2];
    			$nb2--;
    		}
    		$str .= " / <a href='/".substr($str2,1)."'>".$categ_title[title]."</a>";
    		$temp = $categ[parent];
    	}
    }

    Рекурсия... мать его

    cephuo, 12 Сентября 2011

    Комментарии (10)
  11. SQL / Говнокод #7820

    −110

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $sql_info = "SELECT * FROM accessories";
    $query_info = mysql_query($sql_info);
    while($row_info=mysql_fetch_array($query_info)) {
        $found_something=1;
    }

    Проверка наличия записей в БД

    mikhail-spb, 09 Сентября 2011

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