Jump to content

xyph

Staff Alumni
  • Posts

    3,711
  • Joined

  • Last visited

  • Days Won

    1

xyph last won the day on August 24 2013

xyph had the most liked content!

About xyph

  • Birthday 10/19/1986

Contact Methods

  • Website URL
    http://mdanielson.net

Profile Information

  • Gender
    Male
  • Location
    Surrey, BC

xyph's Achievements

Advanced Member

Advanced Member (4/5)

12

Reputation

  1. Well, wacky code will produce wacky results. PHP being so forgiving, it doesn't just explode - There are definitely positives and negatives of that overall behaviour.
  2. Alternately, <?php $values = array( // Number => Weighted chance 1 => 1, 2 => 1, 3 => 5, // 5x more likely than 1,2 4 => 3 // 3x more likely than 1,2 ); // The total of all the chances $total = array_sum($values); // Will track the sum of all tested chances $i = 0; // The number we're looking to find $find = mt_rand(1,$total); // Loop through value=>chance array foreach( $values as $val => $chance ) { // Add current chance to the running total $i += $chance; // Check if the running total equals or exceeds the number we're trying to find if( $find <= $i ) // If so, break out of the loop break; } // The last assigned value before breaking will contain the number echo $val; ?> The process is more complex, but the input is more simplified.
  3. If cURL is gone, I doubt allow_url_fopen is true
  4. Force everyone to use OSX? Expecting a browser to render fonts like a design application is just silly I believe most just piggy-back on the OS' rendering engine. Use images, static or dynamic, if you need fonts to render in a certain way.
  5. BTW - you should tie your mind up tighter next time
  6. Well, there's 256 valid ASCII characters, so he's nowhere near half-way.
  7. session_register is long depricated. On top of that, you're using in incorrectly. Please, check out the manual on how to assign and use session variables. http://php.net/manual/en/session.examples.basic.php
  8. I think it's preg_quote that's messing up the ranges (\-). IMO, using a blacklist is a bad idea unless you're limiting all input to the ASCII range, and even then it would be pretty big. A solution could be to keep ranges in a separate array, and not preg_quote those.
  9. Is the PHP script being used to authenticate running on the same server as their application?
  10. Can you please give us a small snippet of code to recreate your issue. You are being vague and using some confusing language to try and explain your problem.
  11. INSERT INTO tablename (counter, unique) VALUES (1, $unique_value) ON DUPLICATE KEY UPDATE counter = counter + 1; http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html You should read the manual entry. There are some specific by-products of using this method.
  12. Probably, because that function doesn't exist? The manual is a necessary reference, you have to learn to check there first http://www.php.net/m...mysqli-stmt.php As to your problem, http://www.php.net/m...-stmt.fetch.php Ninja'd.
  13. You're missing the money_format call in your log.
  14. Seems legit.
  15. Why not use the example that works then. The language barrier here seems too large to overcome. I'm really lost.
×
×
  • 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.