function c_register() { $email = $_POST['email']; $pass = $_POST['pass']; $conf_pass = $_POST['conf_pass']; $name = $_POST['name']; $phone = $_POST['phone']; if ($email != null && $pass != null && $conf_pass != null && $name != null && $phone != null) { if ($pass == $conf_pass) { $model_return = $this->model->m_register($email, $pass, $name, $phone); if ($model_return > 0) { Session::set('user', $email); setcookie('user', Session::get('user'), 0, APP_W); Sleep(1); header('Location: ' . APP_W . 'users'); } else { echo "<br/>Error al intentar crear el usuario."; } } else { echo "<br/>Las password no coinciden."; } } else { echo "<br/>Rellena todos los campos."; } }
function c_rating() { $score = $_POST['score']; $user = $_POST['user']; $ad = $_POST['ad']; $model_return = $this->model->m_rating($score, $user, $ad); Sleep(1); echo $model_return; }
function loop($parameters) { $start = time(); $this->PerformWork(); $this->lastAttempt = $now = time(); $time_diff = $now - $start; $interval = $this->checkInterval(); if ($time_diff < $interval) { Sleep($interval - $time_diff); } }
function c_post() { $title = $_POST['title']; $description = $_POST['description']; $image = $_POST['image']; $model_return = $this->model->m_post($title, $description, $image); Sleep(1); if ($model_return == 0) { header('Location: ' . APP_W . 'home'); } else { echo "Error: " . $model_return; } }
function set_depth_offset($offset) { global $dest; $command = shell_exec("command-group-function {$dest} 5 128267 3=" . sprintf("%04x", $offset)); $analyzed = shell_exec("echo '{$command}' | analyzer 2>/dev/null"); echo "Sending request to device {$dest}: {$analyzed}\n"; $response = n2k_request_response($command, 'set-depth-offset'); show_command_response($response); Sleep(0.2); $response = n2k_request_response(null, 'set-depth-offset'); if (array_key_exists(128267, $response) && is_array($response[128267])) { echo "New depth sentence\n"; print_r($response[128267]); } }
protected function pre_action_login() { $userid = $_POST['userid']; $security = new Security(); if ($security->check_password($userid, $_POST['pw'], $expired)) { $this->login_phase1($userid); if ($expired) { $_SESSION['expired'] = true; $security->store_verification($userid, 0); } $this->transfer('loginverify.php', array('action_start' => '1')); } else { Sleep(2); $this->transfer('login.php', array('msg' => 'User ID and/or password are invalid')); } }
function CloseCreate($pwdString) { $this->CloseCreateStep(); Sleep(3); $this->__Crypt($pwdString); @unlink($_SERVER["DOCUMENT_ROOT"] . $this->serverLogTmp); }
function RuCenter_Contract_Register($Settings, $PepsonID, $Person, $DomainZone) { /****************************************************************************/ $__args_types = array('array', 'string', 'array', 'string'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ $HTTP = array('Address' => $Settings['Address'], 'Port' => $Settings['Port'], 'Host' => $Settings['Address'], 'Protocol' => $Settings['Protocol'], 'Charset' => 'KOI8-R', 'IsLogging' => $Settings['Params']['IsLogging']); #----------------------------------------------------------------------------- $Query = array(); #--------------------------------------------------------------------------- $RequestID = UniqID('ID'); #--------------------------------------------------------------------------- $Query[] = 'lang: ru'; $Query[] = 'request: contract'; $Query[] = 'operation: create'; $Query[] = SPrintF('login: %s', $Settings['Login']); $Query[] = SPrintF('password: %s', $Settings['Password']); $Query[] = SPrintF('request-id: %s', $RequestID); #--------------------------------------------------------------------------- $Query[] = ''; #--------------------------------------------------------------------------- $Query[] = '[contract]'; $Query[] = SPrintF('password: %s', UniqID()); $Query[] = SPrintF('tech-password: %s', UniqID()); $Query[] = 'currency-id: RUR'; #--------------------------------------------------------------------------- $Query[] = ''; #--------------------------------------------------------------------------- switch ($PepsonID) { case 'Natural': #----------------------------------------------------------------------- $Query[] = 'contract-type: PRS'; $Query[] = SPrintF('person: %s %s %s', Translit($Person['Name']), Mb_SubStr(Translit($Person['Lastname']), 0, 1), Translit($Person['Sourname'])); $Query[] = SPrintF('person-r: %s %s %s', $Person['Sourname'], $Person['Name'], $Person['Lastname']); $Query[] = SPrintF('country: %s', isset($Person['PasportCountry']) ? $Person['PasportCountry'] : $Person['pCountry']); $Query[] = SPrintF('phone: %s', $Person['Phone']); $Query[] = SPrintF('fax-no: %s', $Person['Fax']); $Query[] = SPrintF('birth-date: %s', $Person['BornDate']); $Query[] = SPrintF('passport: %s %s выдан %s, %s', $Person['PasportLine'], $Person['PasportNum'], $Person['PasportWhom'], $Person['PasportDate']); $Query[] = SPrintF('p-addr: %s, %s, %s, %s %s, %s', $Person['pIndex'], $Person['pState'], $Person['pCity'], $Person['pType'], $Person['pAddress'], $Person['pRecipient']); $Query[] = SPrintF('e-mail: %s', $Person['Email']); break; case 'Juridical': #----------------------------------------------------------------------- $Query[] = 'client-type: ORG'; $Query[] = SPrintF('org: %s %s', Translit($Person['CompanyName']), Translit($Person['CompanyFormFull'])); $Query[] = SPrintF('org-r: %s', SPrintF('%s "%s"', $Person['CompanyFormFull'], $Person['CompanyName'])); $Query[] = SPrintF('country: %s', $Person['jCountry']); $Query[] = SPrintF('e-mail: %s', $Person['Email']); $Query[] = SPrintF('phone: %s', $Person['Phone']); $Query[] = SPrintF('fax-no: %s', $Person['Fax']); $Query[] = SPrintF('code: %s', $Person['Inn']); $Query[] = SPrintF('kpp: %s', $Person['Kpp']); $Query[] = SPrintF('address-r: %s, %s, %s, %s %s', $Person['jIndex'], $Person['jState'], $Person['jCity'], $Person['jType'], $Person['jAddress']); $Query[] = SPrintF('p-addr: %s, %s, %s, %s %s, %s "%s"', $Person['pIndex'], $Person['pState'], $Person['pCity'], $Person['pType'], $Person['pAddress'], $Person['CompanyFormFull'], $Person['CompanyName']); $Query[] = SPrintF('d-addr: %s, %s, %s, %s %s', $Person['jIndex'], $Person['jState'], $Person['jCity'], $Person['jType'], $Person['jAddress']); break; default: return new gException('WRONG_PROFILE_ID', 'Неверный идентификатор профиля'); } #----------------------------------------------------------------------------- $Result = HTTP_Send('/dns/dealer', $HTTP, array(), array('SimpleRequest' => Implode("\n", $Query))); if (Is_Error($Result)) { return ERROR | @Trigger_Error('[RuCenter_Contract_Register]: не удалось выполнить запрос к серверу'); } #----------------------------------------------------------------------------- if (Preg_Match('/HTTP\\/1.0\\s502/i', $Result['Heads'])) { return false; } #----------------------------------------------------------------------------- $Result = Trim($Result['Body']); #----------------------------------------------------------------------------- if (Preg_Match('/State:\\s([0-9]+)/', $Result, $CodeID)) { #--------------------------------------------------------------------------- $CodeID = Next($CodeID); #--------------------------------------------------------------------------- switch ($CodeID) { case '200': #----------------------------------------------------------------------- if (!Preg_Match('/nic-hdl:\\s([0-9]+\\/[A-Z\\-]+)/', $Result, $ContractID)) { return new gException('LOGIN_NOT_FOUND', 'Неудалось получить номер договора'); } else { $ContractID = Next($ContractID); } break; case '500': return FALSE; default: return new gException('WRONG_ERROR', SPrintF('Неизвестный статус ошибки (%s)', $Result)); } } else { return new gException('WRONG_ANSWER', $Result); } #----------------------------------------------------------------------------- # Делаем паузу перед запросом Sleep(10); #----------------------------------------------------------------------------- if (!In_Array($DomainZone, array('ru', 'su'))) { #--------------------------------------------------------------------------- $Query = array(); #--------------------------------------------------------------------------- $RequestID = UniqID('ID'); #--------------------------------------------------------------------------- $Query[] = SPrintF('login: %s', $Settings['Login']); $Query[] = SPrintF('password: %s', $Settings['Password']); $Query[] = SPrintF('subject-contract: %s', $ContractID); $Query[] = 'request: contact'; $Query[] = 'operation: create'; $Query[] = 'lang: ru'; $Query[] = SPrintF('request-id: %s', $RequestID); #--------------------------------------------------------------------------- $Query[] = ''; #--------------------------------------------------------------------------- $Query[] = '[contact]'; $Query[] = SPrintF('status:registrant'); $Query[] = SPrintF('org:'); $Query[] = SPrintF('name: %s, %s', Translit($Person['Name']), Translit($Person['Lastname'])); $Query[] = SPrintF('country: %s', isset($Person['PasportCountry']) ? $Person['PasportCountry'] : $Person['pCountry']); $Query[] = SPrintF('region: %s', Translit($Person['pCity'])); $Query[] = SPrintF('city: %s', Translit($Person['pCity'])); $Query[] = SPrintF('street: %s', Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress']))); $Query[] = SPrintF('zipcode: %s', $Person['pIndex']); $Query[] = SPrintF('phone: %s', $Person['Phone']); $Query[] = SPrintF('fax: %s', $Person['Fax']); $Query[] = SPrintF('email: %s', $Person['Email']); #--------------------------------------------------------------------------- $Result = HTTP_Send('/dns/dealer', $HTTP, array(), array('SimpleRequest' => Implode("\n", $Query))); if (Is_Error($Result)) { return ERROR | @Trigger_Error('[RuCenter_Contract_Register]: не удалось выполнить запрос к серверу'); } #--------------------------------------------------------------------------- if (Preg_Match('/HTTP\\/1.0\\s502/i', $Result['Heads'])) { return FALSE; } #--------------------------------------------------------------------------- $Result = Trim($Result['Body']); #--------------------------------------------------------------------------- if (Preg_Match('/State:\\s([0-9]+)/', $Result, $CodeID)) { #------------------------------------------------------------------------- $CodeID = Next($CodeID); #------------------------------------------------------------------------- switch ($CodeID) { case '200': #----------------------------------------------------------------------- if (!Preg_Match('/nic-hdl:([0-9A-Za-z\\-]+)/', $Result, $NicHDL)) { return array('TicketID' => SPrintF('%s:%s', $ContractID, Next($NicHDL))); } #----------------------------------------------------------------------- return new gException('LOGIN_NOT_FOUND', 'Неудалось получить номер договора'); case '500': return FALSE; default: return new gException('WRONG_ERROR', SPrintF('Неизвестный статус ошибки (%s)', $Result)); } } else { return new gException('WRONG_ANSWER', $Result); } } #----------------------------------------------------------------------------- return array('TicketID' => $ContractID); }
#------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- # crutch added by lissyara. With big query, system task may not execute, because # it executed last, after all other $IsUpdate = DB_Update('Tasks', array('CreateDate' => Time()), array('Where' => '`UserID` = 1')); if (Is_Error($IsUpdate)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- echo SPrintF("%s in %s: Waiting %u seconds...\n\n", Date('Y-m-d', Time()), Date('H:i:s', Time()), $Config['Tasks']['SleepTime']); #------------------------------------------------------------------------------- Sleep($Config['Tasks']['SleepTime']); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $FreeLock = DB_Query(SPrintF("SELECT RELEASE_LOCK('%s')", $LockID)); if (Is_Error($FreeLock)) { return ERROR | @Trigger_Error('[Demon]: не удалось сбросить блокировку'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return Date('r'); #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
function request_speed_calibration() { global $dest; $command = shell_exec("request-group-function {$dest} 5 126208 1=0087 3=04 4=29"); echo "Sending request to device {$dest} to report PGN 126208 PID 41: {$command}\n"; $analyzed = shell_exec("echo '{$command}' | analyzer 2>/dev/null"); echo "Sending request to device {$dest} to report PGN 126208 PID 41: {$analyzed}\n"; $response = n2k_request_response($command, 'Request Speed Calibration'); show_command_response($response); Sleep(2); $response = n2k_request_response(null, 'request-access-level'); show_airmar_data($response); }
// Beginning of the script // ------------------------------------------------------------------------------ echo "----- begin parser.php v" . FB_PARSER_VER . " -----\r\n"; include_once AMFPHP_BASE . "amf/io/AMFDeserializer.php"; include_once AMFPHP_BASE . "amf/io/AMFSerializer.php"; $argv = $GLOBALS['argv']; $cmd = $argv[1]; $_SESSION['userId'] = $argv[2]; $_SESSION['flashRevision'] = $argv[3]; $_SESSION['token'] = $argv[4]; if (!empty($cmd) && !empty($_SESSION['userId']) && !empty($_SESSION['flashRevision']) && !empty($_SESSION['token'])) { } else { AddLog2("Error: Missing Initial Configuration Values (Bot fuBar'd)"); } define('farmer', GetFarmserver()); define('farmer_url', GetFarmUrl()); // execute command switch ($cmd) { case 'runparser': $work_timer_start = time(); GetUnitList(); Parser_Get_Locale(); Do_Work(); $work_timer_end = time() - $work_timer_start; AddLog2("##### Work completed in: {$work_timer_end} sec #####\r\n"); Sleep(15); break; default: AddLog2("Error: Invalid Command Sent to Parser (Bot fuBar'd)"); } $_SESSION['vDataDB'] = null;
/** * Resume the upload token with the uploaded file optionally at a given offset * * @param file $fileData * @param bool $finalChunk * @param float $resumeAt */ protected function handleResume($fileData, $finalChunk, $resumeAt) { $uploadFilePath = $this->_uploadToken->getUploadTempPath(); if (!file_exists($uploadFilePath)) { throw new kUploadTokenException("Temp file [{$uploadFilePath}] was not found when trying to resume", kUploadTokenException::UPLOAD_TOKEN_FILE_NOT_FOUND_FOR_RESUME); } $sourceFilePath = $fileData['tmp_name']; if ($resumeAt != -1) { // if this is the final chunk the expected file size would be the resume position + the last chunk size $expectedFileSize = $finalChunk ? $resumeAt + filesize($sourceFilePath) : 0; rename($sourceFilePath, "{$uploadFilePath}.chunk.{$resumeAt}"); $uploadFinalChunkMaxAppendTime = kConf::get('upload_final_chunk_max_append_time', 'local', 30); // if finalChunk, try appending chunks till reaching expected file size for up to 30 seconds while sleeping for 1 second each iteration $count = 0; do { if ($count++) { Sleep(1); } $currentFileSize = self::appendAvailableChunks($uploadFilePath); KalturaLog::log("handleResume iteration: {$count} finalChunk: {$finalChunk} filesize: {$currentFileSize}"); } while ($finalChunk && $currentFileSize != $expectedFileSize && $count < $uploadFinalChunkMaxAppendTime); if ($finalChunk && $currentFileSize != $expectedFileSize) { throw new kUploadTokenException("final size {$currentFileSize} failed to match expected size {$expectedFileSize}", kUploadTokenException::UPLOAD_TOKEN_CANNOT_MATCH_EXPECTED_SIZE); } } else { $uploadFileResource = fopen($uploadFilePath, 'r+b'); fseek($uploadFileResource, 0, SEEK_END); self::appendChunk($sourceFilePath, $uploadFileResource); fclose($uploadFileResource); } }
/** * @Then /^I cancel the Examnination event$/ */ public function iCancelTheExamninationEvent() { $examination = $this->getPage('Examination'); Sleep(5); $examination->CancelExaminationEvent(); }
public function operate(kOperator $operator = null, $inFilePath, $configFilePath = null) { /* * Creating unique output folder for nbrPlay/Webex sessions. * This is required in order to support concurrent conversion sessions, * because the nbrPlay tool generates temp files with the same name. * Upon completion move the generated file into the 'regular' outFilePath */ $saveOutPath = $this->outFilePath; $path_parts = pathinfo($this->outFilePath); $outDir = realpath($path_parts['dirname']); /* * The temp folder name */ $tempFolder = "{$outDir}/" . $path_parts['basename'] . ".webex_temp_folder"; $tempOutPath = "{$tempFolder}/" . $path_parts['basename']; if (!file_exists($tempFolder)) { $oldUmask = umask(00); $result = @mkdir($tempFolder, 0777, true); umask($oldUmask); } /* * Switch to temp forlder */ $this->outFilePath = $tempOutPath; $rv = parent::operate($operator, $inFilePath, $configFilePath); /* * Restore the original */ if (file_exists($tempOutPath)) { $outFilelist = kFile::dirList($tempFolder); if (isset($outFilelist) && count($outFilelist) > 0) { foreach ($outFilelist as $fileName) { for ($tries = 0; $tries < 5; $tries++) { $toFile = "{$outDir}/" . pathinfo($fileName, PATHINFO_BASENAME); $rv = kFile::moveFile($fileName, $toFile); if (!file_exists($fileName)) { break; } KalturaLog::err("Failed to move ({$fileName}) to ({$toFile})"); Sleep(60); } } Sleep(60); rmdir($tempFolder); } } $this->outFilePath = $saveOutPath; return $rv; }
sort($filesBlock, SORT_STRING); foreach ($filesBlock as $file) { file_put_contents($output, $op . ' ' . $file . "\r\n", FILE_APPEND); $op = 'D'; } if ($i !== $lastIndex) { file_put_contents($output, "================================================================\r\n", FILE_APPEND); $filesBlock = array(); } } } file_put_contents($output, "============================ Finish ============================", FILE_APPEND); $timeEnd = microtime(true); $time = $timeEnd - $timeStart; echo "Done in {$time} seconds. Thank you!\n"; Sleep(3); //================================================================ // Common //================================================================ class file { function __construct($path) { $this->shortHash = FALSE; $this->fullHash = FALSE; $this->path = $path; $this->fileSize = filesize($path); if ($this->fileSize === FALSE) { $this->fileSize = 0; } $this->fileSize = str_pad($this->fileSize, 12, '0', STR_PAD_LEFT);
*/ /* do NOT run this script through a web browser */ if (!isset($_SERVER['argv'][0])) { die("<br><strong>" . _("This script is only meant to run at the command line.") . '</strong>'); } /* let PHP run just as long as it has to */ ini_set('max_execution_time', '0'); $no_http_headers = true; require dirname(__FILE__) . '/include/global.php'; $event_manager_interval = read_config_option('event_manager_interval'); log_save('Event Manager Starting', SEV_INFO, FACIL_POLLER, '', 0, 0, 0, true); $counter = time() - $event_manager_interval; while (true) { /* We want to have the event manager process every XX seconds, so sleep until its processing time */ while ($counter > time() - $event_manager_interval) { Sleep(1); } /* Start our timer now, so it includes the actual processing time in the processing interval */ $counter = time(); /* Set the status to show which events are being processed */ $status_id = event_save_status(); /* Get all events so we can begin processing */ $events = event_list(array('status' => $status_id)); /* Loop through each event for processing */ foreach ($events as $event) { log_save('Processing Event ' . $event['id'], SEV_INFO, FACIL_POLLER, '', 0, 0, 0, true); event_process($event['id']); } /* Remove all events that were set to be processed */ event_deleted_processed($status_id); if (date('s', time()) < $event_manager_interval) {
<?php # Open buy order $oid = @ComprarAltcoins($min, $comprarbtc, $alt_id); # Verify if the buy order was ok if ($oid == 0) { RefazerTrade("<h3 class='erro'>[ERRO] Ocorreu um erro ao criar as ordens!</h3>"); } # Fix the flush force_flush(); # For each 5 seconds we will try to open a buy order while we still have time ( specified before ) $tentativas = 0; while (@$Cryptsy->checkSpecificOrder($oid, $alt_id)) { $tentativas++; Sleep(5); if ($tentativas > $tempo * 60 / 5) { $Cryptsy->apiQuery("cancelorder", array("orderid" => $oid)); RefazerTrade("<h2>Não consegui fazer trade desta vez! :( ORDEM CANCELADA. Tentando novamente... </h2>"); } } # Completed buy order notice echo "<h2>[COMPRA] Ordem Fechada.</h2>"; # Altcoin quantity $comprarbtc_nofee = GetAltcoinAmmount($trading, $min); $comprarbtc = GetAltcoinFreeFee($comprarbtc_nofee, $fee); # Generate sell order $oid = @VenderBitcoins($max, $comprarbtc, $alt_id); # Verify if the sell order was ok if ($oid == 0) { RefazerTrade("<h3 class='erro'>[ERRO] Ocorreu um erro ao criar as ordens!</h3>");