Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by cpd

  1. I get the impression the question asks how to display content within 30 seconds of some action as opposed to forcing a redirect after 30 seconds? Do you even need to redirect after 30 seconds? Your posts reflect both at the moment.
  2. Validation isn't specific to php, it should be applied whenever user input is accepted. You're essentially verifying the user has entered valid content as opposed to content that could harm your service. Search "defensive code" or "data validation" in google, you'll get a load of stuff.
  3. Your better off using Python as it has a variety of useful libraries such as nupmpy and scikit. You'll want to apply a kernel to the image such as a 3x3 kernel with -1 along the top row and 1 along the bottom. This will highlight horizontal edges and rotating the kernel 90 degrees will yield vertical edges. Combining the two will yield edge detection. The topic gets increasingly complex and to be totally honest, is probably unnecessary for your purpose. If you're always scanning cards of the same size, why not predefine the area and cut that area out?
  4. Everyone should hate it, its just a really big class - pile of (insert very foul word). I'm extremely fond of laravel. Put together such that its relatively intuitive and provides some extremely useful features. Its also quite a mature framework which is generally a good thing.
  5. Try programming a private messenger app. It would come in handy.
  6. Have an array containing each time zone. Loop through it creating DateTime objects and testing if they have a 12 hour hand. Once you've found the timezone break out and display the zone. Using http://us3.php.net/manual/en/datetimezone.getlocation.php you an get a friendlier name as well.
  7. By putting the HTML in your array you're limiting yourself. HTML is abouoti presentation, not business logic, therefore you shouldn't really have it in the php as you've done.
  8. You can route requests for image files to a php script, do whatever you want, then just output the image from php by setting the relevant content type. Htaccess can be used to route requests for the image. This solution only works if you're hosting the images, however.
  9. I think you're asking if there's a cleaner solution as opposed to can you use implode. Personally, I'd store just the URLs and loop with a foreach statement to print them. $dirs = array_diff(scandir($dirlocation), array('..', '.')); array_walk($dirs, function(&$v, $k, $d) { $v = $d . $v; }, $dirlocation); // HTML section <?php foreach($dirs as $url) : ?> // IMG tag with SRC = $url <?php endforeach; ?>
  10. If you're keeping the mapping you can just do $data = $_POST; $data['pswrd1'] = sha1($_POST['pswrd1']); The error is due to wrapping the password variable in your sha1 call with apostrophes. You don't need to as shown above.
  11. Without your PHP we can't assist - a full dump wont help either so narrow it down to 10-20 lines based on the error you receive.
  12. @mtchisepo - its likely a mistake in his post, not actually part of his code.
  13. http://symfony.com/get-started Awesome place to start.
  14. That's the function I couldn't remember and ended up omitting from my post. I'd definitely recommend this over most solutions.
  15. What does var_dump($result->OCRWSResponse->ocrText->ArrayOfString); give?
  16. To only show mp3 files you can run an $dot = strrpos($file, ".") on the file name to get the last occurrence of a dot then substr($file, $dot+1, strlen($file)) and test if its equal to mp3. Alternatively, you could explode using the dot and get the last item in the array, and test if that's equal to mp3. The rest is self explanatory. With regards to keeping the directory structure: you need to know if an mp3 file is in a directory before you can display it. You could do this by scanning everything and creating an array of the directories and any MP3's they have in them. Then remove any directories that reference an empty array. i.e. array( 'dir1' => array( 'something.mp3' ), 'dir2' => array() ... After you've built your array representing a directory structure as above, cycle through it and remove anything referencing an empty array such as 'dir2'. Without scanning the directory once, its impossible to know if it contains an MP3. To stop linking the directories, just remove the hyperlink after testing if its a directory or not. (http://php.net/is_dir). Just a couple of ideas off the top of my head.
  17. cpd

    Need help

    There's something we tech folk call... "the Internet". Its amazing really, one giant resource for just about anything at your fingertips.
  18. cpd

    Need help

    You've not got a problem and seem to think "help" means "please do it for me"; a definition that's ill-received on this forum.
  19. Why would you have them log in at a sub on their site if it redirects to your website and everything is on there? Why not have them log in on your site?
  20. No you don't need to use the StdClass. A variable has a name: $username = "cpd";. Why is this not satisfactory? Given your description for the problem, there's no need to use an object at all. @web_craftsman: from what you've suggested you don't seem to know what an object is for, when to use it, or how to use it.
  21. Use a variable. Why are you using an object? There is absolutely no need for an object here and this is not object oriented programming in the slightest. You're just creating objects and giving them properties they shouldn't have and then assigning something to the property; that entire process is basically the same as assigning a normal variable.
  22. A select menu isn't a colour and shouldn't be a property of a "Color" object. A "Select" could be an object of its own. @web_craftsman: You shouldn't really declare properties on the fly as you then open a can of encapsulation issue worms.
  23. $result->OCRWSResponse->ocrText->ArrayOfString->string
  • 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.