You are not logged in.

#1 2009-10-31 1:02 pm

sv1cec
Member
Registered: 2009-10-31
Posts: 3

How to query the database with vB 3.0.xx

Folks, my site is still in vB 3.0.xx and there are no plans to upgrade. Any one can provide some help on how to query the stopforumspam.com database the moment a visitor tries to register? I am relarively good with php as it is used in that old vB release, so I believe I could implement a check with some of your help.

Many thanks for your time, sincerely appreciated.

John

Offline

#2 2009-10-31 2:24 pm

MacHeadCase
Member
From: Montréal, Québec
Registered: 2008-09-07
Posts: 346
Website

Re: How to query the database with vB 3.0.xx

Just download the vBStopForumSpam plugin for vBulletin.

But I'm not sure if the earliest version of this plugin will work with such an old version of vBulletin. You can always give it a try.

Offline

#3 2009-10-31 2:56 pm

pedigree
uıɐbɐ ʎɐqǝ ɯoɹɟ pɹɐoqʎǝʞ ɐ buıʎnq ɹǝʌǝu ɯ,ı
From: New Zealand
Registered: 2008-04-16
Posts: 7,056

Re: How to query the database with vB 3.0.xx

Sorry, I have no idea if it will work, even when using the 3.54 product xml and I dont have any plans to revisit a version that old sorry.

The code might work if you copy/paste it into vbulletin itself as Im sure the hooks arent going to be there in order for it to work as a plugin

Download my mod, look at the php or look at the example/generic code for querying and put that in your register.php file manually

Offline

#4 2009-10-31 4:47 pm

sv1cec
Member
Registered: 2009-10-31
Posts: 3

Re: How to query the database with vB 3.0.xx

vB has changed its coding scheme after going to 3.5, it is totally different. So the standard mod will not work, you can't even import xml to 3.0.xx.

Pedigree, can you please point me to the "generic/example" code? I'll have a look at that.

Many thanks again.

Offline

#5 2009-10-31 7:52 pm

pedigree
uıɐbɐ ʎɐqǝ ɯoɹɟ pɹɐoqʎǝʞ ɐ buıʎnq ɹǝʌǝu ɯ,ı
From: New Zealand
Registered: 2008-04-16
Posts: 7,056

Re: How to query the database with vB 3.0.xx

Offline

#6 2009-10-31 10:13 pm

sv1cec
Member
Registered: 2009-10-31
Posts: 3

Re: How to query the database with vB 3.0.xx

Thanks, I'll have a look.

Offline

#7 2009-10-31 10:58 pm

pedigree
uıɐbɐ ʎɐqǝ ɯoɹɟ pɹɐoqʎǝʞ ɐ buıʎnq ɹǝʌǝu ɯ,ı
From: New Zealand
Registered: 2008-04-16
Posts: 7,056

Re: How to query the database with vB 3.0.xx

SimpleXML is a php5 function, so you might have to drop that and use php4 functions, like what Ive done in something like this, where $xml is the result of the curl/fileread/whatever, from our api

function decodexml($xml) {
    $parser = xml_parser_create();
    xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 );
    xml_parser_set_option( $parser, XML_OPTION_SKIP_WHITE, 1 );
    xml_parse_into_struct( $parser, $xml, $tags );
    xml_parser_free( $parser );
    print_r($tags);
}

As the XML returned, when doing a multiple field query, isnt valid XML, stick to single field queries or write an uglyxmltoarray function, or use mine

    function uglyXml2Array($uglyxml) {
    global $vbulletin;
    $parser = xml_parser_create();
    xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 );
    xml_parser_set_option( $parser, XML_OPTION_SKIP_WHITE, 1 );
    xml_parse_into_struct( $parser, $uglyxml, $tags );
    xml_parser_free( $parser );
           
    $results = array();
       
    for ($loop = 0; $loop < count($tags); $loop++) {   
        switch($tags[$loop][tag]) {
            case "response" :
              $results[response][success] = ($tags[$loop][attributes][success] == "true" ? 0 : 1);           
              break;
            case "type" :
                $field = $tags["$loop"][value];
                break;                           
            case "appears":
                $fieldname = $tags[$loop][tag];
              $results[xml]["$field"]["$fieldname"] = (($tags[$loop][value] == "yes") ? 1 : 0);

              break;           
            case "frequency":
            case "lastseen" :
            $fieldname = $tags[$loop][tag];
              $results[xml]["$field"]["$fieldname"] = $vbulletin->input->clean($tags[$loop][value]);
              break;
        }                     
    }           
        return $results;       
    }

Offline

Board footer

Powered by FluxBB

Close
Close