Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Well yeah it was that post I was referring to but didn't knew the title nor poster. Thx MadTechie
  2. I'm confused: You said in this post http://www.phpfreaks.com/forums/index.php/topic,283334.msg1343289.html#msg1343289 And now: In this post http://www.phpfreaks.com/forums/index.php/topic,283334.msg1345268.html#msg1345268
  3. I would do that to probably. But I don't smoke And those fake chocolate versions won't cut it!
  4. You don't need a background task for something like that. You will eat up all resources and even crash your server if you ever get lots of simultaneous users (imagine 10k users each having 10 or more tasks running?? Like building, upgrading and researching). Just use Ajax and a field in your database table that specifies when the build will be complete.
  5. If you really want to create a search engine than you should check out "Understanding Search Engines: Mathematical Modeling and Text Retrieval" (Michael W. Berry & Murray Browne)
  6. Wow a major upgrade from the last I'm very impressed *thumbs up* A few friendly pointers: - SEO optimize your homepage Highlight keywords: Matching page title:
  7. That is confusing to me I ususally adhere to: Now you instanly know the function callsign is check_login() A dash indicates an underscore
  8. take a look at Zend_Log they even allow you to create your own error codes http://framework.zend.com/manual/en/zend.log.html
  9. This should get the job done: function trigerrexit($message) { trigger_error($message); exit(0); } $directory = implode(DIRECTORY_SEPARATOR, array('path', 'to', 'dir2')); if (!is_directory($directory) || !is_readable($directory)) { trigerrexit("$directory is not a directory or is not readable."); } $directoryFileCount = array(); $directoryFileIndex = 0; $directoryPointer = $directory . DIRECTORY_SEPARATOR; // assuming $files are already read from directory1 foreach ($files as $file) { if (empty($directoryFileCount)) { $directoryFileCount[$directoryFileIndex] = 0; $directoryPointer = $directory . DIRECTORY_SEPARATOR . $directoryFileIndex . DIRECTORY_SEPARATOR; if (!mkdir($directoryPointer)) { trigerrexit("Could not create directory $directoryPointer"); } } else if (10 > $directoryFileCount[$directoryFileIndex]) { if (!copy($file, $directoryPointer . basename($file))) { trigerrexit("$file could not be copied to $directoryPointer"); } $directoryFileCount[$directoryFileIndex]++; } else { $directoryFileIndex++; $directoryFileCount[$directoryFileIndex] = 0; $directoryPointer = $directory . DIRECTORY_SEPARATOR . $directoryFileIndex . DIRECTORY_SEPARATOR; if (!mkdir($directoryPointer)) { trigerrexit("Could not create directory $directoryPointer"); } } }
  10. The required functions can be found here http://php.net/manual/en/book.pdf.php It is however required to have the PDFlib library loaded. If you don't have the library and can't install it then FPDF may be of some help as this library does not need the PDFlib FPDF: http://www.fpdf.org/ Alternatively you can use Zend_Pdf which is a component of an increasingly popular framework http://framework.zend.com/manual/en/zend.pdf.html I highly recommend Zend_PDF
  11. - Your HTML is invalid IMO this is a serious problem - Page title remains the same for all pages and does not add to SEO - Your links are blue on a blue background on the products page - Your flyout menu does not add to accessibility, sub links can not be accessed by tabbing
  12. - I like the look of the website. Very clean & proffesional. - Your HTML is invalid which is IMO a serious problem - I like the integration of SaaS services (like flickr) - Your fancy flyout menu is not usable (decreased accessibility) - Only few pages have SEO focused page title's - Meta tags do almost never match the page content - Properly indent sub-pages on the sitemap
  13. IMO this is just bad practice. You are mixing business logic with representation (XML, JSON) switch($Options->type) { case 'mysql': case 'pgsql': $strDSN = "$Options->type:host=$Options->host;dbname=$Options->name"; if ($Options->port) $strDSN .= ";$Options->port"; break; default: throw new DB_Exception("Unsupported type, $Options->type"); return; } There are design patterns for this kind of behavior. cf Adapter pattern (http://en.wikipedia.org/wiki/Adapter_pattern). Plus your constructor should never do real work only initialization. Your collaborators if any should be lazy-loaded (http://en.wikipedia.org/wiki/Lazy_loading). What I also don't like is the usage of mixed hungarian notation. Don't use it on and off. You might aswell just drop it as it has no value in a dynamic programming language like PHP. $txt.. may aswell be an object.
  14. I already gave this link once somewhere in another post http://onlamp.com/pub/a/php/2002/12/05/one_time_URLs.html
  15. When the user gives the order to start build something then store the time it will be done (now() + time to build) in the database with the structure. Use JavaScript or Flash to animate the building process while this is merely fake because even if the user now cheats he would not be able to use the building as in the back-end it is still building... This also allows you to give the user special items like "reduce built time with 20 minutes" where after you update 1 or multiple rows and deduct 20 minutes of 1 or multiple rows for which the finished build time is higher then now()
  16. It is because of how PHP handles strings (http://php.net/manual/en/language.types.string.php#language.types.string.conversion) When you did $time = $start + $end; It converted both $start and $end to an integer (because of the + operand) resulting $start in 8 and $end in 8 which make your 16 total. while ($row = mysql_fetch_array($results, MYSQL_ASSOC)) { $start = strtotime($row['start_time']); $end = strtotime($row['end_time']); $diff = $end - $start; $hours = floor($diff / 3600); $minutes = floor($diff % 3600 / 60); $seconds = $diff % 60; echo date('d M Y', $start), ' + ', date('H:m:s', mktime($hours, $minutes, $seconds)), ' = ', date('d M Y', $end); } Chances are this can be written a lot shorter.
  17. We got plenty of both to share
  18. LOL for a moment I thought he meant it
  19. $keys = array_rand($array, 2); echo $array[$keys[0]][0]; // 1 echo $array[$keys[1]][1]; // E
  20. $PriceTaxed = $currPrice * (1 + $tax / 100);
  21. That's because the function is included before the header.php file is called.
  22. Read the manual on how to properly utilize sprintf echo sprintf('%d', $TotalNumber);
  23. That's not good because then the action was always successfull. if (0 < changeGameState($someId))
  24. @crabfinger, redarrow: That won't stop me from voting a few million times I can get a ten-minute mail. Open 10-20 tabs to the register page and fill them in and submit them. Your system will be just flooded with fake accounts. Many voting systems now use a SMS based service to vote. If someone now wants to vote a few million times you'll be rich
×
×
  • 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.