Example #1
0
function DB_Query($Query)
{
    /******************************************************************************/
    $__args_types = array('string');
    #-------------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /******************************************************************************/
    $Link =& Link_Get('DB');
    #-------------------------------------------------------------------------------
    if (!Is_Object($Link)) {
        #-------------------------------------------------------------------------------
        $Config = Config();
        #-------------------------------------------------------------------------------
        $Link = new MySQL($Config['DBConnection']);
        #-------------------------------------------------------------------------------
        if (Is_Error($Link->Open())) {
            #-------------------------------------------------------------------------------
            $Link = NULL;
            #-------------------------------------------------------------------------------
            return ERROR | @Trigger_Error('[DB_Query]: невозможно соединиться с базой данных');
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
        if (Is_Error($Link->SelectDB())) {
            #-------------------------------------------------------------------------------
            $Link = NULL;
            #-------------------------------------------------------------------------------
            return ERROR | @Trigger_Error('[DB_Query]: невозможно выбрать базу данных');
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    list($Micro, $Seconds) = Explode(' ', MicroTime());
    #-------------------------------------------------------------------------------
    $StartTime = $Micro + $Seconds;
    #-------------------------------------------------------------------------------
    $Result = $Link->Query($Query);
    #-------------------------------------------------------------------------------
    list($Micro, $Seconds) = Explode(' ', MicroTime());
    #-------------------------------------------------------------------------------
    $EndTime = $Micro + $Seconds;
    #-------------------------------------------------------------------------------
    $GLOBALS['__TIME_MYSQL'] = $GLOBALS['__TIME_MYSQL'] + $EndTime - $StartTime;
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    if (Is_Error($Result)) {
        return ERROR | @Trigger_Error('[DB_Query]: невозможно осуществить запрос');
    }
    #-------------------------------------------------------------------------------
    $GLOBALS['__COUNTER_MYSQL']++;
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    return $Result;
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
}
Example #2
0
 function WriteToLog($txt, $level)
 {
     $this->logLevel = IntVal(COption::GetOptionString("mail", "smtp_log_level", "4"));
     if ($this->logLevel < $level) {
         return;
     }
     if (MicroTime(true) - $this->startPeriodTimeTruncate > 600) {
         if ($this->logFile) {
             FClose($this->logFile);
         }
         $this->logFile = null;
         if (File_Exists($_SERVER["DOCUMENT_ROOT"] . $this->logFileName)) {
             $logSize = @FileSize($_SERVER["DOCUMENT_ROOT"] . $this->logFileName);
             $logSize = IntVal($logSize);
             if ($logSize > $this->logMaxSize) {
                 if (($fp = @FOpen($_SERVER["DOCUMENT_ROOT"] . $this->logFileName, "rb")) && ($fp1 = @FOpen($_SERVER["DOCUMENT_ROOT"] . $this->logFileName . "_", "wb"))) {
                     $iSeekLen = IntVal($logSize - $this->logMaxSize / 2.0);
                     FSeek($fp, $iSeekLen);
                     @FWrite($fp1, "Truncated " . Date("Y-m-d H:i:s") . "\n---------------------------------\n");
                     do {
                         $data = FRead($fp, 8192);
                         if (StrLen($data) == 0) {
                             break;
                         }
                         @FWrite($fp1, $data);
                     } while (true);
                     @FClose($fp);
                     @FClose($fp1);
                     @Copy($_SERVER["DOCUMENT_ROOT"] . $this->logFileName . "_", $_SERVER["DOCUMENT_ROOT"] . $this->logFileName);
                     @UnLink($_SERVER["DOCUMENT_ROOT"] . $this->logFileName . "_");
                 }
             }
             ClearStatCache();
         }
         $this->startPeriodTimeTruncate = MicroTime(true);
     }
     if (!$this->logFile || $this->logFile == null) {
         $this->logFile = FOpen($_SERVER["DOCUMENT_ROOT"] . $this->logFileName, "a");
     }
     if (!$this->logFile) {
         echo "Can't write to log\n---------------------------------\n";
         return;
     }
     FWrite($this->logFile, Date("Y-m-d H:i:s") . "\t" . trim($txt) . "\n");
     FFlush($this->logFile);
     //if ($level > 4)
     echo trim($txt) . "\n---------------------------------\n";
 }
Example #3
0
 public function LoadSteam($apiKey)
 {
     $this->Timers['Steam'] = MicroTime(true);
     $steamSearchPlayers = array_chunk($this->Players, 100);
     $builder = '';
     $chunks = array();
     $c = 0;
     foreach ($steamSearchPlayers as $key => $value) {
         foreach ($value as $k => $v) {
             $builder .= $v->SteamId;
             if (end($value) != $v) {
                 $builder .= ',';
             } elseif (end($value) == $v) {
                 $chunks[] = $builder;
                 $builder = '';
             }
         }
     }
     $presponses = array();
     $bresponses = array();
     foreach ($chunks as $key => $value) {
         if (empty($value)) {
             continue;
         }
         // $curl = curl_init();
         $baseUrl = 'https://api.steampowered.com/';
         // var_dump($baseUrl."ISteamUser/GetPlayerSummaries/v0002/?key=$apiKey&steamids=$builder");
         // exit;
         // curl_setopt_array($curl, array(
         //             CURLOPT_RETURNTRANSFER => 1,
         //             CURLOPT_URL => $baseUrl."ISteamUser/GetPlayerSummaries/v0002/?key=$apiKey&steamids=$value",
         //             CURLOPT_SSL_VERIFYPEER => false,
         //         ));
         // $profiles = curl_exec($curl);
         $profiles = Async::call('file_get_contents', array($baseUrl . "ISteamUser/GetPlayerSummaries/v0002/?key={$apiKey}&steamids={$value}"));
         $presponses = array_merge($presponses, json_decode((string) $profiles)->response->players);
         // if (!$profiles) {
         //     die('Error: "'.curl_error($curl).'" - Code: '.curl_errno($curl));
         // }
         // curl_close($curl);
         // $curl = curl_init();
         // curl_setopt_array($curl, array(
         //             CURLOPT_URL => $baseUrl."ISteamUser/GetPlayerBans/v1/?key=$apiKey&steamids=$value",
         //             CURLOPT_RETURNTRANSFER => 1,
         //             CURLOPT_SSL_VERIFYPEER => false,
         //         ));
         // $bans = curl_exec($curl);
         $bans = Async::call('file_get_contents', array($baseUrl . "ISteamUser/GetPlayerBans/v1/?key={$apiKey}&steamids={$value}"));
         $bresponses = array_merge($bresponses, json_decode((string) $bans)->players);
         // if (!$bans) {
         //     die('Error: "'.curl_error($curl).'" - Code: '.curl_errno($curl));
         // }
         // curl_close($curl);
     }
     $this->LinkSteamProfiles($presponses);
     $this->LinkSteamBans($bresponses);
     $this->SteamLoaded = true;
     $this->Timers['Steam'] = Number_Format(MicroTime(true) - $this->Timers['Steam'], 4, '.', '');
 }
 /**
  * Return a 32 bit unique ID
  *
  * @method string uuid()
  * @access public
  * @return string
  *
  * @author     Brian Tafoya
  * @copyright  Copyright 2001 - 2015, Brian Tafoya.
  * @version    1.0
  */
 public function uuid()
 {
     return (string) md5(uniqid(rand() + MicroTime(), 1));
 }
switch (ValueOf($PDF)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        return ERROR | @Trigger_Error(400);
    case 'string':
        #-------------------------------------------------------------------------------
        $Comp = Comp_Load('Formats/Contract/Number', $Contract['ID']);
        if (Is_Error($Comp)) {
            return ERROR | @Trigger_Error(500);
        }
        #-------------------------------------------------------------------------------
        $Tmp = System_Element('tmp');
        if (Is_Error($Tmp)) {
            return ERROR | @Trigger_Error(500);
        }
        #-------------------------------------------------------------------------------
        $File = SPrintF('Contract_%s.pdf', Md5(MicroTime()));
        #-------------------------------------------------------------------------------
        $IsWrite = IO_Write(SPrintF('%s/files/%s', $Tmp, $File), $PDF, TRUE);
        if (Is_Error($IsWrite)) {
            return ERROR | @Trigger_Error(500);
        }
        #-------------------------------------------------------------------------------
        return array('Status' => 'Ok', 'Location' => SPrintF('/GetTemp?File=%s&Name=Contract%s.pdf&Mime=application/pdf', $File, $Comp));
        #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    default:
        return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
Example #6
0
FUNCTION GetMicroTime($time = 0) {
	IF(!$time)
		{$time = MicroTime();}
	List($usec, $sec) = Explode(" ", $time); 
	RETURN ((float)$usec + (float)$sec); 
	}
Example #7
0
    //	$smarty->assign('bookstyl',	isset($_SESSION['bookstyl'])	? $_SESSION['bookstyl']		:'');
    $smarty->assign('f**k', isset($_SESSION['f**k']) ? $_SESSION['f**k'] : '');
    $smarty->assign('mail_notify', isset($_SESSION['mail_notify']) ? $_SESSION['mail_notify'] : '');
    $smarty->assign('friend', isset($_SESSION['friend']) ? $_SESSION['friend'] : '');
    $smarty->assign('friends', isset($_SESSION['friend']) ? $_SESSION['friend'] : '');
    $smarty->assign('anticsrf', isset($_SESSION['anticsrf']) ? $_SESSION['anticsrf'] : NULL);
    $smarty->assign('_POST', isset($_POST) ? $_POST : '');
    //XXX
    $smarty->assign('cube_vector', $_SESSION['cube_vector']);
    //    $new_mail = $newmailset->getInt('user_mail');
    //    if ($new_mail > 0)
    //        $smarty->assign('new_mail',  $new_mail);
    //    $smarty->assign('new_mail_name', $newmailset->getString('mail_sender'));
    //    $smarty->assign('user_k',        $newmailset->getInt('user_k'));
    //    $smarty->assign('k_wallet',      $newmailset->getInt('k_wallet'));
}
error_log("LOG: event: {$event}, node_id: {$node_id}, template_id: {$template_id}");
require_once INCLUDE_DIR . "eventz/{$event}.inc";
// Event is executed, now get $referer_id
$referer_id = "";
if (preg_match('/id\\/(\\d+)/', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "", $match)) {
    $referer_id = $match[1];
} elseif (preg_match('/name\\/(.*?)\\/?$/', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "", $match)) {
    $referer_id = nodes::getNodeIdByName($match[1]);
}
// creating neural network + updating node counters
nodes::update_nodes(isset($_SESSION['user_id']) ? $_SESSION['user_id'] : "", $node_id, $referer_id);
$time = substr(Time() + substr(MicroTime(), 0, 8) - $timer_start, 0, 7);
$smarty->assign('generation_time', $time);
echo $content;
// end of displaying
Example #8
0
/**
 * Custom shutdown function.
 */
function __ShutDown_Function__()
{
    #-------------------------------------------------------------------------------
    // Catch Fatal Errors.
    $lastError = error_get_last();
    #-------------------------------------------------------------------------------
    if ($lastError != NULL) {
        #-------------------------------------------------------------------------------
        $Message = SPrintF('[%s]-%s в линии %s файла %s', $lastError['type'], $lastError['message'], $lastError['line'], $lastError['file']);
        #-------------------------------------------------------------------------------
        Debug(SPrintF('[!] %s', $Message));
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    # added by lissyara 2011-10-12 in 16:15 MSK, for JBS-173
    #Debug("[JBs core]:" . print_r($GLOBALS, true));
    list($Micro, $Seconds) = Explode(' ', MicroTime());
    #-------------------------------------------------------------------------------
    $WorkTimeTmp = (double) $Micro + (double) $Seconds - START_TIME;
    #-------------------------------------------------------------------------------
    $UserData = array('CreateDate' => Time(), 'UserID' => isset($GLOBALS['__USER']) ? $GLOBALS['__USER']['ID'] : 10, 'REMOTE_ADDR' => isset($GLOBALS['_SERVER']['REMOTE_ADDR']) ? $GLOBALS['_SERVER']['REMOTE_ADDR'] : '', 'REQUEST_URI' => isset($GLOBALS['_SERVER']['REQUEST_URI']) ? $GLOBALS['_SERVER']['REQUEST_URI'] : '', 'HTTP_REFERER' => isset($GLOBALS['_SERVER']['HTTP_REFERER']) ? $GLOBALS['_SERVER']['HTTP_REFERER'] : '', 'HTTP_USER_AGENT' => isset($GLOBALS['_SERVER']['HTTP_USER_AGENT']) ? $GLOBALS['_SERVER']['HTTP_USER_AGENT'] : '', 'WORK_TIME' => $WorkTimeTmp, 'TIME_MYSQL' => $GLOBALS['__TIME_MYSQL'], 'COUNTER_MYSQL' => $GLOBALS['__COUNTER_MYSQL'], 'COUNTER_COMPS' => $GLOBALS['__COUNTER_COMPS']);
    #-------------------------------------------------------------------------------
    if ($GLOBALS['_SERVER']['REQUEST_URI'] != '/API/Events') {
        #-------------------------------------------------------------------------------
        $IsInsert = DB_Insert('RequestLog', $UserData);
        if (Is_Error($IsInsert)) {
            return ERROR | @Trigger_Error(500);
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    list($Micro, $Seconds) = Explode(' ', MicroTime());
    #-------------------------------------------------------------------------------
    if (!Define('WORK_TIME', (double) $Micro + (double) $Seconds - START_TIME)) {
        exit('[JBs core]: не удалось определить константу (WORK_TIME)');
    }
    #-------------------------------------------------------------------------------
    Debug(SPrintF('[JBs core]: система работала: %s', WORK_TIME));
    #-------------------------------------------------------------------------------
    # added by lissyara, 2011-10-11 in 15:27 MSK
    Debug(SPrintF('[JBs core]: время работы MySQL: %s [%s%%]', $GLOBALS['__TIME_MYSQL'], Round($GLOBALS['__TIME_MYSQL'] / WORK_TIME * 100, 2)));
    #-------------------------------------------------------------------------------
    Debug(SPrintF('[JBs core]: запросов к MySQL: %u', $GLOBALS['__COUNTER_MYSQL']));
    #-------------------------------------------------------------------------------
    Debug(SPrintF('[JBs core]: загружено компонентов: %u', $GLOBALS['__COUNTER_COMPS']));
    #-------------------------------------------------------------------------------
    Debug('');
    Debug('');
    Debug('');
    Debug('');
    #-------------------------------------------------------------------------------
}
					<li><a href="#" onclick="javascript:window.location='?page=carpark'"><i class="icon-fire"></i> Vozový park hráèe</a></li>
					<li><a href="#"><i class="icon-play-circle"></i> <b>Apex</b> : <?php 
echo GetApexStatus();
?>
</a></li>
					<li><a href="#"><i class="icon-play-circle"></i> <b>Chicane</b> : <?php 
echo GetChicaneStatus();
?>
</a></li>
				</ul>
			</div>
		</div>
		<?php 
PageSystem();
?>
		<div class="span10 tabulka"></div>
		<div id="bottom" class="span10 " style="font-size:small;background-color:white;" >
			<table class="table table-striped">
				<tbody>
					<tr>
						<td style="text-align:left;"><span class="badge badge-important">Ewolutions.cz &copy; 2012</span></td>
						<td style="text-align:right;"><span class="badge badge-success" >Vygenerováno za <?php 
echo Number_Format(MicroTime(true) - $Timer, 4, '.', '') * 1000;
?>
 ms</span></td>
					</tr>
				</tbody>
			<table>
		</div>
	</body>
</html>
Example #10
0
        }
        $File = SPrintF('%s/Config.xml', $Folder);
        $Data = <<<EOD
<XML>
 <DBConnection>
  <User>%s</User>
  <Password>%s</Password>
  <DbName>%s</DbName>
  <Server>%s</Server>
  <Port>%s</Port>
 </DBConnection>
 <EncryptionKey>%s</EncryptionKey>
 <CSRFKey>%s</CSRFKey>
</XML>
EOD;
        if (File_Put_Contents($File, SPrintF($Data, $__SETTINGS['db-user'], $__SETTINGS['db-password'], $__SETTINGS['db-name'], $__SETTINGS['db-server'], $__SETTINGS['db-port'], Str_Shuffle(Md5(MicroTime() . Rand(0, 1000000))), Str_Shuffle(Md5(MicroTime() . Rand(0, 1000000)))))) {
            Message('Настройки конфигурации успешно сохранены');
            if (!chmod($File, 0600)) {
                Error(SPrintF('Не удалось поставить права 0600 на файл конфигурации (%s)', $File));
            } else {
                Message(SPrintF('Права 0600 на файл конфигурации (%s) успешно установлены.', $File));
                # пропускаем стадию с рассказом про триггеры и предложением их установки
                #$__STEP_ID = 5;
                $__STEP_ID = 6;
            }
        } else {
            Error(SPrintF('Не возможно создать файл конфигурации (%s)', $File));
        }
    }
}
#-------------------------------------------------------------------------------
Example #11
0
	else {

		if (is_numeric($template_id) or strpos(";",$template_id)) {
			require(SYSTEM_ROOT.'/inc/actions.inc');
			$content.=$smarty->fetch($node['node_type'].".tpl");
		}
		elseif (empty($template_id)) {
			$content.=$smarty->fetch($node['node_type'].".tpl");
		}
		else {
			$content.=$smarty->fetch($template_id.".tpl");
		}
	}
	
}
*/
$smarty->template_dir = OWN_TEMPLATE_DIR;
if (is_numeric($template_id)) {
    $content .= $smarty->fetch($template_id . ".tpl");
} else {
    $content .= $smarty->fetch($node['template_id'] . ".tpl");
}
$time = SubStr(Time() + SubStr(MicroTime(), 0, 8) - $timer_start, 0, 7);
echo $content;
echo "<center>page generation took: {$time} second</center>";
$query = "insert delayed into load_times values (now(), '{$time}')";
//$db->executequery($query);
//end of displaying
// dake vypisi pre kybu
if ($_SESSION['user_id'] == 342) {
}
Example #12
0
	<?php 
    include "loginbox.inc";
    ?>
	<?php 
    include "navbox.inc";
    ?>
	<?php 
    include "mame_radi_box.inc";
    ?>
	</td>
	</tr>
	<tr><td colspan=3><td align=right><?php 
    include "next.inc";
    ?>
	<tr><td colspan=6  align=center><?php 
    //include("z.inc");
    ?>
</td></tr>
<?php 
}
//vypis casu tvorby stranky
echo "<tr><td colspan=9 align='center'>" . SubStr(Time() + SubStr(MicroTime(), 0, 8) - $timer_start, 0, 7) . "</td></tr>";
?>
<tr><td colspan=9  align=center><?php 
include "tiraz.inc";
?>
</td></tr>
</table>
</table>
</body>
</html>
Example #13
0
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

VerliAdmin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with VerliAdmin; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

=========================================================================
*/

$script_start = MicroTime();	//Get microtime on start of script
OB_Start();	//Start output buffering

$mysql = Parse_Ini_File("config.php", TRUE);

$browser = substr($_SERVER['HTTP_USER_AGENT'], 0, 7);

IF(isset($_POST['selecthub']) && $mysql['HUB']['multi']==1)
{
        setcookie("database",$_POST['HubDB']);
        $database=$_POST['HubDB'];
}
ELSEIF(!$database && $mysql['HUB']['multi']==1) Print "<SCRIPT language=\"javascript\"><!--

location.replace(\"selectdb.php\");
Example #14
0
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    $Result = DB_Query(SPrintF('OPTIMIZE TABLE `%s`', $TableID));
    if (Is_Error($Result)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
    $Rows = MySQL::Result($Result);
    if (Is_Error($Rows)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
    $Row = Current($Rows);
    #-------------------------------------------------------------------------------
    $TimeEnd = Explode(" ", MicroTime());
    #-------------------------------------------------------------------------------
    $TimeExecute = $TimeEnd[0] + $TimeEnd[1] - $TimeStart[0] - $TimeStart[1];
    #-------------------------------------------------------------------------------
    Debug(SPrintF('[comp/Tasks/BackUp]: Время на таблицу: %s; результат оптимизации таблицы (%s) (%s)=[%s]', Round($TimeExecute, 3), $TableID, $Row['Msg_type'], $Row['Msg_text']));
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$DBConnection = $Config['DBConnection'];
#-------------------------------------------------------------------------------
$Tmp = System_Element('tmp');
if (Is_Error($Tmp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
Example #15
0
     #---------------------------------------------------------------------------
     echo JSON_Encode($Answer);
     break;
 case 'false':
     echo JSON_Encode(array('Status' => 'FALSE'));
     break;
 case 'true':
     echo JSON_Encode(array('Status' => 'TRUE'));
     break;
 case 'array':
     $Result = JSON_Encode($Result);
 case 'string':
     #---------------------------------------------------------------------------
     if (!Headers_Sent()) {
         #-------------------------------------------------------------------------
         list($Micro, $Seconds) = Explode(' ', MicroTime());
         #-------------------------------------------------------------------------
         Header(SPrintF('Waiting-Time: %01.2f sec', (double) $Micro + (double) $Seconds - START_TIME));
         #-------------------------------------------------------------------------
         $Size = MB_StrLen($Result, 'ASCII');
         #-------------------------------------------------------------------------
         if ($Size > 30720 && Preg_Match('/gzip/', (string) @$_SERVER['HTTP_ACCEPT_ENCODING'])) {
             #-----------------------------------------------------------------------
             Header(SPrintF('Real-Content-Length: %u', $Size));
             #-----------------------------------------------------------------------
             $Result = GzEncode($Result);
             #-----------------------------------------------------------------------
             Header('Content-Encoding: gzip');
             Header(SPrintF('Content-Length: %u', MB_StrLen($Result, 'ASCII')));
         }
     }
Example #16
0
<?php

// Display everything in browser, because some people can't look in logs for errors
Error_Reporting(E_ALL | E_STRICT);
Ini_Set('display_errors', true);
require __DIR__ . '/src/MinecraftQuery.php';
require __DIR__ . '/src/MinecraftQueryException.php';
require __DIR__ . '/src/MinecraftPing.php';
require __DIR__ . '/src/MinecraftPingException.php';
require_once 'server.conf';
$Timer = MicroTime(true);
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Minecraft Ping PHP Class</title>

	<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
	<style type="text/css">
		.jumbotron {
			margin-top: 30px;
			border-radius: 0;
		}

		.table thead th {
			background-color: #428BCA;
			border-color: #428BCA !important;
			color: #FFF;
		}
	</style>
Example #17
0
        case "delete_link":
            ADMIN_CHILDREN::delete_link($_GET['parent_id'], $_GET['node_id'], $_GET['rel_type'], $_GET['sort_order']);
            break;
        case "add_children_submit":
            ADMIN_CHILDREN::add_child($_GET['node_id']);
            break;
        case "edit_node":
            if (isset($_POST['data_edit']) && $_POST['data_edit'] == 'Odeslat') {
                $admin_data_write = new ADMIN_DATA_WRITE($_POST);
                $admin_data_write->write($_GET['edit_id']);
                echo $admin_data_write->saved;
            }
            if (isset($_GET['edit_id'])) {
                $admin_edit = new ADMIN_EDIT($_GET['edit_id']);
                $admin_edit->vypis();
            }
            break;
    }
    //vyrobi menu
    ADMIN_MENU::menu();
    ADMIN_MENU::orphans();
    ADMIN_NODE::choose_to_add(0);
    echo "<div id='logout'><a href='admin.php?action=logout'>Logout</a></div>";
} else {
    loginFunction();
    echo "not logged in<br /><br />";
}
echo "<br /><br /><br /><br /><a href='index.php'>index</a>";
//echo page creation time
echo "<div id='time_value'><br /><br />" . SubStr(Time() + SubStr(MicroTime(), 0, 8) - $timer_start, 0, 7) . "<br /></div>";
$smarty->display('footer.tpl');
Example #18
0
 private function Log($String)
 {
     $Log = '[';
     $Log .= Number_Format(MicroTime(true) - $this->AppStart, 2);
     $Log .= 's] ';
     $Log .= $String;
     $Log .= '{normal}';
     $Log .= PHP_EOL;
     $Log = Str_Replace($this->APIKey, '{lightred}*APIKEY*{normal}', $Log);
     $Log = Str_Replace(array('{normal}', '{green}', '{yellow}', '{lightred}', '{lightblue}'), array("", "", "", "", ""), $Log);
     echo $Log;
 }
Example #19
0
 #-------------------------------------------------------------------------------
 $Rows = DB_Select($Table, array('ID', 'Password'));
 #-------------------------------------------------------------------------------
 switch (ValueOf($Rows)) {
     case 'error':
         return ERROR | @Trigger_Error(500);
     case 'exception':
         # No more...
         break;
     case 'array':
         #-------------------------------------------------------------------------------
         foreach ($Rows as $Row) {
             #-------------------------------------------------------------------------
             $Password = Crypt_Decode1($Row['Password'], isset($OldEncryptionKey) ? $OldEncryptionKey : HOST_ID);
             if (Is_Error($Password)) {
                 $Password = SubStr(Md5(MicroTime()), 0, 5);
             }
             Debug(SPrintF("[patches/hosting/files/1000011.php]: Password Decoded = %s", $Password));
             #-------------------------------------------------------------------------
             $Password = Crypt_Encode1($Password, $Config['EncryptionKey']);
             if (Is_Error($Password)) {
                 return ERROR | @Trigger_Error(500);
             }
             Debug(SPrintF("[patches/hosting/files/1000011.php]: Password Encoded = %s", $Password));
             #-------------------------------------------------------------------------
             $IsUpdate = DB_Update($Table, array('Password' => $Password), array('ID' => $Row['ID']));
             if (Is_Error($IsUpdate)) {
                 return ERROR | @Trigger_Error(500);
             }
             #-------------------------------------------------------------------------------
         }
Example #20
0
 public static function checkQuery($sid, $ip, $port, $day, $month, $year, $timeout = 2)
 {
     $timer = MicroTime(true);
     $query = new MinecraftQuery();
     try {
         $query->Connect($ip, $port, $timeout);
     } catch (MinecraftQueryException $e) {
         $Exception = $e;
     }
     $timer = Number_Format(MicroTime(true) - $timer, 2, '.', '');
     return $query;
     $info = $query->GetInfo();
     if ($info === false) {
         DB::table('mcserverschecks')->insert(array('mcsc_sid' => $sid, 'mcsc_online' => 0, 'mcsc_players' => 0, 'mcsc_ping' => 0, 'mcsc_day' => $day, 'mcsc_month' => $month, 'mcsc_year' => $year));
         DB::table('mcservers')->where('mcs_id', $sid)->update(array('mcs_players' => 0, 'mcs_status' => 0));
     } else {
         DB::table('mcserverschecks')->insert(array('mcsc_sid' => $sid, 'mcsc_online' => 1, 'mcsc_players' => $info["Players"], 'mcsc_ping' => $timer, 'mcsc_day' => $day, 'mcsc_month' => $month, 'mcsc_year' => $year));
         DB::table('mcservers')->where('mcs_id', $sid)->update(array('mcs_maxplayers' => $info["MaxPlayers"], 'mcs_players' => $info["Players"], 'mcs_status' => 1, 'mcs_map' => substr($info["Map"], 0, 50), 'mcs_plugins' => substr($info["Plugins"], 0, 255), 'mcs_motd' => mcservers::motd(substr($info["HostName"], 0, 255))));
     }
 }
Example #21
0
    }
    #-------------------------------------------------------------------------------
    $Config = $XML->ToArray();
    #-------------------------------------------------------------------------------
    $Config = $Config['XML'];
    #-------------------------------------------------------------------------------
} else {
    #-------------------------------------------------------------------------------
    $Config = array();
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!isset($Config['CSRFKey']) || !$Config['CSRFKey']) {
    #-------------------------------------------------------------------------------
    $Config['CSRFKey'] = Str_Shuffle(Md5(MicroTime() . Rand(0, 1000000)));
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (isset($Config['Interface']['Notes'])) {
    unset($Config['Interface']['Notes']);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (isset($Config['Other']['Libs']['Http'])) {
    unset($Config['Other']['Libs']['Http']);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (isset($Config['Users']['Register'])) {
Example #22
0
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$DOM->AddAttribs('Body', array('onload' => SPrintF("GetSchemes('%s','SchemeID','%s');", $PromoCode['ServiceID'], $PromoCode['SchemeID'])));
#-------------------------------------------------------------------------------
$DOM->AddChild('Head', new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{Js/GetSchemes.js}')));
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Title = $PromoCodeID ? 'Редактирование ПромоКода' : 'Добавление нового ПромоКода';
#-------------------------------------------------------------------------------
$DOM->AddText('Title', $Title);
#-------------------------------------------------------------------------------
$Table = array('Общая информация');
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$PromoCodeExample = StrToUpper(SPrintF('%s-%s-%s-%s', SubStr(md5(MicroTime()), 1, 4), SubStr(md5(MicroTime()), 6, 4), SubStr(md5(MicroTime()), 12, 4), SubStr(md5(MicroTime()), 20, 4)));
#-------------------------------------------------------------------------------
if (!$PromoCodeID) {
    #-------------------------------------------------------------------------------
    $Comp = Comp_Load('Form/Input', array('type' => 'text', 'name' => 'Code', 'value' => $PromoCode['Code'], 'prompt' => 'Английские буквы и цифры, дефисы и подчёркивания', 'style' => 'width:100%'));
    #-------------------------------------------------------------------------------
    $Comp1 = new Tag('NOBODY', new Tag('SPAN', 'ПромоКод'), new Tag('BR'), new Tag('SPAN', array('class' => 'Comment'), 'Например: '), new Tag('SPAN', array('class' => 'Comment', 'style' => 'cursor: pointer;', 'onclick' => SPrintF('document.getElementsByName("Code")[0].value = "%s";', $PromoCodeExample)), $PromoCodeExample));
} else {
    $Comp = $PromoCode['Code'];
    $Comp1 = 'ПромоКод';
}
#-------------------------------------------------------------------------------
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
Example #23
0
// Edit this <-
$Timer = MicroTime(true);
$Query = new SourceQuery();
$Info = array();
$Rules = array();
$Players = array();
try {
    $Query->Connect(SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_TIMEOUT, SQ_ENGINE);
    $Info = $Query->GetInfo();
    $Players = $Query->GetPlayers();
    $Rules = $Query->GetRules();
} catch (Exception $e) {
    $Exception = $e;
}
$Query->Disconnect();
$Timer = Number_Format(MicroTime(true) - $Timer, 4, '.', '');
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Source Query PHP Class</title>
	
	<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0-rc1/css/bootstrap.min.css">
	<style type="text/css">
		.jumbotron {
			margin-top: 30px;
			border-radius: 0;
		}
		
		.table thead th {
Example #24
0
<?php

//requiring main config file with path/database etc. constants
require_once 'config/config.inc';
//Ask for auth if enabled...
//if(isset($realm) && isset($users)) require_once(INCLUDE_DIR.'http_auth.php');
//starting timer for benchmarking purposes
$timer_start = Time() + SubStr(MicroTime(), 0, 8);
//setting PHPSESSID cookie and starting user session
//error reporting has to be before session_start
error_reporting(-1);
ini_set('display_errors', 'On');
session_start();
@ini_set('magic_quotes_gpc', 'off');
if (get_magic_quotes_gpc()) {
    die("Error: magic_quotes_gpc needs to be disabled! F00K!\n");
}
//Smarty from DB
$smarty_resource = 'kyberia';
//connecting to database and creating universal $db object
//require_once(INCLUDE_DIR.'senate.inc'); // in config already
require_once INCLUDE_DIR . 'log.inc';
require_once INCLUDE_DIR . 'ubik.inc';
require_once INCLUDE_DIR . 'nodes.inc';
require_once INCLUDE_DIR . 'error_messages.inc';
require_once INCLUDE_DIR . 'database.inc';
require_once INCLUDE_DIR . 'transports.inc';
$db = new CLASS_DATABASE();
switch (true) {
    case preg_match('/id\\/([0-9]+)(?:\\/([a-zA-Z0-9]+)\\/?)?/', $_SERVER['PATH_INFO'], $match):
        $_GET['node_id'] = $match[1];