Jump to content

jackpf

Members
  • Posts

    1,410
  • Joined

  • Last visited

    Never

Everything posted by jackpf

  1. You should take another look at Ken2K7's code. Test this if you don't believe him (and me) that it does work: <?php function traversal ($arr) { foreach ($arr as $key => $value) { if(is_array($value)) { traversal($value); } else { echo $value.'<br />'; } } } $array = array( 'this', 'does', 'work', 'honestly.' ); traversal($array); ?> If it doesn't, there's something horrifically wrong with your array.
  2. Right at the top. Although, I reckon it would be simpler to put the page in the query string of the url. Like ?page=2 or whatever.
  3. That's not what the query does. What it does is updates the record that has "1" as the value of `column`. Maybe you should have a look at mysql update syntax. Try this mysql_query("UPDATE table SET column='$password' LIMIT 1");
  4. Put or die(mysql_error()); after the query. And are you sure there's a field called column with a value of 1?
  5. You'd have to use regex. Something like this? $str = preg_replace('/\<(^\!)/', '', $str);
  6. DISTINCT is probably what you want.
  7. Yeah, you need to set `field` to something. Look at your code. How does mysql know what to update `field` to? Try something like this: mysql_query("UPDATE table SET `password`='$password' WHERE field=1");
  8. Like this - $password = generatePassword(); You also spelt recipient wrong in your headers (line 49) No problem
  9. Wouldn't it be simpler to find out what's breaking your ajax?
  10. I don't understand, why can't you just use htmlentities()?
  11. It doesn't look like you're calling the function to create the password.
  12. str_replace('body', 'bodies', htmlentities($val));
  13. If you put or die(mysql_error()); after your query and didn't get any errors then it must be inserting.
  14. And put or die(mysql_error()); after your query/connections.
  15. It depends. If you have pretty normal sized html source, it can actually speed up rendering because the browser receives all the html at once, rather than having to piece it together. However, if your source is huge, it'll just end up taking the browser longer. But, you can use stuff like compression with OB. So idk. I personally quite like it.
  16. Kind of... Ok, make one file with something like this in: $username = $_COOKIE['username']; $timestamp = time(); mysql_query("INSERT INTO `user_timestamps` (`username`, `timestamp`) VALUES ('$username', '$timestamp') ON DUPLICATE KEY UPDATE `timestamp`='$timestamp'"); And include that on every page. Then you can figure out who's online with something liek this: $time = time() - $limit;//$limit is how many seconds you allow users to not have made a page request before they are considered "offline" $sql = mysql_query("SELECT * FROM `user_timestamps` WHERE `timestamp`>='$time'"); //do whatever...
  17. I just write some code, make a database, don't really care what it looks like So yeah, I voted "other". I guess I'd define what I code first as..the code.
  18. htmlspecialchars() is probs what you want.
  19. Ooooh you mean it doesn't post? Yeah, you need to put method="post". Default is GET.
  20. Lol yeah, nice one.
  21. What?? Why not just do this? <?php function printMainNav() { return '<ul id="mainNav"> <li><a href="#">Home</a></li> <li><a href="#">Customers</a></li> </ul>'; } $contents = printMainNav(); //do whatever echo $contents; ?>
  22. Ahaha, I have never seen anyone use curly brackets like that before. There's a link at the bottom.
  23. Yeah. Don't know why you're wanting to do it with javascript though. Cookies are way harder to handle with js. if(isset($_COOKIE['username'])) { echo 'this cookie exists'; }
  24. Wtf, surely that's a bit excessive? I just use something like this: static function post($str) { global $mysql; if(!isset($mysql)) { $mysql = new connection; $mysql->connect(); } if(is_array($str)) { foreach($str as $key => $value) { $str[$key] = $mysql->escape_string(trim($str[$key])); } } else { $str = $mysql->escape_string(self::prepare($str)); } return $str; } static function prepare($str) { return trim($str); }
×
×
  • 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.