- 1
$headers .= "From: " . '[email protected]'. " <" . '[email protected]' . ">\n";
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+154.6
$headers .= "From: " . '[email protected]'. " <" . '[email protected]' . ">\n";
Made by real Indians!
+148.6
class ZDate extends Logic
{
/**
* return age
*
* @param integer $birthday
* @return string
*/
public static function getAge($birthday)
{
$year = date('Y', $birthday);
$month = date('m', $birthday);
$day = date('d', $birthday);
$cur_year = date('Y');
$cur_month = date('m');
$cur_day = date('d');
$age = $cur_year - $year;
if ($cur_month < $month) --$age;
if ($cur_month == $month && $cur_day < $day) --$age;
return (string) $age;
}
}
Вот так коллега вычисляет возраст пользователя =)
+167.4
$notch_notch_submit = $_POST['submit'];
$notch_notch_adm_login = $_POST['adm_login'];
$notch_notch_adm_pass = $_POST['adm_pass'];
$notch_submit = htmlspecialchars($notch_notch_submit);
$notch_adm_login = htmlspecialchars($notch_notch_adm_login);
$notch_adm_pass = htmlspecialchars($notch_notch_adm_pass);
$submit = strip_tags($notch_submit);
$adm_login = strip_tags($notch_adm_login);
$adm_pass = strip_tags($notch_adm_pass);
Суперзащита о_О
+170.6
$s = md5('1') . '<br />';
echo md5('2' . $s) . '<br />';
echo md5('2' . md5('1')) . '<br />';
Программист пришёл с жалобой на то что получаются разные значения. =)
+153.3
function catGetCategoryById($categoryID)
{
$categoryID = (int)$categoryID;
$q = db_query("select categoryID, name, parent, products_count, description, picture, ".
" products_count_admin, sort_order, viewed_times".
", allow_products_comparison".
", allow_products_search".
", show_subcategories_products, meta_description, meta_keywords ".
" from ".CATEGORIES_TABLE.
" where categoryID=$categoryID");
return db_fetch_row($q);
}
снова ShopScript...
пересчитал ради интереса количество полей в таблице - как и в запросе 14. вот хотел я добавить еще одно поле. хорошо, что посмотрел, как берутся данные
+171.8
<? $page = $_REQUEST['page'];
switch ($page) {
case news:
include "./pages/news.php";
break;
case about:
include "./pages/about.php";
break;
case about_1:
include "./pages/about_1.php";
break;
case about_2:
include "./pages/about_2.php";
break;
case about_3:
include "./pages/about_3.php";
break;
case how:
include "./pages/how.php";
break;
case admission:
include "./pages/admission.php";
break;
case admission2009:
include "./pages/admission2009.php";
break;
case admission2009_1:
include "./pages/admission2009_1.php";
break;
case admission2009_2:
include "./pages/admission2009_2.php";
break;
case admission2009_3:
include "./pages/admission2009_3.php";
break;
case admission2009_4:
include "./pages/admission2009_4.php";
break;
case admission2009_5:
include "./pages/admission2009_5.php";
break;
case admission2009_6:
include "./pages/admission2009_6.php";
break;
case admission2009_7:
include "./pages/admission2009_7.php";
break;
case admission2009_8:
include "./pages/admission2009_8.php";
break;
case admission2009_10:
include "./pages/admission2009_10.php";
break;
case admission2009_11:
include "./pages/admission2009_11.php";
break;
case programme:
include "./pages/programme.php";
break;
case programme_1:
include "./pages/programme_1.php";
break;
case programme_2:
include "./pages/programme_2.php";
break;
case programme_3:
include "./pages/programme_3.php";
break;
case vacancy:
include "./pages/vacancy.php";
break;
case donation:
include "./pages/donation.php";
break;
case profile:
include "./profile/index.php";
break;
case guestbook:
echo "<div class='GBlock'>";
echo "<h1>Гостевая книга</h1>";
include "./guestbook/index.php";
echo "</div>";
$pagename="Гостевая книга";
break;
case links:
include "./pages/links.php";
break;
case contacts:
include "./pages/contacts.php";
break;
case upload:
include "./profile/upload.php";
break;
default:
include "./pages/404.php";
break;
} ?>
+165.2
function cryptCCNumberDeCrypt( $cifer, $key )
{
return base64_decode($cifer);
/*
$res = "";
$strlen = (int)($cifer[0]);
$dWordArray = array();
for( $i=1; $i<=8; $i++ )
{
$dWordObject = DWord();
$dWordObject->SetValue(
$cifer[ ($i-1)*4 + 1 ],
$cifer[ ($i-1)*4 + 2 ],
$cifer[ ($i-1)*4 + 3 ],
$cifer[ ($i-1)*4 + 4 ] );
$dWordArray[] = $dWordObject;
}
$dWordArrayDeCifered = array();
for( $i=1; $i<=4; $i++ )
{
$deCiferedData = _gostDeCrypt( array( $dWordArray[($i-1)*2], $dWordArray[($i-1)*2 + 1]), $key );
$dWordArrayCifered[] = $deCiferedData[0];
$dWordArrayCifered[] = $deCiferedData[1];
}
foreach( $dWordArrayCifered as $dWordCifered )
{
$byte1 = 0;
$byte2 = 0;
$byte3 = 0;
$byte4 = 0;
$dWordCifered->GetValue( &$byte1, &$byte2, &$byte3, &$byte4 );
$res .= chr($byte1);
$res .= chr($byte2);
$res .= chr($byte3);
$res .= chr($byte4);
}
$temp = $res;
for( $i=1; $i<=$strlen; $i++ )
$res .= $temp[$i-1];
return $res;
*/
}
// *****************************************************************************
// Purpose encrypts cc_expires field ( see ORDERS_TABLE in database_structure.xml )
// Inputs
// Remarks
// Returns
function cryptCCHoldernameCrypt( $cc_holdername, $key )
{
return base64_encode( $cc_holdername );
}
function cryptCCHoldernameDeCrypt( $cifer, $key )
{
return base64_decode( $cifer );
}
function cryptCCExpiresCrypt( $cc_expires, $key )
{
return base64_encode( $cc_expires );
}
function cryptCCExpiresDeCrypt( $cifer, $key )
{
return base64_decode( $cifer );
}
function cryptPasswordCrypt( $password, $key )
{
return base64_encode( $password );
}
function cryptPasswordDeCrypt( $cifer, $key )
{
return base64_decode( $cifer );
}
function cryptFileParamCrypt( $getFileParam, $key )
{
return base64_encode( $getFileParam );
}
function cryptFileParamDeCrypt( $cifer, $key )
{
return base64_decode( $cifer );
}
продолжает радовать Shop-Script PREMIUM от WebAsyst LLC.
перед каждой функцией - комментарий как перед cryptCCHoldernameCrypt() (все просто не влезало)
+144
$start=microtime(true);
for($i=0;$i>1000;$i++)
{
$id = intval($_GET['id']);
}
$end=microtime(true);
$total1=$end-$start;
$start=microtime(true);
for($i=0;$i>1000;$i++)
{
$id = (int) $_GET['id'];
}
$end=microtime(true);
$total2=$end-$start;
echo '<br>---------------------------------------------------------------------------------------<br>';
echo "intval = $total1 <br> int = $total2"
LOL
+146.1
function move($oldname, $newname, $context=null) { retrurn rename($oldname, $newname, $context); }
+166.9
/*....*/
$info = ldap_get_entries($ds, $sr);
$Number=0;
for ($i=0; $i<$info["count"]; $i++) {$Number++;}
for ($i=0; $i<$Number; $i++)
{
if (!($info[$i]["cn"] == ""))
{
$user=$info[$i]["cn"][0];
echo $user."\n";
}
}
/*....*/