- 1
if (!document.getElementById) return;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+169
if (!document.getElementById) return;
Официальный сайт города Сочи
+161
public function get($module, $fields, $options=null) {
$results = $this->get_with_related($module, array($module => $fields), $options);
$records = array();
if ($records) {
foreach ($results['entry_list'] as $entry) {
$record = array();
foreach ($entry['name_value_list'] as $field) {
$record[$field['name']] = $field['value'];
}
$records[] = $record;
}
}
return $records;
}
SugarCRM REST API Class https://github.com/asakusuma/SugarCRM-REST-API-Wrapper-Class/blob/master/sugar_rest.php
+105
procedure TForm2.FormCreate(Sender: TObject);
begin
SpeedButton1.Left := Form2.ClientWidth div 2 - SpeedButton1.Width;
SpeedButton1.Top := Form2.ClientHeight div 2 - SpeedButton1.Height;
SpeedButton2.Left := Form2.ClientWidth div 2;
SpeedButton2.Top := Form2.ClientHeight div 2 - SpeedButton2.Height;
SpeedButton3.Left := Form2.ClientWidth div 2 - SpeedButton3.Width;
SpeedButton3.Top := Form2.ClientHeight div 2;
SpeedButton4.Left := Form2.ClientWidth div 2;
SpeedButton4.Top := Form2.ClientHeight div 2;
end;
+168
var command = 'var p = new Object();';
command +='p.adId = "' + params.adId + '";';
command +='p.campaignId = "' + params.campaignId + '";';
command +='p.parentPositionId="' + params.parentPositionId + '";';
command +='p.childPositionIds = "' + params.childPositionIds + '";';
command +='oneAdSkyscraperLoaded(p);';
setTimeout(command, 0);
Латвийский eval
+156
/**
* форматирование даты - преобразует дату в формат ДД-ММ-ГГГГ
*
* @param unknown_type $inDate - дата
* @return unknown
*/
public static function getDateFormatted($inDate, $forView = false, $inTime = '') {
//2011-05-03 20:27:26
$a_tmp = explode(' ', $inDate);
if ($forView) {
$time = substr($a_tmp[1], 0, 5);
if ($a_tmp[0] == date('Y-m-d')) {
if ($time == '') {
$time = substr($inTime, 11, 5);
if ($time == '') {
$time = $inTime;
}
}
if ($time != '') {
return 'Сегодня, ' . $time;
}
}
$a_tmp = explode('-', $a_tmp[0]);
return $a_tmp[2] . '-' . $a_tmp[1] . '-' . $a_tmp[0];
}
$inDate = substr($inDate, 0 , 10);
$inDate = str_replace(' ', '', $inDate);
$inDate = str_replace('.', '-', $inDate);
$a_tmp = explode('-', $inDate);
if (strlen($a_tmp[0]) == 4) {
$inDate = str_pad($a_tmp[2], 2, '0', STR_PAD_LEFT) . '-' . $a_tmp[1] . '-' . $a_tmp[0];
}
return $inDate;
}
+158
$email = $_POST['email'];
$pass = $_POST['pass'];
$name = $_POST['name'];
$famname = $_POST['famname'];
$ip = $_SERVER['REMOTE_ADDR'];
$date = date('Y-m-d [H:i:s]');
if($_GET['reg'] == 'good' && $email!="" && $name!="" && $famname!="" && $pass!="" ) {
if(!@mysql_connect('localhost', 'root', '')) {
echo 'ѥ䩱ò° ¶é¿ ã±¥ñ»‘塤ﲲó¯ ';
exit();
}
mysql_select_db('efimov');
$number = 0;
$query = "select count(uid) as c from users";
$res = mysql_query($query);
while($row = mysql_fetch_array($res)) {
$number = $row['c'] + 1;
}
if(mysql_query("insert into users values ('$number', '$name','$famname','$email','$pass','$ip','$date')")) {
echo "$name, hello";
}
}
echo '<script type="text/javascript">'.
'alert("fuuu")'.
'</script>';
Регистрация пользователя ;)
+162
/*
Функция для парсинга CSV файла.
Автор: Федорченко Антон Александрович ([email protected], http://sites.neeweb.com/antfsite)
Возвращает двумерный массив:
array(
array ( ... ) //Строка 1
array ( ... ) //Строка 2
...
array ( ... ) //Строка n
)
*/
function parse_csv($filename, $codepage = 'windows-1251') {
$csv_lines = file($filename);
$skip_char = false;
$column = '';
if (is_array($csv_lines)) {
$cnt = count($csv_lines);
for($i = 0; $i < $cnt; $i++) {
$line = trim($csv_lines[$i]);
$first_char = true;
$col_num = 0;
$length = strlen($line);
for ($b = 0; $b < $length; $b ++) {
if ($skip_char != true) {
$process = true;
if ($first_char == true) {
if($line[$b] == '"') {
$terminator = '";';
$process = false;
} else {
$terminator = ';';
}
$first_char = false;
}
if ($line[$b] == '"') {
$next_char = $line[$b + 1];
if ($next_char == '"') {
$skip_char = true;
} elseif ($next_char == ';') {
if($terminator == '";') {
$first_char = true;
$process = false;
$skip_char = true;
}
}
}
if ($process == true) {
if ($line[$b] == ';') {
if ($terminator == ';') {
$first_char = true;
$process = false;
}
}
}
if ($process == true) $column .= $line[$b];
if ($b == ($length - 1)) $first_char = true;
if ($first_char == true) {
$values[$i][$col_num] = $column;
$column = '';
$col_num ++;
}
} else {
$skip_char = false;
}
}
}
}
if (strtolower($codepage) != "utf-8") {
foreach ($values as $lineIndex => $line) {
foreach ($line as $cellIndex => $cell) $values[$lineIndex][$cellIndex] = iconv($codepage, "UTF-8", $cell);
}
}
return $values;
}
Жаль, не пришло в голову запостить сразу - ОНО ещё и неотворматировано было.
Антон Александрович - мощный дядька =)
+165
function show_price_list() {
$period_1 = $period_2 = $period_3 = $period_4 = $period_5 = $period_6 = "";
$query = "
SELECT id, price, type
FROM price
ORDER BY type, start
";
$this->registry['sql']->query($query);
if ($this->registry['sql']->getNumberRows()>0) {
foreach ($this->registry['sql']->getFetchObject() as $oRow) {
switch($oRow->type) {
case 0: $period_1 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
break;
case 1: $period_2 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
break;
case 2: $period_3 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
break;
case 3: $period_4 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
break;
case 4: $period_5 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
break;
case 5: $period_6 .= '<td><input type="text" name="period['.$oRow->id.']" value="'.$oRow->price.'"></td>';
break;
}
}
}
@$this->registry['template']->set('period_1', $period_1);
@$this->registry['template']->set('period_2', $period_2);
@$this->registry['template']->set('period_3', $period_3);
@$this->registry['template']->set('period_4', $period_4);
@$this->registry['template']->set('period_5', $period_5);
@$this->registry['template']->set('period_6', $period_6);
}
Модель в шаблоне MVC
+161
function toggleCategory(tableId, imgId) {
var display = document.getElementById(tableId).style.display;
var classname;
if (display == "none") {
display = "block";
classname = "toggleClosed";
} else {
display = "none";
classname = "toggleOpen";
}
var img = document.getElementById(imgId);
img.className = classname;
document.getElementById(tableId).style.display = display;
}
И все это c jQuery наборту. Латвийская соц-сеть, чё
−85
m = 1
for i in range(100):
for j in range(100):
for k in range(100):
m *= i*j*k
#Почему m = 0?
Ещё один перл автора 7568 и 7545