Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. If you have trouble setting up a DB schema for friend lists then take a look at: http://stackoverflow.com/questions/4674005/setting-up-a-friend-list-in-mysql
  2. XML is not faster than MySQL. And with 40000 queries your XML solution will completely bog down your server while MySQL would only be getting warmed up.
  3. LOL Care to elaborate? I am running PHP 5.4 under Windows and trying to use the money_format() function returns: Which is the same error as the OP while you stated it was due to an old version of PHP, which it is not.
  4. He is running Windows and per the manual: You can try this function that you can find on the manual page as a replacement: http://be2.php.net/manual/en/function.money-format.php#89060 function money_format($format, $number) { $regex = '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?'. '(?:#([0-9]+))?(?:\.([0-9]+))?([in%])/'; if (setlocale(LC_MONETARY, 0) == 'C') { setlocale(LC_MONETARY, ''); } $locale = localeconv(); preg_match_all($regex, $format, $matches, PREG_SET_ORDER); foreach ($matches as $fmatch) { $value = floatval($number); $flags = array( 'fillchar' => preg_match('/\=(.)/', $fmatch[1], $match) ? $match[1] : ' ', 'nogroup' => preg_match('/\^/', $fmatch[1]) > 0, 'usesignal' => preg_match('/\+|\(/', $fmatch[1], $match) ? $match[0] : '+', 'nosimbol' => preg_match('/\!/', $fmatch[1]) > 0, 'isleft' => preg_match('/\-/', $fmatch[1]) > 0 ); $width = trim($fmatch[2]) ? (int)$fmatch[2] : 0; $left = trim($fmatch[3]) ? (int)$fmatch[3] : 0; $right = trim($fmatch[4]) ? (int)$fmatch[4] : $locale['int_frac_digits']; $conversion = $fmatch[5]; $positive = true; if ($value < 0) { $positive = false; $value *= -1; } $letter = $positive ? 'p' : 'n'; $prefix = $suffix = $cprefix = $csuffix = $signal = ''; $signal = $positive ? $locale['positive_sign'] : $locale['negative_sign']; switch (true) { case $locale["{$letter}_sign_posn"] == 1 && $flags['usesignal'] == '+': $prefix = $signal; break; case $locale["{$letter}_sign_posn"] == 2 && $flags['usesignal'] == '+': $suffix = $signal; break; case $locale["{$letter}_sign_posn"] == 3 && $flags['usesignal'] == '+': $cprefix = $signal; break; case $locale["{$letter}_sign_posn"] == 4 && $flags['usesignal'] == '+': $csuffix = $signal; break; case $flags['usesignal'] == '(': case $locale["{$letter}_sign_posn"] == 0: $prefix = '('; $suffix = ')'; break; } if (!$flags['nosimbol']) { $currency = $cprefix . ($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']) . $csuffix; } else { $currency = ''; } $space = $locale["{$letter}_sep_by_space"] ? ' ' : ''; $value = number_format($value, $right, $locale['mon_decimal_point'], $flags['nogroup'] ? '' : $locale['mon_thousands_sep']); $value = @explode($locale['mon_decimal_point'], $value); $n = strlen($prefix) + strlen($currency) + strlen($value[0]); if ($left > 0 && $left > $n) { $value[0] = str_repeat($flags['fillchar'], $left - $n) . $value[0]; } $value = implode($locale['mon_decimal_point'], $value); if ($locale["{$letter}_cs_precedes"]) { $value = $prefix . $currency . $space . $value . $suffix; } else { $value = $prefix . $value . $space . $currency . $suffix; } if ($width > 0) { $value = str_pad($value, $width, $flags['fillchar'], $flags['isleft'] ? STR_PAD_RIGHT : STR_PAD_LEFT); } $format = str_replace($fmatch[0], $value, $format); } return $format; }
  5. $array[] = array(postcount($row['username']) => $row['username'].':'.$row['lastlogin']); Creates a new entry for each user in $array. To be able to access postcount, username, and such in an easy way it's best to use: $array[] = array('postcount' => postcount($row['username']), 'username' => $row['username'], 'lastlogin' => $row['lastlogin']); Acessing the first player's postcount: $array[0]['postcount']; While you would have to get creative with the example at the top of this post to get the same info: key($array[0]);
  6. Use extract function trace_log($array) { if (is_array($array)) { extract($array); $sql = "INSERT INTO reg_log_trace( step, file, script, func, line, var_name, var_value ) VALUES ( 0,'{$myfile}','{$script}','{$func}', {$line}, '{$var_name}', '{$var_value}' )"; db_query($sql); } .. }
  7. It also makes him "valid".
  8. My guess would be "Cannot redeclare function replacesmiley()" move the smiley function out of the while() loop. EDIT: OP beat me to it.
  9. 3 years? Has it already been that long?
  10. Then report they have an RFI issue they need to resolve.
  11. Like PFMaBiSmAd already pointed out your table appears to be sorted by username. CTRL+U and view the source whether it has been correctly sorted there.
  12. Alternative options are: A) model the relation and take advantage of the relational model: comments (comment_id) blog_comments (blog_entry_id, comment_id) artwork_comments (artwork_id, comment_id) profile_comments (profile_id, comment_id) because the type column has a few drawbacks which you may not have considered, it's difficult for example to left join using a value in a type column. B) create a comments table for each type instead of just having one comments table.
  13. Head on over to the phpfox website and contact their support. If there is an exploit in their software you must be able to download a patch.
  14. basename echo basename($_SERVER['PHP_SELF']);
  15. http://www.php.net/manual/en/function.headers-list.php then.
  16. http://www.php.net/manual/en/function.apache-request-headers.php returns the headers of the current request.
  17. Give us an example of code you wrote and what she said you had to change. Maybe she is just nitpicking (or she likes you and just needs an excuse to talk to you ) but is pleased with your work overall. I guess if she wasn't you would be looking for a new job
  18. $settings['0'] is the same as $settings[0] In this code: $httpCode = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); if ( $httpCode == 404 ) { return '404'; } else { return $response; } curl_close( $ch ); curl_close() is never executed. Same here: throw new Exception( "API: Page Not Found - 404" ); // Remove cache file on error to avoid writing wrong json unlink( $cache_file ); unlink() is never executed.
  19. <meta name="robots" content="nofollow"> Means the page will be indexed, to avoid this use: <meta name="robots" content="noindex,nofollow">
  20. Yes
  21. PHP Coding Help means we help you with the code YOU wrote. If you want to hire someone to write code for you, you should post your question in the freelance secction. Otherwise post the code you have so far and where you are having trouble with.
  22. set_exception_handler
  23. Read http://www.phpfreaks.com/tutorial/php-security If you already do this, then your scripts are protected against the most common risks.
  24. You clearly have no idea what you are talking about. procedural pre-dates OO, are you saying all those years there were only newbie programmers?
×
×
  • 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.