- 1
- 2
- 3
- 4
- 5
- 6
- 7
function br($count=1) {
$c=0;
do {
echo '<br>';
$c++;
} while($c!=$count);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+148
function br($count=1) {
$c=0;
do {
echo '<br>';
$c++;
} while($c!=$count);
}
in <- <?php br(10); ?>
out -> <br><br><br><br><br><br><br><br><br><b r>
:DDDDD
+152
$str.= "<div class=\"matchtour2\"><table class='maintable' align=right width=590 cellspacing=0><tr bgcolor=#56B945 style='color:white; margin:0;' class='header'><td align=center width=50><b>время</b></td><td align=center><b>событие</b></td><td width=50 align=center><b>победа<br>1</b></td><td width=50 align=center><b>ничья<br>X</b></td><td width=50 align=center><b>пoбеда<br>2</b></td><td width=50> </td></tr></table></div><br><br>";
Мечта верстальщика
+150
<?php
require_once "class/db.php";
require_once "secrets.php";
ini_set("error_reporting","E_ALL");
$db_obj= new db($mysql_host,$mysql_user,$mysql_pass,$mysql_db);
while ($row=$object->sql_fetch_assoc("SELECT id, name FROM categories ORDER BY sort ASC"))
{
$cats[] = $row;
}
$cats_list = "";
while ($cats){
{
$cats_list .= "<options value=\"" . $cats['id'] . "\">" . $cats['name'] . "</options>";
}
$form = <<<FORM
<form action='" . $PHP_SELF . "' method='post' enctype='multipart/form-data'>
<b>Поиск</b><br>
<tr>
<td>
<b>Cтрока поиска:</b><input type=\"text\" size=\"40\" name=\"string\">
</td>
<td>
<b>Выберете категорию</b>
<select name=\"cats\">
$cats_list
</select>
</td>
</tr>
</form>
FORM;
print ($form);
?>
+151
$result['msg'] .= '<form action="" method="POST">';
$result['msg'] .= 'I RECEIVED ';
$result['msg'] .= '<select name="order_grade" width="10">';
$result['msg'] .= '<option></option>';
$result['msg'] .= '<option value="4"> A </option>';
$result['msg'] .= '<option value="3"> B </option>';
$result['msg'] .= '<option value="2"> C </option>';
$result['msg'] .= '<option value="1"> D </option>';
$result['msg'] .= '<option value="0"> F </option>';
$result['msg'] .= '</select>';
$result['msg'] .= ' FOR THIS PAPER ';
$result['msg'] .= '<input type="submit" name="set_grade" value="Submit my grade">';
$result['msg'] .= '</form>';
Зачем так поступать?
+144.1
#ifdef TYPE_A
#define LEN 10
#else
#define LEN_9 9
#endif
#ifdef TYPE_A
char str[LEN + 20];
#else
char str[LEN_9 + 20];
#endif
Макросня
+185
define('KEY', md5('Obama'));
if($_GET['key'] != KEY) {
...
}
таки обамосекьюрность))
встретилось в одном большом проекте, который успешно работает и процветает по сей день
+139.5
#include <iostream>
#include <deque>
#include <time.h>
using namespace std;
int arr[10][10] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
#define SHIPS 1
struct point{
int x, y;
};
int num = -1, count = 0;
deque<point> ship;
int way[] = {0, 0, 0, 0};
void step(){
for (int i = 0; i < 10; i++){
for (int j = 0; j < 10; j++)
cout << arr[i][j] << ' ' ;
cout << '\n';
}
cout << '\n';
if (num == ship.size()){
memset(way, 0, sizeof(way));
while(!ship.empty()){
arr[ship.front().x + 1][ship.front().y] = 7;
arr[ship.front().x + 1][ship.front().y + 1] = 7;
arr[ship.front().x][ship.front().y + 1] = 7;
arr[ship.front().x + 1][ship.front().y - 1] = 7;
arr[ship.front().x - 1][ship.front().y + 1] = 7;
arr[ship.front().x - 1][ship.front().y - 1] = 7;
arr[ship.front().x][ship.front().y - 1] = 7;
arr[ship.front().x - 1][ship.front().y] = 7;
ship.pop_front();
}
count++;
if (count == SHIPS) {
cout << "Win" << '\n';
exit(0);
}
cout << num << " was killed" << '\n';
num = -1;
}
int x, y;
point tmp;
if (ship.empty()){
x = rand()%10;
y = rand()%10;
while (arr[x][y] == 7){
x = rand()%10;
y = rand()%10;
}
if (arr[x][y] != 0 && arr[x][y] != 7){
num = arr[x][y];
tmp.x = x;
tmp.y = y;
ship.push_front(tmp);
arr[x][y] = 7;
if (x > 0) if (arr[x][y - 1] != 7) way[0] = 1;
if (y > 0) if (arr[x - 1][y] != 7) way[1] = 1;
if (x < 9) if (arr[x][y + 1] != 7) way[2] = 1;
if (y < 9) if (arr[x + 1][y] != 7) way[3] = 1;
step();
}else{
arr[x][y] = 7;
return;
}
}else{
int t = rand()%4;
while (way[t] == 0){
t = rand()%4;
}
switch(t){
case 0:
x = ship.back().x;
y = ship.back().y - 1;
if(arr[x][y] == num){
way[1] = 0;
way[3] = 0;
tmp.x = x;
tmp.y = y;
ship.push_back(tmp);
arr[x][y] = 7;
step();
}else{
arr[x][y] = 7;
way[0] = 0;
return;
}
Морской бой
+157.3
// Строки 8-12. Строковые константы - для мудаков, аффтар гарантирует это!
$simb_r=chr("92").chr("114");
$simb_n=chr("92").chr("110");
$simb_http="http:".chr("47").chr("47");
$simb_ss=chr("47").chr("47");
$r6=chr("35").chr("35").chr("35").chr("35").chr("35").chr("35");
// Строки 20-24. for - для мудаков, копипасту в массы!
$ses[0]=trim($ses[0]);
$ses[1]=trim($ses[1]);
$ses[2]=trim($ses[2]);
$ses[3]=trim($ses[3]);
$ses[4]=trim($ses[4]);
// 50-58. Да здравствует пафос и на хуй не нужное использование тормозных
// POSIX-регэкспов.
for ($i=0; $i < count($_bazadied['browser']); $i++) {
if (eregi($_bazadied['browser'][$i],$_SERVER['HTTP_USER_AGENT'])) exit("Only for peoples!");
}
for ($i=0; $i < count($_bazadied['ip']); $i++) {
if (eregi($_bazadied['ip'][$i],$_SERVER['REMOTE_ADDR'])) exit("IP ban!!!");
}
for ($i=0; $i < count($_bazadied['host']); $i++) {
if($_SERVER['HTTP_REFERER']==true){if (eregi($_bazadied['host'][$i],$_SERVER['HTTP_REFERER'])) exit("HOST ban!!!");}
}
// 135-142. Тернарные? Да идите вы со своими тернарными, и со switch тоже...
if($kak=="first")
{
$text[0]=strtr($text[0],$rubot,$rutop);
}
if($kak=="bot")
{
$text[0]=strtr($text[0],$rutop,$rubot);
}
// 169-170. file_get_contents() - для мудаков.
$fpp=fopen("data.html", "r");
$fulldata=fread($fpp,filesize("data.html")); fclose($fpp);
// 358. Опять же, шли бы вы со своими тернарными...
$temp=false; if(file_exists($dlb.".txt")==true){$temp=true;} if($dlb==$mylicense){$temp=true;}
// 429-437. Брутально.
if($_FILES['addfile']['tmp_name']==true &&
(strrchr($_FILES['addfile']['tmp_name'],'.jpg')==true
|| strrchr($_FILES['addfile']['tmp_name'],'.jpeg')==true
|| strrchr($_FILES['addfile']['tmp_name'],'.gif')==true
|| strrchr($_FILES['addfile']['tmp_name'],'.png')==true
|| strrchr($_FILES['addfile']['name'],'.jpg')==true
|| strrchr($_FILES['addfile']['name'],'.jpeg')==true
|| strrchr($_FILES['addfile']['name'],'.gif')==true
|| strrchr($_FILES['addfile']['name'],'.png')==true))
// 479-500. Аффтар так любит копипасту и ненавидит циклы и file_put_contents()...
if($_POST['event']=="registry"
&& $_POST['sendname']!=$adminlogin
&& $_POST['sendfio']!=$adminname)
{
if($_POST['sendkod']==$_POST['sendtrue']
&& $_POST['sendname']==true
&& $_POST['sendpass']==true
&& $_POST['sendfio']==true
&& eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}$", $_POST['sendemail'])
&& $newuser=="yes"
&& file_exists("data/users/".$_POST['sendname'].".txt")==false)
{
$fop=fopen("data/users/".$_POST['sendname'].".txt", "a+");fputs($fop, "user\r\n"); fclose($fop);
$fop=fopen("data/users/".$_POST['sendname'].".txt", "a+");fputs($fop, $_POST['sendname']."\r\n"); fclose($fop);
$fop=fopen("data/users/".$_POST['sendname'].".txt", "a+");fputs($fop, $_POST['sendpass']."\r\n"); fclose($fop);
$fop=fopen("data/users/".$_POST['sendname'].".txt", "a+");fputs($fop, $_POST['sendfio']."\r\n"); fclose($fop);
$fop=fopen("data/users/".$_POST['sendname'].".txt", "a+");fputs($fop, $_POST['sendemail']."\r\n"); fclose($fop);
$_GET['event']='ok';$_GET['zapros']=$startpage;
}
else{$_GET['event']='error';$_GET['zapros']=$r6;}
$kod=0; $koduri=0;
}
// 735-744. Даёшь копипасту в массы!
$telo=str_replace(" ".$tempik[1]." "," <a href=".$tempik[0].">".$tempik[1]."</a> ",$telo);
$telo=str_replace(" ".$tempik[1].","," <a href=".$tempik[0].">".$tempik[1]."</a>,",$telo);
$telo=str_replace(" ".$tempik[1]."."," <a href=".$tempik[0].">".$tempik[1]."</a>.",$telo);
$telo=str_replace(" ".$tempik[1]."!"," <a href=".$tempik[0].">".$tempik[1]."</a>!",$telo);
$telo=str_replace(" ".$tempik[1]."?"," <a href=".$tempik[0].">".$tempik[1]."</a>?",$telo);
$telo=str_replace(" ".bukvaru($tempik[1],"bot")." "," <a href=".$tempik[0].">".bukvaru($tempik[1],"bot")."</a> ",$telo);
$telo=str_replace(" ".bukvaru($tempik[1],"bot").","," <a href=".$tempik[0].">".bukvaru($tempik[1],"bot")."</a>,",$telo);
$telo=str_replace(" ".bukvaru($tempik[1],"bot")."."," <a href=".$tempik[0].">".bukvaru($tempik[1],"bot")."</a>.",$telo);
$telo=str_replace(" ".bukvaru($tempik[1],"bot")."!"," <a href=".$tempik[0].">".bukvaru($tempik[1],"bot")."</a>!",$telo);
$telo=str_replace(" ".bukvaru($tempik[1],"bot")."?"," <a href=".$tempik[0].">".bukvaru($tempik[1],"bot")."</a>?",$telo);
// 805-808 не влезло, там подряд четыре if'а с одинаковыми условиями...
То, за что глаз уцепился при беглом чтении файла index.php CMS RumbaEasy версии 2.4 (http://rumba.net.ru/easy/skachat.html). Советую скачать оригинал и почитать - оно того стоит. А уж как пафосно она разрекламирована авторами (http://rumba.net.ru/easy/)...
З.Ы. Аффтары, если вы это читаете - извините, не имею ничего против вас лично, но, по-моему, самое место вашей разработке здесь.
+143
define ('bg_color', 'FFFFFF');
define ('border_color', 'AAAAAA');
define ('over_color', 'f4f4f4');
define ('th_color', 'e4e4e4');
CSS 4.0
+146
<?php
$link="http://cert.vatsim.net/cert/vatsimnet/idstatus.php?cid=111111";
$contents = file_get_contents($link);
if ($contents!=FALSE) {
$xml = simplexml_load_string($contents);
$output = "<code>".$contents."</code><br>LAST NAME: ".$xml->user->name_last;
$output.="<br>EMAIL: ".$xml->user->email;
return $output;
}
else {
return "FAILED";
}
?>
Парсерчег XML статов из сети ВАТСИМ