<?php
 
	 
	function A1Lite_processor ($t,$secret)
	{
		$params = array(	
							'tid' => $t['tid'],
							'name' => $t['name'], 
							'comment' => $t['comment'],
							'partner_id' => $t['partner_id'],
							'service_id' => $t['service_id'],
							'order_id' => $t['order_id'],
							'type' => $t['type'],
							'partner_income' => $t['partner_income'],
							'system_income' => $t['system_income'],
							'test'  => 1
		);
		 
	    $params['check'] = md5(join('', array_values($params)) . $secret);

		if ($params['check'] === $t['check'])
		{		
		    $str   = str_replace('', '', $t['name'])	
		    $arr   = explode('/', $str]);
			$tarif = array(
			               3  => 3,
			               4  => 5,
						   10 => 10,
						   20 => 20
						   );
			
			
			if(!empty($tarif[$arr[0]]))
			    $arr[0] = 3;
				
			$udata = explode(":||:", $text);
			$udata[14] = intval($udata[14] + $arr[0]);
			$text  = implode(":||:", $udata); 
			file_put_contents("L2dbnam/esql2db/reg/$arr[1].dat", $text);
			file_put_contents("L2dbnam/esql2db/pay.dat", date('Y-m-d') .' / '. $arr[1] .' / '. $arr[0] ."\r\n", FILE_APPEND);							
			echo "Персонажу ". $arr[1] ." зачислено ". $arr[0] ." Coin of Luck";
		
		}

    	return $ok;
	}

// Пример вызова функции. 
 
    $secret = '09071989';
    A1Lite_processor($_POST, $secret);