- 1
<?php echo "Кру"; ?>чу, <script>document.write('вер');</script><?php print("чу, "); ?>запу<?php eval(" ?>тать<?php "); echo ' хочу'; ?>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+39.2
<?php echo "Кру"; ?>чу, <script>document.write('вер');</script><?php print("чу, "); ?>запу<?php eval(" ?>тать<?php "); echo ' хочу'; ?>
Защита от копирования ))))))
+40.6
Application was halted by an exception.
Debug-mode is off.
Ошибка на govnokod.ru при добавлении комментариев
+46
function PagerStarter( $object_id, $object_url, $dbt, $maxwidth, $edittime, $level_step, $comments_per_page )
{
if ( $_GET['from'] ) { $from = $_GET['from']; }
if ( $_POST['from'] ) { $from = $_POST['from']; }
if ( $_GET['current_page'] ) { $current_page = $_GET['current_page']; }
if ( $_POST['current_page'] ) { $current_page = $_POST['current_page']; }
if ( ( empty( $current_page ) == TRUE ) && ( empty( $from ) == TRUE ) )
{
$r = mysql_query( "SELECT * FROM ".$dbt." WHERE parent = '1' AND parent_image = '$object_id'".$e."" );
$r_count = mysql_num_rows ( $r );
$total_pages = 0;
$i = 0;
while ( $i < $r_count )
{
$total_pages = $total_pages + 1;
$i = $i + $comments_per_page;
}
if ( $total_pages == 0 )
{
$total_pages = 1;
}
for ( $i = 1 ; $i <= $total_pages ; $i++ )
{
$from_q = ( $i * $comments_per_page ) - $comments_per_page + 0;
}
$_GET['current_page'] = $total_pages;
$_GET['from'] = $from_q;
}
}
Особого внимания заслуживает деление сложением. Хотя тут еще достаточно говна :)
+32.7
$id = 0;
while (!$id || mysql_error()) {
$id = rand(1, 10000000);
mysql_query("INSERT INTO `table` (id) VALUES ('".$id."'");
}
+30
void
timerfunc(int sig)
{
signal(SIGALRM, timerfunc);
TimerCount++;
TimerCallFunc();
}
найдено в "примере"
0
#[page]
pub async fn page(cx: &Cx) -> Result<impl View> {
// This state variable is initialized on the server, but lives in the browser.
let count = signal(cx, || 0i32);
Ok(view! {
<button @click=$(|_e| count.increment())>"increment"</button>
<button @click=$(|_e| count.decrement())>"decrement"</button>
// The count updates when clicking the buttons. No server roundtrip.
<div>$(count.get())</div>
})
}
https://tokio.rs/blog/2026-09-24-topcoat-server-applications
0
// Глобальные переменные
uint8_t *map = NULL;
int map_width = 0;
int map_height = 0;
bool load_level(const char *filename) {
FILE *file = fopen(filename, "r");
if (!file) {
printf("Ошибка: Не удалось открыть файл %s\n", filename);
return false;
}
char lines[512][512];
int h = 0;
char buffer[512];
while (fgets(buffer, sizeof(buffer), file)) {
buffer[strcspn(buffer, "\r\n")] = 0;
if (buffer[0] == '\0' || buffer[0] == ';') continue;
bool contains_map_char = false;
for(int i=0; buffer[i]; i++) {
if (strchr("#$@.*+ ", buffer[i])) {
contains_map_char = true;
break;
}
}
if (contains_map_char) {
strncpy(lines[h], buffer, 511);
h++;
if (h >= 512) break;
}
if (h > 0 && buffer[0] == '\0') break;
}
fclose(file);
if (h == 0) return false;
int w = 0;
for (int i = 0; i < h; i++) {
int len = strlen(lines[i]);
if (len > w) w = len;
}
map = malloc(w * h * sizeof(uint8_t));
map_width = w;
map_height = h;
memset(map, CELL_EMPTY, w * h);
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
char c = (x < (int)strlen(lines[y])) ? lines[y][x] : ' ';
if (c == '#') map[y * w + x] = CELL_WALL;
else if (c == '$') map[y * w + x] = CELL_CUBE;
else if (c == '.') map[y * w + x] = CELL_TARGET;
else if (c == '*') map[y * w + x] = CELL_CUBE_ON_TARGET;
else if (c == '@') { map[y * w + x] = CELL_EMPTY; playerX = x; playerY = y; }
else if (c == '+') { map[y * w + x] = CELL_TARGET; playerX = x; playerY = y; }
else map[y * w + x] = CELL_EMPTY;
}
}
return true;
}
Загружалка уровня сокобана, сгенерированная нейронкой
0
char *SomeGlobalPointer {};
void foo()
{
SomeGlobalPointer = new char[1024];
}
int main()
{
foo();
if (!SomeGlobalPointer)
{
delete[] SomeGlobalPointer;
}
return 0;
}
Отсюдова:
https://pvs-studio.ru/ru/blog/posts/cpp/1068/
−2
public class WeaponHold : MonoBehaviour
{
public bool equip;
public float distance = 0.3f;
public RaycastHit2D hit;
public Transform holdPoint; //Здесь задаются координаты дочернего объекта у игрока
public float put = 1f;
public void Update()
{
if (Input.GetKeyDown(KeyCode.F))
{
if (!equip)
{
Physics2D.queriesStartInColliders = false;
hit = Physics2D.Raycast(transform.position, Vector2.right * transform.localScale.x, distance);
if (hit.collider != null && hit.collider.tag == "Gun")
{
equip = true;
Debug.Log("Оружие видно");
}
}
}
else
{
equip = false;
if (hit.collider.gameObject.GetComponent<Rigidbody2D>() != null)
{
hit.collider.gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(transform.localScale.x, 1) * put;
}
}
if (equip)
{
Debug.Log("Оружие перемещено");
hit.collider.gameObject.transform.position = holdPoint.position; //Здесь мы поднимаем дробовик, перемещая его к дочернему объекту
}
}
private void OnDrawGizmos()
{
Gizmos.color = Color.red; //Прорисовка RayCast
Gizmos.DrawLine(transform.position, transform.position + Vector3.right * transform.localScale.x * distance);
}
}
Подбирание и выкидывание оружия
0
#include <clcpp/clcpp.h>
#include <clcpp/FunctionCall.h>
// Reflect the entire namespace and implement each class
clcpp_reflect(TestClassImpl)
namespace TestClassImpl
{
class A
{
public:
A()
{
x = 1;
y = 2;
z = 3;
}
int x, y, z;
};
struct B
{
B()
{
a = 1.5f;
b = 2.5f;
c = 3.5f;
}
float a, b, c;
};
}
clcpp_impl_class(TestClassImpl::A)
clcpp_impl_class(TestClassImpl::B)
void TestConstructorDestructor(clcpp::Database& db)
{
const clcpp::Class* ca = clcpp::GetType<TestClassImpl::A>()->AsClass();
const clcpp::Class* cb = clcpp::GetType<TestClassImpl::B>()->AsClass();
TestClassImpl::A* a = (TestClassImpl::A*)new char[sizeof(TestClassImpl::A)];
TestClassImpl::B* b = (TestClassImpl::B*)new char[sizeof(TestClassImpl::B)];
CallFunction(ca->constructor, a);
CallFunction(cb->constructor, b);
CallFunction(ca->destructor, a);
CallFunction(cb->destructor, b);
delete [] (char*) a;
delete [] (char*) b;
}
https://github.com/Celtoys/clReflect/blob/master/src/clReflectTest/TestClassImpl.cpp