php-general Digest 10 Mar 2008 06:38:37 -0000 Issue 5339
Topics (messages 271178 through 271188):
Unexcepted $this
271178 by: Murat BEÞER
271180 by: Anup Shukla
271183 by: Murat BEÞER
271184 by: Murat BEÞER
271188 by: Anup Shukla
Re: send form by email with image spam controler
271179 by: Per Jessen
SMTP
271181 by: Alain Roger
271182 by: Ray Hauge
271185 by: Andrés Robinet
Re: Links hierarchy maintenance
271186 by: tedd
271187 by: Adil Drissi
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
I can't under stood but PHP gaves me an error:
"UnExcepted $this" for " || $this->getFileExtension($file) == 'jpg' "
When I removed jpg extension check it's okay... PHP script runs well.
What is the problem :)
public function loadImages($folder) {
$result = $this->filemanager->fecthFiles($folder);
$images = array();
if (sizeof($result)>=1 && $result !== false) {
foreach ($result as $file) {
if ($this->getFileExtension($file) == 'gif' ||
$this->getFileExtension($file) == 'png'
|| $this->getFileExtension($file) == 'jpg') {
$images[] = array('name'=>$file);
}
}
}
return $images;
}
--- End Message ---
--- Begin Message ---
Murat BEŞER wrote:
I can't under stood but PHP gaves me an error:
"UnExcepted $this" for " || $this->getFileExtension($file) == 'jpg' "
When I removed jpg extension check it's okay... PHP script runs well.
What is the problem :)
public function loadImages($folder) {
$result = $this->filemanager->fecthFiles($folder);
$images = array();
if (sizeof($result)>=1 && $result !== false) {
foreach ($result as $file) {
if ($this->getFileExtension($file) == 'gif' ||
$this->getFileExtension($file) == 'png' ||
$this->getFileExtension($file) == 'jpg') {
if (
($this->getFileExtension($file) == 'gif') ||
($this->getFileExtension($file) == 'png') ||
($this->getFileExtension($file) == 'jpg')
) {
... rest of your code
...
}
$images[] = array('name'=>$file);
}
}
}
return $images;
}
--
Regards,
Anup Shukla
--- End Message ---
--- Begin Message ---
Thank you Anup,
But why I getting this error ?
is this a bug ?
I have changed my code like this
if (in_array($this->getFileExtension($file), array('gif', 'jpg', 'png'))) {
}
but I can't understand.
Anup Shukla yazmış:
Murat BEŞER wrote:
I can't under stood but PHP gaves me an error:
"UnExcepted $this" for " || $this->getFileExtension($file) == 'jpg' "
When I removed jpg extension check it's okay... PHP script runs well.
What is the problem :)
public function loadImages($folder) {
$result = $this->filemanager->fecthFiles($folder);
$images = array();
if (sizeof($result)>=1 && $result !== false) {
foreach ($result as $file) {
if ($this->getFileExtension($file) == 'gif' ||
$this->getFileExtension($file) == 'png' ||
$this->getFileExtension($file) == 'jpg') {
if (
($this->getFileExtension($file) == 'gif') ||
($this->getFileExtension($file) == 'png') ||
($this->getFileExtension($file) == 'jpg')
) {
... rest of your code
...
}
$images[] = array('name'=>$file);
}
}
}
return $images;
}
--- End Message ---
--- Begin Message ---
Thank you Anup,
But why I getting this error ?
is this a bug ?
I have changed my code like this
if (in_array($this->getFileExtension($file), array('gif', 'jpg', 'png'))) {
}
but I can't understand.
Anup Shukla yazmış:
Murat BEŞER wrote:
I can't under stood but PHP gaves me an error:
"UnExcepted $this" for " || $this->getFileExtension($file) == 'jpg' "
When I removed jpg extension check it's okay... PHP script runs well.
What is the problem :)
public function loadImages($folder) {
$result = $this->filemanager->fecthFiles($folder);
$images = array();
if (sizeof($result)>=1 && $result !== false) {
foreach ($result as $file) {
if ($this->getFileExtension($file) == 'gif' ||
$this->getFileExtension($file) == 'png' ||
$this->getFileExtension($file) == 'jpg') {
if (
($this->getFileExtension($file) == 'gif') ||
($this->getFileExtension($file) == 'png') ||
($this->getFileExtension($file) == 'jpg')
) {
... rest of your code
...
}
$images[] = array('name'=>$file);
}
}
}
return $images;
}
--- End Message ---
--- Begin Message ---
Murat BEŞER wrote:
Thank you Anup,
But why I getting this error ?
is this a bug ?
Its not a bug.
It has to do with operator precindence and associativity.
--
Regards,
Anup Shukla
--- End Message ---
--- Begin Message ---
Stut wrote:
> On 9 Mar 2008, at 12:47, Per Jessen wrote:
>
>> Like I said, it can be broken too (given sufficient effort).
>
> It's not much effort - you just need to request a second URL after
> you've got the form. It's not hard and really doesn't really put
> anything more in the way of a bot than an image-based captcha. In fact
> I'd argue that parsing the text in your questions is significantly
> easier than doing OCR on an image.
Ah, yes, I see what you mean.
> The key thing to remember when securing a form is that if you do
> something that's never been seen before it's unlikely that the generic
> bots will be able to get past it.
Which will still get rid of most of the attacks. But then so will
something that automatically monitors accesses to your form, and
selective bans IP-addresses (e.g. after too many attempts during N
minutes).
> If someone decides to target your site then a text-based captcha will
> never be good enough, and chances are nothing you do will work. If
> someone is willing to put in the effort you've got no chance.
Absolutely. Same goes for encryption etc.
/Per Jessen, Zürich
--- End Message ---
--- Begin Message ---
Hi,
i know that this is not necessary the best forum for that, but i need to get
a real feedback and i guess you already faced the same issue as mine.
basically, i develop php web application on windows XP platform.
So i have apache 2.24 installed and PHP 5.2.4.
now i would like to test if my application send emails, so i've checked my
php.ini file and it seems ok.
i tried to use IIS from windows to define a default SMTP server, but as my
emails are not sent, i guess something is wrong with IIS.
so does it exist a free SMTP server (similar that linux daemon) but running
on windows XP ?
if yes, where can i find it and what steps should i perform to be sure my
emails are sent ?
i do not want to transfer all my web application each time i want to test
email sending...
i would like to test it locally.
thanks for your feedback.
--
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008
--- End Message ---
--- Begin Message ---
Alain Roger wrote:
Hi,
i know that this is not necessary the best forum for that, but i need to get
a real feedback and i guess you already faced the same issue as mine.
basically, i develop php web application on windows XP platform.
So i have apache 2.24 installed and PHP 5.2.4.
now i would like to test if my application send emails, so i've checked my
php.ini file and it seems ok.
i tried to use IIS from windows to define a default SMTP server, but as my
emails are not sent, i guess something is wrong with IIS.
so does it exist a free SMTP server (similar that linux daemon) but running
on windows XP ?
if yes, where can i find it and what steps should i perform to be sure my
emails are sent ?
i do not want to transfer all my web application each time i want to test
email sending...
i would like to test it locally.
thanks for your feedback.
I could be wrong, but I thought that you had to specify the SMTP server
in the php.ini file.
http://us2.php.net/manual/en/ref.mail.php#ini.smtp
> now i would like to test if my application send emails, so i've
checked my
> php.ini file and it seems ok.
Maybe that means you already did that. The second issue might be that
your SMTP server is MS Exchange, and it requires authentication.
If that is the case, then search for php SMTP authentication:
http://www.google.com/search?q=php+smtp+authentication&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
--
Ray Hauge
www.primateapplications.com
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Ray Hauge [mailto:[EMAIL PROTECTED]
> Sent: Sunday, March 09, 2008 5:17 PM
> To: Alain Roger
> Cc: PHP General List
> Subject: Re: [PHP] SMTP
>
> Alain Roger wrote:
> > Hi,
> >
> > i know that this is not necessary the best forum for that, but i need to
> get
> > a real feedback and i guess you already faced the same issue as mine.
> > basically, i develop php web application on windows XP platform.
> > So i have apache 2.24 installed and PHP 5.2.4.
> >
> > now i would like to test if my application send emails, so i've checked
> my
> > php.ini file and it seems ok.
> > i tried to use IIS from windows to define a default SMTP server, but as
> my
> > emails are not sent, i guess something is wrong with IIS.
> >
> > so does it exist a free SMTP server (similar that linux daemon) but
> running
> > on windows XP ?
> > if yes, where can i find it and what steps should i perform to be sure my
> > emails are sent ?
> >
> > i do not want to transfer all my web application each time i want to test
> > email sending...
> > i would like to test it locally.
> >
> > thanks for your feedback.
> >
>
> I could be wrong, but I thought that you had to specify the SMTP server
> in the php.ini file.
>
> http://us2.php.net/manual/en/ref.mail.php#ini.smtp
>
> > now i would like to test if my application send emails, so i've
> checked my
> > php.ini file and it seems ok.
>
> Maybe that means you already did that. The second issue might be that
> your SMTP server is MS Exchange, and it requires authentication.
>
> If that is the case, then search for php SMTP authentication:
>
> http://www.google.com/search?q=php+smtp+authentication&ie=utf-8&oe=utf-
> 8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
>
> --
> Ray Hauge
> www.primateapplications.com
Hi Alain,
I think you have two options:
1 - Install a MTA in your windows box, such as Mercury Mail (if you install
XAMPP, you get Apache, PHP, MySQL, Filezilla FTP Server and Mercury Mail - use
google to know what XAMPP is). To use the "mail" function on windows, you will
NEED a MTA (correct me if I'm wrong, but sendmail is not available "in PHP for
Windows", the "mail" function will try to reach an MTA on port 25 or the port
you have set up in your php.ini).
2 - Use SMTP Authentication to send out emails on behalf of an existing
authenticated email box (or a relay server if you find one).
If you choose the second option (SMTP authentication) you will likely also use
PHPMailer (or PEAR_Mail, or any of the featured classes at
http://www.phpclasses.org that support SMTP authentication) unless you are
willing to write your own class for SMTP stuff through sockets. So let's say you
have an email box with the following information:
User: [EMAIL PROTECTED]
Password: mypassword
SMTP Server: smtp.mydomain.com
Your PHPMailer code will look like:
$mail = new PHPMailer();
$mail->Mailer = 'smtp';
$mail->SMTPAuth = true;
$mail->Username = '[EMAIL PROTECTED]';
$mail->Password = 'mypassword';
$mail->Host = 'smtp.mydomain.com';
$mail->From = '[EMAIL PROTECTED]';
$mail->FromName = 'My beautiful website';
$mail->Subject = 'You know what this is';
$mail->Body = 'Your email message';
$mail->AddAddress('[EMAIL PROTECTED]', 'Mr X-Man');
$mail->AddReplyTo('[EMAIL PROTECTED]', 'My Beautiful Website');
$mail->Send();
Hope this helps. This issue drove me crazy on my first month with PHP... what is
worse, I asked in the office I worked for at that time. They said "it was not
possible" (great I don't work there anymore). As "The Rock" said... "NEVER SAY
NO" :).
Cheers,
Rob(inet)
Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 |
Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace |
Web: bestplace.biz | Web: seo-diy.com
--- End Message ---
--- Begin Message ---
Yes this is the correct way to do things. As i said,
i'm using different styles for the menus links
indicating the current page. Suppose my page has one
horiontal menu at the top and one vertical menu at the
left. In this case, one element of the horizontal menu
and one from the vertical menu will be displayed
differently from the other elements. So the function
that will be inluded will be more complex to handle
this. I was just wondering, how other poeple are
dealing with that. Of course it is feasable, but i
want to do it the best way.
I hope the problem i posted is clearer now
Two menus, do you mean like this:
http://webbytedd.com/clients/beckyscan/about-company.php
It's still just css and php -- simply a logic problem.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Yes like that, but you can consider also that the
vertical menu has different style for the link of the
current page. Anyway it does not matter for this
problem. Can you show us how your php function looks
like? Or maybe you are just doing a test for each link
for your function to know if it is the link that
should be displayed differently. I was wondering if
there is a way to do the same thing without the
overhead of all that "if " statements.
--- tedd <[EMAIL PROTECTED]> wrote:
> >Yes this is the correct way to do things. As i
> said,
> >i'm using different styles for the menus links
> >indicating the current page. Suppose my page has
> one
> >horiontal menu at the top and one vertical menu at
> the
> >left. In this case, one element of the horizontal
> menu
> >and one from the vertical menu will be displayed
> >differently from the other elements. So the
> function
> >that will be inluded will be more complex to handle
> >this. I was just wondering, how other poeple are
> >dealing with that. Of course it is feasable, but i
> >want to do it the best way.
> >
> >I hope the problem i posted is clearer now
>
> Two menus, do you mean like this:
>
>
http://webbytedd.com/clients/beckyscan/about-company.php
>
> It's still just css and php -- simply a logic
> problem.
>
> Cheers,
>
> tedd
>
>
> --
> -------
> http://sperling.com http://ancientstones.com
> http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
--- End Message ---