- 1
- 2
- 3
function smallfil($string)
{ return mysql_real_escape_string($string);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+157
function smallfil($string)
{ return mysql_real_escape_string($string);
}
Что не сделаешь ради удобства?
+171
<?php
$usr = $_POST['user'];
$usr = mysql_escape_string($usr);
$query = "SELECT * FROM $admins WHERE name = '".$_POST['user']."'";
$lst = @mysql_query($query);
Заглянул в упомянутую ниже Esay Engne Site CMS
Несколько строк кода пропустил, для простоты чтения, на эту конструкцию пропущенное никак не влияло.
+168
<?php
/*
=====================================================
Esay Engne Site CMS
-----------------------------------------------------
http://ees-co.com
-----------------------------------------------------
Copyright © 2010 - 2011 EES
=====================================================
Назначение: Главная
=====================================================
*/
require_once("engine/class/config.db.php");
require_once("engine/editor/bbcode/bbcode.lib.php");
$query = "SELECT * FROM $setting where name='name_site'";
$lst = @mysql_query($query);
$row2 = @mysql_fetch_array($lst);
$sn = $row2['value'];
$query = "SELECT * FROM $setting where name='home_page'";
$lst = @mysql_query($query);
$row2 = @mysql_fetch_array($lst);
$HO_PA = $row2['value'];
$query = "SELECT * FROM $setting where name='templates'";
$lst = @mysql_query($query);
$row2 = @mysql_fetch_array($lst);
$tem = $row2['value'];
$query = "SELECT * FROM $setting where name='status_site'";
$lst = @mysql_query($query);
$row2 = @mysql_fetch_array($lst);
$status = $row2['value'];
Что-то тут недавно про EsayScript было... Тут у нас тоже Esay/Easy, только уже целая CMS. Оф.сайт полон опечаток и восторженного школотекста.
Самое смешное - наткнулся я на эту гадость, увидев AdSense'овский баннер. Неужто современные школьники настолько суровы, что готовы продвигать свой опенсорсный говнокод контекстной рекламой?..
+167
<a title="Главная" href="http://<?php echo $_SERVER['HTTP_HOST'].str_replace('\\', '', dirname($_SERVER['PHP_SELF'])); ?>">Главная</a>
нашел в одном проекте, я бы и не смог до такого додуматься
+163
<?php echo '<?xml version="1.0" encoding="utf-8"?>';?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="ru">
<head>
<title>День Победы! 66 лет со дня победы! 9 Мая!</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">body{background:#000;}h1{color:#ff5500;}</style>
</head>
<body>
<div style="text-align:center">
<div style="padding-top:28%"><h1><?php
class Main
{
var $timex;
var $month;
var $day;
var $year;
function win2uni($s)
{
$s = convert_cyr_string($s,'w','i');
for ($result='', $i=0; $i<strlen ($s); $i++) {
$charcode = ord($s[$i]);
$result .= ($charcode>175)?"&#".(1040+($charcode-176)).";":$s[$i];
}
return $result;
}
function Main()
{
if ($this->GetDate())
$this->TimeTo();
return true;
}
function GetDate()
{
$this->month = '05';
$this->day = '09';
$this->year = '2011';
return true;
}
function TimeTo()
{
$m = $this->month;
$d = $this->day;
$y = $this->year;
$mn = date("m");
$dn = date("d");
$yn = date("y");
$hh = date("H");
$mm = date("i");
$ss = date("s");
$diff = mktime(23,59,59,$m,$d,$y)-mktime($hh,$mm,$ss,$mn,$dn,$yn);
$days = $diff/60/60/24;
$hours = $diff/60/60 - intval($days)*24;
$minutes = $diff/60 - intval(intval($days*24)*60);
$seconds = $diff - intval(intval(intval($days*24*60))*60);
$text = "До Дня Победы (9 мая) осталось<br/>\n";
$text.= round($days);
$mins = round($days)."";
if ($mins == "11" or $mins == "12" or $mins == "13" or $mins == "14") $text.= " дней "; else
if (
$mins[strlen($mins)-1] == "2"
or $mins[strlen($mins)-1] == "3"
or $mins[strlen($mins)-1] == "4")
$text.= " дня "; else
if($mins[strlen($mins)-1] == "1")
$text.= " день "; else
$text.= " дней ";
$text.= round($hours);
if (round($hours) == 1 or round($hours == 21)) $text.= " час "; else
if (round($hours) == 2 or round($hours) == 3 or round($hours) == 4 or round($hours) == 22 or round($hours) == 23) $text.= " часа ";
else $text.= " часов ";
$text.= round($minutes);
$mins = round($minutes)."";
if ($mins == "11" or $mins == "12" or $mins == "13" or $mins == "14") $text.= " минут "; else
if (
$mins[strlen($mins)-1] == "2"
or $mins[strlen($mins)-1] == "3"
or $mins[strlen($mins)-1] == "4")
$text.= " минуты "; else
if($mins[strlen($mins)-1] == "1")
$text.= " минута "; else
$text.= " минут ";
$text.= round($seconds);
$mins = round($seconds)."";
if ($mins == "11" or $mins == "12" or $mins == "13" or $mins == "14") $text.= " секунд "; else
if (
$mins[strlen($mins)-1] == "2"
or $mins[strlen($mins)-1] == "3"
or $mins[strlen($mins)-1] == "4")
$text.= " секунды "; else
if($mins[strlen($mins)-1] == "1")
$text.= " секунда "; else
$text.= " секунд ";
echo $text;
return true;
}
}
$X = new Main();
?></h1></div>
Заранее извиняюсь за "опять даты, опять php":)
Отсчет времени до 9 мая
http://dumpz.org/23155/
+147
<?php
$this->phptal->id=$id;
$this->phptal->returnid=$returnid;
if(isset($params['catalogue']))
{
if(isset($params['category']))
{
if(isset($params['news']))
{
$nid=(int)$params['news'];
require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventNewsDAO.php'));
$nldao=new EventNewsDAO($this);
$this->phptal->newsline=$nldao->get($nid);
echo $this->ProcessTalTemplate('admin/admin_newsline.tal.tpl');
}
else
{
$cid=(int)$params['catalogue'];
require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCatalogueDAO.php'));
$cdao=new EventCatalogueDAO($this);
$this->phptal->catalogue=$cdao->get($cid);
require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCategoryDAO.php'));
$ccdao=new EventCategoryDAO($this);
$this->phptal->categories=$ccdao->all($cid);
$ccid=(int)$params['category'];
$this->phptal->category=$ccdao->get($ccid);
require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventNewsDAO.php'));
$ndao=new EventNewsDAO($this);
$this->phptal->news=$ndao->all($ccid);
echo $this->ProcessTalTemplate('admin/admin_news.tal.tpl');
}
}
else
{
$cid=(int)$params['catalogue'];
require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCatalogueDAO.php'));
$cdao=new EventCatalogueDAO($this);
$this->phptal->catalogue=$cdao->get($cid);
require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCategoryDAO.php'));
$ccdao=new EventCategoryDAO($this);
$this->phptal->categories=$ccdao->all($cid);
echo $this->ProcessTalTemplate('admin/admin_categories.tal.tpl');
}
}
else
{
require_once(cms_join_path($this->GetModulePath(), 'classes','dao', 'EventCatalogueDAO.php'));
$cdao=new EventCatalogueDAO($this);
$this->phptal->catalogues=$cdao->all();
echo $this->ProcessTalTemplate('admin/admin_catalogues.tal.tpl');
}
я молодец. наговнокодил как школьник.
ветвистое ветвление + жуткая копипаста.
буду это рефакторить, когда в целом закончу базовую функциональность.
+157
$opdirbase=opendir(H.'sys/fnc');
while ($filebase=readdir($opdirbase))
{
if (eregi('\.php$',$filebase))
{
include_once(H.'sys/fnc/'.$filebase);
}
}
Вот так вот инклюдится код в одной в вап cms.В дериктории файлы по 200-300кб.
+158
{|if $message=="ok"|}
<div style="text-align: center; padding:10px; margin:10px; color: white; font-weight: bold; background-color: green;">Your message has successfully been added.</div>
{|/if|}
{|if $message=="error"|}
<div style="text-align: center; padding:10px; margin:10px; color: white; font-weight: bold; background-color: red;">Mistake. You filled out the wrong form.</div>
{|/if|}
Красивое использование CSS.
+154
public function assign($a, $b) {
parent::assign($a, $b);
}
Из того же проекта.
И все-таки хорошо, что программеры понимают ООП :-)
+157
$deleteBasketElId = URLParser::GetParser()->getArgumentSecure('deleteelid');
if ($deleteBasketElId){
$html = 'бугога';
print $html;
}
Откопано в старом проекте, который писали студийные недопрограммеры.