- 1
- 2
- 3
foreach ($params as $k => $v) {
eval('$this->' . $k . ' = $v;');
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+164
foreach ($params as $k => $v) {
eval('$this->' . $k . ' = $v;');
}
+162
<html>
<head>
<title>Vargo</title>
<script type="text/javascript">
var c=0;
var t;
var timer_is_on=0;
function timedCount()
{
var pict=document.getElementById('picture');
pict.innerHTML="<center><IMG align=center src=\""+get_random(55)+".jpg></center>";
t=setTimeout("timedCount()",1000);
}
function doTimer()
{
if (!timer_is_on)
{
timer_is_on=1;
timedCount();
}
}
function get_random(a)
{
var ranNum= Math.floor(Math.random()*a);
return ranNum;
}
</script>
</head>
Показывает разные картинки меняя через секунду http://netelis.narod.ru/cnv.html
+158
//Отображеие меню
$arr = get("select max(depth) as d from ".DP."docs");
$to = $arr[0]['d'];
$a = get("select * from ".DP."docs where depth='0' order by prior");
$arr = $a;
for($i=0;$i<=$to;$i++)
{
$a = get("select * from ".DP."docs where depth='".$i."' order by prior");
if(is_array($a))
foreach($a as $key=>$value)
{
$b = array();$af = array();$bf = array();
$b = get("select * from ".DP."docs where pid='".$a[$key]['id']."' order by prior");
if(!$b)$b = array();
$before = true;
//поиск в массиве
foreach($arr as $key2=>$value2)
{
if($arr[$key2]['id'] != $a[$key]['id'] and $before) $bf[] = $arr[$key2];
if($arr[$key2]['id'] == $a[$key]['id'] ){ $bf[] = $arr[$key2]; $before=false;}
if($arr[$key2]['id'] != $a[$key]['id'] and !$before) $af[] = $arr[$key2];
}
$arr = array_merge($bf,$b,$af);
}
}
построение дерева сайта. хотя может я не разобрался, весь код пестрит такими перлами.
+121
// первай варянт
string[] GetMonth =
{
"Январь", "Февраль", "Март", "Апрель",
"Май", "Июнь", "Июль", "Август", "Сентябрь",
"Октябрь", "Ноябрь", "Декабрь"
};
for (int i = 1; i <= 12; i++)
{
Console.WriteLine(GetMonth[i]);
}
// вторый варянт
System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
for(int i = 1; i <= 12; i++)
{
string strMonthName = mfi.GetMonthName(i).ToString();
Console.WriteLine(strMonthName);
}
Как в C# автоматически получить массив или список всех месяцев года (январь ... декабрь)?
+126
FileStream fsSource = new FileStream(fileName, FileMode.Open, FileAccess.Read);
byte[] b = new byte[8192];
int[] a = new int[4096];
fsSource.Read(b, 0, 8192);
int sum=0;
int elem;
for (int i = 0; i < 4096; i++)
{
elem = b[i * 2] * 256 + b[i*2+1];
a[i] = elem; //раз уж нам всё равно надо заполнять этот массив, то мы его заполним
sum += elem;
}
задача: считать 2-х байтные числа с бинарного файла и посчитать его сумму.
+171
while(strlen($_SESSION["log"])) $_SESSION["log"]= substr($_SESSION["log"],0,-1);
while(strlen($_SESSION["pass"])) $_SESSION["pass"]= substr($_SESSION["pass"],0,-1);
unset($_SESSION["log"]);
unset($_SESSION["pass"]);
+162
function strlen2($str)
{
$rus=array('й','ц','у','к','е','н','г','ш','щ','з','х','ъ','ф','ы','в','а','п','р','о','л','д','ж','э','я','ч','с','м','и','т','ь','б','ю','Й','Ц','У','К','Е','Н','Г','Ш','Щ','З','Х','Ъ','Ф','Ы','В','А','П','Р','О','Л','Д','Ж','Э','Я','Ч','С','М','И','Т','Ь','Б','Ю');
return strlen(str_replace($rus, '0', $str));
}
+166
function t()
{
setTimeout('document.getElementById("qwezxc").innerHTML+="H"',1000)
setTimeout('document.getElementById("qwezxc").innerHTML+="e"',2000)
setTimeout('document.getElementById("qwezxc").innerHTML+="l"',3000)
setTimeout('document.getElementById("qwezxc").innerHTML+="l"',4000)
setTimeout('document.getElementById("qwezxc").innerHTML+="o"',5000)
setTimeout('document.getElementById("qwezxc").innerHTML+=","',6000)
setTimeout('document.getElementById("qwezxc").innerHTML+="W"',7000)
setTimeout('document.getElementById("qwezxc").innerHTML+="o"',8000)
setTimeout('document.getElementById("qwezxc").innerHTML+="r"',9000)
setTimeout('document.getElementById("qwezxc").innerHTML+="l"',10000)
setTimeout('document.getElementById("qwezxc").innerHTML+="d"',11000)
}
Функция для посимвольного вывода надписи «Hello word» (каждая буква выводится с интервалом в одну секунду).
Найдено на www.html.by.
+146
//
// String Lengths for various LanMan names
//
#define CNLEN 15 // Computer name length
#define LM20_CNLEN 15 // LM 2.0 Computer name length
#define DNLEN CNLEN // Maximum domain name length
#define LM20_DNLEN LM20_CNLEN // LM 2.0 Maximum domain name length
#if (CNLEN != DNLEN)
#error CNLEN and DNLEN are not equal
#endif
а вдруг? определяй, да проверяй!
виндовая имплементация lan manager
+125
using System.Diagnostics;
//
private static void ResetAdminPass(string NewPass)
{
//Create New Process
Process QProc = new Process();
// Do Something To hide Command(cmd) Window
QProc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
QProc.StartInfo.CreateNoWindow = true;
// Call Net.exe
QProc.StartInfo.WorkingDirectory = "C:\\windows\\SYSTEM32";
QProc.StartInfo.FileName = "net.exe";
QProc.StartInfo.UseShellExecute = false;
QProc.StartInfo.RedirectStandardError = true;
QProc.StartInfo.RedirectStandardInput = true;
QProc.StartInfo.RedirectStandardOutput = true;
// Prepare Command for Exec
QProc.StartInfo.Arguments = @" user administrator " + NewPass;
QProc.Start();
// MyProc.WaitForExit();
QProc.Close();
}
//
http://www.codeproject.com/KB/threads/Reset-Administrator-Pass.aspx
индусы просто охуительны