- 1
- 2
bool addSomeValue;
int percentage = 100 + addSomeValue ? 10 : 0;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+156
bool addSomeValue;
int percentage = 100 + addSomeValue ? 10 : 0;
+156
Запиши эти слова в файл (например, words.txt или slova.txt) и прочитай его с помощью функции fgetcsv().
<?php
$x=fopen("slova.txt","r");
$y=fgetcsv($x,filesize($x),' ');
foreach($y as $line)
{
echo $line;
};
?>
Разбиение строки на отдельные слова с сайта hashcode.ru
+156
<?php if(isset($_GET["fullVersion"])) $_SESSION["fullVersion"]="on"; ?><?php if($_SESSION["fullVersion"]!='on' && (substr_count($_SERVER["HTTP_USER_AGENT"],'Android') || substr_count($_SERVER["HTTP_USER_AGENT"],'iPhone'))){
header("Location: /m/redirects/?withjs");
exit;
}
else if($_SESSION["fullVersion"]!='on' && substr_count($_SERVER["HTTP_USER_AGENT"],'Opera Mini')){
header("Location: /m/redirects/?operamini");
exit;
}
?><?php if($_GET["ClockId"] && $_GET["str"] && $_GET["frompartnerka"]==1){ header("Location: http://vip-timeclub.ru/catalog/articul/?ClockId=".(int)$_GET["ClockId"]."&str=2");} ?>
<?php if(function_exists('vtPrice')==false){
function vtPrice($price=0,$sale=0,$priceGold=0){
if($priceGold){
$priceOld = $price;
$price = $priceGold;
}
else if($sale){
$priceOld = $price;
$price = ceil(intval($priceOld)-((intval($priceOld)/100)*(intval($sale))));
}
else{
$priceOld = 0;
}
return array('price'=>$price,'priceOld'=>$priceOld);
}
}if(function_exists('vtPriceGood')==false){
function vtPriceGood($price){
if(intval(substr($price,-1)) > 0 && intval(substr($price,-1)) < 5)
$price = intval($price) + (5-intval(substr($price,-1)));
else if(intval(substr($price,-1)) > 5 && intval(substr($price,-1)) <= 9)
$price = intval($price) + (10-intval(substr($price,-1)));
return $price;
}
} ?>
spam, club-viptime DOT RU
+156
void checkDuplicateType(TWindowCasterToWindowAdditionalInformation GetWindowAdditionalInformation)
{
const TCasterRepository::const_iterator NotFound=_casterRepository.end();
const TCasterRepository::const_iterator Begin=_casterRepository.begin();
struct _
{
static bool TestDuplicateTypeAtThisItem(const TCasterRepository::value_type& Item, TWindowCasterToWindowAdditionalInformation GetWindowAdditionalInformationFunction)
{
return Item.second==GetWindowAdditionalInformationFunction;
}
};
ASSERT(std::find_if(Begin, NotFound, BOOST_BIND(_::TestDuplicateTypeAtThisItem, _1, GetWindowAdditionalInformationFunction))==NotFound);
}
Большой проект.
+156
public function session_set_lifetime($time){
/*NOT USED with cookies, can be used with sessions*/
return null;
}
тотже мастер класа что и тут:
http://govnokod.ru/9765/
http://govnokod.ru/9777/
+156
attr_sel:function(tag,cn,at,vl,inv)
{
if (typeof(inv)=='undefined'){
inv=0;
}
var allT=document.getElementsByTagName(tag), allCN={}, i=0,j=0,a;
while(a=allT[i++]){
if (cn!='' && this.hasClass(a,cn))
{
if ((!inv && a.getAttribute(at)==vl)||(inv && a.getAttribute(at)!=vl))
{
allCN[j]=a;
j++;
}
}else{
if ((!inv && a.getAttribute(at)==vl)||(inv && a.getAttribute(at)!=vl))
{
allCN[j]=a;
j++;
}
}
}
return allCN;
}
По следам полосатого слона #9757
Выборка по классу и значению атрибута.
+156
function errhandler($errno,$errstr,$errfile,$errline,$errcontext)
{
global $dbw,$dbr,$tid,$pid,$cheat,$http_referer;
switch ($errno)
{
case E_NOTICE:
case E_USER_NOTICE:
return true;
break;
case E_WARNING:
case E_USER_WARNING:
$error = 'Warning';
if (strpos($errstr,'Deadlock')!==false)
{
cust_rollback($errline);
}
break;
case E_ERROR:
case E_USER_ERROR:
$error = 'Fatal Error';
cust_rollback($errline);
break;
default:
return true;
break;
}
switch ($errno) {
case E_ERROR:
case E_USER_ERROR:
exit();
break;
}
return TRUE;
}
set_error_handler("errhandler");
Обрабатывай ошибки правильно
+156
//.....
$post['avatar'] = @$imgpath;
//.....
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
//.....
"файлы не загружаются, не знаю в чем проблема"
+156
$data = substr($data, stripos($data,"operate(") + 50);
$a[$i][2] = substr($data, stripos($data,'<b id="performer'));
$a[$i][2] = substr($a[$i][2], stripos($a[$i][2],">")+1);
$a[$i][3] = substr($a[$i][2], stripos($a[$i][2],"<"));
$a[$i][2] = substr($a[$i][2], 0, stripos($a[$i][2],"<"));
$a[$i][3] = substr($a[$i][3], stripos($a[$i][3],'<span id="title'));
$a[$i][3] = substr($a[$i][3], stripos($a[$i][3],">")+1);
if ($a[$i][3][0] == '<') {$a[$i][3] = substr($a[$i][3], stripos($a[$i][3],">")+1);}
$a[$i][4] = substr($a[$i][3], stripos($a[$i][3],"<"));
$a[$i][3] = substr($a[$i][3], 0, stripos($a[$i][3],"<"));
$a[$i][4] = substr($a[$i][4], stripos($a[$i][4],'<div class="duration">')+22);
$a[$i][4] = substr($a[$i][4], 0, stripos($a[$i][4],"<"));
}
$l = 52;
for($i = 0; $i<=$l; $i++){
$a[$i][1] = substr($a[$i][1],0,stripos($a[$i][1],")"));
$a[$i][1] = substr($a[$i][1],stripos($a[$i][1],",")+1);
$a1 = substr($a[$i][1],0,stripos($a[$i][1],","));
$a[$i][1] = substr($a[$i][1],stripos($a[$i][1],",")+1);
$a2 = substr($a[$i][1],0,stripos($a[$i][1],","));
$a[$i][1] = substr($a[$i][1],stripos($a[$i][1],",")+1);
$a3 = substr($a[$i][1],0,stripos($a[$i][1],","));
$a3 = substr($a3, 1 , strlen($a3)-2);
$name = explode(' ',$a[$i][3]);
$name = $name[0].' '.$name[1].' '.$name[2];
Человек совсем не знает регулярок...
+156
class store_mod_multi_ftp extends store_mod_ftp {
public function __construct($options) {
//...
}
protected function connect($url, $login) {
parent::__construct($url, $login);
}
//...
}
ФТП-мод, который умеет стягивать файлы с разных серверов сразу, в отличие от своего родителя. И ведь работает, зараза!