- 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
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
+1
#pragma aux __cdecl "_*" \
parm caller [ ] \
value struct float struct routine [eax] \
modify [eax ecx edx]
0
#define debut {
#define fin }
#define si if
#define alors {
#define sinon } else {
#define sinonsi } else if
#define repeter do {
#define jusqua } while (!
#define choix switch
#define quand case
#define retourner return
какой gaffe))