Jump to content

Nolongerused3921

Members
  • Posts

    141
  • Joined

  • Last visited

Posts posted by Nolongerused3921

  1. [quote author=newb link=topic=107752.msg433678#msg433678 date=1158174603]
    usergroup permissions can be done without bitwise. they can be done in sessions and stuff, i think.
    [/quote]

    How exactly can an optimized [url=http://en.wikipedia.org/wiki/Bitwise]Bitwise[/url]-like system be achieved with "sessions and stuff"?
  2. I've been planning my engine out, but I've run into a bit of a problem... How should I handle permissions?
    I was thinking having an internal module (Automatically loaded regardless) set to do permissions checks, and have each module set its own permission tables (Defines), but this leads to the (Nearly impossible but potential) problem of... What will I do when I want to access certain permissions from other modules?

    My other idea was to put a SET permission table in the permission checker... But this kind of scares me, since I'd have to have a LARGE number of defines and could potentially run out of bitwise numbers.

    Although, after a bit of thought... I suppose the latter would make more sense as the bitwise number would be stored in the database, in the same column...
    Anyone have comments or suggestions on this?
  3. [quote author=448191 link=topic=107752.msg432868#msg432868 date=1158079436]
    [quote author=Sykoi link=topic=107752.msg432843#msg432843 date=1158077362]
    ... However, I'd rather not use function_exists() as it would kind of defeat the purpose in my opinion, as it would require you to know a function from that module.
    [/quote]

    But you intend to use the function, right? Wouldn't you need to know the name of the function in order to use it?  ;D

    Just check for the first function you want to use, if it exists, you know the 'module' is loaded and it is safe to use the other functions in that module.
    [/quote]

    Yes but I was kind of going for a no hassle, automatic, "just call the load function" functionality :p
  4. [quote author=448191 link=topic=107752.msg432836#msg432836 date=1158077066]
    [quote author=Sykoi link=topic=107752.msg432815#msg432815 date=1158076097]
    For the loading, what I was thinking about doing is making the "main file" (All the module loading stuff), read a list of modules from a modules.php file (Which includes where they're located), and loading up ones that are important automatically (A priority system in modules.php?), and allowing each module to include other modules on its own.

    Now this could lead to problems, but I have solved it (In theory :p), by making the module loading function (Which 'automatic loading' calls) add the module loaded into an array, and checking this array every time it loads a new module into memory - this way modules that need to access the mysql module, can call it in case they are called before MySQL is loaded automatically.

    Its a bit confusing, but it sounds good... At least to me.


    This is just a small portion of it, and I'd like to get some comments and suggestions and hear more ideas before I actually plan this all out in full :)
    [/quote]

    Just to make sure we're on the level here: with loading modules into an array you mean loading instances of classes representing modules into an array? If so, how do you propose to access the objects from other modules (objects)? You could of course make the array global. One of the things I run into often, is that when I load a diff class from one class from the constructor, I cannot operate on the global instance of the first class from the second class, because the object is not yet constucted. Be carefull what you put in constructors, watch your extends.

    Or are you using procedural code, and are the files with functions simply included, and does the array hold the names of modules loaded? If so, you could do without the array and just check function_exists().
    [/quote]

    Errr no you're completely misunderstanding me, what I meant is that it would load the module's NAME into an array... The function itself would load a module based on an alias, then add that alias to a list of modules loaded... It would be solely used to keep track of what is loaded.

    And yes, your second statement is correct... However, I'd rather not use function_exists() as it would kind of defeat the purpose in my opinion, as it would require you to know a function from that module.
  5. For the loading, what I was thinking about doing is making the "main file" (All the module loading stuff), read a list of modules from a modules.php file (Which includes where they're located), and loading up ones that are important automatically (A priority system in modules.php?), and allowing each module to include other modules on its own.

    Now this could lead to problems, but I have solved it (In theory :p), by making the module loading function (Which 'automatic loading' calls) add the module loaded into an array, and checking this array every time it loads a new module into memory - this way modules that need to access the mysql module, can call it in case they are called before MySQL is loaded automatically.

    Its a bit confusing, but it sounds good... At least to me.


    This is just a small portion of it, and I'd like to get some comments and suggestions and hear more ideas before I actually plan this all out in full :)
  6. Indeed, however I wanted to know what the community here feels is needed in a modular system or what they have in their own. Along with any articles they used to inspire their systems... I'm good at planning whatever I program out, I just need to know what I need (I need ideas) first :p
  7. Well I've decided to take the plunge and rewrite my base code I use in all my projects, and I want to make sure to get it right this time and make sure its completely modular. But, quite honestly, I don't fully understand the allure, need, or what a modular system truly entails.

    I'm open for advice on what features a modular system needs, and any articles you can point out for me :)

    Thanks
  8. [!--quoteo(post=354617:date=Mar 13 2006, 01:33 PM:name=keeB)--][div class=\'quotetop\']QUOTE(keeB @ Mar 13 2006, 01:33 PM) [snapback]354617[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    What a weird method :D

    Try commenting out everything in the middle layer.. see if that helps.. and.. what does that do? can you post the method for that one?
    [code]  public  function query($the_query, $cached_name) {
            $this->query_id = mysql_query($the_query);
          
    /*
            if (! $this->query_id )
            {
                $this->fatal_error("mySQL query error: $the_query");
            }
        
            $this->query_count++;
    */
            $this->obj["cached_queries"]["$cached_name"] = $this->query_id; //what does this do??
            return $this->query_id;
        }[/code]
    [/quote]

    Basically it allows you to put a query into an array filled with other cached queries, so you can use other functions on them such as fetch_rows, affected_rows, etc. - without having to rewrite the query.
    And the bug is still there even after commenting :(
    Its weird, the UPDATE statement only makes THAT row blank on the FIRST time for THAT row... As in, if I update user2 the first time, no matter what I change or even if I leave everything the same - it clears everything the update query SETs... However, Every time after that - it works correctly.
  9. [!--quoteo(post=354613:date=Mar 13 2006, 01:24 PM:name=keeB)--][div class=\'quotetop\']QUOTE(keeB @ Mar 13 2006, 01:24 PM) [snapback]354613[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    can you post the [b]query[/b] method ? i am sure the problem lies in there.. [=
    [/quote]

    I thought that was the problem at first too, but, well - take a look for yourself :(
    [code]
        function query($the_query, $cached_name) {
            $this->query_id = mysql_query($the_query);
        
            if (! $this->query_id )
            {
                $this->fatal_error("mySQL query error: $the_query");
            }
        
            $this->query_count++;
            $this->obj["cached_queries"]["$cached_name"] = $this->query_id;
            return $this->query_id;
        }
    [/code]
  10. Okay well let me explain the situation: I'm currently writing a moderate users area for a site I'm working on, now thats all fine and dandy - pretty easy to do... However I've run into a major, very annoying bug that only seems to surface on my non-test machine (Non-localhost).

    The problem basically is this: When you edit a user, all of the forms are filled out and you are allowed to edit them (Username, location, etc.) and finally you can submit these changes, however - the first time a user is edited, ALL of the data is erased - the form data is SENT, I've checked this by printing the $_POST's, but MySQL just doesn't update the user THE FIRST TIME - its updated the second, third, fourth, etc. time... But never the first.

    My code:
    [code]
        $user_id_e = $var1;
        $username_e = $_POST['username'];
        $email_e = $_POST['email'];
        $country_e = $_POST['country'];
        $fav_genre_e = $_POST['fav_genre'];
        $fav_artist_e = $_POST['fav_artist'];
        $user_level_e = $_POST['user_level'];
        
        $mysql->query("UPDATE users SET username='$username_e', email='$email_e', country='$country_e', fav_genre='$fav_genre_e', fav_artist='$fav_artist_e', user_level='$user_level_e' WHERE id='$user_id_e'", "update_user");
    [/code]

    The $mysql->query is just a basic function to run a query and put it into a cache to call up later (To get fetch_row, affected_rows, etc.)

    Does anyone know what in gods name could be going wrong? Any ideas at all? I'm willing to accept even the most off the wall "Sun spots" explaination... I just need to know why this isn't working THE FIRST TIME, but does all times after that.
  11. I'm currently trying to write a function that will work on all systems (Win/*nix) without any extra PHP modules, that will allow me to both encrypt and decrypt a string.
    Now this obviously throws Mcrypt and Md5 out of the running... So what do I use? Are there ANY PHP functions that can encrypt and decrypt, that don't require any extra libraries?
    I'd prefer not to write my own encryption class but I will if nothing else exists.


    Thanks
  12. Well, its my first time using regex and I'm having a bit of a problem: I need to split the following string:
    [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
    a:6:{s:12:"firstinsertd";s:10:"01-01-1970";s:12:"firstinsertt";s:8:"01:00 AM";s:7:"updated";s:10:"10-13-2005";s:7:"updatet";s:8:"05:37 PM";s:6:"amount";d:51218.2087766306431149132549762725830078125;s:10:"updatetime";i:1131550652;}
    [/quote]
    So I can get the amount (512218) alone, without the decimal, or ;d:... But I just can't figure out how to do it.

    Heres my regex, which seems to return the number AFTER the decimal as [1] in the array (Along with ";s:10:"updatetime";i:1131550652;} )", for some reason) :
    [code]
    $ucashbank = 'a:6:{s:12:"firstinsertd";s:10:"01-01-1970";s:12:"firstinsertt";s:8:"01:00 AM";s:7:"updated";s:10:"10-13-2005";s:7:"updatet";s:8:"05:37 PM";s:6:"amount";d:51218.2087766306431149132549762725830078125;s:10:"updatetime";i:1131550652;}';


    $test = preg_split("/amount\";[d]:([0-9])*[.]/", $ucashbank);
    print_r($test);
    [/code]

    Returns:
    [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
    Array ( [0] => a:6:{s:12:"firstinsertd";s:10:"01-01-1970";s:12:"firstinsertt";s:8:"01:00 AM";s:7:"updated";s:10:"10-13-2005";s:7:"updatet";s:8:"05:37 PM";s:6:" [1] => 2087766306431149132549762725830078125;s:10:"updatetime";i:1131550652;} )
    [/quote]

    Anyone know what I'm doing wrong?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.