- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
function getCountComment($ent_id = null)
{
if(empty($ent_id))
{
return false;
}
...
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+147
function getCountComment($ent_id = null)
{
if(empty($ent_id))
{
return false;
}
...
}
+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>';
Регистрация пользователя ;)
+147
int main(int argc, char* argv[])
{
std::cout<<"Good testing!\n";
system("PAUSE");
return 0;
}
http://www.gamedev.ru/code/forum/?id=151702−88
#-----------view:
def catalog(request):
subcatalog_list = SubCatalog.objects.all().order_by('index')
objects_list = Object.objects.all().order_by('subcatalog')
t = loader.get_template('catalog.html')
c = RequestContext(request, {
'subcatalog_list': subcatalog_list,
'objects_list': objects_list,
})
return HttpResponse(t.render(c))
#-----------template:
{% if subcatalog_list %}
{% for subcatalog in subcatalog_list %}
<div class="section_name clear">{{ subcatalog.name }}</div>
<div class="clear"></div>
{% if objects_list %}
{% for obj in objects_list %}
{% if obj.subcatalog.id == subcatalog.id %}
<div class="section">
<a class="clear" href="{{ obj.link }}/">{{ obj.name }}</a>
{% if obj.description %}
<div class="description">{{ obj.description|safe }}</div>
{% endif %}
{% if forloop.counter0|divisibleby:3 %}
{% endif %}
{% endif %}
{% endfor %}
{% else %}
<h2>No objects available.</h2>
{% endif %}
{% endfor %}
{% else %}
<h1>No subcatalogs available.</h1>
{% endif %}
#-------И еще печенька напоследок:
<a onclick="window.location = '/create/' + {{ subcatalog.id }} + '/'"></a>
Django
дико, дико.
−95
loop do
client = server.accept
otvet = []
while line = client.gets
otvet << line
break if line == "\r\n"
end
client.print "HTTP/1.1 200/OK\n"
client.print "Content-type: text/html\n\n"
client.print '"<meta http-equiv="refresh" content="0; url=http://www.google.ru">"' # переадресация
client.close
puts otvet
File.open('log.txt', 'a'){ |f| f.puts("#{otvet}")} # запись лога
end
творние юного кулхацкера
+161
<?php
header('content-type: application/x-javascript; charset=windows-1251');
function utf8win1251($s){
$out=""; $c1=""; $byte2=false;
for ($c=0;$c<strlen($s);$c++){
$i=ord($s[$c]); if ($i<=127) $out.=$s[$c];
if ($byte2) { $new_c2=($c1&3)*64+($i&63); $new_c1=($c1>>2)&5;
$new_i=$new_c1*256+$new_c2;
if ($new_i==1025) $out_i=168; else
if ($new_i==1105) $out_i=184; else $out_i=$new_i-848;
$out.=chr($out_i); $byte2=false; }
if (($i>>5)==6) {$c1=$i;$byte2=true; } }
return $out; }
$src = file_get_contents("http://letopisi.ru/index.php/%D0%A8%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD:%D0%97%D0%BD%D0%B0%D0%B5%D1%82%D0%B5_%D0%BB%D0%B8_%D0%B2%D1%8B");
$tmp = preg_replace('/.*<ul><li>(.*)<\/ul>.*<div class="printfooter">.*/s', '$1', $src);
$tmp = trim(preg_replace('/href="/', 'href="http://letopisi.ru', $tmp));
$matches = explode('</li>', $tmp);
if (sizeof($matches) > 1) {
$trans = Array("\x0D" => "", "\x0A" => " ");
do {
$quote = trim($matches[rand(0, sizeof($matches)-2)]);
} while (empty($quote));
$quote = str_replace('<li>', '', utf8win1251(strtr($quote, $trans)));
$quote = preg_replace('/<div class="thumb.*<\/div>/', '', $quote);
$quote = str_replace('"', '\"', $quote);
print 'document.write("' . $quote . '");';
}
?>
Аа, блин, надо было сразу все кидать.
Нужна возможность удалять свои коды в течение 10 минут.
+100
case
0: FilterList.Add('RCHECK = '+''''+'+'+'''');
1: FilterList.Add('RCHECK = '+''''+'-'+'''');
...
Автор кода жжот. Код реально работает. Но прочитать такое даже автор по прошествии года не сможет.
Можно было проще
0:FilterList.Add('RCHECK = ''+''');
−114
SELECT
h.id,
IF(h.link ='',h.action,CONCAT('<a href=\'',h.link,'\'>',h.action,'</a>')) action,
DATE_FORMAT(h.time,'%d.%m.%Y %H:%i') time,
u.name user_name
FROM
history h LEFT JOIN users u ON h.user = u.id ORDER BY h.time DESC
+161
session_start();
$Time = $_SESSION['Time'];
$Time--;
if($Time<0) $Time=0;
$Hour=(int)($Time/3600);
$Min=(int)(($Time-$Hour*3600)/60);
$Sec=$Time-($Hour*3600+$Min*60);
$Str=sprintf("%02d:%02d:%02d",$Hour,$Min,$Sec);
$_SESSION['Time']=$Time;
echo "{'Time':$Time,'sss':'$Str'}";
// jquery
function show()
{
$.post('TimeStr.php',
{'ids':'1'},
function(data){
$("#content").html(data['sss']);
if(data['Time']=='0')
{
$("#AnswerBtn").attr('disabled','disabled');
document.getElementById('NotSaveAnswer').style.display='';
}
},
"json");
}
$(document).ready(function(){
show();
setInterval('show()',1000);
});
Выводит текущее время на сайт используя jquery и php O_O
+116
repositoryBugzilla.Open();
repositoryBugzilla.Close();
Вот такой код я нашел у себя в проекте.