- 1
- 2
$code = 'eval($code);';
eval($code);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+56.5
$code = 'eval($code);';
eval($code);
Дзен-PHP
+23
<?php
class Admin_ClientsController extends Page_Controller_Admin
{
protected $_idMenu = 20;
public function init()
{
parent::init();
}
public function indexAction()
{
$this->view->scripts[] = 'jquery';
$this->view->scripts[] = 'jquery.center';
$tClients = new Db_Table_Clients();
$this->view->clients = $tClients->fetchAll('confirm = 0', 'name ASC');
$this->view->countConfirmedClients = $tClients->fetchAll('confirm = 1')->count();
$this->renderScript('body.phtml');
}
public function actionAction()
{
if ($this->_request->isPost()) {
$clientId = $this->_request->getPost();
$action = $clientId['action'];
$tClients = new Db_Table_Clients();
unset($clientId['action']);
foreach($clientId as $key => $value) {
echo $value;
if ($action == 'confirm') {
$tClients->update(array('confirm' => 1), 'id = ' . $value);
$client = $tClients->fetchRow('id = ' . $value);
$this->view->dealer = new Zend_Mail('windows-1251');
$mail = new Zend_Mail('windows-1251');
$mail->addTo($this->view->dealer->email);
$mail->setFrom('[email protected]', '');
$mail->setSubject('Регистрация нового дилера на сайте компании Оконные технологии');
$mail->setBodyHtml($this->view->render('clients/email.phtml'), 'windows-1251', Zend_Mime::ENCODING_8BIT);
//$tr = new Zend_Mail_Transport_Smtp('mail.hostland.ru');
//Zend_Mail::setDefaultTransport($tr);
try {
$mail->send();
} catch (Exception $e)
{
}
} elseif ($action == 'delete') {
$tClients->delete('id = ' . $value);
} elseif ($action == 'allow') {
$tClients->update(array('access' => 1), 'id = ' . $value);
} elseif ($action == 'denied') {
$tClients->update(array('access' => 0), 'id = ' . $value);
}
}
$this->_redirect($_SERVER['HTTP_REFERER']);
}
$this->_redirect('/admin/clients/');
}
public function confirmAction()
{
if ($this->_request->isPost()) {
$clientId = $this->_request->getPost();
var_dump($clientId);
$tClients = new Db_Table_Clients();
foreach($tClients as $key => $value) {
$tClients->update(array('confirm' => 1), 'id = ' . $value);
}
}
//$this->_redirect('/admin/clients/');
}
public function editAction()
{
$id = $this->_request->getParam('id');
if ($id == null) {
return $this->_redirect('/admin/clients/');
}
$tClients = new Db_Table_Clients();
if ($this->_request->isXmlHttpRequest()) {
$this->view->client = $tClients->fetchRow('id = ' . $id);
} elseif ($this->_request->isPost()) {
$name = $this->_request->getPost('name', '');
$login = $this->_request->getPost('login', '');
$password = $this->_request->getPost('password', '');
$description = $this->_request->getPost('description');
$email = $this->_request->getPost('email');
$access = $this->_request->getPost('access', 0);
if ($name == null or $password == null) {
$messager = new Zend_Session_Namespace('messager');
$messager->error = 'Поле «Имя» и «Пароль» должны быть заполнены';
} else {
+3
public void SetDirty()
{
ViewState.SetDirty(false);
}
Отличное название для функции ;-)
+15.7
switch (true) {
case $formid == 'search_form' :
case $formid == 'search_theme_form' :
$form['#action'] = getlangpref() . ltrim($form['#action'], '/');
$form['#submit']['gpcustom_customsubmit'] = array();
break;
case $formid == 'localizernode_translations' :
foreach ( $form['languages'] as $key => $value ) {
if ( !is_array($value['#options']) ) continue;
asort($form['languages'][$key]['#options']);
}
break;
case $formid == 'contact_mail_page' :
if ( $url = variable_get('gpcustom-contact-form-redirect', false) ) $form['#redirect'] = $url;
break;
}
Долго медитировал над этим кодом...
Чую, чувак уже достиг нирваны, в отличае от меня...
(Кусок из Дрюпального модуля)
+29
int main ()
{{{
return 0;
}}}
Я любил делать так... От этого хуже работать не будет, но вызывает вопросительное выражение лица.
−11.8
protected string TryToUpper(string text)
{
StringBuilder sb = new StringBuilder();
foreach(char t in text)
{
try
{
sb.Append(t.ToString().ToUpper());
}
catch
{
sb.Append(t.ToString());
}
}
return sb.ToString();
}
+30
void ListViewCtrl::SetEditableColumn(int col, bool editable)
{
while(col >= static_cast<int>(editableCols_.size()))
{
editableCols_.push_back(true);
}
editableCols_[col] = editable;
}
std::vector<bool> editableCols_;
вектор булов используется в ListView для того чтобы указать является ли столбец редактируемым...
p.s. польские паттерны)
0
(ql:quickload :cl-json)
(defmacro penetrate-json (val shifrate)
`(if (null ,shifrate)
,val)
`(case ,shifrate
(#XA (penetrate-json (car ,val) (cadr ,shifrate)))
(#XF (penetrate-json (cdr ,val) (cadr ,shifrate)))
(#XFF (penetrate-json (caadar ,val) (cadr ,shifrate)))
(#XFA (penetrate-json (cddddr ,val) (cadr ,shifrate)))
(#XAF (penetrate-json (caddar ,val) (cadr ,shifrate)))
(#XFFF (penetrate-json (cdaadr ,val) (cadr ,shifrate)))
(#XFAF (penetrate-json (cddadr ,val) (cadr ,shifrate)))
(#XAAA (penetrate-json (caaddr ,val) (cadr ,shifrate)))))
(let ((parsed (with-open-file (stream "C:/Users/lisps/PycharmProjects/pythonProject/.venv/Scripts/commonlisp/test" :direction :input)
(json:decode-json-from-source stream))))
(setf (cdadar (penetrate-json (assoc :pidorasik parsed) `(,#XA ,#XFAF ,#XFFF ,#XAF ,#XF ,#XAAA ,#XFAF ,#XFF))) 100) ; oh my fucking gosh
(with-open-file (stream "C:/Users/lisps/PycharmProjects/pythonProject/.venv/Scripts/commonlisp/test" :direction :output :if-exists :supersede)
(json:encode-json parsed stream)))
car/cdr ад
+1
int iseven(long long int number)
{
struct Num {
unsigned int x:1;
unsigned int y:31;
unsigned int z:32;
} num = (*(struct Num*)(&number));
return num.x; //Если результат 1, то нечётное.
}
Функция определения чётности числа посредством возврата младшего бита.
0
longlong ** FUN_14000e5a0(longlong **param_1,LPCWSTR param_2,int param_3,uint param_4)
{
uint uVar1;
longlong **pplVar2;
longlong **hFile;
longlong *plVar3;
longlong **pplVar4;
DWORD DVar5;
LONG local_38;
undefined4 uStack_34;
pplVar4 = (longlong **)0x0;
uVar1 = param_4 & 0x1f;
if ((param_4 & 0x1f) == 0) {
uVar1 = 2;
}
pplVar2 = FUN_1400119f8(DAT_1400213a0,(longlong)param_1);
if (pplVar2 == (longlong **)0x0) {
return (longlong **)0x0;
}
if (param_3 == 1) {
DVar5 = (DWORD)((param_4 >> 0x11 & 1) != 0);
if ((param_4 >> 0x12 & 1) != 0) {
DVar5 = 7;
}
hFile = (longlong **)
CreateFileW(param_2,0x80000000,DVar5,(LPSECURITY_ATTRIBUTES)0x0,3,0x80,(HANDLE)0x0);
LAB_14000e70c:
if (hFile == (longlong **)0xffffffffffffffff) goto LAB_14000e7ad;
}
else {
if (param_3 == 2) {
DVar5 = (DWORD)((param_4 >> 0x11 & 1) != 0);
if ((param_4 >> 0x12 & 1) != 0) {
DVar5 = 7;
}
hFile = (longlong **)
CreateFileW(param_2,0xc0000000,DVar5,(LPSECURITY_ATTRIBUTES)0x0,4,0x80,(HANDLE)0x0);
goto LAB_14000e70c;
}
if (param_3 != 3) {
hFile = (longlong **)CONCAT44(uStack_34,local_38);
goto LAB_14000e70c;
}
DVar5 = (DWORD)((param_4 >> 0x11 & 1) != 0);
if ((param_4 >> 0x12 & 1) != 0) {
DVar5 = 7;
}
hFile = (longlong **)
CreateFileW(param_2,0xc0000000,DVar5,(LPSECURITY_ATTRIBUTES)0x0,2,0x80,(HANDLE)0x0);
if (hFile == (longlong **)0xffffffffffffffff) {
hFile = (longlong **)
CreateFileW(param_2,0x40000000,DVar5,(LPSECURITY_ATTRIBUTES)0x0,5,0,(HANDLE)0x0);
goto LAB_14000e70c;
}
}
if (hFile != (longlong **)0x0) {
if ((DAT_14001f140 == 0) || ((param_4 >> 0x13 & 1) != 0)) {
pplVar2[1] = (longlong *)0x0;
}
else {
plVar3 = (longlong *)HeapAlloc(DAT_1400204cc,0,(longlong)DAT_14001f140);
pplVar2[1] = plVar3;
}
*pplVar2 = (longlong *)hFile;
*(int *)(pplVar2 + 2) = DAT_14001f140;
*(undefined4 *)((longlong)pplVar2 + 0x14) = 0;
*(uint *)(pplVar2 + 4) = uVar1;
*(uint *)((longlong)pplVar2 + 0x24) = (uint)(param_3 == 1);
*(undefined4 *)((longlong)pplVar2 + 0x1c) = 1;
if ((param_3 == 2) && ((param_4 >> 0x14 & 1) != 0)) {
local_38 = 0;
SetFilePointer(hFile,0,&local_38,2);
}
pplVar4 = hFile;
if (param_1 == (longlong **)0xffffffffffffffff) {
pplVar4 = pplVar2;
}
if (pplVar4 != (longlong **)0x0) {
return pplVar4;
}
}
LAB_14000e7ad:
if (param_1 == (longlong **)0xffffffffffffffff) {
param_1 = pplVar2;
}
FUN_14001192c(DAT_1400213a0,(longlong)param_1);
return pplVar4;
}