/* This example script does the following: This script converts a given string into a Private Key for a specific address. Useful for extracting Private Keys in Wallet Import Format when using Distributed Trust, and mop-py to sweep coins out of the Distributed Trust address without going through Block.io. IMPORTANT! Specify your own API Key here. The network to use for the Wallet Import Format is determined from the API Key used. Contact support@block.io for any help with this. */ <?php require_once 'path/to/block_io.php'; /* Replace the $apiKey with the API Key from your Block.io Wallet. */ $apiKey = 'YOUR API KEY'; $pin = 'PIN - NOT NEEDED'; $version = 2; // the API version $block_io = new BlockIo($apiKey, $pin, $version); $network = $block_io->get_balance()->data->network; // get our current network off Block.io $passphrase = strToHex('alpha1alpha2alpha3alpha4'); $key = $block_io->initKey()->fromPassphrase($passphrase); echo "Current Network: " . $network . "\n"; echo "Private Key: " . $key->toWif($network) . "\n"; // print out the private key for the given network
function StateMsg($msgs) { $str = explode("", $msgs); $ste = 0; if (count($str) > 3) { switch ($str[0]) { case 'success': $ste = 1; break; /*成功返回*/ /*成功返回*/ case 'serror': $ste = -1; break; /*错误返回*/ } if (0 != $ste) { if (strlen($str[3]) > 1) { $mstr = '0x' . strToHex($str[3]); } else { $mstr = '""'; } $hsql = 'update task_tab set msg=' . $mstr . ",ste={$ste} where id=" . $str[1] . ' and tkey="' . $str[2] . '"'; if (!HwExec($hsql)) { WebCenterLogs('[' . $_SERVER['REMOTE_ADDR'] . ']任务状态更新-错误', $hsql); } } else { WebCenterLogs('[' . $_SERVER['REMOTE_ADDR'] . ']节点状态码-错误', "未知返回状态:\n" . $str[0]); } } else { WebCenterLogs('[' . $_SERVER['REMOTE_ADDR'] . ']节点状态码-', strToHex($msgs)); } }
public static function tokenString($userId, $departmentId, $groupId, $created) { $tokenString = array(); $tokenString['userId'] = $userId; $tokenString['departmentId'] = $departmentId; $tokenString['groupId'] = $groupId; $tokenString['created'] = $created; return strToHex(\Think\Crypt\Driver\Base64::encrypt(json_encode($tokenString), 'easonchan')); }
function encrypt($string, $key) { $result = ''; for ($i = 0; $i < strlen($string); $i++) { $char = substr($string, $i, 1); $keychar = substr($key, $i % strlen($key) - 1, 1); $char = chr(ord($char) + ord($keychar)); $result .= $char; } return strToHex($result); }
function HwCreateTask($ip, $fid, $ftr) { global $link; if (strlen($ip) > 30) { return false; } else { $node = '0x' . strToHex($ip); } $dte = date('Y-m-d H:i:s'); $key = md5($ip . Rndkeys(32) . $dte, false); $hsql = "insert into task_tab(ip,tkey,fid,fpath,dte)values({$node},'{$key}',{$fid},'{$ftr}','{$dte}')"; if (HwExec($hsql)) { echo "successCreate task Success ~!"; HwSend($ip, '32303', $key); } else { echo "errorx1Fail to create task ~!"; } return true; }
public static function verifyToken($token) { $tokenString = hexToStr($token); $jsonData = \Think\Crypt\Driver\Base64::decrypt($tokenString, 'easonchan'); $array = json_decode($jsonData, true); if ($array == null) { return false; } $created = $array['created']; $expire = BoxTokenHelper::$expire; $now = time(); if ($created + $expire < $now) { return false; } $info = new TokenInfo($array['userId'], $array['departmentId'], $array['groupId'], $array['created']); $array['created'] = time(); $tokenString = strToHex(\Think\Crypt\Driver\Base64::encrypt(json_encode($array), 'easonchan')); return array('str' => $tokenString, 'info' => $info); }
function rcon($serverip, $serverport, $rconpassword, $cmd) { $passhead = chr(0xff) . chr(0x0); $head = chr(0x42) . chr(0x45); $pass = $passhead . $rconpassword; $answer = ""; $checksum = get_checksum($pass); $loginmsg = $head . $checksum . $pass; $rcon = fsockopen("udp://" . $serverip, $serverport, $errno, $errstr, 1); stream_set_timeout($rcon, 5); if (!$rcon) { echo "ERROR: {$errno} - {$errstr}<br />\n"; } else { fwrite($rcon, $loginmsg); $res = fread($rcon, 16); $cmdhead = chr(0xff) . chr(0x1) . chr(0x0); //$cmd = "Players"; $cmd = $cmdhead . $cmd; $checksum = get_checksum($cmd); $cmdmsg = $head . $checksum . $cmd; $hlen = strlen($head . $checksum . chr(0xff) . chr(0x1)); fwrite($rcon, $cmdmsg); $answer = fread($rcon, 102400); if (strToHex(substr($answer, 9, 1)) == "0") { $count = strToHex(substr($answer, 10, 1)); //echo $count."<br/>"; for ($i = 0; $i < $count - 1; $i++) { $answer .= fread($rcon, 102400); } } //echo strToHex(substr($answer, 0, 16))."<br/>"; //echo strToHex($answer)."<br/>"; //echo $answer."<br/>"; $cmd = "Exit"; $cmd = $cmdhead . $cmd; $checksum = get_checksum($cmd); $cmdmsg = $head . $checksum . $cmd; fwrite($rcon, $cmdmsg); } return $answer; }
public function check_video($videoid) { $rows = $this->db->get_rows('videos', array(), "LIMIT 1000"); foreach ($rows as $row) { extract($row); $fh = fopen($storage, "rb"); if ($fh) { $fheader = fread($fh, 20); $fheader_hex = strToHex($fheader); $fheader_printable = preg_replace('/[\\x00-\\x1F\\x80-\\xFF]/', '', $fheader); if (in_array($fheader_printable, $this->known_formats)) { $known = "<font color='green'>[recognized]</font>"; } else { $known = "<font color='red'>[not recognized]</font>"; } $this->msg .= "File {$storage}, request {$request}, header {$fheader_printable}, hex {$fheader_hex} {$known}<br>\n"; fclose($fh); } else { $this->msg .= "File {$storage}, request {$request} not found!<br>\n"; } } }
function HwCreateTask($ip, $fid, $ftr) { global $link; if (strlen($ip) > 30) { return false; } else { $node = '0x' . strToHex($ip); } $dte = date('Y-m-d H:i:s'); $key = md5($ip . Rndkeys(32) . $dte . microtime(), false); $hsql = "insert into task_tab(ip,tkey,fid,fpath,dte)values({$node},'{$key}',{$fid},'{$ftr}','{$dte}')"; if (HwExec($hsql)) { if (HwSend($ip, '32303', $key) > -1) { echo "success{$key}Create task Success ~!"; } else { WebCenterLogs('[' . $ip . ']推送失败', $hsql); } } else { echo "errorx1{$key}Fail to create task ~!"; WebCenterLogs('[' . $ip . ']任务创建失败', $hsql); } return true; }
$objRotatividade->set_hor_entrada($hor_entrada); $objRotatividade->set_dat_cadastro($dat_cadastro); $objRotatividade->set_cod_rotatividade($cod_rotatividade); $objRotatividade->set_hor_saida($hor_saida); $objRotatividade->set_dat_saida($dat_saida); $objRotatividade->set_cod_desconto($cod_desconto); $objRotatividade->set_val_total(str_replace(",", ".", $val_total)); $objRotatividade->set_val_cobrado(str_replace(",", ".", $val_cobrado)); $objRotatividade->set_des_justificativa($des_justificativa); $objRotatividade->set_tem_permanencia($tem_permanencia); $objRotatividade->removeRotatividade($objRotatividade); $objClientes->set_des_placa($des_placa); $arrCliente = $objClientes->buscaClientes($objClientes); $cod_cliente = $arrCliente[0]['cod_cliente']; $msgRetorno = 'Veiculo liberado com sucesso'; $msgRetorno .= '<br> Deseja imprimir RPS? <a href="' . $url . 'rotatividade/index.php?imprimir=' . base64_encode(strToHex('imprimeRPS')) . '&cod_rotatividade=' . $cod_rotatividade . '&cod_cliente=' . $cod_cliente . '">Sim</a>'; $val_total = ""; } } if (isset($_GET) && !empty($_GET['imprimir'])) { $cod_rotatividade = $_GET['cod_rotatividade']; $cod_rotatividade = base64_decode(hexToStr($cod_rotatividade)); $cod_cliente = $_GET['cod_cliente']; geraRPS($cod_rotatividade, 1, $cod_cliente); Header("Location:" . $url . "rotatividade/index.php"); } if (isset($_POST) && !empty($_POST['imprimirCupomEntrada']) && $verificaImprimir == true) { $imprime_cupom = true; } //$hora_entrada = date("H:i:s"); $hora_entrada = "";
function computverifier($srp, $user, $pwd, $salt) { // private key $innerHash = $srp->hashHex(strToHex($user) . '3a' . strToHex($pwd)); $privateKey = $srp->hashHex($salt . $innerHash); // verifier $tmp = dec2hex(bcpowmod($srp->gdec(), hex2dec($privateKey), $srp->Ndec())); $verifier = str_pad($tmp, strlen($srp->Nhex()), "0", STR_PAD_LEFT); return $verifier; }
/** * handle incoming data along capabilities * @param array $data */ private function ParseData($data) { // $caps = $this->GetCaps(); //$this->debug(__FUNCTION__,print_r($this->all_caps,true)); foreach (array_keys($caps) as $cap) { $ident = $caps[$cap]; $vid = @$this->GetIDForIdent($ident); if ($vid == 0) { $this->debug(__FUNCTION__, "Cap {$cap} Ident {$ident}: Variable missed"); continue; } if (!isset($data[$cap])) { continue; } $s = $data[$cap]; switch ($cap) { //integer case 'TS': //Timestamp //Timestamp case 'Signal': //RSSI //RSSI case 'Timer': //Duration code //Duration code case 'Dimmer': //intensity 100% //intensity 100% case 'Shutter': //intensity 100% $iv = (int) $s; SetValueInteger($vid, $iv); break; //String //String case 'Name': //Duration code $st = utf8_decode($s); SetValueString($vid, $st); break; //special //special case 'Switch': //Status $state = $this->SwitchStatus($s); SetValueBoolean($vid, $state); break; case 'Lock': //Status $state = preg_match("/YES|CLOSE|OK/i", $s); //reversed SetValueBoolean($vid, $state); break; case 'Alert': //Status $state = !preg_match("/YES|ALERT/i", $s); //reversed SetValueBoolean($vid, $state); break; case 'Battery': //battery $state = !preg_match("/LOW|WARN/i", $s); //reversed SetValueBoolean($vid, $state); break; case 'FS20': //fs20 mode decoding $state = false; $intensity = 0; $timer = 0; $acode = ''; $actioncode = ''; $code = utf8_decode($s); $this->debug(__FUNCTION__, "FS20 Code " . strToHex($code)); $action = $code[0]; $ext = ord($code[1]); $tvid = @$this->GetIDForIdent($caps['Timer']); $dvid = @$this->GetIDForIdent($caps['Dimmer']); $swid = @$this->GetIDForIdent($caps['Switch']); $avid = @$this->GetIDForIdent($caps['TimerActionCode']); $this->debug(__FUNCTION__, "FS20 Vars S:{$swid},D:{$dvid},T:{$tvid},A:{$avid}"); if ($dvid) { $intensity = GetValueInteger($dvid); } if ($swid) { $state = GetValueBoolean($swid); } if ($tvid) { $timer = GetValueInteger($tvid); } if ($avid) { $acode = GetValueString($avid); } $ac = ord($action) & 0x1f; $timed = ($action & 0x20) > 0; $this->debug(__FUNCTION__, "FS20 AC:" . $ac . "PrevD:{$intensity}, PrevS:" . ($state ? "On" : "Off")); switch ($ac) { case 0: //off if ($timed) { $actioncode = 'Switch:Off'; } else { $state = false; } break; case $ac < 0xf: //Dim to value $intensity = FHZ_helper::fs20_intensity_percent($action & 0xf); $state = true; if ($timed) { $actioncode = 'Switch:Off'; } break; case 0x10: //on full $state = true; $intensity = 100; if ($timed) { $actioncode = 'Switch:Off'; } break; case 0x11: //on with old value $state = true; if ($intensity == 0) { $intensity = 100; } if ($timed) { $actioncode = 'Switch:Off'; } break; case 0x12: $state = !GetValueBoolean($swid); //toggle break; case 0x13: //dimup $steps = FHZ_helper::fs20_intensity_steps($intensity); $intensity = FHZ_helper::fs20_intensity_percent($steps + 1); $state = true; break; case 0x14: //dimdown if ($intensity == 0) { $intensity = 100; } $steps = FHZ_helper::fs20_intensity_steps($intensity); $intensity = FHZ_helper::fs20_intensity_percent($steps - 1); if ($intensity == 0) { $state = false; } break; case 0x18: //off-for-timer $state = 'Off'; $actioncode = 'Switch:On'; break; case 0x19: //on-for-timer than out $state = true; $actioncode = 'Switch:Off'; break; case 0x1a: //on-old-for-timer than out $state = true; $actioncode = 'Switch:Off'; break; case 0x1c: //ramp-on-time (time to reach the desired dim value on dimmers) $state = true; $actioncode = "Dimmer:{$intensity}"; break; case 0x1d: //ramp-off-time (time to reach the off state on dimmers) $actioncode = 'Switch:Off;Dimmer:0'; break; case 0x1e: //on-old-for-timer-prev", // old val for timer, then go to prev. state $actioncode = "Switch:" . ($state ? 'On' : 'Off'); $state = true; break; case 0x1f: //on-100-for-timer-prev", // 100% for timer, then go to previous state //new intensity will be the old one $action = "Switch:" . ($state ? 'On' : 'Off') . ";Dimmer:{$intensity}"; $intensity = 100; $state = true; break; case 0x15: //dimupdown, no value changes //dimupdown, no value changes case 0x16: //Set Timer //Set Timer case 0x17: //nop //nop case 0x1b: //rese break; } $new_timer = FHZ_helper::fs20_times($ext); $this->debug(__FUNCTION__, "State:" . ($state ? "ON" : "OFF") . ", Dimmer:{$intensity}%,Timer: {$new_timer},ActionCode: '{$actioncode}'"); //state if ($swid) { SetValueBoolean($swid, $state); } //dimmer if ($dvid) { SetValueInteger($dvid, $intensity); } //timer if ($tvid) { $this->SetTimerInterval('DeviceTimer', $new_timer * 1000); SetValueInteger($tvid, $new_timer); } //action if ($avid && $acode != $actioncode) { SetValueString($avid, $actioncode); } //log $actiontext = FHZ_helper::$fs20_codes[strToHex($action)]; if ($ext > 0) { $actiontext .= ', Timer:' . $timer; } $text = sprintf('%s (%s)', $actiontext, strToHex($code)); if ($vid) { SetValueString($vid, $text); } $this->debug(__FUNCTION__, "Action:" . $text); break; default: $this->debug(__FUNCTION__, "{$cap} not handled"); } $this->debug(__FUNCTION__, "{$cap}:({$vid})" . $s); } }
function WebCenterLogs($title, $logbody = '') { global $link; $hsql = 'insert into fw_log(jet,log,uid,ip,dte)values'; if (strlen($title) > 0) { $jet = '0x' . strToHex($title); } else { $jet = '""'; } if (strlen($logbody) > 0) { $log = '0x' . strToHex($logbody); } else { $log = '0x' . strToHex($_SERVER['HTTP_USER_AGENT']); } $ip = $_SERVER['REMOTE_ADDR']; if (isset($_SESSION['#UID'])) { $uid = $_SESSION['#UID']; } else { $uid = '"node"'; } $dte = date('Y-m-d H:i:s'); $hsql .= "({$jet},{$log},{$uid},'{$ip}','{$dte}')"; HwExec($hsql); }
if (isset($_POST) && !empty($_POST['envia'])) { $valor_pago = str_replace(",", ".", $_POST['valor_pago']); $periodo_inicial = gravaData($_POST['periodo_inicial']); $periodo_final = gravaData($_POST['periodo_final']); $data_pagamento = gravaData($_POST['data_pagamento']); $cod_cliente = $_POST['cod_cliente']; $cod_mensalidade = $_POST['cod_mensalidade']; $objMensalidadeUsuario->set_valor_pago($valor_pago); $objMensalidadeUsuario->set_periodo_inicial($periodo_inicial); $objMensalidadeUsuario->set_periodo_final($periodo_final); $objMensalidadeUsuario->set_data_pagamento($data_pagamento); $objMensalidadeUsuario->set_cod_cliente($cod_cliente); $objMensalidadeUsuario->set_cod_mensalidade($cod_mensalidade); $cod_pagamento = $objMensalidadeUsuario->cadastraPagamento(); $msgRetorno = "Pagamento registrado com sucesso"; $msgRetorno .= '<br> Deseja imprimir RPS? <a href="' . $url . 'admin/clientes/mensalidade.php?imprimir=' . base64_encode(strToHex('imprimeRPS')) . '&cod_pagamento=' . $cod_pagamento . '">Sim</a>'; $objMensalidadeUsuario->ResetObject(); } if (isset($_POST) && !empty($_POST['ImprimirComprovante'])) { $cod_mensalidade_usuario = $_POST['cod_mensalidade_usuario']; $objMensalidadeUsuario->set_cod_mensalidade_usuario($cod_mensalidade_usuario); $objMensalidadeUsuario->geraComprovante(); } if (isset($_POST) && !empty($_POST['ExcluirPagamento'])) { $cod_mensalidade_usuario = $_POST['cod_mensalidade_usuario']; $cod_cliente = $_POST['cod_cliente']; $objMensalidadeUsuario->set_cod_mensalidade_usuario($cod_mensalidade_usuario); $msgRetorno = $objMensalidadeUsuario->excluirPagamento(); } if (isset($_GET) && !empty($_GET['imprimir'])) { $cod_pagamento = $_GET['cod_pagamento'];
function Encrypt($sValue, $sSecretKey) { return strToHex(rtrim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $sSecretKey, $sValue, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))), "")); }
function strToClassName($string) { // escapes everything to "¤xx" but not 0-9, a-z, A-Z, and unicode >= (hex 00A5, dec 165) $l = mb_strlen($string, 'UTF-8'); $r = ''; for ($i = 0; $i < $l; $i++) { $c = mb_substr($string, $i, 1, 'UTF-8'); $o = ord($c); if ($o < 48 || $o > 57 && $o < 65 || $o > 90 && $o < 97 || $o > 122 && $o < 165) { $r .= '¤' . strToHex($c); } else { $r .= $c; } } return $r; }
<?php require 'hfwinc/session.php'; require 'hfwinc/rsa.php'; require 'hfwinc/hwfunction.php'; /*用户登录检测*/ if (!isset($_SESSION['#LOGIN']) || !isset($_SESSION['#UID']) || !isset($_SESSION['#DTE']) || !isset($_SESSION['#TID'])) { $hstr = explode("", trim(Priv_decrypt(HGT('info'), TRUE))); if (count($hstr) < 2) { echo 'error-num'; exit(0); } //格式不对 if (strlen($hstr[0]) > 1) { $uid = '0x' . strToHex($hstr[0]); } else { echo 'error-uid'; exit(0); } //用户名为空或小于2个字节 if (strlen($hstr[1]) > 5) { $pwd = md5($hstr[1], false); } else { echo 'error-pwd'; exit(0); } //密码为空或小于6 $hsql = "select id,nme,ste,grup from user_tab where uid={$uid} and pwd='{$pwd}'"; $result = @mysql_query($hsql, $link); if ($result != false) { if ($row = @mysql_fetch_array($result)) {
/** * parse data from device * @param array $packet * @return array */ private function parse_switch($packet) { $this->debug(__FUNCTION__, 'Parse'); $l = count($packet); if ($l != 8) { $this->debug(__FUNCTION__, 'Length wrong:' . $l . '<->8'); return false; } //if len //FS20 02 06 A2 HH HH HH AA EE $src = $packet[3] . $packet[4] . $packet[5]; $fs20data = $packet[6] . $packet[7]; $hc = FHZ_helper::bin2four($src); //prepare structure $data = array(); $data['Typ'] = 'FS20'; //Device FS20 $data['DeviceID'] = $hc; // $data['FS20'] = utf8_encode($fs20data); $data['Class'] = __CLASS__; $action = FHZ_helper::$fs20_codes[strToHex($fs20data[0])]; if (ord($fs20data[0]) > 31) { $action .= ' Timer:' . FHZ_helper::fs20_times(ord($fs20data[1])); } $text = sprintf('Device:%s(%s), Action:%s (%s)', $hc, strToHex($src), $action, strToHex($fs20data)); $this->debug(__FUNCTION__, $text); $this->SendSwitchData($data); return true; }
/** * Parse FS20 CUL Hex record * * @code * # F1F1E013A4F * # FHHHHAACCTTSS * # 0123456789012 * @endcode * -HHHH Homecode * -AA Address * -CC FS20code * -TT Timer code * -SS Signal * * @param $line */ private function parse_FS20($line) { $data = array(); $caps = "Switch:1;Timer;FS20;TimerActionCode;"; //enable action for switch and dimmer $hcode = substr($line, 1, 4); $addr = substr($line, 5, 2); $code = substr($line, 7, 2); $acode = hexdec($code); #fix if ($acode > 0x3f) { $acode = $acode & 0x3f; $code = strtoupper(sprintf("%02x", $acode)); $this->debug(__FUNCTION__, "fix Action Code {$code}, Line: {$line}"); } $hc = FHZ_helper::hex2four($hcode . $addr); $action = isset(FHZ_helper::$fs20_codes[$code]) ? FHZ_helper::$fs20_codes[$code] : ''; if (!$action) { $this->incError(); IPS_LogMessage(__CLASS__, __FUNCTION__ . ":: unknown Action Code {$code}, Line: {$line}"); return; } if (isset(FHZ_helper::$FS20_DimCodes[$code])) { $caps .= "Dimmer:1;"; } //timer if ($acode > 31) { $timer = substr($line, 9, 2); $tcode = hexdec($timer); $action .= ' Timer:' . FHZ_helper::fs20_times($tcode); } else { $tcode = 0; } $fs20data = chr($acode) . chr($tcode); //signal $rssi = 0; if (strlen($line) > 11) { $rssi = $this->GetSignal(substr($line, 11, 2)); $data['Signal'] = $rssi; $caps .= 'Signal;'; } else { //signal if (strlen($line) > 9 && $acode < 0x20) { $rssi = $this->GetSignal(substr($line, 9, 2)); $data['Signal'] = $rssi; $caps .= 'Signal;'; } } //make record $data['Typ'] = 'FS20'; //Device FS20 $data['Id'] = $hc; $data['Class'] = __CLASS__ . "-FS20"; $data['FS20'] = utf8_encode($fs20data); //send $text = sprintf('Device:%s(%s), Action:%s (%s), Signal %d', $hc, $hcode . $addr, $action, strToHex($fs20data), $rssi); $this->debug(__FUNCTION__, $text); $this->SendSwitchData($data, $caps); }
rot.des_situacao = "P" AND rot.cod_cartao = ' . $cod_cartao; $rsCartao = $objConexao->prepare($SQL); $rsCartao->execute(); if ($rsCartao != false) { if ($rsCartao->rowCount() > 0) { while ($cartao = $rsCartao->fetch(PDO::FETCH_ASSOC)) { $des_placa = $cartao['des_placa']; $hor_entrada = $cartao['hor_entrada']; $dat_entrada = $cartao['dat_cadastro']; $hora_saida = date("H:i:s"); $dat_saida = date("Y-m-d"); $cod_marca = $cartao['cod_marca']; $cod_modelo = $cartao['cod_modelo']; $des_cor = $cartao['des_cor']; $des_situacao = $cartao['des_situacao']; $cod_rotatividade = strToHex(base64_encode($cartao['cod_rotatividade'])); if ($_GET["cod_preco"] != "") { $cod_preco = $_GET['cod_preco']; } else { $cod_preco = $cartao['cod_preco']; } $data1 = $dat_entrada . " " . $hor_entrada; $data2 = $dat_saida . " " . $hora_saida; $minutos = calculaMinutos($data1, $data2); if ($minutos < 1440) { $dat_entrada = ""; } else { $dat_entrada = mostraData($dat_entrada); } $objPrecos->set_cod_preco($cod_preco); $arrPreco = $objPrecos->buscaPrecoPagar($objPrecos, $minutos);
IMPORTANT! Specify your own API Key and Secret PIN in this code. Keep your Secret PIN safe at all times. Contact support@block.io for any help with this. */ <?php require_once '/path/to/block_io.php'; /* Replace the $apiKey with the API Key from your Block.io Wallet. A different API key exists for Dogecoin, Dogecoin Testnet, Litecoin, Litecoin Testnet, etc. */ $apiKey = 'DogecoinTestnetAPIKey'; $pin = 'SecretPin'; $version = 2; // the API version $block_io = new BlockIo($apiKey, $pin, $version); // create 4 keys for a 3 of 4 MultiSig address (1 key is Block.io's, added automatically by Block.io) $passphrases = [strToHex('alpha1alpha2alpha3alpha4'), strToHex('alpha2alpha3alpha4alpha1'), strToHex('alpha3alpha4alpha1alpha2'), strToHex('alpha4alpha1alpha2alpha3')]; $keys = [$block_io->initKey()->fromPassphrase($passphrases[0]), $block_io->initKey()->fromPassphrase($passphrases[1]), $block_io->initKey()->fromPassphrase($passphrases[2]), $block_io->initKey()->fromPassphrase($passphrases[3])]; // create an address with label 'dTrust1' that requires 3 of 4 signatures from the above keys $pubKeyStr = $keys[0]->getPublicKey() . "," . $keys[1]->getPublicKey() . "," . $keys[2]->getPublicKey() . "," . $keys[3]->getPublicKey(); $dTrustAddress = ""; echo "*** Creating Address with 4 Signers, and 3 Required Signatures: " . "\n"; try { $response = $block_io->get_new_dtrust_address(array('label' => 'dTrust1', 'public_keys' => $pubKeyStr, 'required_signatures' => 3)); $dTrustAddress = $response->data->address; } catch (Exception $e) { // print the exception below for debugging // echo "Exception: " . $e->getMessage() . "\n"; // the label must exist, let's get its address then $dTrustAddress = $block_io->get_dtrust_address_by_label(array('label' => 'dTrust1'))->data->address; } echo "*** Address with Label=dTrust1: " . $dTrustAddress . "\n";
/** * Create a new WSDev instance and set its properties * @param array $data parsed record * @param String $caps String semicolon seperated capabilities of this device * @return int new Instance ID */ private function CreateWSDevice($data, $caps) { $instID = 0; $Device = $data['Id']; $typ = $data['Typ']; $ModuleID = $this->module_interfaces['WSDEV']; if (IPS_ModuleExists($ModuleID)) { //return $result; $this->debug(__FUNCTION__, "Create Device {$Device},Type {$typ}"); $instID = IPS_CreateInstance($ModuleID); if ($instID > 0) { IPS_ConnectInstance($instID, $this->InstanceID); //Parents are ourself! IPS_SetProperty($instID, 'DeviceID', $Device); IPS_SetProperty($instID, 'Class', __CLASS__); IPS_SetProperty($instID, 'Typ', $typ); IPS_SetProperty($instID, 'CapList', $caps); IPS_SetProperty($instID, 'Debug', $this->isDebug()); //follow debug settings from splitter switch ($Device) { case 0: case $Device < 8: IPS_SetName($instID, 'Sensor ' . $Device); break; case 8: IPS_SetName($instID, 'KombiSensor'); break; case 9: IPS_SetName($instID, 'InnenSensor'); break; default: IPS_SetName($instID, "unknown Sensor('" . strToHex($Device) . "')"); break; } //switch $ident = __CLASS__ . "_WS_{$Device}"; $ident = preg_replace("/\\W/", "_", $ident); //nicht-Buchstaben/zahlen entfernen IPS_SetIdent($instID, $ident); IPS_ApplyChanges($instID); $cat = $this->GetCategory(); $pcat = $this->GetParentCategory(); $ident = preg_replace("/\\W/", "_", $cat); //nicht-Buchstaben/zahlen entfernen $catid = @IPS_GetObjectIDByIdent($ident, $pcat); if ($catid == 0) { $catid = IPS_CreateCategory(); IPS_SetName($catid, $cat); if (IPS_SetIdent($catid, $ident) && IPS_SetParent($catid, $pcat)) { IPS_LogMessage(__CLASS__, "Category {$cat} Ident {$ident} ({$catid}) created"); } else { IPS_LogMessage(__CLASS__, "Category {$cat} Ident {$ident} ({$catid}) FAILED"); } } $this->debug(__FUNCTION__, "Category:{$catid}"); if (!IPS_SetParent($instID, $catid)) { $this->debug(__FUNCTION__, "SetParent to Cat {$catid} failed"); } $this->debug(__FUNCTION__, 'New ID:' . $instID); //if instID //set willi profile for forecast $vid = @IPS_GetObjectIDByIdent('Forecast', $instID); if ($vid > 0) { IPS_SetVariableCustomProfile($vid, "WS300_Willi"); } } else { $this->debug(__FUNCTION__, 'Instance is not created!'); } } //module exists return $instID; }
$smarty->assign('boardMemberName', array()); $smarty->assign('boardMemberFirstName', array()); $smarty->assign('boardMemberLastName', array()); $smarty->assign('boardMemberEmail', array()); $smarty->assign('boardMemberHomePhone', array()); $smarty->assign('boardMemberWorkPhone', array()); $smarty->assign('boardMemberCellPhone', array()); $smarty->assign('boardMemberDuties', array()); $smarty->assign('boardMemberImageSize', array()); foreach ($BoardMembersArray as $BoardMember) { $count++; $smarty->append('boardMemberID', $BoardMember->get_boardMemberID()); $smarty->append('boardMemberName', $BoardMember->get_boardMemberFirstName() . ' ' . $BoardMember->get_boardMemberLastName()); $smarty->append('boardMemberFirstName', $BoardMember->get_boardMemberFirstName()); $smarty->append('boardMemberLastName', $BoardMember->get_boardMemberLastName()); $smarty->append('boardMemberEmail', strToHex($BoardMember->get_boardMemberEmail())); $smarty->append('boardMemberHomePhone', $BoardMember->get_boardMemberHomePhone()); $smarty->append('boardMemberWorkPhone', $BoardMember->get_boardMemberWorkPhone()); $smarty->append('boardMemberCellPhone', $BoardMember->get_boardMemberCellPhone()); $smarty->append('boardMemberDuties', $BoardMember->get_boardMemberDuties()); if ($BoardMember->get_boardMemberImageWidth() > 0) { $smarty->append('boardMemberImageSize', imageSize($BoardMember->get_boardMemberImageWidth(), $BoardMember->get_boardMemberImageWidth(), $BoardMember->get_imageMaxWidth())); } else { $smarty->append('boardMemberImageSize', 0); } } $smarty->assign('count', $count); } // Build the page require 'global_begin.php'; $smarty->display('public/boardmembers.tpl');
function setup_boardmembers() { global $smarty; require_once 'com/tcshl/board/BoardMember.php'; require_once 'com/tcshl/board/BoardMembers.php'; // Build list of board members $BoardMembers = new BoardMembers(); $BoardMembersArray = $BoardMembers->get_BoardMemberArray(0); if (count($BoardMembersArray) > 0) { $boardMemberCount = 0; $smarty->assign('boardMemberID', array()); $smarty->assign('boardMemberName', array()); $smarty->assign('boardMemberFirstName', array()); $smarty->assign('boardMemberLastName', array()); $smarty->assign('boardMemberEmail', array()); $smarty->assign('boardMemberHomePhone', array()); $smarty->assign('boardMemberWorkPhone', array()); $smarty->assign('boardMemberCellPhone', array()); $smarty->assign('boardMemberDuties', array()); foreach ($BoardMembersArray as $BoardMember) { $boardMemberCount++; $smarty->append('boardMemberID', $BoardMember->get_boardMemberID()); $smarty->append('boardMemberName', $BoardMember->get_boardMemberFirstName() . ' ' . $BoardMember->get_boardMemberLastName()); $smarty->append('boardMemberFirstName', $BoardMember->get_boardMemberFirstName()); $smarty->append('boardMemberLastName', $BoardMember->get_boardMemberLastName()); $smarty->append('boardMemberEmail', strToHex($BoardMember->get_boardMemberEmail())); $smarty->append('boardMemberHomePhone', $BoardMember->get_boardMemberHomePhone()); $smarty->append('boardMemberWorkPhone', $BoardMember->get_boardMemberWorkPhone()); $smarty->append('boardMemberCellPhone', $BoardMember->get_boardMemberCellPhone()); $smarty->append('boardMemberDuties', $BoardMember->get_boardMemberDuties()); } $smarty->assign('boardMemberCount', $boardMemberCount); } }
function passremind($email, $serverlist, $passremind) { global $tpl; global $db; global $lang_error; global $config; global $lang_title; global $resp; if ($passremind) { if (!$email) { $info = '<div class="alert alert-error" style="margin:0px;"><strong>' . $lang_error['all_info'] . '</strong><br>' . $lang_error['err_field'] . '</div>'; return $info; } if (!$resp->is_valid) { $info = '<div class="alert alert-error" style="margin:0px;"><strong>' . $lang_error['all_info'] . '</strong><br>' . $lang_error['err_01.5'] . '</div>'; return $info; } if ($serverlist == 0) { $info = '<div class="alert alert-error" style="margin:0px;"><strong>' . $lang_error['all_info'] . '</strong><br>' . $lang_error['err_01.3'] . '</div>'; return $info; } $sql = $db->query("SELECT * FROM accounts WHERE pEmail='{$email}'") or die(mysql_error()); if ($row = $db->fetch_assoc($sql)) { $username = $row['Name']; $change = rand(111111111, 999999999); $db->query("UPDATE accounts SET pPodarok1 = '{$change}' WHERE Name = '{$username}'") or die(mysql_error()); $sendmails = ' Уважаемый игрок! <br><br> Прежде всего выражаем Вам свою благодарность за доверие, оказанное серверам ' . $config['home_title'] . '! Вы сделали правильный выбор. <br><br> Для восстановления пароля (Имя пользователя: ' . $username . ', Cервер: ' . $serverlist . ') перейдите по ссылке:<br> <a href="' . $config['http_home_url'] . 'confirmation/' . strToHex($serverlist) . '-' . $change . '-' . strToHex($username) . '/" target="_blank">' . $config['http_home_url'] . 'confirmation/' . strToHex($serverlist) . '-' . $change . '-' . strToHex($username) . '/</a> <br><br> СЛУЖБА ПОДДЕРЖКИ<br><br>Вы всегда можете обратиться в нашу Службу поддержки по адресу: <a href="http://forum.samp-rp.kz/" target="_blank">http://forum.samp-rp.kz/</a><br> Убедительная просьба не отвечать на данное сообщение. Поддержка осуществляется только посредством форумов. <br><br> --<br> С уважением,<br> игровой сервер ' . $config['home_title'] . ' / <a href="http://www.samp-rp.kz/" target="_blank">http://www.samp-rp.kz/</a>'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= "Reply-To: " . $config['mail_email'] . "\r\n"; $headers .= 'Content-type: text/html; charset="windows-1251"' . "\r\n"; $headers .= "From: " . $config['mail_from'] . " <" . $config['mail_email'] . ">\r\n"; if ($config['mail'] == "smtp") { require_once ENGINE_DIR . '/classes/mail.class.php'; $result = smtpmail($email, $lang_title['ti_remind2'] . $username, $sendmails, $headers); if (!$result) { $info = '<div class="alert alert-error" style="margin:0px;"><strong>' . $lang_error['all_info'] . '</strong><br>' . $lang_error['err_email.1'] . $result . '</div>'; return $info; } else { $info = '<div class="alert alert-success" style="margin:0px;"><strong>' . $lang_error['all_info'] . '</strong><br>' . $lang_error['ok_email.2'] . '</div>'; return $info; } } else { $result = mail($email, $lang_title['ti_remind'], $sendmails, $headers); if (!$result) { $info = '<div class="alert alert-error" style="margin:0px;"><strong>' . $lang_error['all_info'] . '</strong><br>' . $lang_error['err_email.1'] . $result . '</div>'; return $info; } else { $info = '<div class="alert alert-success" style="margin:0px;"><strong>' . $lang_error['all_info'] . '</strong><br>' . $lang_error['ok_email.2'] . '</div>'; return $info; } } } else { $info = '<div class="alert alert-error" style="margin:0px;"><strong>' . $lang_error['all_info'] . '</strong><br>' . $lang_error['err_email.2'] . '</div>'; return $info; } } }
function CheckTaskState() { global $link; $tkey = HGT('info'); if (strlen($tkey) > 30) { $tkey = '0x' . strToHex($tkey); } else { echo "keyerr"; exit; } $hsql = 'select ste,msg from task_tab where tkey=' . $tkey; if ($result = mysql_query($hsql, $link)) { $row = mysql_fetch_array($result); switch ((int) $row['ste']) { case 0: echo "wait"; break; case 1: HwExec('delete from task_tab where tkey=' . $tkey); echo "success"; break; case -1: echo "error" . $row['msg']; break; default: echo "unknowerror"; break; } mysql_free_result($result); } else { echo "chkerror"; } }
* Date: 07.02.2016 * Time: 13:48 */ function strToHex($string) { $hex = ''; for ($i = 0; $i < strlen($string); $i++) { $ord = ord($string[$i]); $hexCode = dechex($ord); $hex .= substr('0' . $hexCode, -2); } return strToUpper($hex); } function hexToStr($hex) { $string = ''; for ($i = 0; $i < strlen($hex) - 1; $i += 2) { $string .= chr(hexdec($hex[$i] . $hex[$i + 1])); } return $string; } $key = '1234567890'; $method = 'aes-256-cbc'; $iv = openssl_random_pseudo_bytes(16); $plaintext = 'SECRET'; printf("PLAINTEXT: %s , HEX: %s \n", $plaintext, strToHex($plaintext)); $encrypted = openssl_encrypt($plaintext, $method, $key, OPENSSL_RAW_DATA, $iv); printf("ENCRYPTED(HEX): %s \n", strToHex($encrypted)); $decrypted = openssl_decrypt($encrypted, $method, $key, OPENSSL_RAW_DATA, $iv); printf("DECRYPTED: %s , HEX: %s \n", $decrypted, strToHex($decrypted));
if (!socket_sendto($txsock, $input, strlen($input), 0, $server, $txport)) { $errorcode = socket_last_error(); $errormsg = socket_strerror($errorcode); die("Could not send data: [{$errorcode}] {$errormsg} \n"); } //Now receive reply from server and print it if (socket_recv($txsock, $reply, 2045, MSG_WAITALL) === FALSE) { $errorcode = socket_last_error(); $errormsg = socket_strerror($errorcode); die("Could not receive data: [{$errorcode}] {$errormsg} \n"); } $data = unpack("H*", $reply); //unpack the binary data //e("two"); //var_dump($data[1]); $hex = strToHex($data[1]); var_dump($hex); echo "Reply : {$reply}"; } function hexToStr($hex) { $string = ''; //var_dump($hex); for ($i = 0; $i < sizeof($hex); $i++) { $string .= chr($hex[$i]); } // e($string); return $string; } function strToHex($string) {
</font> </div></br></br></br><center> <img src="../images/Less-36.jpg" /> </br> </br> </br> </br> </br> <font size='4' color= "#33FFFF"> <?php function strToHex($string) { $hex = ''; for ($i = 0; $i < strlen($string); $i++) { $hex .= dechex(ord($string[$i])); } return $hex; } echo "Hint: The Query String you input is escaped as : " . $id . "<br>"; echo "The Query String you input in Hex becomes : " . strToHex($id); ?> </center> </font> </body> </html>