- 1
- 2
- 3
<input type="hidden" name="lang" value="<?= LANG ?>"/>
<input type="hidden" name="ID" value=<?= $arResult["ID"] ?>/>
<input type="hidden" name="LOGIN" value=<?= $arResult["arUser"]["LOGIN"] ?>/>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
<input type="hidden" name="lang" value="<?= LANG ?>"/>
<input type="hidden" name="ID" value=<?= $arResult["ID"] ?>/>
<input type="hidden" name="LOGIN" value=<?= $arResult["arUser"]["LOGIN"] ?>/>
Кусок формы редактирования профиля.. Отвлечемся от горячо любимой CMS и сконцентрируемся на сути...
Кодер так спешил, что решил просто type="text" превратить в хиддены. Бог с ним что это дает юзеру намек на то как сменить логин.
Но он забыл кавычки. ID проходит через IntVal и это не заметно. А вот к логину при каждом сохранении дописывается "/", юзера не выкидывает. А вот в следующий раз он должен угадать сколько слэшей добавить к логину. Да и логин запретили менять наверное не просто так, а потому что при регистрации туда прописывается мыло, а вот при апдейте юзера уже не трогают это...
0
# https://www.fusionticket.org/ cms для продажи билетов
// файл includes/classes/class.router.php
if(is_null($action)){
if (isset($_POST['action'])) {
$action=$_POST['action'];
} elseif (isset($_GET['action'])) {
$action=$_GET['action'];
} else
$action=false;
}
$_REQUEST['action'] = $action;
$_GET['action'] = $action;
$_POST['action'] = $action;
//echo $controller,'-',$module, '-',$action;
// теперь с class.router.php попадаем сюда includes/template/web/shop.tpl
{if $smarty.post.action eq 'resendpassword'}
{$user->forgot_password_f($smarty.post.email)}
{/if}
{if $smarty.request.action eq 'login' and $smarty.request.type != 'block'}
{include file="user_login.tpl"}
{elseif $smarty.request.action eq 'register'}
{if $smarty.request.register_user}
{user->register ismember=true data=$smarty.post secure='user_nospam' login=true}
{assign var='user_data' value=$smarty.post}
{if $user_errors}
{include file="user_register.tpl" ManualRegister=true}
{else}
{include file="user_activate.tpl"}
{/if}
{else}
{include file="user_register.tpl" ManualRegister=true}
{/if}
{elseif $smarty.request.action eq 'activate'}
{include file="user_activate.tpl"}
{elseif $smarty.request.action eq 'resend_activation'}
{include file="resend_activation.tpl"}
{elseif $smarty.get.action eq "remove"}
{$cart->remove_item_f($smarty.get.event_id,$smarty.get.cat_id,$smarty.get.item)}
{include file="cart_view.tpl"}
{elseif $smarty.request.action eq "addtocart"}
{if $smarty.post.place}
{assign var='last_item' value=$cart->add_item_f($smarty.post.event_id, $smarty.post.category_id, $smarty.post.place, $smarty.post.discount, 'mode_web')}
{else}
{assign var='last_item' value=$cart->add_item_f($smarty.post.event_id, $smarty.post.category_id, $smarty.post.places, $smarty.post.discount, 'mode_web')}
{/if}
{if $last_item}
{redirect url="index.php?action=view_cart&event_id={$smarty.post.event_id}"}
{else}
{include file="event_ordering.tpl"}
{/if}
{elseif $smarty.request.action eq "buy"}
{include file="event_ordering.tpl"}
и т. д. 250 строк.
https://www.fusionticket.org/.
+7
<?php
$ip=$_SERVER[REMOTE_ADDR];
if ($_GET['hash']="ae2b1fca515949e5d54fb22b8ed95575") {
file_put_contents("deviceupdate.log","DATE: ".date("Y-m-d H:i:s")." IP: ".$ip."\n",FILE_APPEND | LOCK_EX);
file_put_contents("homeip.log",$ip,LOCK_EX);
print "DATE: ".date("Y-m-d H:i:s")." IP: ".$ip;
}
?>
http://wiki.mikrotik.com/wiki/Dynamic_DNS_on_private_DNS_server_(Route r_OS,_Bind,_Apache,_and_Shell_script)
> Web server reads the IP from the router and if the hash is ok, it writes the IP into two files in the same folder
> if the hash is ok
Ок.
−1
public function getRegProductDetails($product_id = '', $status = 'yes'){
$this->db->select('*');
if ($product_id != '') {
$this->db->where('product_id', $product_id);
}
if ($status != '') {
$this->db->where('active', $status);
}
$query = $this->db->get('registration_package');
foreach ($query->result_array() as $row) {
$product_details[] = $row;
}
return $product_details;
Работаю с коммерческой системой, писали Индусы. У меня 100 Мб анекдотов в исходном коде. В БД есть столбец статус, они туда пишут статус yes OR no. И проверка везде тоже идет через строку. а выборку делают вот такой функцией. Зачем тут проверять статус на пустоту? В других подобных функциях встречаю RETURN в форейче
+3
if(substr($_POST['id'], -3) == '_id'){
echo mpql(mpqw("SELECT name FROM {$conf['db']['prefix']}{$arg['modpath']}_". substr($_POST['id'], 0, strlen($_POST['id'])-3). " WHERE id=". (int)$_POST['value']), 0, 'name');
}else{
echo $_POST['value'];
}
https://github.com/mpak2/mpak.su/blob/master/modules/users/edit.свойства.php
+6
# https://github.com/mpak2/mpak.su/blob/607ee884dddc1df541aefc4f3b06ea5c2bfa4470/modules/users/pass.php
if($_POST['new'] && $_POST['new'] == $_POST['ret']){
Сравнение пароля на ==
Для тех кто не знает, http://ideone.com/yPjk4K
+4
while($r=mysql_fetch_array($q)){
$buf[$r['id']]['image_file']=$r['file'];
$r=null;
$r['id']=null;
}
return $buf;
+5
//If the array is not empty
if ($files[0] != '') {
...
}
http://valentinvannay.com/2016/01/07/laravel-5-multiple-files-upload
+10
final public function getCustomerKey()
{
return implode('', array_map('c'.'h'
.'r', explode('.', '53.51.50.52.49.51.50.50.49.51.102.100.50.57.55.54.101.54.56.51.51.57.102.55.53.102.49.57.100.54.49.98.51.51.49.56.99.53.57.48.57.49')
));
}
+8
https://github.com/mpak2/mpak.su/blob/master/include/mpfunc.php#L54
Новая система измерения файлов