- 1
- 2
if(strlen($refnumber)==1) $refnumber="00".$refnumber;
if(strlen($refnumber)==2) $refnumber="0".$refnumber;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+157
if(strlen($refnumber)==1) $refnumber="00".$refnumber;
if(strlen($refnumber)==2) $refnumber="0".$refnumber;
+156
if($check==1) $check="экзамен";
if($check==2) $check="зачет";
if($check==0) $check="пусто";
+156
if(isItMe($msg->id_from,$id_ssid_user))
{
$echo_message->chat_user_img = ($msg->toimg ? $msg->toimg : "/img/user.png");
}else{
$echo_message->chat_user_img = ($msg->fromimg ? $msg->fromimg : "/img/user.png");
}
if(isItMe($msg->id_from,$id_ssid_user))
{
$echo_message->chat_user_firstname = $msg->tofirst;
$echo_message->chat_user_lastname = $msg->tolast;
$id_see=$msg->id_to;
}else
{
$echo_message->chat_user_firstname = $msg->fromfirst;
$echo_message->chat_user_lastname = $msg->fromlast;
$id_see=$msg->id_from;
}
+156
function isItMe($fromid,$id_this)
{
return ($fromid==$id_this ? true : false);
}
+159
if($semester==1||$semester==2) $course = 1;
if($semester==3||$semester==4) $course = 2;
if($semester==5||$semester==6) $course = 3;
if($semester==7||$semester==8) $course = 4;
+156
if(!$id_year)
{
echo json_encode(array("status"=>"missing_year"));
exit();
}
if(!$group_id)
{
echo json_encode(array("status"=>"missing_group"));
exit();
}
if(!$lesson_id)
{
echo json_encode(array("status"=>"missing_lesson"));
exit();
}
+155
//допускаются только перечисленные роли пользователей
foreach ($roles as $role) {
switch ($role) {
case 'admin':
$role_id=1;
break;
case 'teacher':
$role_id=2;
break;
case 'student':
$role_id=3;
break;
case 'parent':
$role_id=4;
break;
default:
$role_id=0;
break;
}
if ($this->usersmod->checkRole($user_id,$role_id)) return true;
+157
class ModelCheckoutOrder extends Model {
public function addOrder($data) {
$data['login']=md5(rand(0,100).rand(0,100).rand(0,100).rand(0,100).rand(0,100).rand(0,100).rand(0,100).rand(0,100).rand(0,100));
$this->db->query("INSERT INTO `" . DB_PREFIX . "order` SET login='".$data['login']."',invoice_prefix = '" . $this->db->escape($data['invoice_prefix']) . "', store_id = '" . (int)$data['store_id'] . "', store_name = '" . $this->db->escape($data['store_name']) . "', store_url = '" . $this->db->escape($data['store_url']) . "', customer_id = '" . (int)$data['customer_id'] . "', customer_group_id = '" . (int)$data['customer_group_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', payment_firstname = '" . $this->db->escape($data['payment_firstname']) . "', payment_lastname = '" . $this->db->escape($data['payment_lastname']) . "', payment_company = '" . $this->db->escape($data['payment_company']) . "', payment_company_id = '" . $this->db->escape($data['payment_company_id']) . "', payment_tax_id = '" . $this->db->escape($data['payment_tax_id']) . "', payment_address_1 = '" . $this->db->escape($data['payment_address_1']) . "', payment_address_2 = '" . $this->db->escape($data['payment_address_2']) . "', payment_city = '" . $this->db->escape($data['payment_city']) . "', payment_postcode = '" . $this->db->escape($data['payment_postcode']) . "', payment_country = '" . $this->db->escape($data['payment_country']) . "', payment_country_id = '" . (int)$data['payment_country_id'] . "', payment_zone = '" . $this->db->escape($data['payment_zone']) . "', payment_zone_id = '" . (int)$data['payment_zone_id'] . "', payment_address_format = '" . $this->db->escape($data['payment_address_format']) . "', payment_method = '" . $this->db->escape($data['payment_method']) . "', payment_code = '" . $this->db->escape($data['payment_code']) . "', shipping_firstname = '" . $this->db->escape($data['shipping_firstname']) . "', shipping_lastname = '" . $this->db->escape($data['shipping_lastname']) . "', shipping_company = '" . $this->db->escape($data['shipping_company']) . "', shipping_address_1 = '" . $this->db->escape($data['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($data['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($data['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($data['shipping_postcode']) . "', shipping_country = '" . $this->db->escape($data['shipping_country']) . "', shipping_country_id = '" . (int)$data['shipping_country_id'] . "', shipping_zone = '" . $this->db->escape($data['shipping_zone']) . "', shipping_zone_id = '" . (int)$data['shipping_zone_id'] . "', shipping_address_format = '" . $this->db->escape($data['shipping_address_format']) . "', shipping_method = '" . $this->db->escape($data['shipping_method']) . "', shipping_code = '" . $this->db->escape($data['shipping_code']) . "', comment = '" . $this->db->escape($data['comment']) . "', total = '" . (float)$data['total'] . "', affiliate_id = '" . (int)$data['affiliate_id'] . "', commission = '" . (float)$data['commission'] . "', language_id = '" . (int)$data['language_id'] . "', currency_id = '" . (int)$data['currency_id'] . "', currency_code = '" . $this->db->escape($data['currency_code']) . "', currency_value = '" . (float)$data['currency_value'] . "', ip = '" . $this->db->escape($data['ip']) . "', forwarded_ip = '" . $this->db->escape($data['forwarded_ip']) . "', user_agent = '" . $this->db->escape($data['user_agent']) . "', accept_language = '" . $this->db->escape($data['accept_language']) . "', date_added = NOW(), date_modified = NOW()");
$order_id = $this->db->getLastId();
foreach ($data['products'] as $product) {
$this->db->query("INSERT INTO " . DB_PREFIX . "order_product SET order_id = '" . (int)$order_id . "', product_id = '" . (int)$product['product_id'] . "', name = '" . $this->db->escape($product['name']) . "', model = '" . $this->db->escape($product['model']) . "', quantity = '" . (int)$product['quantity'] . "', price = '" . (float)$product['price'] . "', total = '" . (float)$product['total'] . "', tax = '" . (float)$product['tax'] . "', reward = '" . (int)$product['reward'] . "'");
$order_product_id = $this->db->getLastId();
foreach ($product['option'] as $option) {
$this->db->query("INSERT INTO " . DB_PREFIX . "order_option SET order_id = '" . (int)$order_id . "', order_product_id = '" . (int)$order_product_id . "', product_option_id = '" . (int)$option['product_option_id'] . "', product_option_value_id = '" . (int)$option['product_option_value_id'] . "', name = '" . $this->db->escape($option['name']) . "', `value` = '" . $this->db->escape($option['value']) . "', `type` = '" . $this->db->escape($option['type']) . "'");
}
foreach ($product['download'] as $download) {
$this->db->query("INSERT INTO " . DB_PREFIX . "order_download SET order_id = '" . (int)$order_id . "', order_product_id = '" . (int)$order_product_id . "', name = '" . $this->db->escape($download['name']) . "', filename = '" . $this->db->escape($download['filename']) . "', mask = '" . $this->db->escape($download['mask']) . "', remaining = '" . (int)($download['remaining'] * $product['quantity']) . "'");
}
}
И это известный движок интернет-магазина OpenCart???
\catalog\model\checkout\order.php
+160
function viplogin() {
global $lang, $userrec;
$ret="<div class=viplogin>".array_pop($var1=mqfa("select id, mixtxt$lang from txts where name='viplogin'")).(!INADMIN?"":"<input style=\"width:35px;\" type=button class=\"changebtn\" value=\"Edit 721\" onclick=\"window.open('edit.php?table=txts&id=$var1[id]&&'+Math.random(),'_blank','toolbar=0, scrollbars=1, resizable=1, width=653, height=620');\">")."</div>".($userrec["local"] || $userrec["isadmin"]?"<a href=# onclick=\"window.open('txted.php?lang=$lang&id=$var1[id]','_blank','width=700, height=500')\">edit</a>":"");
$ret.="<center><a href=\"".echolink("lang=$lang&page=buyvip")."\">".echoword2("buyvip")."</a></center>";
return $ret;
}
как правильно логинить важных пользователей
+156
function mydqs($s="") {
global $dellink,$origqs;
$dellink="";
if (!$s) $s=$_SERVER["QUERY_STRING"];
$key="qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890 &=";
$orig="qXbn BrZ7tiJz1Hva4mx0KCY6hfV&LGAejIO=TsdgF5E3uPwkp8NScyWlRQo2MD9U";
$i=0;
$len=5;
$ret="";
$s=urldecode($s);
while ($i<strlen($s)) {
$i2=0;
$retchar=$s[$i];
while ($i2<strlen($orig)) {
if ($s[$i]==$orig[$i2]) {
$pos=$i2-$i%$len;
if ($pos<0) $pos+=strlen($orig);
$retchar=$key[$pos];
}
$i2++;
}
$i++;
$ret.=$retchar;
}
$pcs=explode("&",$ret);
foreach ($pcs as $k=>$v) {
if ($v=="") continue;
$vs=explode("=",$v);
$vs[1]=str_replace("'","\\'",$vs[1]);
@eval("global \$$vs[0];\$$vs[0]='$vs[1]';");
if (substr($vs[0],0,1)!="_") $dellink.="&$vs[0]=$vs[1]";
}
$origqs=$ret;
return $ret;
}
что делает этот метод?