Re: [PHP] What is wrong here?
"Karl-Arne Gjersøyen" hat am 25. April 2012 um 06:45 geschrieben: > Hello again. > I can't figure out what is wrong here. > > move_uploaded_file() get error message from die() and can't copy/move > temp_file into directory bilder > > I have try to chmod 0777 bilder/ but it did not help. > Also I have try to chown www-data.www-data bilder/ since Ubuntu Server > run apache as www-data user... > > Here is my souce code > -- > // Temfil lagres midlertidig på serveren som > // spesifisert i php.ini > $tmp_fil = $_FILES['filbane']['temp_name']; tmp_name not temp_name -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is wrong here?
On 25 Apr 2012, at 09:45, ma...@behnke.biz wrote: > "Karl-Arne Gjersøyen" hat am 25. April 2012 um 06:45 > geschrieben: > >> Hello again. >> I can't figure out what is wrong here. >> >> move_uploaded_file() get error message from die() and can't copy/move >> temp_file into directory bilder >> >> I have try to chmod 0777 bilder/ but it did not help. >> Also I have try to chown www-data.www-data bilder/ since Ubuntu Server >> run apache as www-data user... >> >> Here is my souce code >> -- >> // Temfil lagres midlertidig på serveren som >>// spesifisert i php.ini >>$tmp_fil = $_FILES['filbane']['temp_name']; > > tmp_name not temp_name This indicates that you're developing with notices switched off. This is a very bad idea because it hides simple errors like this. See the manual for details: http://php.net/error_reporting. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sort question..
Hello again. I have a photo album that show all images in a specified directory. but I like to sort them by filename as one possibillity and random sort the photos as another feature. I don't know how to do this.. Here is my soruce-code: Bildegalleri Bildegalleri Last opp nye bilder | Sorter på filnavn | Tilfeldig sortering valid()){ if(!$bilde->isDot()){ if($_GET['sorter_filnavn']){ echo ''; } elseif($_GET['tilfeldig_sortering']) { echo ''; } else { echo ''; } } $bilde->next(); } unset($bilde); ?> I will be lucky if somebode have time to help me out here.. I am sure it is some functions in php that can do the trick, but haven't found anything yet. Thanks for your time. Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sort question..
On Wed, Apr 25, 2012 at 3:16 PM, Karl-Arne Gjersøyen wrote: > Hello again. > I have a photo album that show all images in a specified directory. > but I like to sort them by filename as one possibillity and random > sort the photos as another feature. > I don't know how to do this.. Here is my soruce-code: > > > > > > Bildegalleri > > > > Bildegalleri > Last opp nye bilder | > Sorter på filnavn > | > Tilfeldig > sortering > > // Skann katalogen og hent fram bildene > $bilde = new DirectoryIterator('bilder/'); > while($bilde->valid()){ > if(!$bilde->isDot()){ > if($_GET['sorter_filnavn']){ > echo ' src="bilder/'.sort($bilde->getFilename()).'" > alt="'.sort($bilde->getFilename()).'" height="200">'; > } elseif($_GET['tilfeldig_sortering']) { > echo ' src="bilder/'.rand($bilde->getFilename()).'" > alt="'.rand($bilde->getFilename()).'" height="200">'; > } else { > echo ' src="bilder/'.$bilde->getFilename().'" > alt="'.$bilde->getFilename().'" height="200">'; > } > } > $bilde->next(); > } > unset($bilde); > ?> > > > > > I will be lucky if somebode have time to help me out here.. I am sure > it is some functions in php that can do the trick, but haven't found > anything yet. > Thanks for your time. > > Karl Put all the files in an array, then sort with one of the sort functions[1]. - Matijn [1] http://www.php.net/manual/en/array.sorting.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Email Antispam
Hello, Thank you to all who have offered suggestions with this issue. I have discussed it with the individual I'm working for and a contact form has been authorized. So, I'm going to go with that option. Thanks. Dave. On 4/19/12, Ashley Sheridan wrote: > On Thu, 2012-04-19 at 13:48 +0200, Matijn Woudt wrote: > >> On Thu, Apr 19, 2012 at 1:01 PM, Bastien wrote: >> > >> > >> > Bastien Koert >> > >> > On 2012-04-19, at 1:54 AM, tamouse mailing lists >> > wrote: >> > >> >> On Wed, Apr 18, 2012 at 8:47 PM, Ross McKay wrote: >> >>> On Wed, 18 Apr 2012 11:08:00 -0400, Jim Giner wrote: >> >>> >> He literally wants the "addresses" visible on the sight? [...] >> >>> >> >>> Yes, they want the addresses visible and clickable on the website. >> >>> They >> >>> have contact forms, but they also want the email addresses (of their >> >>> scientists and other consultants) available to their clients. And they >> >>> want the addresses to be shielded against harvesting for spam. >> >> >> >> Ob/Deobfuscation schemes that use javascript are a partial solution. >> >> Many spam harvesters are smart enough these days to know enough about >> >> decoding email addresses even obfuscated with javascript, with or >> >> without the mailto: scheme. Any that do obfuscation by substituting >> >> html entities for the characters are quite easily cracked. (Just >> >> appearance of a string of html entities is often enough to indicate >> >> there is something there to decode.) There is no 100% solution here. >> >> Coming up with clever ways to obfuscate the address on download, and >> >> deobfuscate it afterwards to display to the user will work for a >> >> while, however, the people writing spam harvesters are just as clever >> >> as we are. If the application is going to end up with email addresses >> >> displayed on the screen, some spam harvester is going to be able to >> >> get them. Even if you come up with a method that will stop them now, >> >> it won't stop them forever. >> >> >> >>> As I said, I don't like doing it this way, but the client gets what >> >>> they >> >>> want after the options have been explained to them. >> >> >> >> They need to understand the options, but even more important, the >> >> risks of any solution, and of the concept as a whole. After you've >> >> presented the risks, and the lack of a 100% solution, if they still >> >> want to do something against their own policies, you have to decide if >> >> your liability in giving it to them is going to be a problem. >> >> >> >> -- >> >> PHP General Mailing List (http://www.php.net/) >> >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >> > >> > Could this be a place to consider a flash Based solution? >> >> Maybe, though that requires clients to have a flash enabled device. >> Since iOS devices still don't support flash, that's not a reasonable >> option anymore for me. >> >> In the end, there's no real solution for spam bots, I think that a >> good spam filter is still the best option. My mail address is at >> several places all over the web, though I hardly get any spam in my >> inbox (thanks Gmail!). >> >> - Matijn >> > > > A Flash solution would also be highly innaccessible, which may make it > impossible to use for certain types of company. > > Like Matijn, my email address is on a lot of public forums, so I've > resigned myself to not even attempting to obfuscate my email address on > my website. It's like playing a game of whack-a-mole, there is no real > hope of stopping it being harvested once it's online in a readable form. > If a human can read it, what's to stop a human from adding it to some > "marketing" list? > -- > Thanks, > Ash > http://www.ashleysheridan.co.uk > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Find/count different word in a text
Hello again. I am looking for a way to find and count different word in a text.. I am thinking on save the text as array and iterate through the array. Then I like to register all different words in the text. For example. If bread is used more than one time, I will not count it. After the check were I have found single (one) word of every words, I count it and tell how many different word that is in the text. Is this difficult to do? Can you give me a hint for were I shall look on www.php.net for a solution to fix this problem? What function am I in need of? Thank you very much. Kind Regards, Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Find/count different word in a text
On 25 Apr 2012, at 17:59, Karl-Arne Gjersøyen wrote: > I am looking for a way to find and count different word in a text.. > I am thinking on save the text as array and iterate through the array. > Then I like to register all different words in the text. > For example. If bread is used more than one time, I will not count it. > After the check were I have found single (one) word of every words, I > count it and tell how many different word that is in the text. > > Is this difficult to do? Can you give me a hint for were I shall look > on www.php.net for a solution to fix this problem? What function am I > in need of? Let's start with... have you had a go? We're not here to do it for you. Some things to consider... How big is the text you're wanting to process? If it's relatively small you can load it up, strip non-alphanumeric characters, use preg_split to get an array of the individual words, then give that to array_unique or array_count_values to get an array of the unique words. If it's large enough that it will take a sizeable chunk of memory to load and process the entire thing then you'll be better off loading it in chunks, and processing it as you work through the file. Open the file and start reading it in chunks. For each chunk do the same as above but then stuff the results into another array such that the key is the word, then you can simply count the number of entries in the array. Have a go and if you have problems post the code and we can help you some more. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Find/count different word in a text
On Wed, Apr 25, 2012 at 6:59 PM, Karl-Arne Gjersøyen wrote: > Hello again. > I am looking for a way to find and count different word in a text.. > I am thinking on save the text as array and iterate through the array. > Then I like to register all different words in the text. > For example. If bread is used more than one time, I will not count it. > After the check were I have found single (one) word of every words, I > count it and tell how many different word that is in the text. > > Is this difficult to do? Can you give me a hint for were I shall look > on www.php.net for a solution to fix this problem? What function am I > in need of? > > Thank you very much. > Kind Regards, Karl > How about: - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best PHP Template System
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have been looking at Smarty Template Engine. The only reason I don't like it is because it is really slow when there are a bunch of results for pagination. Question is, is there something out there that is a lot faster with pagination built into it? Also with the features of Smarty Template Engine? - -- Willie Matthews matthews.wil...@gmail.com -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.17 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJPmHE9AAoJEPyaSMdprRSF+swH/jkXqfzG+uHE/g7HleLnRIa+ Ld0QYCIXPA1xdv5yPl3HndxPkMeCbvmqPCcdCchQR+2QGV2vOi/P+LycJbh01jb0 ht1BGb+MsOikyT+sNn2VYT1kjKENwZ3VJ4tsjTaGZl9Si98NZGAhCdzAhvkIvB8t xavbA8eX7y6fKpaGMmV5fOfPDSxavLMy0T7ox2mmLo7UBFcjRyd+Icghdd7rSK34 WH8Wd/nhpcX4E/zCc0D1zEnfzWP/Z7yS0GJi/sLSGpZcs7AyAvQV60XKCSuABBRf z23n0wrdSmgjbahGFalmog+9u5JxceCxwQ9ZT4tzOgoihLwhwZCUYFxyaWv5jyI= =jMqu -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best PHP Template System
Why use an external engine which slows your scripts down to do something which can easily be done by PHP itself? PHP is imho the best template engine for PHP. With PHP 5.4, it became even easier because somestuff()?> can be used without short_open_tag enabled. However, you always schould divide UI and backend. --- Ursprüngl. Mitteilung --- Von: Willie Matthews Gesend.: 25.04.2012, 23:48 An: PHP Mailinglist Betreff: [PHP] Best PHP Template System -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have been looking at Smarty Template Engine. The only reason I don't like it is because it is really slow when there are a bunch of results for pagination. Question is, is there something out there that is a lot faster with pagination built into it? Also with the features of Smarty Template Engine? - -- Willie Matthews matthews.wil...@gmail.com -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.17 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJPmHE9AAoJEPyaSMdprRSF+swH/jkXqfzG+uHE/g7HleLnRIa+ Ld0QYCIXPA1xdv5yPl3HndxPkMeCbvmqPCcdCchQR+2QGV2vOi/P+LycJbh01jb0 ht1BGb+MsOikyT+sNn2VYT1kjKENwZ3VJ4tsjTaGZl9Si98NZGAhCdzAhvkIvB8t xavbA8eX7y6fKpaGMmV5fOfPDSxavLMy0T7ox2mmLo7UBFcjRyd+Icghdd7rSK34 WH8Wd/nhpcX4E/zCc0D1zEnfzWP/Z7yS0GJi/sLSGpZcs7AyAvQV60XKCSuABBRf z23n0wrdSmgjbahGFalmog+9u5JxceCxwQ9ZT4tzOgoihLwhwZCUYFxyaWv5jyI= =jMqu -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best PHP Template System
Point taken. I will try to learn without the Template Engine! Thanks a lot Yared! On Wed, Apr 25, 2012 at 3:07 PM, Yared Hufkens wrote: > Why use an external engine which slows your scripts down to do something > which can easily be done by PHP itself? PHP is imho the best template > engine for PHP. > With PHP 5.4, it became even easier because somestuff()?> can be > used without short_open_tag enabled. > However, you always schould divide UI and backend. > > --- Ursprüngl. Mitteilung --- > Von: Willie Matthews > Gesend.: 25.04.2012, 23:48 > An: PHP Mailinglist > Betreff: [PHP] Best PHP Template System > > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > I have been looking at Smarty Template Engine. The only reason I don't > like it is because it is really slow when there are a bunch of results > for pagination. > > Question is, is there something out there that is a lot faster with > pagination built into it? Also with the features of Smarty Template > Engine? > > - -- > Willie Matthews > matthews.wil...@gmail.com > -BEGIN PGP SIGNATURE- > Version: GnuPG v2.0.17 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQEcBAEBAgAGBQJPmHE9AAoJEPyaSMdprRSF+swH/jkXqfzG+uHE/g7HleLnRIa+ > Ld0QYCIXPA1xdv5yPl3HndxPkMeCbvmqPCcdCchQR+2QGV2vOi/P+LycJbh01jb0 > ht1BGb+MsOikyT+sNn2VYT1kjKENwZ3VJ4tsjTaGZl9Si98NZGAhCdzAhvkIvB8t > xavbA8eX7y6fKpaGMmV5fOfPDSxavLMy0T7ox2mmLo7UBFcjRyd+Icghdd7rSK34 > WH8Wd/nhpcX4E/zCc0D1zEnfzWP/Z7yS0GJi/sLSGpZcs7AyAvQV60XKCSuABBRf > z23n0wrdSmgjbahGFalmog+9u5JxceCxwQ9ZT4tzOgoihLwhwZCUYFxyaWv5jyI= > =jMqu > -END PGP SIGNATURE- > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Willie Matthews matthews.wil...@gmail.com
Re: [PHP] Find/count different word in a text
At 12:59 PM 4/25/2012, Karl-Arne Gjersøyen wrote: Hello again. I am looking for a way to find and count different word in a text.. I am thinking on save the text as array and iterate through the array. Then I like to register all different words in the text. For example. If bread is used more than one time, I will not count it. After the check were I have found single (one) word of every words, I count it and tell how many different word that is in the text. Is this difficult to do? Can you give me a hint for were I shall look on www.php.net for a solution to fix this problem? What function am I in need of? I would use a combination of the functions str_word_count and array_count_values. $str = "This is a test of word counting and this sentence repeats words a a a a a is is is is"; print_r(array_count_values(str_word_count($str, 1))); ?> Ken Robinson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Serving a .dmg via readfile?
Hey all - I'm having no luck serving a .dmg from my online store. I stripped down the code to just the following to debug, but no matter what I get a zero-byte file served: header('Content-Type: application/x-apple-diskimage'); // also tried octet-stream header('Content-Disposition: attachment; filename="My Cool Image.dmg"'); $size = filesize('/var/www/mypath/My Cool Image.dmg'); header('Content-Length: '.$size); readfile('/var/www/mypath/My Cool Image.dmg'); This same code works for a number of other file types that I serve: bin, zip, pdf. Any suggestions? Professor Google is not my friend. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serving a .dmg via readfile?
On Wed, Apr 25, 2012 at 8:54 PM, Brian Dunning wrote: > Hey all - I'm having no luck serving a .dmg from my online store. I stripped > down the code to just the following to debug, but no matter what I get a > zero-byte file served: > > header('Content-Type: application/x-apple-diskimage'); // also tried > octet-stream > header('Content-Disposition: attachment; filename="My Cool Image.dmg"'); > $size = filesize('/var/www/mypath/My Cool Image.dmg'); > header('Content-Length: '.$size); > readfile('/var/www/mypath/My Cool Image.dmg'); > > This same code works for a number of other file types that I serve: bin, zip, > pdf. Any suggestions? Professor Google is not my friend. > -- Maybe file size limit somewhere? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serving a .dmg via readfile?
On 4/25/12 10:54 PM, Brian Dunning wrote: Hey all - I'm having no luck serving a .dmg from my online store. I stripped down the code to just the following to debug, but no matter what I get a zero-byte file served: header('Content-Type: application/x-apple-diskimage'); // also tried octet-stream header('Content-Disposition: attachment; filename="My Cool Image.dmg"'); $size = filesize('/var/www/mypath/My Cool Image.dmg'); header('Content-Length: '.$size); readfile('/var/www/mypath/My Cool Image.dmg'); This same code works for a number of other file types that I serve: bin, zip, pdf. Any suggestions? Professor Google is not my friend. Most likely your file is larger than the memory you have available to PHP. The readfile() command will load the whole file into memory before streaming it out. You'll want to use fopen, fread, fwrite, and fclose to loop through bytes in your file as you shuttle chunks to the client instead of slooping it all into memory in one hunk. -- Dante D. Dante Lorenso da...@lorenso.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date() confustion
Hi everyone, Does anybody know what might influence the output of the date() function besides date.timezone setting? Running through some code in an app I'm working on, I have this code: $timestamp = time(); $mysqlDatetime = date("Y-m-d G:i:s", $timestamp); Logging these values yields: INSERT TIMESTAMP: 1335414561 INSERT DATE TIME: 2012-04-26 4:29:21 But then from the interactive interpreter on the same box (same php.ini as well): php > echo date("Y-m-d G:i:s", 1335414561); 2012-04-25 22:29:21 I get this same output from another random computer of mine and I've verified date.timezone is consistent in both environments. Something's going on in the first case, but I'm unsure what; any ideas? Your help appreciated as always. -nathan
Re: [PHP] date() confustion
On 26/04/2012, at 4:40 PM, Nathan Nobbe wrote: > Hi everyone, > > Does anybody know what might influence the output of the date() function > besides date.timezone setting? > > Running through some code in an app I'm working on, I have this code: > > $timestamp = time(); > $mysqlDatetime = date("Y-m-d G:i:s", $timestamp); > > Logging these values yields: > > INSERT TIMESTAMP: 1335414561 > INSERT DATE TIME: 2012-04-26 4:29:21 > > But then from the interactive interpreter on the same box (same php.ini as > well): > > php > echo date("Y-m-d G:i:s", 1335414561); > 2012-04-25 22:29:21 > > I get this same output from another random computer of mine and I've > verified date.timezone is consistent in both environments. > > Something's going on in the first case, but I'm unsure what; any ideas? > > Your help appreciated as always. > > -nathan A call to date_default_timezone_set() during execution can change the timezone. If you add echo date_default_timezone_get(); just before this, does it give the same output as your date.timezone setting? --- Simon Welsh Admin of http://simon.geek.nz/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date() confustion
On Wed, Apr 25, 2012 at 10:44 PM, Simon J Welsh wrote: > On 26/04/2012, at 4:40 PM, Nathan Nobbe wrote: > > > Hi everyone, > > > > Does anybody know what might influence the output of the date() function > > besides date.timezone setting? > > > > Running through some code in an app I'm working on, I have this code: > > > > $timestamp = time(); > > $mysqlDatetime = date("Y-m-d G:i:s", $timestamp); > > > > Logging these values yields: > > > > INSERT TIMESTAMP: 1335414561 > > INSERT DATE TIME: 2012-04-26 4:29:21 > > > > But then from the interactive interpreter on the same box (same php.ini > as > > well): > > > > php > echo date("Y-m-d G:i:s", 1335414561); > > 2012-04-25 22:29:21 > > > > I get this same output from another random computer of mine and I've > > verified date.timezone is consistent in both environments. > > > > Something's going on in the first case, but I'm unsure what; any ideas? > > > > Your help appreciated as always. > > > > -nathan > > > A call to date_default_timezone_set() during execution can change the > timezone. If you add echo date_default_timezone_get(); just before this, > does it give the same output as your date.timezone setting? > Simon, I was dumping out the value from ini_get('date.timezone'); seems it must be getting set at runtime. Thanks! -nathan
Re: [PHP] Serving a .dmg via readfile?
On Wed, Apr 25, 2012 at 9:04 PM, Tommy Pham wrote: > On Wed, Apr 25, 2012 at 8:54 PM, Brian Dunning wrote: >> Hey all - I'm having no luck serving a .dmg from my online store. I stripped >> down the code to just the following to debug, but no matter what I get a >> zero-byte file served: >> >> header('Content-Type: application/x-apple-diskimage'); // also tried >> octet-stream >> header('Content-Disposition: attachment; filename="My Cool Image.dmg"'); >> $size = filesize('/var/www/mypath/My Cool Image.dmg'); >> header('Content-Length: '.$size); >> readfile('/var/www/mypath/My Cool Image.dmg'); >> >> This same code works for a number of other file types that I serve: bin, >> zip, pdf. Any suggestions? Professor Google is not my friend. >> -- > > Maybe file size limit somewhere? Forgot to mention that your code doesn't check the result [1]. If it was this instead: header('Content-Type: application/x-apple-diskimage'); // also tried octet-stream header('Content-Disposition: attachment; filename="My Cool Image.dmg"'); $size = filesize('/var/www/mypath/My Cool Image.dmg'); header('Content-Length: '.$size); if (readfile('/var/www/mypath/My Cool Image.dmg') === false) die ('Error readfile ...'); Or alternatively, use xdebug in your dev environment. ;) HTH, Tommy [1] http://php.net/readfile -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php