Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. There are all sorts of stuff in the old images folder. Eric, Eric with his kid, Eric's father, Eric with Rasmus Lerdorf, scanned signature of Lerdorf to Eric. Then there is a pretty weird image called supertroopers2.jpg which is a man with, well... not much clothes on.
  2. I think it was actually a bloke, dressed as a woman... Here it is (attached). [attachment deleted by admin]
  3. Oh yeah, also, I was actually mod for a few hours between admin and PFR. So my route was actually: regular member > pfr > mod > admin. Mod was for a so short time that it doesn't really matter though. I also had root access to this server before I was admin, so you could say I was an undercover admin if you wish.
  4. Well, yeah. You can use SimpleXML to parse it and then create queries to insert it into a database. I'm not exactly sure what "parse the XML into MySQL" is supposed to mean though.
  5. While knowing some of the library functions and the syntax of the language may be important to some extent, it's much more important that you learn how to think like a programmer. Programming is about problem solving, so if you can do that, then you can program. Once you've grasped the language's syntax I'd recommend that you read books about programming theory instead of the "how to build a blog" kind of books/tutorials. There are various topics about books on this site. Just an advice
  6. Try: <?php $destination = 'Spain'; $availablePlaces = 10; $placesBooked = 0; $handle = fopen("test.txt", "r"); while (($info = fgetcsv($handle, 1000, ",")) !== FALSE) { if (trim(strtolower($info[0])) == strtolower($destination)) { $placesBooked += $info[1]; } } fclose($handle); if ($placesBooked > $availablePlaces) { echo 'Somebody made rather a mess of things...'; } else if ($placesBooked < $availablePlaces) { echo 'There are ' . ($availablePlaces - $placesBooked) . ' places left for ' . $destination; } else { echo 'Sorry, no places left for ' . $destination; } ?> That should give you "There are 2 places left for Spain" using the CSV sample you posted above.
  7. <?php $destination = 'Spain'; $availablePlaces = 10; $placesBooked = 0; $entries = file('file.csv'); foreach ($entries as $entry) { $info = explode(',', $entry); if ($info[0] == $destination) { $placesBooked += $info[1]; } } if ($placesBooked > $availablePlaces) { echo 'Somebody made rather a mess of things...'; } else if ($placesBooked < $availablePlaces) { echo 'There are ' . $availablePlaces - $placesBooked . ' places left for ' . $destination; } else { echo 'Sorry, no places left for ' . $destination; } ?> Something like this?
  8. I can't. Quod erat demonstrandum, I am not an idiot. Yay Okay, I'll leave now...
  9. That question doesn't make sense. I don't even know where to move it. ???
  10. roopurt18 was also PFR before mod if I remember correctly. He was between Mark and John (448191) on the mod list. Also, Thantos was the admin in relation to the SMF switch, not Jay. Thantos was removed and replaced with Jay later for some reasons. Both of them were/are SMF developers.
  11. What's a modern email address?
  12. That comment is lying. It's signifying that the PHP interpreter should start at that point.
  13. Actually, it has a hidden, unfinished code snippet repository as well. Wait, am I implicitly promising that I'll finish it now??
  14. Your CAPTCHA is two weak. The letters aren't distorted or skewed. They are always at a fixed position so it's relatively easy to figure out where to look.
  15. Uhm... if (isset($out[1]) && isset($out[2])) { $d = array_combine($out[1], $out[2]); foreach($d as $k => $v) { echo $k . " - " . $v . "<br>"; } } ? Instead of suppressing the error, why not try to prevent it in the first place?
  16. That has got to do with what I told you about operator associativity. If the first one fails then the other one will not be run. You will have to use transactions in order to rollback the changes. Using PDO it could look like this: // ... try { $db->beginTransaction(); $db->query($query1); $db->query($query2); $db->commit(); echo 'Insertion was successful.'; } catch (PDOException $e) { $db->rollBack(); echo 'Insertion failed.'; } In that snippet, $db is an instance of the class PDO.
  17. Good job repeating me.
  18. Just call mysql_query() twice. I.e. $result = mysql_query($query1) && mysql_query($query2); $result will then be a boolean having the value true if both queries were successful and false if either of those failed. You have a problem with data integrity if one of them fails though as you'll have to remove information. You should look into transactions. Those are, however, only in InnoDB and they are not supported by the mysql extension which you use. This means you'll have to use MySQLi or PDO (see the manual). Edit: Actually, query two will not be executed if query one failed using the snippet I showed above because of operator associativity (logical and is left associative). If the first (left) operand is false then the "and" cannot possibly return true thus evaluating the second (right) operand will be redundant. You'll still have a problem if query one were successful and query two wasn't though, so you should still look into transactions.
  19. You could have a site in some country where they aren't as strict on internet sites, where you could have a site that has thousands (maybe millions) of full length copy written videos free to download, and the U.S. can't do a thing to that site, only the down loader (if he/she resides in the U.S.). Indeed, but the opposite can be true as well: The other country has equally strict laws and its government will comply with the request of foreign companies/governments to shutdown the site. Again, my point was that things are not inherently unresolvable just because it happens across borders. Without sufficient information it's not possible to tell.
  20. Daniel0

    Show code

    Or any other tag with white-space:preserve;
  21. Daniel0

    Show code

    By leaving them alone? What do you mean? The tabs won't magically disappear.
  22. You want a backup solution, but you don't want to pay extra money. Hmmkay...
  23. [attachment deleted by admin]
  24. Eh, yeah. Take birthdays for instance. There are people who are over 38 years old you know
  25. I use exceptions all the time... if (!$this->acl->isAllowed('current_user', 'content', 'read')) { throw new PHPFreaks_Exception('Access denied. You do not have sufficient permissions to view this page.'); }
×
×
  • 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.