"PHP" / Говнокод #1298 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
if($_SERVER['SERVER_ADDR'] == '127.0.0.1') 
    $PATH_DELIM=";";  //разделитель путей. в Windows - ; , в Unix - :
  else 
    $PATH_DELIM=":";

..................................


$adress = str_replace("//","/",$host.$request);
$adress = str_replace("//","/",$adress);
$adress = str_replace("//","/",$adress);

Часть системы управления сайтом фирмы it construct

guest guest, (Updated )

Комментарии (4, +4)

ЙажаСценарий / Говнокод #1297 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  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
  82. 82
  83. 83
  84. 84
  85. 85
function Cross(value) {
  if (value == 0) document.pole0.src = x.src;
  if (value == 1) document.pole1.src = x.src;
  if (value == 2) document.pole2.src = x.src;
  if (value == 3) document.pole3.src = x.src;
  if (value == 4) document.pole4.src = x.src;
  if (value == 5) document.pole5.src = x.src;
  if (value == 6) document.pole6.src = x.src;
  if (value == 7) document.pole7.src = x.src;
  if (value == 8) document.pole8.src = x.src;
}

function Zero(value) {
  if (value == 0) document.pole0.src = o.src;
  if (value == 1) document.pole1.src = o.src;
  if (value == 2) document.pole2.src = o.src;
  if (value == 3) document.pole3.src = o.src;
  if (value == 4) document.pole4.src = o.src;
  if (value == 5) document.pole5.src = o.src;
  if (value == 6) document.pole6.src = o.src;
  if (value == 7) document.pole7.src = o.src;
  if (value == 8) document.pole8.src = o.src;
}

function CheckVictory() {
  if (cell[0] == cell[1] && cell[1] == cell[2] && cell[2] > 0) return true; 
  if (cell[3] == cell[4] && cell[4] == cell[5] && cell[5] > 0) return true;
  if (cell[6] == cell[7] && cell[7] == cell[8] && cell[8] > 0) return true;
  if (cell[6] == cell[3] && cell[3] == cell[0] && cell[0] > 0) return true;
  if (cell[7] == cell[4] && cell[4] == cell[1] && cell[1] > 0) return true;
  if (cell[8] == cell[5] && cell[5] == cell[2] && cell[2] > 0) return true;
  if (cell[6] == cell[4] && cell[4] == cell[2] && cell[2] > 0) return true;
  if (cell[0] == cell[4] && cell[4] == cell[8] && cell[8] > 0) return true;
}

function CompTurn() {
  for (i=0; i<9; i++) if (cell[i] == 0) PutHere = i;
  for (i=0; i<3; i++) {
  if (cell[0] == cell[1] && cell[2] == 0 && cell[0] == i) PutHere = 2;
  if (cell[0] == cell[2] && cell[1] == 0 && cell[0] == i) PutHere = 1;
  if (cell[1] == cell[2] && cell[0] == 0 && cell[2] == i) PutHere = 0;
  if (cell[3] == cell[4] && cell[5] == 0 && cell[3] == i) PutHere = 5;
  if (cell[3] == cell[5] && cell[4] == 0 && cell[3] == i) PutHere = 4;
  if (cell[4] == cell[5] && cell[3] == 0 && cell[5] == i) PutHere = 3;
  if (cell[6] == cell[7] && cell[8] == 0 && cell[6] == i) PutHere = 8;
  if (cell[6] == cell[8] && cell[7] == 0 && cell[6] == i) PutHere = 7;
  if (cell[7] == cell[8] && cell[6] == 0 && cell[8] == i) PutHere = 6;

  if (cell[6] == cell[3] && cell[0] == 0 && cell[6] == i) PutHere = 0;
  if (cell[6] == cell[0] && cell[3] == 0 && cell[6] == i) PutHere = 3;
  if (cell[3] == cell[0] && cell[6] == 0 && cell[3] == i) PutHere = 6;
  if (cell[7] == cell[4] && cell[1] == 0 && cell[7] == i) PutHere = 1;
  if (cell[7] == cell[1] && cell[4] == 0 && cell[7] == i) PutHere = 4;
  if (cell[4] == cell[1] && cell[7] == 0 && cell[4] == i) PutHere = 7;
  if (cell[8] == cell[5] && cell[2] == 0 && cell[8] == i) PutHere = 2;
  if (cell[8] == cell[2] && cell[5] == 0 && cell[8] == i) PutHere = 5;
  if (cell[5] == cell[2] && cell[8] == 0 && cell[5] == i) PutHere = 8;

  if (cell[6] == cell[4] && cell[2] == 0 && cell[6] == i) PutHere = 2;
  if (cell[6] == cell[2] && cell[4] == 0 && cell[6] == i) PutHere = 4;
  if (cell[4] == cell[2] && cell[6] == 0 && cell[4] == i) PutHere = 6;
  if (cell[0] == cell[4] && cell[8] == 0 && cell[0] == i) PutHere = 8;
  if (cell[0] == cell[8] && cell[4] == 0 && cell[0] == i) PutHere = 4;
  if (cell[4] == cell[8] && cell[0] == 0 && cell[4] == i) PutHere = 0;
  }
  Zero(PutHere);
  cell[PutHere] = 2;
  if (CheckVictory() == true) {
    alert("Выиграл JavaScript =).");
    GameOver();
  }
}

function GameOver() {
  for (i=0; i<9; i++) cell[i] = 0;
  document.pole0.src = e.src;
  document.pole1.src = e.src;
  document.pole2.src = e.src;
  document.pole3.src = e.src;
  document.pole4.src = e.src;
  document.pole5.src = e.src;
  document.pole6.src = e.src;
  document.pole7.src = e.src;
  document.pole8.src = e.src;
}

Найдено тут: http://top.asf.ru/Sgames/xo/. В остальном без комментариев, код говорит сам за себя.

guest guest, (Updated )

Комментарии (5, +5)

"PHP" / Говнокод #1296 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
class cDBEngineWrapper
	{
	private $dbprefix;
	
	public function __construct($prefix)
		{
		$this->dbprefix = $prefix;
		}
		
	public function __call($func, $args)
		{
		return call_user_func_array("{$dbprefix}_{$func}", $args);
		}
	}

Вот такая вот оберточка для быстрой смены БД...

guest guest, (Updated )

Комментарии (4, +4)

"PHP" / Говнокод #1295 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  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
<HTML>
    <HEAD>
    <title>
    </HEAD>
<BODY>
<?php
include("connect.php");
/* вводим переменную которая соединяется с бд */
        $db = @mysql_connect ($host, $user, $psw);
/* выбираем бд с использованием предыдущей */
/*переменной для соединения с бд*/
        $sdb = @mysql_select_db("zforum", $db);
/* для наглядности показываем месагу результата выполнения скрипта */
if(empty($sdb)) {
                echo "mysql_error()";
        };
echo($info);
if($query_string=='go_reg') {$ins_new_usr="insert into users usrnick=$_POST[nick], usrpsw=$_POST[pass], usrmail=$_POST[email], usrabout=$_POST[about]";
if(isset($_POST['nick']) && isset($_POST['pass']) && isset($_POST['pass2']) && isset($_POST['email']) && $_POST['pass2']=$_POST['pass']) {
 mysql_query($ins_new_usr);
        $info="Account created"; } else {
        $info="Input data error please correct";
      }} else { $info="Please input this form";
 }
?>
<form action="reg.php?go_reg" method=post target="_self">
<Table border="5">
<tr><th COLSPAN=2>Registration form</th></tr>
<tr><td>Nickname</td><td><input type="text" size=26 name="nick" maxlegth="16" size="16" value=""></td></tr>
<tr><td>Password</td><td><input type="password" name="pass" size=26 maxlength=24 size="16" value=""></td></tr>
<tr><td>Password again</td><td><input type="password" name="pass2" size=26 maxlength="24" size="16" value=""></td></tr>
<tr><td>E-mail</td><td><input type="text" name="email" maxlength="50" size=26 value=""></td></tr>
<tr><td>About</td><td><textarea name="about" maxlength="100" wrap="virtual" rows=4></textarea></tr>
<tr><th colspan=2><input type="submit" value="enter"></th></tr>
</table>
</body>

guest guest, (Updated )

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

Jawa / Говнокод #1294 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
/**
	 * public static final int ARRAY 2003 public static final int BIGINT -5
	 * public static final int BINARY -2 public static final int BIT -7 public
	 * static final int BLOB 2004 public static final int BOOLEAN 16 public
	 * static final int CHAR 1 public static final int CLOB 2005 public static
	 * final int DATALINK 70 public static final int DATE 91 public static final
	 * int DECIMAL 3 public static final int DISTINCT 2001 public static final
	 * int DOUBLE 8 public static final int FLOAT 6 public static final int
	 * INTEGER 4 public static final int JAVA_OBJECT 2000 public static final
	 * int LONGVARBINARY -4 public static final int LONGVARCHAR -1 public static
	 * final int NULL 0 public static final int NUMERIC 2 public static final
	 * int OTHER 1111 public static final int REAL 7 public static final int REF
	 * 2006 public static final int SMALLINT 5 public static final int STRUCT
	 * 2002 public static final int TIME 92 public static final int TIMESTAMP 93
	 * public static final int TINYINT -6 public static final int VARBINARY -3
	 * public static final int VARCHAR 12
	 */

guest guest, (Updated )

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

"PHP" / Говнокод #1292 Ссылка на оригинал

0

  1. 1
$col=array('red','blue','green','black','yellow','magenta','blue','gray','red','blue','green','black','yellow','blue','gray','red','blue','green','black','yellow','blue','gray');

А какие ты знаешь цвета?

guest guest, (Updated )

Комментарии (1, +1)

"PHP" / Говнокод #1291 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
<?

function q($q){
    return mysql_query($q);
}

function fa($q){
    return mysql_fetch_array($q);
}

function nr($q){
    return mysql_num_rows($q);
}

function gr($t,$f,$w,$wf,$def){
    $r = ($a = mysql_fetch_array(mysql_query("SELECT $f FROM $t WHERE $wf = '$w' LIMIT 1"))) ? $a[$f] : $def ;
    return $r;
}

?>

лень творит чудеса

guest guest, (Updated )

Комментарии (5, +5)