ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
Yes. Use mailto:email1@domain,email2@domain?cc=email3@domain&bcc=email4@domain&subject=a-subject&body=some-text-body You must know that 'mailto:' is a handle that will be handled by the program that knows how to handle 'mailto:' just like your browser knows how to handle 'http:' or like irc knows how to handle 'irc:' When you use 'mailto:' you imply that your visitor has a program installed that can handle 'mailto:' and is therefor not using any web-based e-mail clients otherwise the browser won't find a handler for it and will tell the visitor that it doesn't know how to handle 'mailto:' making it obsolete for your visitor, maybe even losing the visitor as he has no proper way to contact you. The parameters you can use are ofcourse also limited to the e-mail client used by your visitor.
-
How can I sort images in a directory by the date they were uploaded?
ignace replied to pneudralics's topic in PHP Coding Help
Use filectime() function getFileList($directory) { $files = array(); if (!is_dir($directory) || !is_readable($directory)) return $files; if ($handle = opendir($directory)) { while (false !== ($file = readdir($handle)) { if (preg_match('/\.(jpe?g|gif|png)$/i', $file)) { $fullpath = implode(DIRECTORY_SEPARATOR, array($directory, $file)); $files[] = $fullpath; } } usort($files, create_function('$f1, $f2', '$f1ct = filectime($f1); $f2ct = filectime($f2); if ($f1ct === $f2ct) { return 0; } return $f1ct < $f2ct ? -1 : 1;')); } return $files; } Not sure this will work just wrote it out of the top of my head. -
That would be X_FORWARDED_FOR
-
$id = $_GET['id']; before if ($id == 0)
-
Creating a simple 'events calendar' and add event from DB
ignace replied to eits's topic in Miscellaneous
Chances to find a calendar that matches your needs perfectly are probably going to be very slim. Some that I found using Google where: - http://www.easyphpcalendar.com/ looks good in my opinion - http://www.hotscripts.com/category/php/scripts-programs/calendars/ hotscript is a vast and great resource -
What does print $sql say?
-
$id is undefined thus will return null in an integer context null evaluates to 0. if (0 == 0) true thus show current user profile, sounds familiar?
-
Well I can think of a few ways. 1. Use LIMIT $offset, $count in your query. This way you will only see $count number of rows starting from $offset. 2. Use JavaScript each x number of row add an empty row that has a collapse button in it when clicked it shows/hides all rows that has it's prefix. Use element.style.display = 'block' to show and element.style.display = 'none' to hide. An example of what I mean can be found here: http://framework.zend.com/about/faq
-
$section = array(); $sections = array(); $string = 'x,1,3,42,2,5,7,y,x,1,8,4,3,y,x,5,3,3,4,y,x,2,8,7,4,6,y'; $parts = explode(',', $string); foreach ($parts as $part) { if ('x' === $part && !empty($section)) { $sections[] = implode(',', $section); $section = array(); } $section[] = $part; } print_r($sections); Outputs: Array ( [0] => x,1,3,42,2,5,7,y [1] => x,1,8,4,3,y [2] => x,5,3,3,4,y )
-
post your code and I can adjust it for you.
-
$matches = array(); $contents = file_get_contents('path/to/file'); preg_match_all('/([a-z0-9]+(:|\.)[a-z0-9]+)/i', $contents, $matches); print_r($matches); May work but will not match 8655 and Flamengo : Cruzeiro if they contain a space before and after :.
-
function scandir_r($directory) { $mp3files = array(); if (!is_dir($directory) || !is_readable($directory)) return $mp3files; $files = scandir($directory); foreach ($files as $file) { $fullpath = implode(DIRECTORY_SEPARATOR, array($directory, $file)); if (is_dir($fullpath)) { $mp3files += call_user_func(__FUNCTION__, $fullpath); } else if (preg_match('/\.mp3/', $file)) { $mp3files[] = $fullpath; } } return $mp3files; } $mp3files = array(); $directories = array('..'); foreach ($directories as $directory) { $mp3files += scandir_r($directory); } print_r($mp3files); Edit: I haven't tested this. I just wrote this out of the top of my head. If you have a serious amount of mp3 files your script may time-out and you may want to look at other algorithms available.
-
Yeah you actually need recursion to go through the entire directory structure capture each and every mp3 file and read it's ID3
-
Work the other way around show the link to the java website and remove it using java. So if they don't see the link they have Java enabled.
-
You need to use the component object model (COM) for that. http://us3.php.net/manual/en/book.com.php
-
$makes = array(); $models = array(); if (isset($_POST['make'])) { //generate models $models = array(..); if (isset($_POST['model'])) { //generate something else or handle it! } } The reason I defined $makes and $models before my if's is because you prolly want to roll it out like or use in a template which wouldn't otherwise work because $models wasn't yet defined: <?php if (!empty($models)): ?> <select name="models"> <?php foreach ($models as $model): ?> <option name="<?php print $model; ?>"><?php print $model; ?></option> <?php endforeach; ?> </select> <?php else: ?> <select name="models" disabled></select> <?php endif; ?>
-
Creating a simple 'events calendar' and add event from DB
ignace replied to eits's topic in Miscellaneous
wrong section. Plus whatever we will tell have we been told by Google bypass the middle man and Google yourself. -
Add a counter $i and on each iteration increment it $i++ then if ($i % 5 == 0) add line break. Other option is using a combination of html and css create a list <ul> or <ol> add each item to a <li>. In CSS say ul li { display: inline } this will let the <li> act like an inline element so if it reaches the end of the box it will jump to a new line.
-
$this1 must be $this
-
Time. What do you mean by 'an attached patch'? A solution to the problem? Ok I realize that this even can happen with the script from the company I trust(ed) or that the problem even can be PHP itself. In the first case there is someone who you can bill the amount the customer has billed you for the problem not being resolved in short notice. In the second case however things gets complicated like it does with most open-source solutions. We usually use open-source solutions at area's in the application where it wouldn't be a big deal if it would break.
-
Yes ofcourse there is a big difference if the script was developed by some John Doe (snipplr, phpclasses.org, PEAR, ..) or if an entire community or a company has created it. But generally, I tend to use only third-party script's if it has been developed and is being maintained by a company I trust wether open- or closed-source. The only time that I would use other third-party scripts (John Doe, community) is when I'm developing for my own and not when I'm building an application for some client. The same goes for back-ups. I have a back-up for my back-up. Yes I'm a control-freak but I've got that under control.
-
It's not always possible to upgrade. Not every company wants to spend money every year to upgrade a system that is already working fine. And when they do upgrade a decade has past. Personally I'm suffering from the not-made-here principle. I will only re-use code that I have written and tested myself, no matter how many classes are already out there on the subject. If it breaks I'll have no-one to return to.
-
reinventing the wheel is a very bad proverb IMO. Let's assume I don't and I use the existing wheel, then who do I turn to when it is broke? The garage? And what if the model isn't made anymore? And their current models arent backwards compatible to my model? So I'm left with one option try to figure out how they have put it together in the first place and try to fix whatever is wrong. The better option is to not use the wheel of someone else and always create my own wheels, that way if one is broke I can just by looking at it tell from where the problem originates (well atleast most of the time) and fix it.
-
$matches = array(); $contents = file_get_contents('path/to/file'); preg_match_all('/\d{1,2}(:|\.)\d{1,2}/', $contents, $matches); print_r($matches); Sorry wrong function
-
This error means that you have defined is_empty_date() multiple times, like: function is_empty_date() .. a few lines lower: function is_empty_date() .. Make sure function is_empty_date() only appears once.