Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. Okay, think you should have introduced your project a little earlier The comments I wrote at #8 were answered on the next page.
  2. Also.. Shouldn't there be an option to optionally define a type for each parameter, like in #4? Forcing a type is going to break about 99% of PHP scripts out there.
  3. Welcome! How do you know it's nearly 2 million, out of interest?
  4. Just out of curiousity, where does the name Labradoodle-360 come from? Whilst in the midst of a 360 degree spin did you discover your talent for breeding unusual dog hybrids?
  5. What exactly do you have 100 switch cases against? You're doing something wrong, or should I say there's a much better way of doing it. Edit Also I work in a development team, and whatever files you're working on, the use of version control takes away of lot of those problems. Again, if you're having a lot of troubles, you're doing something wrong.
  6. Since the more robust DOM extension also requires you to provide the URI of the namespace, not the namespace prefix, I'm guessing there's a reason. What comes to mind is probably that you can define a namespace for a sub-element without a prefix, that would make it impossible to distinguish one from the other. So my guess is it's to prevent any ambiguity.
  7. Just to add to Maq's post, to use the dialog() widget you need to also include the jQuery UI library (core + Dialog widget).
  8. Although you could use DB management software over the top if you would find that easier..? Don't know any to suggest to you, but Google found plenty.
  9. A quick search on Google found a similar website - although their concept of result-only access was developed by an idiot.
  10. You would be best off running it from the command line, as then you won't run into time-out issues or require a browser to be left open running it. Although I'd check your host's terms of use because they might not want you running spiders on their servers.
  11. No problem, and it turns out you can. I didn't realise this before, which is why I suggested you're likely talking about classes due to the similar syntax. Once you've called the parent function you're also able to call the child function directly: function foo() { function bar() { echo 'baz'; } } foo(); bar(); // echoes "baz" In response to your original question though, you don't need to define a function within a function to call it. Functions can call any functions that have been defined. Recursion is a function calling itself. Doesn't neccesarily need to return anything or call any additional functions, just call itself.
  12. system accepts a second parameter to store the response from the server. Instead of echoing it, store the result and use that variable in your comparison. $5 is not a valid custom variable name by the way, as it starts with a number.
  13. You can't have a function within a function. You're most likely thinking of classes: class Foo { function bar() { // ... } } These are a very different concept, far beyond the scope of this post. If you would like to learn more though there's plenty of information in the manual, and an Object Orientated PHP Tutorial on the main site here. Recursion is something completely different, it's basically a function calling itself. For example a function that can take either an array or string as an argument, but if it's an array calls itself with each string item in the array. Very simple example: function recursion($arg) { if (is_array($arg)) { foreach ($arg as $str) { recursion($str); } } if (is_string($arg)) { echo $arg . "\n"; } } recursion(array('foo', 'bar')); recursion('baz');
  14. You would be right, and that's exactly your problem. HTTP requests are relatively slow, and making (what sounds like you're trying to) thousands at a time is a ridiculous load on both your server and theirs. This problem is generally overcome by "scraping" their website, page by page with a courteous delay in between, indexing the data in your own database and then querying that for the details later. Think search engines. This is of course assuming you're not violating their terms of use, and they may still block you. I'm surprised they haven't already if you're firing off even 10 requests at once - probably just a matter of time till they notice to be honest.
  15. Read this ^ .. You're basically updating the data after you've already displayed it, which is obviously not going to show the updated data until the next request.
  16. The problem with your method is that you're assuming the next image will always be the ID + or - 1. What if the user adds an image to an older gallery? Your system won't be able to handle it. Instead try to think of it more like pagination, but only showing a single result per page. You get a count of how many images are in the gallery, and then use a parameter to pass the "page" (or better worded as "image") offset in the gallery. Also you can save yourself the sub-query by passing the gallery ID within the URL. So first, get a count of how many images are in the gallery into a variable ($max_images let's say). Then get the current page/image number from the URL (defaulting to 1 if none has been passed - also remember to subtract 1 from this value, as the LIMIT clause is 0-indexed). Then using that return the image data, limited to the current page/image number (i.e. LIMIT $image, 1), and ordered by the image ID. From this point a simple condition on the current page/image number against 0 or $max_images should tell you whether you need a previous and next link respectively. There's a tutorial on the main site covering Basic Pagination that would probably help you.
  17. That's just what my friends call me..
  18. Could you change mine to "<<Adam_69_Bad_Boi_Wrecking_Ball>>" please? Heh.. no "Adam89" please, since Adam is taken
  19. I think they knew a little more then they tell you. From what I've heard, they didn't give instructions on anything to do, there were hardly any updates, and made false promises to have PSN back up on May 4th (Maybe they didn't lie b/c it was backup in Japan). Oh yeah, I have no doubt they'd have known more than they let on - what company doesn't? At first they did try to keep people in the know and said it would be back online within a couple of days, which was probably a mistake. Presumably after they re-launched it in Japan, they realised the extent of the intrusion and took it back down; keeping in favour of not saying much over giving false hope/information again. We can only guess really... As said the data actually exposed was stuff that's pretty much available else-where anyway, or useless on it's own. Any sensitive data like the password, was encrypted and is most likely useless to them -- especially after they re-launch the service and force every use to reset their password on the machine they created the account (or through email).
  20. Okay so in login.php, you verify that $error_ar isn't empty, every time reglardless of whether they submitted the form. Assuming it's not you then redirect them to processform.php. In processform.php you then attempt to authenticate them, based on the username and password you stored in the session in login.php. If they aren't authenticated you then redirect them back to login.php, which doesn't enter the validation because $_POST['submit'] is not set - which also means that $error_ar is not defined. So when you enter the $error_ar count check afterwards, it defaults to 0 and you redirect them back to processform.php.. Which still has the session values and then results in a redirect back to login.php, and so on. This logic needs correcting; perhaps by moving the error check in login.php to within the submit button condition's code? Also I'm guessing that either your authenticate method doesn't work, or you're providing invalid login details.. Edit Why are you splitting the logic and forcing the redirect like this anyway? Why not just perform it all within the same request, and then redirect once successful?
  21. That firefox error suggests you have an infinite loop in your redirect.
  22. Couldn't have put it better, KingPhilip. Also people say they reacted slowly, but in truth they actually shut down the PSN as soon as they found out there had been an intrusion. Can you actually imagine having to make that decision? The impact it would have and the repercussions to follow.. Sure they didn't give updates as often as others, and didn't put it back up in the two or so days they said they would, but they didn't know exactly what had happened themselves. What do you want them to say? Plus if someone's sat hour after hour, just waiting for some scrap of hope from Sony's blog... well it's been said they need to get out more!
  23. Kind of, but I'd say they're for looping through the contents of an array - or object - as opposed to extracting values from them.
  24. You could always resort to passing parameters through the 'PATH_INFO' server var: example.com/index.php/parent1/parent2/actual-page Just doesn't look as good.
×
×
  • 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.