- 1
- 2
- 3
- 4
$w="";
foreach(array("id_page","id_point","id") as $i)
$w.=$$i?(($w?" and ":"")."$i=".$$i):"";
$sql="select * from ".$this->_name." where $w order by ordr,ts desc";
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+161.1
$w="";
foreach(array("id_page","id_point","id") as $i)
$w.=$$i?(($w?" and ":"")."$i=".$$i):"";
$sql="select * from ".$this->_name." where $w order by ordr,ts desc";
и без комментов, ага.
+166.4
<?
$query="SELECT * FROM Communicators WHERE phoneID=$phoneID";
$dba->query($query);
list($phoneID, $brandID, $phoneModel, $phoneDate, $phonePriceRetail, $phonePriceWS,$phonePriceWS1, $phoneDescrShort, $phoneDescrFull, $phonePicShort, $phonePicFull,
$phonePriceWSComment, $groupDefaultprice1, $groupDefaultprice2, $groupGroup2price1, $groupGroup2price2, $grouptempprice1, $grouptempprice2, $groupGorodprice1, $groupGorodprice2, $groupClientsprice1, $groupClientsprice2,
$standards, $height, $width, $thickness, $weight, $batteryType, $batteryMAH, $standbyTime, $talkTime, $phoneBookSize, $video, $processor, $calendar, $wap, $OS, $GPRS, $EDGE, $java, $FMradio, $memcard, $bluetooth, $modem, $irda, $EMS, $MMS, $USB, $dictaphone, $camera, $colorDisplay, $twoDisplays, $outlookSynchro, $otherDescription, $games, $ringFileFormat, $innerMemory, $mp3player, $corpus, $WiFi, $videoCall, $GPS, $xtraDescr, $id_article)=$dba->get_row();
?>
<h2>Описание <?=$brandName?> <?=$phoneModel?></h2>
<b>Основные характеристики</b><br>
<?if( $standards != "" ){?>Стандарт: <?=$standards?><br><?}?>
<?if( $corpus != "" ){?>Тип корпуса: <?=$corpus?><br><?}?>
Размеры, мм (Ш×В×Г): <?=$width?>×<?=$height?>×<?=$thickness?><br>
<?if( $weight != "" ){?>Вес: <?=$weight?> г<br><?}?>
Аккумулятор: <?if( $batteryType != "" ){?><?=$batteryType?>, <?}?><?if( $batteryMAH != "" ){?><?=$batteryMAH?> мА·ч<br><?}?>
<?if( $processor != "" ){?>Процессор: <?=$processor?><br><?}?>
<?if( ($innerMemory != "0") && ($innerMemory != 0) && ($innerMemory != "") ){?>Память RAM/ROM: <?=$innerMemory?><br><?}?>
<?if( $memcard != "" ){?>Слоты расширения: <?=str_replace("+","есть",str_replace("-","нет",$memcard))?><br><?}?>
<?if( $OS != "" ){?>Операционная система: <?=$OS?><br><?}?>
<?if( $calendar != "" ){?>Органайзер: <?=str_replace("+","есть",str_replace("-","нет",$calendar))?><br><?}?>
<br>
<b>Связь</b><br>
<?if( $USB != "" ){?>USB: <?=str_replace("+","есть",str_replace("-","нет",$USB))?><br><?}?>
<?if( $irda != "" ){?>Инфракрасный порт: <?=str_replace("+","есть",str_replace("-","нет",$irda))?><br><?}?>
<?if( $GPRS != "" ){?>GPRS: <?=str_replace("+","есть",str_replace("-","нет",$GPRS))?><br><?}?>
<?if( $EDGE != "" ){?>EDGE: <?=str_replace("+","есть",str_replace("-","нет",$EDGE))?><br><?}?>
<?if( $bluetooth != "" ){?>Bluetooth: <?=str_replace("+","есть",str_replace("-","нет",$bluetooth))?><br><?}?>
<?if( $WiFi != "" ){?>Wi-Fi: <?=str_replace("+","есть",str_replace("-","нет",$WiFi))?><br><?}?>
<?if( $GPS != "" ){?>GPS: <?=str_replace("+","есть",str_replace("-","нет",$GPS))?><br><?}?>
<br>
<b>Экран</b><br>
<?if( $colorDisplay != "" ){?>Экран: <?=str_replace("+","есть",str_replace("-","нет",$colorDisplay))?><br><?}?>
<?if( $twoDisplays != "" ){?>Сенсорный дисплей: <?=str_replace("+","есть",str_replace("-","нет",$twoDisplays))?><br><?}?>
<br>
<b>Мультимедийные возможности</b><br>
<?if( $mp3player != "" ){?>MP3-плеер: <?=str_replace("+","есть",str_replace("-","нет",$mp3player))?><br><?}?>
<?if( $ringFileFormat != "" ){?>Аудио форматы: <?=$ringFileFormat?><br><?}?>
<?if( $FMradio != "" ){?>FM радио: <?=str_replace("+","есть",str_replace("-","нет",$FMradio))?><br><?}?>
<?if( $dictaphone != "" ){?>Диктофон: <?=str_replace("+","есть",str_replace("-","нет",$dictaphone))?><br><?}?>
<?if( $camera != "" ){?>Камера: <?=str_replace("+","есть",str_replace("-","нет",$camera))?><br><?}?>
<?if( $video != "" ){?>Съемка видео: <?=str_replace("+","есть",str_replace("-","нет",$video))?><br><?}?>
<?if( $videoCall != "" ){?>Видеозвонок: <?=str_replace("+","есть",str_replace("-","нет",$videoCall))?><br><?}?>
<?if( $games != "" ){?>Игры: <?=str_replace("+","есть",str_replace("-","нет",$games))?><br><?}?>
<?if( $otherDescription != "" ){?>
<br>
<b>Прочее</b><br>
<?=nl2br($otherDescription)?>
<?}?>
Разгребаю это говно... Тот кто так пишет - недостоин жить :(
+148
if(mysql_num_rows($records_sql)<1){
$_SESSION['site_msg']='no_user_found';
header('Location: customer_listing.php');
echo '<script type="text/javascript">';
echo 'window.location.href="customer_listing.php";';
echo '</script>';
echo '<noscript>';
echo '<meta http-equiv="refresh" content="0;url=customer_listing.php" />';
echo '</noscript>';
exit();
}
чтоб наверняка
+162.2
$r_fam = str_replace(',',"",$r_fam);
$r_fam = str_replace('$',"",$r_fam);
$r_fam = str_replace('\"',"",$r_fam);
$r_fam = str_replace('<',"",$r_fam);
$r_fam = str_replace('>',"",$r_fam);
$r_fam = str_replace('*',"",$r_fam);
$r_fam = str_replace('=',"",$r_fam);
$r_name = str_replace(',',"",$r_name);
$r_name = str_replace('$',"",$r_name);
$r_name = str_replace('\"',"",$r_name);
$r_name = str_replace('<',"",$r_name);
$r_name = str_replace('>',"",$r_name);
$r_name = str_replace('*',"",$r_name);
$r_name = str_replace('=',"",$r_name);
$sqlr="INSERT INTO users VALUES(NULL,'$r_login','$r_pass','0.00','0.00','0.00','$r_email','$r_name','$r_fam','$date','0.00')";
mysql_query($sqlr);
Защита в лоб.
register_globals = on
+147.8
if ($i++%2==0)
$bgc='#eeeeee';
else
$bgc='#cccccc';
Самое интересное, что инкремент производится после прохождения проверки
+153
function strum($text, $simb)
{
if(mb_strlen($text, 'UTF-8') > $simb){
}
if(mb_strlen($text, 'UTF-8') > $simb)
{
$start = 0;
for($i = 0; $i <= (ceil(mb_strlen($text, 'UTF-8') / $simb)); $i++)
{
$tmp = mb_strpos($text, '. ', $start + $simb, 'UTF-8');
if(is_numeric($tmp))
{
$num[] = $tmp;
}
$tmp = mb_strpos($text, '! ', $start + $simb, 'UTF-8');
if(is_numeric($tmp))
{
$num[] = $tmp;
}
$tmp = mb_strpos($text, '? ', $start + $simb, 'UTF-8');
if(is_numeric($tmp))
{
$num[] = $tmp;
}
if($num != '')
{
$end = min($num) + 1;
}
if($end <= $start)
{
$end = mb_strlen($text, 'UTF-8');
}
$str = mb_substr($text, $start, $end, 'UTF-8');
$string[] = mb_substr($str, 0, ($end - $start), 'UTF-8');
$start = $end;
unset($num);
unset($str);
unset($tmp);
if($end == mb_strlen($text, 'UTF-8'))
{
break;
}
}
}
else
{
$string[] = $text;
}
return $string;
}
Функция для умной разбивки
+153
<?php
$thelist = array();
$dir = './upload/ftp/';
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file !="index.php" && $file !=".ftpquota") {
$file = $file;
$thelist[] = array('file' => $file, 'filemtime' => filemtime($file), 'filesize' => filesize($file));
}
}
closedir($handle);
}
?>
<?php
for($i = 0; $i < count($thelist); $i++) {
?><a href="sitename/<?=$thelist[$i]['file']?>"><?=$thelist[$i]['file']?></a><?php
}
?>
+156
<?
$i=$var = null;
function NullPointerShare(&$vv)
{
for (;;)
{
$i=$vv;
$i++;
if ($i==20)
{
$i=null;
die (NullPointerShare($i));
}else if ($i<20){
$ix=19;
die (NullPointerShare($ix));
}
}
return $vv;
}
die ("--> ".NullPointerShare($var));
?>
Без коментов:)
+157
<?php
// AI для jabber-бота http://coolbot.vndv.com
// Автор AI: Black.ZerO
$db = mysql_connect($dbhost, $dbuser, $dbpasswd) or die("MySQL error");
mysql_select_db($dbname, $db);
$result = mysql_query("select * from mozg", $db);
$myrow = mysql_fetch_array($result);
$messages['body'] = "Hello";
do
{
if ($messages['body'] == $myrow[question])
{
echo "OK";
break;
}
else {
echo "false";
}
}
while ($myrow = mysql_fetch_array($result));
AI для jabber-бота http://coolbot.vndv.com
+155
$cnt_ = count($array_objects['rate']);
for($i=0; $i<$cnt_; $i++) {
//...
}
$DB->query('REPAIR TABLE `' . $rates_table . '` QUICK;');
Кусок скрипта для импорта данных из XML...