- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
function del()
{
temp = window.confirm("Вы действительно хотите удалить?");
if (temp == true)
return true;
else
return false;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+151
function del()
{
temp = window.confirm("Вы действительно хотите удалить?");
if (temp == true)
return true;
else
return false;
}
Из реальной системы
+167
/**
* Функция умирания
*/
public static function ending()
{
die;
}
Нашел в одном из классов волшебный метод ))
+167
if($pass == $pswd)
{
//Выполнение запросов...
}
else
{
header('location: ./index.html');
if(empty($pass))
{
header('location: ./index.html');
}
if(empty($pswd))
{
header('location: ./index.html');
}
if(empty($pass) && empty($pswd))
{
header('location: ./index.html');
}
if(empty($login) or empty($pswd))
{
header('location: ./index.html');
}
}
//Код вывода формы.
+171
<?if ($tip1[1]=="avi"){?>class="lnk-avi"<?}
elseif ($tip1[1]=="djv"){?>class="lnk-djv"<?}
elseif ($tip1[1]=="doc"){?>class="lnk-doc"<?}
elseif ($tip1[1]=="flv"){?>class="lnk-flv"<?}
elseif ($tip1[1]=="pdf"){?>class="lnk-pdf"<?}
elseif ($tip1[1]=="jpeg"){?>class="lnk-jpeg"<?}
elseif ($tip1[1]=="jpg"){?>class="lnk-jpeg"<?}
elseif ($tip1[1]=="JPEG"){?>class="lnk-jpeg"<?}
elseif ($tip1[1]=="JPG"){?>class="lnk-jpeg"<?}
elseif ($tip1[1]=="pdf"){?>class="lnk-pdf"<?}
elseif ($tip1[1]=="png"){?>class="lnk-png"<?}
elseif ($tip1[1]=="swf"){?>class="lnk-swf"<?}
elseif ($tip1[1]=="gif"){?>class="lnk-gif"<?}
elseif ($tip1[1]=="xls"){?>class="lnk-xls"<?}?>
><?=$VALUESIO[$i]?></a>, <?=$tip1[1];?>, <?=$size1;?>Мб
case придумали дураки)
нашол в проекте, который сейчас доделываю)
+165
//SECURITY
$mid = mysql_escape_string($mid);
$ip = mysql_escape_string($ip);
..
..
$time = intval(time());
на всякий случай ;-)
+126
if (isset($_REQUEST['input1'])) {
echo "Данные введены";
}
elseif (!isset($_REQUEST['input1'])) {
echo "
<form action='#' name='form1'>
<input type='text' name='input1' value='' >
<input type='submit' value='Отправить' />
</form>
";
}
Логика ващще
+144
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule \.(jpeg|gif|bmp|png|jpg|css|js)$ - [L]
RewriteRule ^([a-z]+)$ index.php?param1=$1 [L,QSA]
+156
//delete internal note
if(is_numeric($post['nID']) && is_numeric($post['cID'])) {
//echo $post['nID'];
$q = mysql_query("DELETE FROM notes WHERE notes_id='{$post['nID']}' LIMIT 1");
if($q) {echo "<span style='font-weight:bold;color:red'>Note deleted</span>";}
show_notes_2($post['cID']);
}
if(is_numeric($post['nIDD']) && is_numeric($post['cIDD'])) {
//echo $post['nID'];
$q = mysql_query("DELETE FROM notes WHERE notes_id='{$post['nIDD']}' LIMIT 1");
if($q) {echo "<span style='font-weight:bold;color:red'>Note deleted</span>";}
show_notes($post['cIDD'],2);
}
что нам стоит срач устроить
+157
$q = mysql_query("... /* тут мог быть ваш код */") or die(mysql_error());
$nr = mysql_num_rows($q);
$contor=0;
if($nr<1) {
echo "No notes found";
$contor=0;
} else {
$contor=1;
$cc = 0;
while($d = mysql_fetch_assoc($q)) {
... /* тут мог быть ваш код */
$cc++;
$contor++;
}
if (!$contor) $contor = 0;
}
if (!$contor) $contor = 0;
для уверенности.
+148
<?php
if (!$action){
echoheader('addnews', $echo['header']);
?>
<form method="post" name="addnews" action="<?=$PHP_SELF; ?>" onsubmit="return process_form(this)">
<!-- короткая -->
<fieldset id="short"><legend><?=$echo['short']; ?></legend>
<?
echo run_filters('new-advanced-options', 'short');
?>
<textarea name="short_story" tabindex="4"></textarea>
</fieldset>
<!-- кнопки -->
<fieldset id="actions"><legend><?=$echo['actions']; ?></legend>
<input type="submit" value="<?=$echo['add']; ?>" accesskey="s">
</fieldset>
<?
}
?>
<fieldset id="date"><legend><?=$echo['date']; ?></legend>
<input type="text" name="day" size="10" maxlength="2" value="<?=date('d'); ?>" title="<?=$echo['calendar']['day']; ?>" readonly>
<input type="text" name="month" size="10" maxlength="10" value="<?=date('M'); ?>" readonly>
<input type="text" name="year" maxlength="4" value="<?=date('y'); ?>" title="<?=$echo['calendar']['year']; ?>" readonly> <input type="text" name="hour" maxlength="2" value="<?=date('H', (time() + $config_date_adjust * 60)); ?>" title="<?=$echo['calendar']['hour']; ?>" readonly>:<input type="text" name="minute" maxlength="2" value="<?=date('i', (time() + $config_date_adjust * 60)); ?>" title="<?=$echo['calendar']['minute']; ?>" readonly>:<input type="text" name="second" maxlength="2" value="<?=date('s', (time() + $config_date_adjust * 60)); ?>" title="<?=$echo['calendar']['second']; ?>" readonly>
</fieldset>
</div></fieldset>
<input type="hidden" name="mod" value="addnews">
<input type="hidden" name="action" value="doaddnews">
</form>
<?
echofooter();
// ********************************************************************************
// Do add News to DB
// ********************************************************************************
if ($action == 'doaddnews'){
if (($added_time = strtotime($day.' '.$month.' '.$year.' '.$hour.':'.$minute.':'.$second)) == -1){
$added_time = (time() + $config_date_adjust * 60);
}
if (!$title){
$title = substr($short_story, 0, 10).'...';
}
$id = $sql->last_insert_id('news', '', 'id') + 1;
run_actions('new-save-entry');
$sql->insert(array(
'table' => 'news',
'values' => array(
'date' => $added_time,
'author' => $member['username'],
'title' => replace_news('add', $title),
'short' => strlen(replace_news('add', $short_story)),
'full' => strlen(replace_news('add', $full_story)),
'avatar' => $avatar,
'category' => $category,
'url' => ($url ? my_namespace($url) : my_namespace(totranslit($title))),
'hidden' => (($config_approve_news == 'yes' and $member['level'] > 2) ? true : false)
)
));
$sql->insert(array(
'table' => 'story',
'values' => array(
'post_id' => $id,
'short' => replace_news('add', $short_story),
'full' => replace_news('add', $full_story)
)
));
run_actions('new-save-entry');