Activity Stream
48,167 MEMBERS
6715 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 42
  1.     
    #11
    (1only)
    Website's:
    BarakaDesigns.com Amodity.com IMGFlare.com
    Day 2 and ready for another post
    Anyhow this is something i done awhile back for vBulletin. For those whom use cyb - chatbox may see this useful its only the gist of things to make custom commands since cyb lacks on it Anyhow here is a /ban one limited to 15 lines so this is gist

    PHP Code: 
    $vbulletin->GPC['ccb_newmessage'] = str_replace('/ban '"".''$vbulletin->GPC['ccb_newmessage']);
    $banuserthis $vbulletin->db->query_read("SELECT user.username, user.usergroupid, user.displaygroupid,user.userid FROM ".TABLE_PREFIX."user WHERE user.username = '".$banusername."' AND user.userid !='".$banusername."'");
    $banuserthisone $db->fetch_array($banuserthis);
    $lists explode(',',$vbulletin->options['cybchatbox_excluded_users']);
    $userid $banuserthisone['userid'];

    $cybcb_banuser $vbulletin->options['cybchatbox_excluded_users'].','.$cybcb_usertoban;                
    $cybcb_banuser str_replace(',,',',',$cybcb_banuser);                          
    $cybcb_banuser trim($cybcb_banuser',');
    $vbulletin->db->query_write("UPDATE " TABLE_PREFIX "setting SET value = '".$cybcb_banuser."' WHERE varname = 'cybchatbox_excluded_users' "); 
    Basically once /ban {username} is executed, it'll select that user off the DB and ban that user following the correct order from , in the vBulletin options for cyb ban section is. Have note this is not the full code upon it, its just the gist upon it so hopefully it can help for those whom like to make their own commands I done this off the top of my head
    (I may post the full code not sure though)

    CEO Of BarakaDesigns.com, Need PSD to vB? Need a Custom skin? Hit me up -Baraka aka 1Only

  2.   Sponsored Links

  3.     
    #12
    (╯?□?)╯︵ ┻━┻
    Website's:
    Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.com
    Interesting, but i do prefer my own implementation of such functionality.
    Actually, it is in use on KWWH right now, handles several commands in a generic fashion, meaning none of the main code needs to be altered when adding new ones.

    I actually replaced a huge amount of the original code when modifying KWWH's copy. Deleted most of the code and reimplemented it myself because the original was inadequate and inefficient.
    Projects:
    WCDDL - The Professional DDL Script
    Top Secret Project: In Development - ZOMG
    ImgTrack - Never Have Dead Images Again!

  4.     
    #13
    Respected Developer
    Website's:
    X4B.org
    JmZ but thats the vBulliten way. Its also the way you can tell vbulliten code appart.

    My snippet, an example of when SQL is better than a query builder/prepared statements/ORM.

    PHP Code: 
    function swap($inc){
            if(
    $inc>=0$inc '+'.$inc;
            
    $sql 'UPDATE '.self::TABLE.' t1, '.self::TABLE.' t2
                    SET
                    t1.cr_order=(@temp:=t1.cr_order),
                    t1.cr_order = t2.cr_order ,
                    t2.cr_order = @temp
                    WHERE
                    t1.cr_id='
    .$this->id.' and 
                            (t2.lease_id='
    .$this->getLease()->getId().' AND t2.cr_order=t1.cr_order'.$inc.')';
            \
    DB::Q($sql);
        } 
    Its code for reordering values in a database (e.g moving cr:1 up one position might involve swapping with cr:3). The table is partitioned by lease_id.

    $inc would be +1 to move up or -1 to move down.

  5.     
    #14
    (╯?□?)╯︵ ┻━┻
    Website's:
    Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.com
    Nah splitice you misunderstood.

    Of course it'd be the "vbulletin way" either way. I was merely stating that I preferred my code as it has a generic (and secure) handler for commands, allowing for easy addition to the selection.

    I re-coded half of the mod because I found the original code to be insufficient and inefficient. It was very procedural and repetative, very specific to the default features, meaning it didn't allow easy modification/extension.

    Basically I didn't like the code, it wasn't up to standard, so I deleted most of it and wrote it myself.

    The resulting code was still the 'vbulletin way', so I have absolutely no idea why you thought otherwise, lol.
    Projects:
    WCDDL - The Professional DDL Script
    Top Secret Project: In Development - ZOMG
    ImgTrack - Never Have Dead Images Again!

  6.     
    #15
    Respected Developer
    Website's:
    X4B.org
    Didnt say your new comment, just stating that repeated code, repeated SQL and long functions / scopes is how vbulliten is written (as apposed to normal programming practices).

    I cant speculate as to your 'new' code as I havent seen it. My observations are based on my own experience and in response to 1only's sample.

  7.     
    #16
    (╯?□?)╯︵ ┻━┻
    Website's:
    Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.com
    How vB is written, probably, but plugins may be written in any way you wish as long as they work.

    Most recent vb releases use classes for the data managers and what not anyway, pretty useful if you're coding plugins.

    Anyway, a snippet:

    PHP Code: 
    re.findall('^(?:(?:(?:(?:(SELECT) ([\w, ]+) FROM ([\w]+))|(?:(DELETE) FROM ([\w]+))|(?:(UPDATE) ([\w]+) SET ([\w,= ]+)))(?:(?: WHERE ([\w=>< ,]+))?))|(?:(INSERT) INTO ([\w]+) VALUES ([\w, \(\)]+)))$'query)[0
    From a few years back, I could write it way better now.

    Basically I got bored one day so I made a small python app. It parsed SQL queries and performed their actions on dictionaries. So I essentially wrote an SQL interpreter to interface with python dictionaries (a standard python data type, like arrays).

    It has absolutely no use really, the most pointless thing ever. Ridiculous idea, but I was bored and felt like coding something crazy.
    Projects:
    WCDDL - The Professional DDL Script
    Top Secret Project: In Development - ZOMG
    ImgTrack - Never Have Dead Images Again!

  8.     
    #17
    Respected Developer
    Website's:
    X4B.org
    I like it, Ive toyed with the idea of a SQL parser class in my framework for the purpose of running only on development/testing servers for advanced debugging (also things like efficiency scores). Although I wouldnt do in regex (prefering an objective parser, utilising the same parse tree as mysql).

    Still a nice regex, certainly thorough.

  9.     
    #18
    (1only)
    Website's:
    BarakaDesigns.com Amodity.com IMGFlare.com
    PHP Code: 
        public function saltGenerator($limitChars=8) {
            
    $symb "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()-=_+[]{}\\|;:'\",./<>?~`";//letters,numbers,& symbols
            
    $saltv '';
            for (
    $i 0$i $limitChars$i++)
                
    $saltv .= $symb[rand(0strlen($symb) - 1)];
            return 
    $saltv;
        } 
    well this is pretty small but its a mini function to generate salt hash value(s) to make secure when inserted in the database for either when a user registers or w/e which then when you want use of the function for making the pass-hash you can do something like this:
    PHP Code: 
    $saltv $saltv ?: $this->saltGenerator();
    $phash md5(md5($saltv) . md5($pass));
    $sql->password $phash;
    $sql->salt $saltv
    This is really something that can be used in a class to make things easier. Did this off the top of my head so if there is room for improvement let me know

    CEO Of BarakaDesigns.com, Need PSD to vB? Need a Custom skin? Hit me up -Baraka aka 1Only

  10.     
    #19
    Member
    Website's:
    warezhackerz.com forumscripts.org
    I really Like this thread

  11.     
    #20
    Respected Developer
    Website's:
    X4B.org
    Quote Originally Posted by 1only View Post

    well this is pretty small but its a mini function to generate salt hash value(s) to make secure when inserted in the database for either when a user registers or w/e which then when you want use of the function for making the pass-hash you can do something like this:

    This is really something that can be used in a class to make things easier. Did this off the top of my head so if there is room for improvement let me know
    Ask and ye shall receive.
    PHP Code: 
    function saltGenerator($limitChars=8) {
        
    $saltv '';
        for (; 
    $limitChars; --$limitChars)
            
    $saltv .= chr(rand(33,126));
        return 
    $saltv;

    Best I can think of, also includes a few more symbols in the calculation, see ascii table: http://www.asciitable.com/index/asciifull.gif

Page 2 of 5 FirstFirst 1234 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Plz Help To Add A Php Snippet Into My DLE Index !
    By JoomlaZ in forum Web Development Area
    Replies: 0
    Last Post: 7th Jul 2011, 01:18 PM
  2. [C#] Tiny Web Server (snippet)
    By Hyperz in forum Web Development Area
    Replies: 6
    Last Post: 24th Jun 2010, 01:19 PM
  3. Image Upload in php. Code snippet #2
    By SplitIce in forum Tutorials and Guides
    Replies: 5
    Last Post: 31st Oct 2009, 07:40 AM
  4. See real OOP (Snippet from Litewarez V2) Webmasters CP
    By litewarez in forum Tutorials and Guides
    Replies: 21
    Last Post: 19th Sep 2009, 03:59 PM
  5. A Snippet from my latest project
    By litewarez in forum Tutorials and Guides
    Replies: 19
    Last Post: 21st Jun 2009, 05:17 PM

Tags for this Thread

BE SOCIAL