php-general Digest 7 Jun 2005 17:58:03 -0000 Issue 3499

Topics (messages 216541 through 216572):

Re: Japanese with UTF-8 and mysql
        216541 by: Mark Sargent
        216542 by: Mark Sargent

Re: about the absolutely path
        216543 by: Burhan Khalid
        216552 by: Jason Barnett

Project ZNF: Struts-like MVC framework
        216544 by: Alessandro 'Aronnax' Rossini
        216547 by: Petar Nedyalkov

Re: PHP bug within multi. dimensional arrays?
        216545 by: Jochem Maas

Telling users and machines apart
        216546 by: Merlin
        216549 by: Chris Shiflett
        216551 by: Burhan Khalid
        216556 by: Merlin
        216564 by: Burhan Khalid
        216565 by: Manuel Lemos
        216566 by: Manuel Lemos
        216567 by: Manuel Lemos
        216569 by: Merlin

Nameserver lookup
        216548 by: Hans J.J. Prins
        216559 by: John Nichel
        216560 by: Philip Hallstrom

test
        216550 by: Hans J.J. Prins

Re: The "goto" discussion on the Internals List
        216553 by: Jason Barnett
        216557 by: Jochem Maas
        216562 by: Rory Browne
        216571 by: Jay Blanchard

Re: headers and session
        216554 by: Angelo Zanetti

Re: linux php editor
        216555 by: Miguel Guirao
        216558 by: Greg Donald
        216563 by: Jim Moseby
        216568 by: Chris Boget

Re: Displaying an Outlook Calendar on a webpage using PHP
        216561 by: tg-php.gryffyndevelopment.com

Returned mail: see transcript for details
        216570 by: php-general.lists.php.net

How to execute local applications on the client
        216572 by: Mauricio Pellegrini

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Peter Brodersen wrote:

On Thu, 2 Jun 2005 11:58:26 +0100, in php.general
[EMAIL PROTECTED] (Richard Davey) wrote:

I would recommend setting UTF-8 as the Content-type via PHP itself:
header('Content-type: UTF-8') - do it as one of the first things when
you're ready to output the HTML.

UTF-8 is a charset, not a Content-type.

A quick test shows that the HTTP header output from Apache would
contain:
Content-Type: UTF-8

The correct way - if one wants utf-8 as charset - is:
header("Content-Type: index/html; charset=utf-8");

Hi All,

yes, I've tried that as well, with no success. As I've stated, people, the static J renders fine, just not the dynamic stuff. Cheers.

Mark Sargent.

--- End Message ---
--- Begin Message ---
Mark Sargent wrote:

Peter Brodersen wrote:

On Thu, 2 Jun 2005 11:58:26 +0100, in php.general
[EMAIL PROTECTED] (Richard Davey) wrote:

I would recommend setting UTF-8 as the Content-type via PHP itself:
header('Content-type: UTF-8') - do it as one of the first things when
you're ready to output the HTML.


UTF-8 is a charset, not a Content-type.

A quick test shows that the HTTP header output from Apache would
contain:
Content-Type: UTF-8

The correct way - if one wants utf-8 as charset - is:
header("Content-Type: index/html; charset=utf-8");

Hi All,

yes, I've tried that as well, with no success. As I've stated, people, the static J renders fine, just not the dynamic stuff. Cheers.

Mark Sargent.

Hi All,

actually, if I add this,

header("Content-Type: index/html; charset=utf-8");


as suggested, firefox prompts to download the page, instead of just displaying the page.

You have chosen to open
    productdetails.php
which is a : PHP file
from: http://localhost/
What should firefox do with this file?
Open with Browse..
Save to disk

Weird, what's with that. Cheers.

Mark Sargent.

--- End Message ---
--- Begin Message ---
Jochem Maas wrote:
Richard Lynch wrote:

On Mon, June 6, 2005 1:54 am, yangshiqi said:

I have a php application (let's call it app A) which is developed
separated
in a test domain name, like http://testa.xxx.com <http://testa.xxx.com/>
/.

But now I have to move it to another app (called B) using
http://testb.xxx.com <http://testb.xxx.com/> /, and the app A becomes just
a
subsystem of app B.

The access url is changed to http://testb.xxx.com/a/.

Then I meet a problem that the app A 's links, the path and other elements
in it are set like '/Main.php', '/art/logo.gif' by an absolutely path.

The app A is very independent and I do not want to disperse it to app B.

So how can I get this effect: when the user input the url, '
http://testb.xxx.com/a/ ', the app A will work fine?

Can I just modify some configuration about yapache to fit this
requirement?



maybe you could use the apache ProxyPass directive?

ProxyPass testb.xxx.com/a/ testa.xxx.com

or something like that. (I'm just half-remembering
a cool post by Rasmus L. so the syntax is probably off)


I've been trying to search for that message for a while. It talked about running php4 and php5 in one Apache instance.
--- End Message ---
--- Begin Message ---
http://marc.theaimsgroup.com/?l=php-general&m=111008638014141&w=2

--- End Message ---
--- Begin Message ---
Hi, my name is Alessandro Rossini and I want to let you know the launch of a 
new project called ZNF.
The goal of this project is to provide an open source framework for building 
PHP5 enterprise web applications. It's based on the Apache Struts project of 
the Apache Software Foundation, available at http://struts.apache.org/. This 
is not the first attempt to rewrite the Struts implementation, or part of it, 
in PHP, but after spending a lot of time studying existing open source 
frameworks, like Phrame, PHPMVC, Struts4PHP, Seagull and Vida we decided to 
reimplement a brand new framework from scratch for many reasons. First of 
all, all the mentioned frameworks, except Vida, are written in PHP4 and we 
believe that its object engine (Zend Engine 1) is too limited for developing 
enterprise level web application. At the same time the code we analyzed is 
written without a rigorous approach (coding standards, compliance to W3C 
standards, output of notice/warnings, lack of documentation/examples). Last 
but not least frameworks claiming to be a porting of Struts have made no code 
optimization during the porting from J2EE to PHP.
ZNF is free software released under GNU/LGPL license, the official ZNF home 
page is at http://znf.zeronotice.com/. You will find the main package, a PEAR 
compatible package and the developer's guide.
The project has been developed by me and Graziano Liberati, we're searching 
for comments, feedback, bug signaling and best of all new developers. Any 
kind of contribution will be appreciated, if you find the project interesting 
join us!

Best regards.
-- 
Alessandro 'Aronnax' Rossini
----------------------------
web -> www.aronnax.it
e-mail -> [EMAIL PROTECTED]
icq -> 2442698
OpenLUG member -> www.openlug.org
ZeroNotice IT Solutions -> www.zeronotice.com

Attachment: pgpEwO2UOrntA.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
On Tuesday 07 June 2005 12:05, Alessandro 'Aronnax' Rossini wrote:
> Hi, my name is Alessandro Rossini and I want to let you know the launch of
> a new project called ZNF.
> The goal of this project is to provide an open source framework for
> building PHP5 enterprise web applications. It's based on the Apache Struts
> project of the Apache Software Foundation, available at
> http://struts.apache.org/. This is not the first attempt to rewrite the
> Struts implementation, or part of it, in PHP, but after spending a lot of
> time studying existing open source frameworks, like Phrame, PHPMVC,
> Struts4PHP, Seagull and Vida we decided to reimplement a brand new
> framework from scratch for many reasons. First of all, all the mentioned
> frameworks, except Vida, are written in PHP4 and we believe that its object
> engine (Zend Engine 1) is too limited for developing enterprise level web
> application. At the same time the code we analyzed is written without a
> rigorous approach (coding standards, compliance to W3C standards, output of
> notice/warnings, lack of documentation/examples). Last but not least
> frameworks claiming to be a porting of Struts have made no code
> optimization during the porting from J2EE to PHP.
> ZNF is free software released under GNU/LGPL license, the official ZNF home
> page is at http://znf.zeronotice.com/. You will find the main package, a
> PEAR compatible package and the developer's guide.
> The project has been developed by me and Graziano Liberati, we're searching
> for comments, feedback, bug signaling and best of all new developers. Any
> kind of contribution will be appreciated, if you find the project
> interesting join us!

Cool, keep up guys.

>
> Best regards.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436

Attachment: pgpg5U5W668xy.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Matthew Weier O'Phinney wrote:
* Merlin <[EMAIL PROTECTED]>:

Hi there,

I am outputting an multidim. array. That works fine, except one thing. The first letter of the value inside dimension 1 always gets printed.

For example:

I fill the arrays:
while ($row = mysql_fetch_object($result)){             
        $cat[$row->main_id][name]            = $row->main_name;   
        $cat[$row->main_id][$row->sub_id][name] = $row->sub_name;               
       
}


First off, if you're creating associative arrays, you should quote the
keys:

    $cat[$row->main_id]['name'] = $row->main_name;

If you don't do so, PHP assumes you're using a constant value for the
key name.


Then I output them:
foreach ($cat AS $maincat){
        echo $maincat[name].':';


Quote your keys!


        foreach($maincat AS $subcat){


You do realize that the above will also loop over the index 'name',
right?...


                echo $subcat[name].$br;


and since it does, the first element in that array is 'name', which
isn't an array, but a string. Since the 'name' constant isn't defined,
it will interpret that as 'true', or 1, and so it takes the first
character of that string.

I think you'll find the 'name' constant evaluates to FALSE, which in turn
casts to zero, which will give you the first element of the given array,
but as you pointed out its a string not an array so you get the first
char (because php allows array-like access to the individual chars in
a string) ... if it had evaluated to TRUE you would be getting the second
char.

the rest of your explaination is spot on.



        }
        echo $br;
}

Which does result in:

Europe:E
Germany
UK

North America:N
US
CA

As you can see I get the extra letters N and E. Is this an php error or did I do something wrong?


So, what you should probably do is create an additional layer in your
multi-dimensional array for the subcategories, and have it of the form
sub_id => sub_name:

        $cat[$row->main_id]['subs'][$row->sub_id] = $row->sub_name;    

Then loop over that:

    foreach ($cat as $main_cat) {
        echo $maincat['name'] . ":\n";
        foreach ($maincat['subs'] as $sub_id => $sub_name) {
            echo "$sub_name$br"; // could also use $sub_id here if
                                 // desired
        }
    }


--- End Message ---
--- Begin Message ---
Hi there,

I am getting more and more emails through my webforms submited by bots.
It looks like some sites liky yahoo are placing an image into their forms and the human has to enter a code visible on the image to submit the form.
After some googling I found captcha, but I do not like the images.

Do you know if there is a class available for PHP which does create the image and does parts of the handling? That seems like a common task to me. Maybe someone else already implemented such thing and can recommend.

Thank you in advance,

Merlin

--- End Message ---
--- Begin Message ---
Merlin wrote:
I am getting more and more emails through my webforms submited by bots.
It looks like some sites liky yahoo are placing an image into their
forms and the human has to enter a code visible on the image to submit
the form. After some googling I found captcha, but I do not like the
images.

Do you know if there is a class available for PHP which does create the
image and does parts of the handling?

You might find this helpful:

http://phpsec.org/articles/2005/text-captcha.html

It uses an image, and there are valid complaints against such. Of course, you could also argue that CAPTCHA has very little to do with security, and I'd have to agree. :-)

Other approaches include asking a simple question that any user will know and throttling requests from the same client to restrain the scope of the problem.

Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

--- End Message ---
--- Begin Message ---
Merlin wrote:
Hi there,

I am getting more and more emails through my webforms submited by bots.
It looks like some sites liky yahoo are placing an image into their forms and the human has to enter a code visible on the image to submit the form.
After some googling I found captcha, but I do not like the images.

Do you know if there is a class available for PHP which does create the image and does parts of the handling? That seems like a common task to me. Maybe someone else already implemented such thing and can recommend.

There is Text_CAPTCHA at PEAR, but I haven't used it myself. I use my own little code snippet.
--- End Message ---
--- Begin Message ---
Burhan Khalid wrote:
Merlin wrote:

Hi there,

I am getting more and more emails through my webforms submited by bots.
It looks like some sites liky yahoo are placing an image into their forms and the human has to enter a code visible on the image to submit the form.
After some googling I found captcha, but I do not like the images.

Do you know if there is a class available for PHP which does create the image and does parts of the handling? That seems like a common task to me. Maybe someone else already implemented such thing and can recommend.


There is Text_CAPTCHA at PEAR, but I haven't used it myself. I use my own little code snippet.

That sounds intersting. Could you show me an online example of this?

Merlin

--- End Message ---
--- Begin Message ---
Merlin wrote:
Burhan Khalid wrote:

Merlin wrote:

Hi there,

I am getting more and more emails through my webforms submited by bots.
It looks like some sites liky yahoo are placing an image into their forms and the human has to enter a code visible on the image to submit the form.
After some googling I found captcha, but I do not like the images.

Do you know if there is a class available for PHP which does create the image and does parts of the handling? That seems like a common task to me. Maybe someone else already implemented such thing and can recommend.



There is Text_CAPTCHA at PEAR, but I haven't used it myself. I use my own little code snippet.


That sounds intersting. Could you show me an online example of this?

This is an example of what my script outputs : http://meidomus.com/code/captcha/ -- refresh to see different results.

Source available if you are interested.

--- End Message ---
--- Begin Message ---
on 06/07/2005 09:39 AM Merlin said the following:
Hi there,

I am getting more and more emails through my webforms submited by bots.
It looks like some sites liky yahoo are placing an image into their forms and the human has to enter a code visible on the image to submit the form.
After some googling I found captcha, but I do not like the images.

Do you know if there is a class available for PHP which does create the image and does parts of the handling? That seems like a common task to me. Maybe someone else already implemented such thing and can recommend.

You may want to try this class that comes with a CAPTCHA plug-in to do exactly that. The class comes with documentation and a straight example to demonstrate how to use.

http://www.phpclasses.org/formsgeneration

Here you may also find a screenshot of how it will look:

http://www.phpclasses.org/browse/file/8244.html

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--- End Message ---
--- Begin Message ---
on 06/07/2005 09:39 AM Merlin said the following:
Hi there,

I am getting more and more emails through my webforms submited by bots.
It looks like some sites liky yahoo are placing an image into their forms and the human has to enter a code visible on the image to submit the form.
After some googling I found captcha, but I do not like the images.

Do you know if there is a class available for PHP which does create the image and does parts of the handling? That seems like a common task to me. Maybe someone else already implemented such thing and can recommend.

You may want to try this class that comes with a CAPTCHA plug-in to do exactly that. The class comes with documentation and a straight example to demonstrate how to use.

http://www.phpclasses.org/formsgeneration

Here you may also find a screenshot of how it will look:

http://www.phpclasses.org/browse/file/8244.html

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--- End Message ---
--- Begin Message ---
Hello,

on 06/07/2005 09:39 AM Merlin said the following:
Hi there,

I am getting more and more emails through my webforms submited by bots.
It looks like some sites liky yahoo are placing an image into their forms and the human has to enter a code visible on the image to submit the form.
After some googling I found captcha, but I do not like the images.

Do you know if there is a class available for PHP which does create the image and does parts of the handling? That seems like a common task to me. Maybe someone else already implemented such thing and can recommend.

You may want to try this class that comes with a CAPTCHA plug-in to do exactly that. The class comes with documentation and a straight example to demonstrate how to use.

http://www.phpclasses.org/formsgeneration

Here you may also find a screenshot of how it will look:

http://www.phpclasses.org/browse/file/8244.html

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--- End Message ---
--- Begin Message ---
Burhan Khalid wrote:
Merlin wrote:

Burhan Khalid wrote:

Merlin wrote:

Hi there,

I am getting more and more emails through my webforms submited by bots.
It looks like some sites liky yahoo are placing an image into their forms and the human has to enter a code visible on the image to submit the form.
After some googling I found captcha, but I do not like the images.

Do you know if there is a class available for PHP which does create the image and does parts of the handling? That seems like a common task to me. Maybe someone else already implemented such thing and can recommend.




There is Text_CAPTCHA at PEAR, but I haven't used it myself. I use my own little code snippet.



That sounds intersting. Could you show me an online example of this?


This is an example of what my script outputs : http://meidomus.com/code/captcha/ -- refresh to see different results.

Source available if you are interested.

Hi Burhan,

looks interesting. Is this a lot of code?

Merlin

--- End Message ---
--- Begin Message ---
Hello,

I seem to be having a little bit of trouble with executing a nslookup via
PHP's passthr() function.

This:
passthru("nslookup -query=ns testing12345.nl", $returnVar);

Returns:
"Server:  ns1.activedomain.nl
Address:  217.148.161.5
Aliases:  5.161.148.217.in-addr.arpa

0"

However, when I execute the nslookup command directly from my SSH client, I
get this result (minus the ---):
---
Server: ns1.activedomain.nl
Address: 217.148.161.5
Aliases: 5.161.148.217.in-addr.arpa

*** ns1.activedomain.nl can't find testing12345.nl: Non-existent host/domain
---

For some reason passthru does not pass back the last line. And that is
exactly the line that I need! I also tried exec(), system() and shell_exec()
But PHP does not give me that last line.

I should mention that I'm on a freeBSD system with Apache 1.3.32 and PHP
4.3.10

Can anyone help me out on this?

Thanks in advance.

Hans J.J. Prins

--- End Message ---
--- Begin Message ---
Hans J.J. Prins wrote:
Hello,

I seem to be having a little bit of trouble with executing a nslookup via
PHP's passthr() function.

This:
passthru("nslookup -query=ns testing12345.nl", $returnVar);

Returns:
"Server:  ns1.activedomain.nl
Address:  217.148.161.5
Aliases:  5.161.148.217.in-addr.arpa

0"

However, when I execute the nslookup command directly from my SSH client, I
get this result (minus the ---):
---
Server: ns1.activedomain.nl
Address: 217.148.161.5
Aliases: 5.161.148.217.in-addr.arpa

*** ns1.activedomain.nl can't find testing12345.nl: Non-existent host/domain
---

For some reason passthru does not pass back the last line. And that is
exactly the line that I need! I also tried exec(), system() and shell_exec()
But PHP does not give me that last line.

I should mention that I'm on a freeBSD system with Apache 1.3.32 and PHP
4.3.10

Can anyone help me out on this?

What do you get with shell_exec("nslookup -query=ns testing12345.nl")

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
I seem to be having a little bit of trouble with executing a nslookup via
PHP's passthr() function.

This:
passthru("nslookup -query=ns testing12345.nl", $returnVar);

Returns:
"Server:  ns1.activedomain.nl
Address:  217.148.161.5
Aliases:  5.161.148.217.in-addr.arpa

0"

However, when I execute the nslookup command directly from my SSH client, I
get this result (minus the ---):
---
Server: ns1.activedomain.nl
Address: 217.148.161.5
Aliases: 5.161.148.217.in-addr.arpa

*** ns1.activedomain.nl can't find testing12345.nl: Non-existent host/domain
---

For some reason passthru does not pass back the last line. And that is
exactly the line that I need! I also tried exec(), system() and shell_exec()
But PHP does not give me that last line.

I should mention that I'm on a freeBSD system with Apache 1.3.32 and PHP
4.3.10

Can anyone help me out on this?

Try...

passthru("nslookup -query=ns testing12345.nl 2>&1", $returnVar);

The "2>&1" will send stderr to stdout. My guess is your last line is stderr.
--- End Message ---
--- Begin Message ---
test

--- End Message ---
--- Begin Message --- I agree 100% with Greg's comments for the goto() / ifsetor() discussion on the internals list. As far as speed goes if the dev team knew of ways to improve specific parts of the codebase (while maintaining the rest of the features available in PHP) then I'm confident they would make that change.

There was one comment on the internals list that perhaps the documentation should have a big fat red warning label that says "DO NOT USE THIS UNLESS YOU REALLY KNOW WHAT YOU'RE DOING". I guess the developers assume users actually read the manual, but I think this list has proved time and again that end users don't do this. ;) This is especially true for newbies (i.e. the ones most likely to get burned by using goto() all over their code).

PHP-dev team: at the moment you are supplying me with 95% of the features that I need with a base installation. Just focus on getting Unicode support, make it stable, and make it fast.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY | http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
--- End Message ---
--- Begin Message ---
Jason Barnett wrote:
I agree 100% with Greg's comments for the goto() / ifsetor() discussion on the internals list. As far as speed goes if the dev team knew of ways to improve specific parts of the codebase (while maintaining the rest of the features available in PHP) then I'm confident they would make that change.

There was one comment on the internals list that perhaps the documentation should have a big fat red warning label that says "DO NOT USE THIS UNLESS YOU REALLY KNOW WHAT YOU'RE DOING". I guess the developers assume users actually read the manual, but I think this list has proved time and again that end users don't do this. ;) This is especially true for newbies (i.e. the ones most likely to get burned by using goto() all over their code).

PHP-dev team: at the moment you are supplying me with 95% of the features that I need with a base installation. Just focus on getting Unicode support, make it stable, and make it fast.

and fix whatever it is that causes failed require_once statement to segfault
( there are other instances where simple syntax errors causes segfaults - the
really annoying thing is that I/you get no logs, no errors, nothing - not very
easy to debug) ... this has been true since php5 beta

funny thing is I only see it happening in very complex scripts, which means its
obviously not a real bug because I can't create a short reproduce script -
(slight dig at someone there)

both goto and ifsetor (and a whole host of other stuff like PDO) I can miss,
whereas proper unicode support, better datetime handling and more 
indepth/usuable
documentation on php5 are things I am really looking forward to... like rather 
than giving
us even more features why not give us some good/complex examples
of the newer features (SPL, Exceptions, etc, etc) and give us the knowledge
we need to leverage the tools we already have.



heh Jason, your sig will require a new item ;-):

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY | 
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
GOTO | heh noob don't use 'goto'.

--- End Message ---
--- Begin Message ---
If there is a use for goto, that can cause certain tasks to be
acomplished faster using goto, and that implementing goto in the ZE
isn't too much work, then I don't see a problem with implementing it.

I'm not totally sure why, but Zend used goto, in the Zend Engine(one
used for php4) code for looping through opcodes. I'm sure zend saw
some benefit in using goto's when they decided to use them in the ZE
Backend.

Goto has (I believe) been described as a method of shooting yourself
in both feet at the same time. Maybe if there was an
enable_expert_mode() command to enable expert mode for that page, or
maybe a <?php_expert opening brace, that enable functionalty that is
recommended for use only by experts.  - Just a thought.


On 6/7/05, Jason Barnett <[EMAIL PROTECTED]> wrote:
> I agree 100% with Greg's comments for the goto() / ifsetor() discussion
> on the internals list.  As far as speed goes if the dev team knew of
> ways to improve specific parts of the codebase (while maintaining the
> rest of the features available in PHP) then I'm confident they would
> make that change.
> 
> There was one comment on the internals list that perhaps the
> documentation should have a big fat red warning label that says "DO NOT
> USE THIS UNLESS YOU REALLY KNOW WHAT YOU'RE DOING".  I guess the
> developers assume users actually read the manual, but I think this list
> has proved time and again that end users don't do this.  ;)  This is
> especially true for newbies (i.e. the ones most likely to get burned by
> using goto() all over their code).
> 
> PHP-dev team: at the moment you are supplying me with 95% of the
> features that I need with a base installation.  Just focus on getting
> Unicode support, make it stable, and make it fast.
> 
> --
> Teach a man to fish...
> 
> NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
> STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
> STFM | http://php.net/manual/en/index.php
> STFW | http://www.google.com/search?q=php
> LAZY |
> http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
[snip]
Goto has (I believe) been described as a method of shooting yourself
in both feet at the same time. 
[/snip]

goto (not a 'new' construct as was mentioned earlier) had its uses, but
thos would seem depricated now as you can call a function, which is
essentially what a goto did. Consider;

if('foo' == $bar){
     goto(1001); //essentially a line number (remember, old school)
 OR  goto(LABEL); //defined constant
} else {
     goto(2001);
}

VS.

if('foo' == $bar){
     assimilate($bar);
} else {
     anhylate($bar);
}


Where problems arose from goto they would arise from function use as
well. Nesting goto's was every bit as challenging as properly
constructing regex statements. goto also did not fit as well with OOP
methodology, being more of a procedural construct in accordance with the
procedural programming at the time that it was conceived.

--- End Message ---
--- Begin Message ---
Hi Alessandro

try this as well (Put these lines before and after your redirect/header
statement);

session_write_close();
header( "Location: ".$PHPcmd );
exit();

hope this helps

Angelo Zanetti
Z Logic
www.zlogic.co.za



Alessandro Rosa wrote:

>Hi to all,
>
>I got a problem while storing session variables.
>
><?php
>session_start();
>header( "Cache-control: private" );
>
>require_once("config.inc.php");
>
>////////////////////////////////////////////////////////////
>$_SESSION['session_psw'] = $_POST['txtPassword'];
>$_SESSION['session_user'] = $_POST['txtIdUtente'];
>
>////////////////////////////////////////////////////////////
>
>$PHPcmd = $GLOBALS['gestionale_path_name']."test/2.php" ;
>
>header( "Location: ".$PHPcmd );
>
>?>
>
>After the call to header(...), the values of session variables are lost.
>
>I think I should fix this up with some settings in my php.ini
>
>Could you help me, please?
>
>Alessandro Rosa
>
>  
>

--- End Message ---
--- Begin Message ---
Try NVU, from www.nvu.org

-----Original Message-----
From: Clive Zagno [mailto:[EMAIL PROTECTED]
Sent: Lunes, 06 de Junio de 2005 09:09 p.m.
To: php
Subject: Re: [PHP] linux php editor


the truth is Ive been developing on windows, because of some .net
developments.

Ive been starting most new projects as web applications and using
php/mysql. On windows I used ultredit, then I found a product called
phpedit, which I liked, now Im trying to move to linux.

what I really want is a app that can do that predictive text thing, you
know when it start showing me the possible php syntax as Im typing it
in. Two reasons for this is it help with debugging as I get the syntax
correct the first time and secondly I think its cool.


clive

Rory Browne wrote:
> Cut the red, connect the blue, and green..............
>
> In seriousness though I like vim, and Kate.
>
> On 6/6/05, John Nichel <[EMAIL PROTECTED]> wrote:
>
>>Greg Donald wrote:
>>
>>>On 6/6/05, John Nichel <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>>>You newbies and your fancy editors.  Back in my day, you got vi, and you
>>>>were happy with it.  ;)
>>>
>>>
>>># dd if=/dev/tty of=/dev/hda1
>>
>>Now we just need the punch card people to speak up.
>>
>>--
>>John C. Nichel
>>ÜberGeek
>>KegWorks.com
>>716.856.9675
>>[EMAIL PROTECTED]
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>

--- End Message ---
--- Begin Message ---
On 6/7/05, Miguel Guirao <[EMAIL PROTECTED]> wrote:
> 
> Try NVU, from www.nvu.org

I don't see any sort of text editor there.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

--- End Message ---
--- Begin Message ---
> 
> On 6/7/05, Miguel Guirao <[EMAIL PROTECTED]> wrote:
> > 
> > Try NVU, from www.nvu.org
> 
> I don't see any sort of text editor there.


Try NVU.com


JM

--- End Message ---
--- Begin Message ---
Slickedit has a linux flavor and is an exceptional IDE (in general; 
at least, on Windows).

http://www.slickedit.com

thnx,
Chris

--- End Message ---
--- Begin Message ---
Sorry, wasn't able to test this when I got home.  But to clearify, when you use 
COM, it's loading Outlook (as you've seen) and then talking directly to it.  So 
you don't need an exchange server to make it work.

Try tracing through the code and see where it's failing.  And nothing's showing 
up when you do "View source" (I know you said it's continuously running but 
curious what happens if you stop the page load and see what's been output)?   
Have you tried running the script via command line?

I'd be curious to see how far the script gets for you before it bombs out.   It 
might be trying to tell Outlook to do something and just hanging (hence the 
perpetual loading in your browser) which is why I'm wondering how far it gets 
and what happens if you run it via command-line.

More info would definitely be appreciated.

-TG

= = = Original message = = =

Still no luck I am afraid. Same thing happens - it kicks off an instance
of Outlook.exe on the server, but the page never loads, it just stays
blank with a never-ending progress bar.

I thought it could be security related but have shared out my Calendar
with default having reviewer access.

I am using an Exchange server but don't want to follow the route of
sharing Calendars and accessing them in Outlook. 

Is the problem with the script that it has to access an Exchange server
to read the Calendar, even while Outlook is installed on the server and
configured with the same profile?

Thanks
Justin

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 7 June 2005 1:01 AM
To: php-general@lists.php.net
Cc: Baiocchi, Justin (CSIRO IT, Armidale)
Subject: Re: [PHP] Displaying an Outlook Calendar on a webpage using PHP


That looks like some of my code.. or a derivative of my code.   For some
reason, my PC at work here is having issues with PHP instantiating with
COM so I can't test this, but the code you posted is conspicuously
missing all the braces  .  I'm guessing that's not your issue
though... or else you'd be getting some kind of error maybe.

Anyway, here's a re-braced version of the code.   It should produce
something when run through a web browser, but you might View Source and
see what shows up there.

This does require Outlook to be installed on the PC that PHP is running
on, as that's how COM works.   I never messed around with remote COM
calls, but I'm sure there's some way to do that.

If someone wants to try this code and see if there are other issues
besides the missing braces.  I don't see anything obviously wrong with
it (besides maybe some sloppy programming on my part :).  I'll see about
checking it when I get home tonight if I have time.

<?php
$comobjOutlook = new COM("outlook.application") or die("Outlook not
loaded");

//$comobjOutlook -> Activate;

# This is your mailbox name just like it appears in your Folders view.
# It might be 'Inbox' or something else.
$targetmailboxname = "Mailbox - Baiocchi, Justin (CSIRO IT, Armidale)";


# This is the folder you're looking for. In this case, I'm looking for
calendar
# items, but you can look for any folder. You need to add another loop
to look
# for subfolders. Although there's probably a better way, that's how I
did it when 
# I needed to get to Personal Folders/Inbox/Subfoldername
$targetfoldername = "Calendar";

$objNamespace = $comobjOutlook->GetNameSpace("MAPI");
$objFolders = $objNamespace->Folders();
$mailboxcount = $objFolders -> Count();


$foundmailbox = FALSE;
for ($i=1; $i<=$mailboxcount; $i++) 
  $folderitem = $objFolders ->Item($i);
  if ($folderitem -> Name == $targetmailboxname) 
    $objMailbox = $folderitem;
    $foundmailbox = TRUE;

    $foundcal = FALSE;
    if ($foundmailbox) 
      $objFolders = $objMailbox->Folders();
      $foldercount = $objFolders -> Count();

      for ($i=1; $i<=$foldercount; $i++) 
        $folderitem = $objFolders -> Item($i);
        if ($folderitem -> Name == $targetfoldername) 
          $objCalendar = $folderitem;
          $foundcal = TRUE;
        
      
    


    if ($foundcal) 
      $objItems = $objCalendar->Items();
      $itemcount = $objItems->Count();

      for ($i=1; $i<=$itemcount; $i++) 
        $apptitem = $objItems -> Item($i);
        $apptstart = $apptitem -> Start();
        $apptend = $apptitem -> End();
        $apptallday = $apptitem -> AllDayEvent();
        $apptrecur = $apptitem -> IsRecurring();
        $apptsubject = $apptitem -> Subject();
        $apptlocation = $apptitem -> Location();

        $secondsadj = $apptstart - 14400;
        $startadj = date("m/d/Y H:i:s",
mktime(0,0,$secondsadj,1,1,1970));

        $secondsadj = $apptend - 14400;
        $endadj = date("m/d/Y H:i:s", mktime(0,0,$secondsadj,1,1,1970));

        if($apptallday)  $allday = "All Day";  else  $allday = "";
        if($apptrecur)  $recurring = "Recurring";  else  $recurring =
"";

        echo "$apptsubject @ $apptlocation\r\nFrom: $startadj To:
$endadj\r\n";

        if ($allday <> "" OR $recurring <> "") echo "$allday
$recurring\r\n";
        echo "\r\n\r\n";
      
     else 
      die ("Did not find calendar folder");
    
   else 
    die("Did not find target mailbox: $targetmailboxname");
  

?>



= = = Original message = = =

Hello all,
 
I am trying to publish an Outlook Calendar on a web page using PHP and
COM. I have managed to track down on the net some examples of how it
could be done. The most promising is the code below. However, all that
happens is that outlook.exe is started on the server, but nothing is
displayed on the web page and it just times-out.
 
I am running PHP 4.0.18 on Windows 2003 server and I have Outlook 2002
installed on the server.
Does anybody know why it doesn't work?
 
Thanks 
Justin


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---
--- Begin Message ---
The message was not delivered due to the following reason:

Your message was not delivered because the destination server was
not reachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.

Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.

Your message could not be delivered within 5 days:
Host 151.227.146.62 is not responding.

The following recipients could not receive this message:
<php-general@lists.php.net>

Please reply to [EMAIL PROTECTED]
if you feel this message to be in error.


--- End Message ---
--- Begin Message ---
Hi, sorry if what I am asking makes no sense, but here it goes..

Some one has asked me to set a web page from within wich users could
launch local applications. Those applications are allready installed in
the client PC.

The link on the web page would act as a simple link to start the
application.

This page would be something that resembles the windows desktop with all
its links on it.

My question is would it be possible to start in example word or excel
from a link in a web page?

Thanks for your answers
Mauricio

--- End Message ---

Reply via email to