Show DevBest [PHP] [CLASS] XQL; INIFile Recode

Status
Not open for further replies.

X1M!

le troller
Jan 6, 2011
179
1
I recoded the INIFile class to be faster, more secure and easier to use.
The code is stored at pastebin;
This is NOT for noobs.
 

X1M!

le troller
Jan 6, 2011
179
1
I am working on a function to emulate the MySQL_Query()

PHP:
$Test = new XQL("xim.ini");
$Test->Query("GET `Username`"); // This returns Xim
$Test->Query("SET `Username` TO 'X1M!'"); // This returns X1M! and changes the Username key from Xim to X1M!
Though it is not complete yet, I am trying to make it work.
 

Deion

Posting Freak
Jul 3, 2010
1,273
300
10/10 This code is nice.
I've see a really junky code and Didn't even know what the code was for ;D
 

X1M!

le troller
Jan 6, 2011
179
1
Here is a untested Query-function;
If it doesnt work, please tell me.

EDIT: Tested it, you can get keys but not set their value.


PHP:
    function Query($Query)
    {
        $Qry = Explode(" ", $Query);
        Switch(strtoupper($Qry[0])) {
            Default:
                Return 0;
            Break;
            Case "GET":
                If(isset($Qry[1])):
                    return $this->getKey(str_replace("`", "", $Qry[1]), (isset($Qry[4]) && $Qry[4] == "INT()")?1:0);
                Else:
                    return 0;
                EndIf;
            Break;
            Case "SET":
                If(isset($Qry[1]) && isset($Qry[3])):
                    $this->setKey(str_replace("`", "", $Qry[1]), str_replace("'", "", $Qry[3]), (isset($Qry[4]) && $Qry[4] == "INT()")?1:0);
                    return 1;
                Else:
                    Return 0;
                EndIf;
            Break;
        }
    }
Working Query function, enjoy!
 
Status
Not open for further replies.

Users who are viewing this thread

Top