Jump to content

alecks

Members
  • Posts

    80
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

alecks's Achievements

Member

Member (2/5)

0

Reputation

  1. as long as you are using ajax, grab the hash w/ ecma and load the rest of the page from a php script
  2. Never encountered this before until browsing through some code error_reporting(E_ALL & ~E_STRICT); I know what the function is, I'm curious about what & ~E_STRICT does. If it helps, this code has a PHP 5 requirement. Thanks
  3. Whats the point of having static methods then?
  4. Just a bit confused as to how PHP handles static methods; my impression is that they cannot be accessed through an instance ($obj->staticMethod(), only using the scope res op (class::staticMethod(). Is this correct?
  5. Nevermind $('ul.test').children('li').remove();
  6. I have a list (<ul>), and I want to remove the items (<li>s) from within it using jQuery. How do I do it? I tried it this way: JavaScript: $(function() { $('ul.test').remove('li'); }); HTML file: <ul class="test"> <li>List item number one.</li> <li>List item number two.</li> </ul> Thanks!
  7. Will a session ID always have letters in it, so that when tested with is_numeric() it will always come back as false?
  8. I need to clear this up in my mind, because I have heard so many conflicting answers from online references: What is the proper way to retrieve HTTP passed variables (http://www.test.com/index.php?var=foo) within a PHP script? (so that it will work with PHP 6 (register_globals gone))
  9. Consider this query: $query = "SELECT * FROM users WHERE username = ''. $_POST['username'] .''"; The user could send "' OR '1'='1" as their username, which would make the query: $query = "SELECT * FROM users WHERE username = '' OR '1'='1' "; Which would always come back as true (not false) if queried. The user could of course do something even more malicious . What mysql_real_escape_string does is add slashes before the quotes, so they are taken literally, not as parts of the query. $query = "SELECT * FROM users WHERE username = '\' OR \'1\'=\'1\''"; In this query where the input is escaped the username would have to be "' OR '1'='1" in order for the query to come back as true (not false).
  10. that would be a javascript feature, not PHP basically just look at the source code from existing text editors (http://www.kevinroth.com/rte/demo.htm).
  11. That does work; the context I was trying to implement it was within the object instantiation. I wanted to fetch data from a database and then change the array into object vars. Ex: <?php class obj{ function obj($name) { $data = <fetch from database> $this = (object) $data; } } $obj = new obj('name'); ?>
  12. Is there an easy way to turn an associative array into an object? Something like (within the object) : $this = (object) array('bleh'=>'teh'); The above does not work...
  13. $GLOBALS['glob_var'] = 10; $var =& funk(); echo 'SHOULD BE 10: '.$var."<br />\n"; $GLOBALS['glob_var'] = 11; echo 'SHOULD BE 11: '.$var."<br />\n"; function funk() { $ref_var = &$GLOBALS['glob_var']; echo 'SHOULD BE 10: '.$ref_var."<br />\n"; return $ref_var } ???
  14. with global-ized variables or super globals like $GLOBALS it isn't necessary to reference them within a function, ex $my_var = 12345; echo $my_var; function afunc() { global $my_var; $my_var = 23456; } afunc(); echo '<br />'.$my_var; would output 12345 23456 References are useful when passing variables to functions and you want to modify them, ex: $my_var = 12345; echo $my_var; function afunc(&$ref_to_my_var) { $ref_to_my_var = 23456; } afunc($my_var); echo '<br />'.$my_var; will output 12345 23456
×
×
  • 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.