Jump to content

Zane

Administrators
  • Posts

    4,362
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zane

  1. [quote]what are the drawbacks of public classes ? If I remember correctly in Java my teacher used to say that we should try to use as much private classes as public classes tended to be a risk to mess up later programming.[/quote] I think you mean public/private functions In a public function: You can access the function from within the class and outside the class (from the object) In a private function: You can only access the function from within the class Additionally in a static function: You can only access the function from outside the class....and not the object either Example [code=php:0]class Foo   public Foo() {   }   public functionA($showB = false) {     echo "A";     if($showB)         $this->functionB();   }   private functionB() {     echo "B";   }   static functionC() {       echo "Static C";   } } $var = new Foo(); $var->functionA(); //would show A $var->functionA(true); //would show AB $var->functionB(); //would return an error because it's private $var->functionC(); //would return an error for non-object whatever Foo:functionC(); //would show Static C[/code]
  2. oh ok..I get it I can't exactly explain why I get it, but i reminds me of the same way CHMOD permissions work.. but more extended
  3. I'll have to study the pattern of that tomrrow... Thanks a lot Barrand, I learned a lot in the last...while. @roopurt too I'm definitely putting this thread in the Repository when it's all said and done. Some very useful information here.
  4. eh..I was just wondering since the numbers 17 through 31 are both greater than 16 and NOT a power of two that they would all be classified as ALL of these ---------------------- 1    E_ERROR 2    E_WARNING 4    E_PARSE 8    E_NOTICE 16  E_CORE_ERROR I'm assuming they are I just wrote the loop wrong... that IF will always return true regardless I just realized...unless the result is 0
  5. So is that true for all numbers 17 through 31 here I am at another interesting point. say I wanted to test such a question with a loop [code=php:0] for($i=17;$i<32;$i++) {   if(decbin(31) | decbin($i))     echo "$i is all of them"; } [/code] would that work?
  6. OMG I learned something! thanks so much guys Now I just have to grasp the other operators. In retrospect I learned that if I do $a & ~$b $b is basically removed from $a IF it exists....or turned off essentially. Just gonna do another test in my head ... I'm not even using a PHP server at all BTW.  This is all straight up calc.exe, php.net and you guys. So Considering echo decbin(E_ALL & ~(E_CORE_WARNING | E_COMPILE_WARNING | E_USER_WARNING)); returns 10101011111 echo decbin(E_ALL | ~(E_CORE_WARNING & E_COMPILE_WARNING & E_USER_WARNING)); should return..... - - -time goes by - [code] E_CORE_WARNING (0000100000) & E_COMPILE_WARNING(0010000000) & E_USER_WARNING(1000000000) (0000100000 & 0010000000 & 1000000000) = 0000000000 ~0000000000 = 1111111111 E_ALL(1111111111) & 1111111111 = 0000000000 [/code] Furthermore... say I went error_reporting(E_ALL >> 5) translating to....... 1111111111 -> 0000011111 -> 31 31 translating to E_CORE_ERROR I guess since 32 hasn't been reached yet...right?
  7. Ok...it's making much more sense now So say I wanted to show all errors except E_CORE_WARNING - 32 bits E_COMPILE_WARNING - 128 bits E_USER_WARNING - 512 bits would I say? in a non-constant sense [code] $showErrors = 11111111111;                //E_ALL $showErrors = $showErrors & ~100000        // ~E_CORE_WARNING $showErrors = $showErrors & ~10000000    // E_COMPILE_WARNING $showErrors = $showErrors & ~100000000  //E_USER_WARNING error_reporting($showErrors); [/code] or another quesiton would $showErrors then equal? 10101011111
  8. Is Wikepedia really that insecure? It seems like they would work off a surveying system or something like where moderators go through and read a bunch of entries and decide what stays according to how recurrent it is.
  9. ReCap again... alright I'm a permissionless user $zanesPerms = 0x00000000; the Admin gives me posting rights $zanesPerms = $zanesPerms | 0x00000128 //$zanePerms now equals ... 0x00000128? if the Admin then gave me Delete user rights... 0x00000064 Explain to me the way barand did, how the variable is changed. would zanesPerms be 0x00000192? or something else and why I appreciate your help a lot
  10. If it's custom 404 pages your wanting, you'll have to edit the 404.shtml file to forward those variables to 404.php. I can't remember the exact instructions but I can find out for you in a second UPDATE: take a look at this tutorial http://www.onlamp.com/pub/a/onlamp/2003/02/13/davidsklar.html EDIT: Nevermind, if you have it redirecting to 404.php already on an error then you must already have that setup you need to tell 404.php to use the $_SERVER['REDIRECT_URL'] variable
  11. I don't seem to follow your question all the way.. are these separate columns [quote] 1 : red pie <#> green pie <#> blue pie <#> yellow pie 2 : blue pie <#> yellow pie 3 : green pie <#> blue pie <#> yellow pie [/quote] or is it data all in one column....shown per row My question is how would you end up with the order Red Green Yellow Blue I can't see that order appearing anywhere.
  12. In reference to this post http://www.phpfreaks.com/forums/index.php/topic,110890.msg450649.html#msg450649 So to check my understanding..using as little jargon as possible. At the beginning you have NO permissions..meaning just that then say you want to allow them to delete a user Delete a user has it's own numeric ...hex..value..whatever say 0x00000064 if I want to append that permissioin to the $perms variable I use the | operator? [code=php:0]$perms = $perms | 0x00000064[/code] [color=teal]Considering I don't use constants in this example which I know you preached on so much and I'd like to say I agree on but for the sake of understanding...yeah[/color] and I validate it with the & operator? [code=php:0]if($perms & 0x00000064) //Can delete users[/code] Say I did it vice versa? [code=php:0] $perms = $perms & 0x00000064; if($perms | 0x00000064) //Then what [/code]
  13. Wow I completely understand how it works but I have no clue why I would use it now. I can't spot the convenience of it Thank you for the extensive examples though Barrand I'm sure one day something will spark and I'll need to dig deep into the binary aspects of what I'm doing. omg my brain hurts from that one. I knew I shouldn't have asked such a question...lol
  14. I've always wondered how that feature would work.  It baffles me everytime. But the idea I come up with everytime at the end is this. You would want it so that you can tell if they've seen the post or not...not the thread. cuz if you think about it.  Everytime someone posts a new reply...that's a new post you haven't seen.  And once you view the thread again you have. It makes it that much harder though.  I'd say have an extra column in the users table for posts read and continue to populate a serialized array you have in there...maybe at a fulltext datatype. Just throwing an idea out there not sure of it's quality Hope I inspired something
  15. Thanks for the response. &= is an assignment operator not a bitwise. Assign by reference I believe it's called. I understand how references work, I was wondering how such operators like these work $a & $b $a | $b $a ^ $b ~ $a $a << $b $a >> $b
  16. [quote=http://us2.php.net/manual/en/reserved.variables.php] HTTP POST variables: $_POST     Note: Introduced in 4.1.0. In earlier versions, use $HTTP_POST_VARS. [/quote]
  17. Every now and again I stumble on something about PHP I've never heard about. I was looking at Operator Precedence and found a bitwise operator. I looked further into it and found out there were more of those, but I have no clue where or when I would use them.  I can't understand the examples. Can anyone enlighten me here.  Gimme a scenario were I'd use a bitwise operator? Thanks
  18. wow..this is an interesting thread well for my turn. I'm 20 years old. I'm from the farthest west city you can go in North Carolina.  For those of you who watch the news, it's the city where they caught [url=http://en.wikipedia.org/wiki/Eric_Robert_Rudolph]Eric Rudolph[/url] (one of the Top Ten Most Wanted) The first time I remember really soaking myself into a computer was with an old Gateway2k running Windows 3.1 Never thought I would be making anything useful on one though.  By the time high school rolled around I could take them apart and troubleshoot whatever as well as make some sort of cheesy website with Homestead/Geocities/Angelfire/ or Tripod.  I can't even remember how I found PHP.  I guess I just knew that I needed a way to create a form and found the best way and wala. I go to a Community College aiming towards a Computer Technology Systems degree and am struggling through the welcome path to the "real world."  I speak English and Spanish..(thanks to 10 years of dedication) and I like to party and get ~retarded.
  19. what's the way the date should correctly show. take a look at the date funciton here http://www.php.net/date and use this whole statement as the second argument for instance [code=php:0] date("Y-m-d:h:m:s", strtotime("-1 hour", strtotime(mosCurrentDate()))); [/code]
  20. I think it would be a good idea to give your navation links a background-color and some padding instead of just being underlined. It would seem more modular, if that's what you're going for. Like the breaking news...if you gave each LI a background color
  21. echo strtotime("-1 hour", strtotime(mosCurrentDate()));
  22. Well for one [code] it's supposed to be $query="INSERT INTO movie (name, genre, description) VALUES ('$mname', '$genre', '$mdesc')"; $result = mysql_query($query)or die('Error!' . mysql_error()); [/code] not [quote] $query ="INSERT INTO movie (name, genre, description) VALUES ("$mname", "$genre", "$mdesc")" or die('Error!' . mysql_error()); mysql_query($query); [/quote]
  23. check out this thread http://www.phpfreaks.com/forums/index.php/topic,95376.0.html
  24. As long as you don't allow them to create variables make PHP statements you should have to worry about malicious code. if you block thing like { } $ = -> and as long as they don't have access to any global variables like _POST or _GET there's nothing dangerous that could happen... [quote] To modify this to allow letters as well, I would use? (assuming I first make the input lowercase) Code: if(ereg("[^a-z0-9()\*\/\\\^\+-\s]+", $textInput))   echo "Not a Valid Mathmatical function"; else   eval($textInput); [/quote] yeah...you can also set for uppercase too [^a-zA-Z0-9()\*\/\\\^\+-\s]
  25. [code=php:0] if(ereg("[^0-9()\*\/\\\^\+-\s]+", $textInput))   echo "Not a Valid Mathmatical function"; else   eval($textInput); [/code]
×
×
  • 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.