Please consider me to be an admin, in fact i am a really great php programmer!!! Attached is some sample code! It is a class i wrote for reading config files with the following syntax:
##App name v1.0
TAG: VALUE
#List of random stuff
LIST[0]: VALUE
LIST[1]: VALUE
LIST[7]: VALUE
PASSCODE: 666
=====================================================================================================
=====================================================================================================
HAHA! But i will not give you the missing dependencies unless there is a use for them, that use being me as admin.
Oh and i also know C++, Javascript, Java, HTML5/CSS, Both Win and Linux shell scripting languages, C#, C# for Unity 3D, My own custom scripting language for an interpretor that i made in C++, Qt, Windows, Linux, Apache, MySQL, XML, Go, and much more! See, i really am soooper smartz!
So wanna know what the C++ scripting engine was used for? An ad clicker bot that uses many VPNs! LOL, and i am never gonna work for Hillary Clinton!
This is pretty much MasterChief117 (formerly superhornet18):
##App name v1.0
TAG: VALUE
#List of random stuff
LIST[0]: VALUE
LIST[1]: VALUE
LIST[7]: VALUE
PASSCODE: 666
=====================================================================================================
Code:
<?php
//Config File Parser
/*
Features:
-Define all tags and their values as const variables. This can significantly boost performance.
-Parse read iterating over a list, if you wish to write (Writing not supported as of this version)
-Check if contains certain tags
-Check if currently set
Warnings:
-If defining tags, keep in mind that matching the tag name must be precise. Not doing so may lead to unpredictable results (e.g undefined variable errors and et cetera)
*/
//Dependencies:
include_once(dirname(__FILE__).'/Tags.php');
include_once(dirname(__FILE__).'/StringParsing.php');
include_once(dirname(__FILE__).'/FileSystem.php');
include_once(dirname(__FILE__).'/FileIo.php');
class ConfigFile
{
//_____________________________________________________
//Public:
/*OK*/
//@param: filepath, bool to specify if to define everything as a const variable (optional)
//specify config filepath
public function __construct($Filepath, $DefineVars = FALSE)
{
$this->m_Filepath = $Filepath;
//load file
$Buffer = CPReadFile($this->m_Filepath);
if ($Buffer == NULL)
{
$this->m_IsSet = NOT_SET;
return;
}
//append line breaker at end so the parser does not get confused
$Buffer = $Buffer."\n";
TrimWhitespaces($Buffer);
if ($Buffer != NULL)
{
//for each line
//remove comments
//initialize parallel arrays
$this->m_Tags = array();
$this->m_Values = array();
foreach(preg_split("/((\r?\n)|(\r\n?))/", $Buffer) as $Line)
{
//if comment tag '#' found
if (StrContains($Line, '#') == TRUE)
{
StrErase($Line, strpos($Line, '#'));
}
//trim whitespaces
TrimWhitespaces($Line);
//if NOT empty
if (StrEmpty($Line) == FALSE)
{
//if contain ':' tag
//otherwise we cannot parse it, we will have to attempt to continue deserializing the config data
if (StrContains($Line, ':') == TRUE)
{
//get value
$ValueStr = substr($Line, strpos($Line, ':')+1);
TrimWhitespaces($ValueStr);
//checks and removes if is encapsulated in double quotation marks
$ValueStr = RemoveEncapsulatingDoubleQuotes($ValueStr);
array_push($this->m_Values, $ValueStr);
//get tag
$TagStr = substr($Line, 0, strpos($Line, ':'));
TrimWhitespaces($TagStr);
array_push($this->m_Tags, $TagStr);
//if defining as a const var
if ($DefineVars == TRUE)
{
define($TagStr, $ValueStr);
}
}
}
}
//debug status:
//echo "is set";
$m_IsSet = IS_SET;
}
else
{
//debug status:
//echo "not set";
$m_IsSet = NOT_SET;
}
}
/*OK*/
//check if is successfully set
public function _IsSet()
{
return $this->m_IsSet;
}
/*OK*/
//get associated filepath
public function GetFilepath()
{
return $this->m_Filepath;
}
/*OK*/
//get num entries
public function Size()
{
return count($this->m_Tags);
}
/*OK*/
//get entry
//outputs NULL is does not have element
public function Get($Tag)
{
//if NOT set
if ($this->m_IsSet == NOT_SET)
{
return FAILED;
}
//format tag
TrimWhitespaces($Tag);
TrimBeginRepeats($Tag, ':');
TrimEndRepeats($Tag, ':');
//iterate for element of corresponding tag
$Size = count($this->m_Tags);
//For debugging
//echo (string)$Size;
//echo $this->m_Tags[0];
for ($Item = 0; $Item < $Size; $Item++)
{
//if element matches by tag name
if ($this->m_Tags[$Item] == $Tag)
{
return $this->m_Values[$Item];
}
}
return NULL;
}
/*NT*/
//@deprecated: you should not use this, instead just cast the output of 'get(...)'
//get entry casted to (int)
//outputs NULL if does not have elements
public function GetInt($Tag)
{
$Output = get($tag);
//if '$output' only contains numeric characters
if (StrIsNumeric($Output) == TRUE)
{
return $Output;
}
//otherwise output NULL because this failed
else
{
return NULL;
}
}
/*OK*/
//has entry
//output TRUE/FALSE
//NOTE: You should just use 'get()' instead of 'has()'. Don't use this function unless absolutely necessary.
public function Has($Tag)
{
//if NOT set
if ($this->m_IsSet == NOT_SET)
{
return FALSE;
}
//format tag
TrimWhitespaces($Tag);
TrimBeginRepeats($Tag, ':');
TrimEndRepeats($Tag, ':');
//iterate for element of corresponding tag
$Size = count($this->m_Tags);
//echo (string)$size;
//echo $m_tags[0];
for ($Item = 0; $Item < $Size; $Item++)
{
//if element matches by tag name
if ($this->m_Tags[$Item] == $Tag)
{
return TRUE;
}
}
return FALSE;
}
//_____________________________________________________
//Private:
//set to IS_SET if successfully set, NOT_SET if NOT successfully set
private $m_IsSet = IS_SET;
//associated filepath
private $m_Filepath = NULL;
//file contents array
private $m_Tags = NULL;
private $m_Values = NULL;
};
?>
HAHA! But i will not give you the missing dependencies unless there is a use for them, that use being me as admin.
Oh and i also know C++, Javascript, Java, HTML5/CSS, Both Win and Linux shell scripting languages, C#, C# for Unity 3D, My own custom scripting language for an interpretor that i made in C++, Qt, Windows, Linux, Apache, MySQL, XML, Go, and much more! See, i really am soooper smartz!
So wanna know what the C++ scripting engine was used for? An ad clicker bot that uses many VPNs! LOL, and i am never gonna work for Hillary Clinton!
This is pretty much MasterChief117 (formerly superhornet18):