Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. One of my personal favorites. I invite you to share yours
  2. In the words of Vinnie Jones in lock stock, "you cheeky barstard!"
  3. Tested in IE7 now I'm home, works as well. Personally I wouldn't worry about it...
  4. Which version? Tested in IE6 okay.
  5. Meta cache preventions are inconsistent across browsers, try using PHP to set the headers: header('Cache-Control: no-cache'); header('Pragma: no-cache'); NB I wouldn't rely on JavaScript for anything "fail-safe".
  6. Have a read.. http://www.w3.org/TR/CSS21/media.html
  7. It's not recursive if that's what you meant, but it'll work on any 2 single-dimension arrays with equal length. Actually I didn't consider this originally, but it'll only work properly on integer indexes - converting literal indexes to integer in the event of them. I'd just go with Daniel's solution..
  8. To make it more like shuffle() in-fact you could pass the array by reference: function shuffle2arrays(&$array1, &$array2) { if (count($array1) != count($array2)) { return false; } $count = count($array1); $keys = array_rand(range(0, ($count-1)), $count); $new_array1 = array(); $new_array2 = array(); for ($i = 0; $i < $count; $i++) { $new_array1[$i] = $array1[$keys[$i]]; $new_array2[$i] = $array2[$keys[$i]]; } $array1 = $new_array1; $array2 = $new_array2; return true; } Then you just need to call it with: shuffle2arrays($some_array, $another_array);
  9. shuffle() is random so there's no way you can repeat it. However you could implement you're own shuffle method, for example: <?php function shuffle2arrays($array1, $array2) { if (count($array1) != count($array2)) { return false; } $count = count($array1); $keys = array_rand(range(0, ($count-1)), $count); $new_array1 = array(); $new_array2 = array(); for ($i = 0; $i < $count; $i++) { $new_array1[$i] = $array1[$keys[$i]]; $new_array2[$i] = $array2[$keys[$i]]; } return array($new_array1, $new_array2); } $array1 = array(1,2,3,4,5); $array2 = array('a','b','c','d','e'); list($array1, $array2) = shuffle2arrays($array1, $array2); print_r($array1); print_r($array2); ?> That's the only way I can think of doing it, someone else may have a much simpler solution though.
  10. This is probably something the browser does automatically to save ink. Have you setup a print media style sheet?
  11. This may be of some use to you for Q1 (assuming a *nix system): http://www.mydigitallife.info/2007/12/13/how-to-find-and-check-number-of-connections-to-a-server/ You should be able to run that through the system function: system("netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1"); You may not get a truly accurate result running through PHP though as you're not root user. Think you need to give more details for Q2, what kind of "message" do you mean?
  12. Adam

    fadeOut

    I've never implemented it myself but this may be of use to you: jQuery's stop() method.
  13. The ereg* functions are deprecated as of PHP5-3. I'd go with a preg_* solution if I were you.
  14. You can use empty to check if the variable is empty: <p class="right"><?php if (!empty($price4)) echo $price4 . " per Lb."; ?></p>
  15. ... and the error is? By the looks of things you're using undeclared variables -- or do you have register globals enabled? (bad idea)
  16. *slaps forehead* That'll be why var_dump had no output. Nice spot Buddski! You just need to change the form action as Buddski was talking about. Change: <FORM ACTION="page2.php" method=post> To: <form action="Orderform.php" method="post"> You also need to re-think the way you're testing if the form validation was successful. if (!(VerifyForm($formValues, $formErrors)) [...] Returning the $error array length will lead to this evaluating to true when the function returns 0 errors, because 0 == false. Instead return from the VerifyForm() function like this: if (count($errors) > 0) { return false; } return true;
  17. By nothing do you mean "bool(false)"?
  18. There's several problems then. Keep that last bit as what I just said or the VerifyForm() function will always return 0. I can only think there's a problem with your form logic, try a var_dump on the $errors array just before you return it.
  19. Think this is your problem: return (count($errors) == 0); Try just: return count($errors);
  20. Which are lines 53 and 56? That looks like some messy logic.. What is it you're trying to do?
  21. You'd want to use regexp for something like this. This may be helpful: preg_replace('\b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]', '<a href="\0">\0</a>', $text); Taken from: http://www.roscripts.com/PHP_regular_expressions_examples-136.html -- not tested. Read up on preg_replace for how to use it properly.
  22. Could you post just the relevant code?
  23. Notice the red "deprecated" warnings on the BODY attributes: http://www.w3schools.com/tags/tag_body.asp As gwolgamott was saying you should use the style attribute, or better yet a CSS class: body { background-color: <?php echo $bg; ?>; color: <?php echo $fg; ?>; } And you were actually combining the two: <?php= ..
  24. Over how much time?
×
×
  • 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.