php-general Digest 25 Apr 2012 21:48:54 -0000 Issue 7789
Topics (messages 317674 through 317681):
Re: What is wrong here?
317674 by: Stuart Dallas
Sort question..
317675 by: Karl-Arne Gjersøyen
317676 by: Matijn Woudt
Re: Email Antispam
317677 by: David Mehler
Find/count different word in a text
317678 by: Karl-Arne Gjersøyen
317679 by: Stuart Dallas
317680 by: Matijn Woudt
Best PHP Template System
317681 by: Willie Matthews
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
On 25 Apr 2012, at 09:45, ma...@behnke.biz wrote:
> "Karl-Arne Gjersøyen" <karlar...@gmail.com> 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/
--- End Message ---
--- Begin Message ---
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:
<!DOCTYPE html>
<html lang="no">
<head>
<meta charset="utf-8">
<title>Bildegalleri</title>
<link rel="stylesheet" href="standard.css" media="screen">
</head>
<body>
<h1>Bildegalleri</h1>
<p><a href="bildegalleri.html">Last opp nye bilder</a> |
<a href="vis_bildegalleri.php?sorter_filnavn">Sorter på filnavn</a>
|
<a href="vis_bildegalleri.php?tilfeldig_sortering">Tilfeldig
sortering</a></p>
<ul>
<?php
// Skann katalogen og hent fram bildene
$bilde = new DirectoryIterator('bilder/');
while($bilde->valid()){
if(!$bilde->isDot()){
if($_GET['sorter_filnavn']){
echo '<li><img
src="bilder/'.sort($bilde->getFilename()).'"
alt="'.sort($bilde->getFilename()).'" height="200"></li>';
} elseif($_GET['tilfeldig_sortering']) {
echo '<li><img
src="bilder/'.rand($bilde->getFilename()).'"
alt="'.rand($bilde->getFilename()).'" height="200"></li>';
} else {
echo '<li><img
src="bilder/'.$bilde->getFilename().'"
alt="'.$bilde->getFilename().'" height="200"></li>';
}
}
$bilde->next();
}
unset($bilde);
?>
</ul>
</body>
</html>
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
--- End Message ---
--- Begin Message ---
On Wed, Apr 25, 2012 at 3:16 PM, Karl-Arne Gjersøyen
<karlar...@gmail.com> 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:
>
> <!DOCTYPE html>
> <html lang="no">
> <head>
> <meta charset="utf-8">
> <title>Bildegalleri</title>
> <link rel="stylesheet" href="standard.css" media="screen">
> </head>
> <body>
> <h1>Bildegalleri</h1>
> <p><a href="bildegalleri.html">Last opp nye bilder</a> |
> <a href="vis_bildegalleri.php?sorter_filnavn">Sorter på filnavn</a>
> |
> <a href="vis_bildegalleri.php?tilfeldig_sortering">Tilfeldig
> sortering</a></p>
> <ul>
> <?php
> // Skann katalogen og hent fram bildene
> $bilde = new DirectoryIterator('bilder/');
> while($bilde->valid()){
> if(!$bilde->isDot()){
> if($_GET['sorter_filnavn']){
> echo '<li><img
> src="bilder/'.sort($bilde->getFilename()).'"
> alt="'.sort($bilde->getFilename()).'" height="200"></li>';
> } elseif($_GET['tilfeldig_sortering']) {
> echo '<li><img
> src="bilder/'.rand($bilde->getFilename()).'"
> alt="'.rand($bilde->getFilename()).'" height="200"></li>';
> } else {
> echo '<li><img
> src="bilder/'.$bilde->getFilename().'"
> alt="'.$bilde->getFilename().'" height="200"></li>';
> }
> }
> $bilde->next();
> }
> unset($bilde);
> ?>
> </ul>
> </body>
> </html>
>
> 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
--- End Message ---
--- Begin Message ---
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 <a...@ashleysheridan.co.uk> wrote:
> On Thu, 2012-04-19 at 13:48 +0200, Matijn Woudt wrote:
>
>> On Thu, Apr 19, 2012 at 1:01 PM, Bastien <phps...@gmail.com> wrote:
>> >
>> >
>> > Bastien Koert
>> >
>> > On 2012-04-19, at 1:54 AM, tamouse mailing lists
>> > <tamouse.li...@gmail.com> wrote:
>> >
>> >> On Wed, Apr 18, 2012 at 8:47 PM, Ross McKay <ro...@zeta.org.au> 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
>
>
>
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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/
--- End Message ---
--- Begin Message ---
On Wed, Apr 25, 2012 at 6:59 PM, Karl-Arne Gjersøyen
<karlar...@gmail.com> 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:
<?php
$arr = preg_split('/ /', $text);
foreach($arr as $word)
$count[$word]++;
?>
- Matijn
--- End Message ---
--- Begin Message ---
-----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-----
--- End Message ---