Essentially all it is, is a file like so:
[SERVER] host=localhost; port=8130; [IMAGE] debugmode=false; onlinetext=Test; onlinetextloc=1,2,3; offlinetext=Me; offlinetextloc=4,5,6; curr_listcount=0; max_listcount=32; ....and so on....
Whats getting at me is I don't even know how to even get it do do what i want. Which is to get the stuff between [SERVER] and [IMAGE] as well as [IMAGE] and END-OF-FILE.
So far my code is, like this:
<?php
$cfg_file = "../configs/ah.cfg";
$handle = fopen($cfg_file, "rb");
$page = '';
while (!feof($handle)) {
$page .= fread($handle, 8192);
}
fclose($handle);
$gathered_info = explode(";",$page);
for($n=0; $n <= sizeof($gathered_info); $n++){
$server_db[] = explode("=",$gathered_info[$n]);
}
print("<pre>");
print_r($server_db);
print("</pre>");
?>
Nothing fancy.. or anything. In fact all it does is spit out information in an array, of the whole file, which is where my starting point is.
My array that it spouts is:
Array
(
[0] => Array
(
[0] => [SERVER]
host
[1] => localhost
)
[1] => Array
(
[0] =>
port
[1] => 8130
)
[2] => Array
(
[0] =>
[IMAGE]
debugmode
[1] => false
)
[3] => Array
(
[0] =>
onlinetext
[1] => Test
)
[4] => Array
(
[0] =>
onlinetextloc
[1] => 1,2,3
)
[5] => Array
(
[0] =>
offlinetext
[1] => Me
)
[6] => Array
(
[0] =>
offlinetextloc
[1] => 4,5,6
)
[7] => Array
(
[0] =>
curr_listcount
[1] => 0
)
[8] => Array
(
[0] =>
max_listcount
[1] => 32
)
[9] => Array
(
[0] =>
)
[10] => Array
(
[0] =>
)
)
I would use a mysql database, but unfortunately i would like to keep it from using a mysql server for the moment. Now at the moment all I'm doing is reading the file, but, i plan to write to it as well at a later date.
I dont need someone to fully solve this for me.. But maybe just a few solid working examples of what im trying to accomplish—ie: the separation between [server] and [image].
And yes, i did search the forum, and the tutorial database, but didnt find anything to what i want to achieve. like one that serializes and then unserializes. But then i could have missed one and I'd never know.
