OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 10 Aug 2004 21:38:00 -0000 Issue 2929

php-general-digest-helplists.php.net
Date: Tue Aug 10 2004 - 16:38:00 CDT


php-general Digest 10 Aug 2004 21:38:00 -0000 Issue 2929

Topics (messages 193252 through 193393):

Re: why use http headers??
        193252 by: Aidan Lister

Re: GENERAL DIGEST MAILLIST ALLOWS POST
        193253 by: Aidan Lister

Re: PHP 4 equivalent for convert_uuencode
        193254 by: Aidan Lister

Re: SQL Join query
        193255 by: Jason Wong

sessions not working when page redirects
        193256 by: Angelo Zanetti
        193260 by: Jason Wong
        193262 by: pete M
        193264 by: Ron Stiemer
        193266 by: John W. Holmes
        193267 by: Angelo Zanetti
        193273 by: Ford, Mike [LSS]

Image and variable
        193257 by: Henri Marc
        193258 by: Alfonso Baqueiro
        193259 by: Torsten Roehr
        193261 by: Kevin Waterson
        193263 by: pete M
        193282 by: Henri Marc
        193284 by: Ford, Mike [LSS]
        193286 by: Jason Wong

PHP Calendar/Planner Project
        193265 by: PHP Junkie

Re: LDAP Group query examples?
        193268 by: Sam Evans
        193386 by: Sam Evans
        193391 by: Justin Patrin

define constants within functions?
        193269 by: Justin French
        193270 by: Jay Blanchard
        193274 by: Justin French

Re: PHP/MySQL based webmail?
        193271 by: Chris Shenton
        193272 by: raditha dissanayake
        193290 by: John W. Holmes
        193316 by: Matthew Sims
        193323 by: raditha dissanayake
        193343 by: Hardik Doshi

SQL Functions
        193275 by: Dan Joseph
        193278 by: Jay Blanchard
        193281 by: Dan Joseph
        193288 by: John W. Holmes
        193289 by: Dan Joseph
        193291 by: John Nichel
        193293 by: Dan Joseph
        193294 by: Robby Russell
        193302 by: John Nichel
        193326 by: raditha dissanayake
        193331 by: Justin Patrin
        193335 by: Dan Joseph
        193336 by: Justin Patrin
        193349 by: Dan Joseph
        193352 by: John W. Holmes
        193361 by: Ed Lazor
        193378 by: Michael Collins

Problems with array_reverse!
        193276 by: Labunski
        193287 by: Ford, Mike [LSS]

hosting provider won't enable ftp_connect()
        193277 by: Brian Anderson
        193279 by: Jay Blanchard
        193280 by: John Nichel
        193283 by: Brian Anderson
        193295 by: Robby Russell
        193296 by: Randall Perry
        193311 by: Brian Anderson
        193315 by: Afan Pasalic
        193317 by: Justin Patrin
        193328 by: Jason Wong
        193338 by: Justin Patrin

You can all take a look
        193285 by: PHPDevX
        193292 by: Jay Blanchard
        193304 by: John W. Holmes
        193309 by: Curt Zirzow
        193312 by: John Nichel
        193318 by: John W. Holmes

Global persistent variables
        193297 by: Jean-Yves Jourdain
        193298 by: Jay Blanchard
        193299 by: Jason Davidson
        193300 by: Robby Russell
        193301 by: Jay Blanchard
        193303 by: Jason Davidson
        193305 by: Jay Blanchard
        193307 by: Tom Rogers
        193308 by: John W. Holmes
        193310 by: Jason Davidson
        193314 by: John W. Holmes
        193320 by: Jean-Yves Jourdain

MVC pattern help?
        193306 by: Justin French
        193313 by: Justin French
        193324 by: Matthew Weier O'Phinney

preg_match_all but no preg_replace_all?
        193319 by: Marten Lehmann
        193322 by: Matthew Weier O'Phinney
        193329 by: Luke Davison
        193330 by: Justin Patrin
        193333 by: Peter Brodersen
        193348 by: Matthew Weier O'Phinney
        193358 by: John Nichel
        193373 by: Peter Brodersen
        193374 by: Peter Brodersen

Re: how to configure sessions
        193321 by: Naty

Re: You can all take a look OT
        193325 by: Jay Blanchard

download script
        193327 by: Aaron Todd
        193334 by: Aaron Todd
        193339 by: Jason Wong
        193342 by: John Nichel
        193344 by: John Nichel
        193354 by: Aaron Todd
        193359 by: Ed Lazor
        193362 by: Aaron Todd
        193376 by: John W. Holmes

PHP5 OOP
        193332 by: Joel Kitching
        193356 by: Matthew Sims
        193357 by: John W. Holmes

php tools
        193337 by: Naty
        193345 by: Matthew Weier O'Phinney
        193346 by: John Nichel
        193347 by: Naty
        193350 by: Matthew Weier O'Phinney
        193353 by: Jay Blanchard
        193363 by: Matthew Sims
        193367 by: John W. Holmes
        193368 by: Lester Caine
        193375 by: John Nichel
        193377 by: John Nichel
        193380 by: Jonathan Haddad
        193385 by: Peter Ellis
        193390 by: Matthew Sims

URL String
        193340 by: Stephen Craton

Embeded PHP
        193341 by: Aaron Todd

Cannot redeclare function
        193351 by: Alex Hogan
        193364 by: John W. Holmes
        193365 by: Ed Lazor
        193366 by: Alex Hogan
        193387 by: Justin Patrin
        193392 by: Alex Hogan

PHP performance
        193355 by: Ed Lazor
        193369 by: Alex Hogan
        193370 by: Jay Blanchard
        193379 by: Matthew Sims
        193382 by: Vail, Warren
        193384 by: John Nichel
        193393 by: Ed Lazor

embedded php
        193360 by: Aaron Todd
        193371 by: Jay Blanchard
        193381 by: John Nichel

Re: php tools OT
        193372 by: Jay Blanchard

Read External Directory
        193383 by: Stephen Craton
        193388 by: Jay Blanchard
        193389 by: Justin Patrin

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Hi Tobias,

I don't really understand what you are asking, but if you want to send HTTP
headers please see:
www.php.net/header

If you need "Arguments for http headers", see the protocol specification
http://www.faqs.org/rfcs/rfc2616

"Tobias grønlund" <tobiasedev.dk> wrote in message
news:20040810083648.94544.qmailpb1.pair.com...
> Hey people,
>
> i need some help. Im missing some arguments for using http headers,
> especially "content-length", for speeding up a site or just improving
> the quality of a site :)
>
> any comments appreciated...

attached mail follows:


Alfonso,

Please stop sending crap to this list, or you will be unsubscribed.

We're more than happy you've been able to sign up, but we don't need 4
emails detailing your progress.

Kind Regards,
Aidan

"Alfonso Baqueiro" <abaqueiromemoria1.com> wrote in message
news:20040809115935.87251.qmailpb1.pair.com...
> If you are viewing this, means that been suscribed only to the
> general-digest, you are able to post.
>
> This is very useful for mozilla clients, cause you have mozilla to see
> the message list for new messages without the inconvenience of recieving
> a lot of mail daily.
>
> :)

attached mail follows:


Hi Vidyut,

This function will be replicated in userland code when I get some more time,
I'll add a note when it is done.

For more info, see http://pear.php.net/php_compat

"Vidyut Luther" <vidluthergmail.com> wrote in message
news:776936ac040809135218d90864mail.gmail.com...
> Hello,
> I'm looking at the PHP manual which has
http://us3.php.net/convert_uuencode
> convert_uuencode as a function, but it's only a PHP 5 function. Is
> there a PHP 4 equivalent for this function ?.
>
> Really appreciate any help on this.
>
> --
> Vidyut Luther

attached mail follows:


On Tuesday 10 August 2004 17:28, Peter Brodersen wrote:

> .. but this is rather an SQL-related question.

That's what I pointed out last week when this thread started! Glad someone's
paying attention :)

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
I will follow the good side right to the fire, but not into it if I can
help it.
                -- Michel Eyquem de Montaigne
*/

attached mail follows:


Hi all,

Im having a slightly weird problem with my session variables. when on a
certain page call it "A", I register a session variable and assign it a
value. I then test if it is registered successfully and has the correct
value on the same page, that works no problem. After that page "A"
redirects to page "B":

header("Location: ../admin/include/B.php");

After this I do the exact same test on page "B" to test for successful
registration and value and I get that the session variable is not
registered. on page "B" I do have session_start(); at the top. I even do
2 tests to on the session variable:

if (session_is_registered("myvar"))

and

if (isset($_SESSION["myvar"]))

and they both tell me that the session variable is not registered. what
could be causing the sesssion variable not to be remembered from page to
page. I am using register_globals=on;

any ideas/comments?
Thanks
Angelo
--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Technikon or the sender
of this e-mail be liable to any party for any direct, indirect,
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

attached mail follows:


On Tuesday 10 August 2004 19:50, Angelo Zanetti wrote:

> Im having a slightly weird problem with my session variables. when on a
> certain page call it "A", I register a session variable and assign it a
> value. I then test if it is registered successfully and has the correct
> value on the same page, that works no problem. After that page "A"
> redirects to page "B":
>
> header("Location: ../admin/include/B.php");

Did you close the session before you redirected?

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Think of your family tonight. Try to crawl home after the computer crashes.
*/

attached mail follows:


u need to start the session at the top of each page
sesion_start();

Angelo Zanetti wrote:
> Hi all,
>
> Im having a slightly weird problem with my session variables. when on a
> certain page call it "A", I register a session variable and assign it a
> value. I then test if it is registered successfully and has the correct
> value on the same page, that works no problem. After that page "A"
> redirects to page "B":
>
> header("Location: ../admin/include/B.php");
>
> After this I do the exact same test on page "B" to test for successful
> registration and value and I get that the session variable is not
> registered. on page "B" I do have session_start(); at the top. I even do
> 2 tests to on the session variable:
>
> if (session_is_registered("myvar"))
>
> and
>
> if (isset($_SESSION["myvar"]))
>
> and they both tell me that the session variable is not registered. what
> could be causing the sesssion variable not to be remembered from page to
> page. I am using register_globals=on;
>
> any ideas/comments?
> Thanks
> Angelo
> --------------------------------------------------------------------
> Disclaimer
> This e-mail transmission contains confidential information,
> which is the property of the sender.
> The information in this e-mail or attachments thereto is
> intended for the attention and use only of the addressee.
> Should you have received this e-mail in error, please delete
> and destroy it and any attachments thereto immediately.
> Under no circumstances will the Cape Technikon or the sender
> of this e-mail be liable to any party for any direct, indirect,
> special or other consequential damages for any use of this e-mail.
> For the detailed e-mail disclaimer please refer to
> http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

attached mail follows:


 Hi there,

Try to add the session_id(); into the redirection:

header("Location: ../admin/include/B.php?PHPSESSID=" . session_id() );

Works for me though...

Greetings,
-Ron

-----Ursprüngliche Nachricht-----
Von: Angelo Zanetti [mailto:binc2ctech.ac.za]
Gesendet: Dienstag, 10. August 2004 13:51
An: php-generallists.php.net
Betreff: [PHP] sessions not working when page redirects

Hi all,

Im having a slightly weird problem with my session variables. when on a
certain page call it "A", I register a session variable and assign it a
value. I then test if it is registered successfully and has the correct
value on the same page, that works no problem. After that page "A"
redirects to page "B":

header("Location: ../admin/include/B.php");

After this I do the exact same test on page "B" to test for successful
registration and value and I get that the session variable is not
registered. on page "B" I do have session_start(); at the top. I even do
2 tests to on the session variable:

if (session_is_registered("myvar"))

and

if (isset($_SESSION["myvar"]))

and they both tell me that the session variable is not registered. what
could be causing the sesssion variable not to be remembered from page to
page. I am using register_globals=on;

any ideas/comments?
Thanks
Angelo
--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information, which is the
property of the sender.
The information in this e-mail or attachments thereto is intended for the
attention and use only of the addressee.
Should you have received this e-mail in error, please delete and destroy it
and any attachments thereto immediately.
Under no circumstances will the Cape Technikon or the sender of this e-mail
be liable to any party for any direct, indirect, special or other
consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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

attached mail follows:


From: "Angelo Zanetti" <binc2ctech.ac.za>
> Im having a slightly weird problem with my session variables. when on a
> certain page call it "A", I register a session variable and assign it a
> value. I then test if it is registered successfully and has the correct
> value on the same page, that works no problem. After that page "A"
> redirects to page "B":
>
> header("Location: ../admin/include/B.php");

This should be a complete URL to begin with:
http://www.yourdomain.com/whatever/admin/include/B.php

> After this I do the exact same test on page "B" to test for successful
> registration and value and I get that the session variable is not
> registered. on page "B" I do have session_start(); at the top. I even do
> 2 tests to on the session variable:

Using IE?

Try using session_write_close() right before you redirect with the header()
and be sure to put exit() directly after header(). Should look like this
anytime you want to redirect.

session_write_close();
header(...);
exit();

If that doesn't work, then pass the session ID in the URL when you redirect
like someone else mentioned.

---John Holmes...

attached mail follows:


I do do that on all pages...

>>> pete M <pmorganukds.net> 8/10/2004 2:15:21 PM >>>
u need to start the session at the top of each page
sesion_start();

Angelo Zanetti wrote:
> Hi all,
>
> Im having a slightly weird problem with my session variables. when on
a
> certain page call it "A", I register a session variable and assign it
a
> value. I then test if it is registered successfully and has the
correct
> value on the same page, that works no problem. After that page "A"
> redirects to page "B":
>
> header("Location: ../admin/include/B.php");
>
> After this I do the exact same test on page "B" to test for
successful
> registration and value and I get that the session variable is not
> registered. on page "B" I do have session_start(); at the top. I even
do
> 2 tests to on the session variable:
>
> if (session_is_registered("myvar"))
>
> and
>
> if (isset($_SESSION["myvar"]))
>
> and they both tell me that the session variable is not registered.
what
> could be causing the sesssion variable not to be remembered from page
to
> page. I am using register_globals=on;
>
> any ideas/comments?
> Thanks
> Angelo
> --------------------------------------------------------------------
> Disclaimer
> This e-mail transmission contains confidential information,
> which is the property of the sender.
> The information in this e-mail or attachments thereto is
> intended for the attention and use only of the addressee.
> Should you have received this e-mail in error, please delete
> and destroy it and any attachments thereto immediately.
> Under no circumstances will the Cape Technikon or the sender
> of this e-mail be liable to any party for any direct, indirect,
> special or other consequential damages for any use of this e-mail.
> For the detailed e-mail disclaimer please refer to
> http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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

--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Technikon or the sender
of this e-mail be liable to any party for any direct, indirect,
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

attached mail follows:


On 10 August 2004 13:19, Ron Stiemer wrote:

> Hi there,
>
> Try to add the session_id(); into the redirection:
>
> header("Location: ../admin/include/B.php?PHPSESSID=" . session_id() );

No, no, no! Use the SID constant -- that's what it's for. It only has a value if you need one, so:

  header("Location: ../admin/include/B.php?".SID);

will redirect to include ../admin/include/B.php?PHPSESSID=whatever or ../admin/include/B.php? as appropriate to the particular circumstances of the current invocation of the script.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.fordleedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


Hello,

I would like to use a variable instead of an image
file name in a html page with this instruction:

<?php
echo '<img src="$myimage">';
?>

I tried but the image doesn't show up. Is it
impossible or do I do something wrong?
My goal is to have a random image print in the page,
that's why I want to use a variable.

Thank you for your good advices.

        

        
                
Vous manquez d’espace pour stocker vos mails ?
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com

attached mail follows:


Try this:

<?php
     $myimage = "http://pear.php.net/gifs/pearsmall.gif";
     echo '<img src="$myimage">';
?>

Probably you are not initializing the $myimage var.
To see if the html generated is ok, you can use your browser "view
source" capability.

Henri marc wrote:
> Hello,
>
> I would like to use a variable instead of an image
> file name in a html page with this instruction:
>
> <?php
> echo '<img src="$myimage">';
> ?>
>
> I tried but the image doesn't show up. Is it
> impossible or do I do something wrong?
> My goal is to have a random image print in the page,
> that's why I want to use a variable.
>
> Thank you for your good advices.
>
>
>
>
>
>
> Vous manquez d’espace pour stocker vos mails ?
> Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
> Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
>
> Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com

attached mail follows:


"Henri marc" <mesmlamoiyahoo.fr> wrote in message
news:20040810114736.98514.qmailweb50104.mail.yahoo.com...
> Hello,
>
> I would like to use a variable instead of an image
> file name in a html page with this instruction:
>
> <?php
> echo '<img src="$myimage">';
> ?>
>
> I tried but the image doesn't show up. Is it
> impossible or do I do something wrong?
> My goal is to have a random image print in the page,
> that's why I want to use a variable.
>
> Thank you for your good advices.

Variables in single-quoted strings are not evaluated. Either user double
quotes or concatination:

echo "<img src=\"$myimage\">"; or
echo '<img src="' . $myimage . '">';

Regards, Torsten Roehr

attached mail follows:


This one time, at band camp, Henri Marc <mesmlamoiyahoo.fr> wrote:

> Hello,
>
> I would like to use a variable instead of an image
> file name in a html page with this instruction:
>
> <?php
> echo '<img src="$myimage">';
> ?>
hmm, something like this may help for random images
<?php

  // just so we know it is broken
  error_reporting(E_ALL);

  // set the images directory
  $imgDir = './photos';

  // open the image dir
  $dir = opendir("$imgDir");

  // read the files in the image dir
  while (false !== ($file = readdir($dir)))
        {
        // make sure only image files are selected
        $t = getimagesize($imgDir.'/'.$file);
        // there are now 16 image types supported
        if ($file != "." && $file != ".." && $t['2'] < 17 && !is_dir($imgDir.'/'.$file))
                {
                // put the file names in an array
                $file_array[] = $file;
                }
        }

  // close the dir
  closedir($dir);

  // make sure there are files in the array :/
  if(!isset($file_array))
        {
        echo 'No image files found';
        }
  else
        {
        // shuffle the array
        shuffle($file_array);

        // pick one off the top
        $randImg = $file_array['0'];

        // get the file info
        $size = getimagesize ($imgDir.'/'.$randImg);

        // open the file for reading
        $fp=fopen($imgDir.'/'.$randImg, "rb");

        // if everything is cool...
        if ($size && $fp)
                {
                // set the headers
                header("Content-type: {$size['mime']}");
                // show the image
                fpassthru($fp);
                // bail out
                exit;
                }
          else
                {
                // show an error
                echo 'Sorry, No images available in '. $imgDir;
                }
        }
?>

--
 ______
(_____ \
 _____) ) ____ ____ ____ ____
| ____/ / _ ) / _ | / ___) / _ )
| | ( (/ / ( ( | |( (___ ( (/ /
|_| \____) \_||_| \____) \____)
Kevin Waterson
Port Macquarie, Australia

attached mail follows:


$myimage = 'hi.gif';
echo "<img src='$myimage'>";

Henri marc wrote:

> Hello,
>
> I would like to use a variable instead of an image
> file name in a html page with this instruction:
>
> <?php
> echo '<img src="$myimage">';
> ?>
>
> I tried but the image doesn't show up. Is it
> impossible or do I do something wrong?
> My goal is to have a random image print in the page,
> that's why I want to use a variable.
>
> Thank you for your good advices.
>
>
>
>
>
>
> Vous manquez d’espace pour stocker vos mails ?
> Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
> Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
>
> Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com

attached mail follows:


Hello,

> Variables in single-quoted strings are not
> evaluated. Either user double
> quotes or concatination:
Thank you very much all for your help, specially Kevin
Waterson for his complete program.
It was simple, I always make some mistakes with those
quotes :-(

Another problem still related to those images.

I have done that just as a test. Its' very simple but
I really don't know why, the result is always the same
picture.

<?php
$random=MT_RAND(1,2);
echo "$random<br>";
if ($random=1) {
$image='pic.gif';
}
if ($random=2) {
$image='pic2.gif';
}
echo $image;
echo "<img src='$image'>";
?>

Before I used 'if... else' but it wasn't working so I
made a test with a second 'if'.
I print the result of the variable to be sure that the
number is really different, but anyway the picture is
always the same.

Why, why, why?

        

        
                
Vous manquez d’espace pour stocker vos mails ?
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com

attached mail follows:


On 10 August 2004 15:55, Henri Marc wrote:

> Hello,
>
> > Variables in single-quoted strings are not
> > evaluated. Either user double
> > quotes or concatination:
> Thank you very much all for your help, specially Kevin
> Waterson for his complete program.
> It was simple, I always make some mistakes with those
> quotes :-(
>
> Another problem still related to those images.
>
> I have done that just as a test. Its' very simple but
> I really don't know why, the result is always the same picture.
>
> <?php
> $random=MT_RAND(1,2);
> echo "$random<br>";
> if ($random=1) {

You mean == (comparison) not = (assignment).

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.fordleedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


On Tuesday 10 August 2004 22:54, Henri Marc wrote:

> > Variables in single-quoted strings are not
> > evaluated. Either user double
> > quotes or concatination:
>
> Thank you very much all for your help, specially Kevin
> Waterson for his complete program.
> It was simple, I always make some mistakes with those
> quotes :-(

That's why view (HTML) source should be part of your debugging procedure.

> Another problem still related to those images.

You should always start a new thread when asking about something different.

> I have done that just as a test. Its' very simple but
> I really don't know why, the result is always the same
> picture.
>
> <?php
> $random=MT_RAND(1,2);
> echo "$random<br>";
> if ($random=1) {

Because you're assigning the value 1 to the variable $random.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Small change can often be found under seat cushions.
                -- One of Lazarus Long's most penetrating insights
*/

attached mail follows:


Ave,

I'm working to create a sophisticated PHP Calendar/Planner application for
my company's web server. I was wondering if there is a nice powerful
calendar/planner application out there which could help me in guidance
towards building my project. What I'm looking for is something sophisticated
with features of users/groups, private/public calendars etcetera.

I'd really appreciate if someone can point to an existing application which
I can get.

Thanks,
Ave.

attached mail follows:


Hello..

Sorry if this is a repost, I didn't see it come through the lists the
first time..

I am wondering if someone could point me in the general direction of
some examples which show how to query an LDAP group for user
membership? I am trying to identify if a user is a member of an LDAP group.

Thanks,
Sam

attached mail follows:


Hello..

I am wondering if someone could point me in the general direction of
some examples which show how to query an LDAP group for user
membership?

Thanks,
Sam

attached mail follows:


On Tue, 10 Aug 2004 11:26:07 -0600 (MDT), Sam Evans <samneuroflux.com> wrote:
>
> Hello..
>
> I am wondering if someone could point me in the general direction of
> some examples which show how to query an LDAP group for user
> membership?

Use Softerra LDAP browser to look at the groups and figure out the
path you need to access them, then use PHP's LDAP functions to query.
http://www.ldapadministrator.com/download/index.php

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

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


If I define a constant within a function, it appears that the constant
is only defined within the namespace of the function. Fair enough.

Can I globalise these definitions?

---
Justin French
http://indent.com.au

attached mail follows:


[snip]
If I define a constant within a function, it appears that the constant
is only defined within the namespace of the function. Fair enough.

Can I globalise these definitions?
[/snip]

They should be global already...

http://us3.php.net/manual/en/language.constants.php

"Like superglobals, the scope of a constant is global. You can access
constants anywhere in your script without regard to scope. For more
information on scope, read the manual section on variable scope."

attached mail follows:


On 11/08/2004, at 12:16 AM, Jay Blanchard wrote:

> They should be global already...
>
> http://us3.php.net/manual/en/language.constants.php
>
> "Like superglobals, the scope of a constant is global. You can access
> constants anywhere in your script without regard to scope. For more
> information on scope, read the manual section on variable scope."

Ok, just figured out the problem:

<?
function test() { define('PET_NAME','Fluffy'); }
define('PET_TYPE','Cat');
echo PET_NAME." is a ".PET_TYPE; // fails
?>

I didn't activate test() :)

<?
function test() { define('PET_NAME','Fluffy'); }
test();
define('PET_TYPE','Cat');
echo PET_NAME." is a ".PET_TYPE; // works
?>

---
Justin French
http://indent.com.au

attached mail follows:


Hardik Doshi <php_hardikyahoo.com> writes:

> I strongly recommend Horde web mail. We are currently
> using it in our institute and it scales better.

Better than what? Squirrelmail?

Can you give us some numbers, like how many simultaneous
Horde/Squirrelmail users you can run on some number of specific server
boxes? Are the boxes doing anything else, perhaps running the IMAP
daemon that Horde/SquirrelMail talk to?

Thanks.

attached mail follows:


Chris Shenton wrote:

>Hardik Doshi <php_hardikyahoo.com> writes:
>
>
>
>>I strongly recommend Horde web mail. We are currently
>>using it in our institute and it scales better.
>>
>>
>
>Better than what? Squirrelmail?
>
>Can you give us some numbers, like how many simultaneous
>Horde/Squirrelmail users you can run on some number of specific server
>boxes? Are the boxes doing anything else, perhaps running the IMAP
>daemon that Horde/SquirrelMail talk to?
>
>
What has squirrelmail/horde scalability got to do with PHP?

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


From: "raditha dissanayake" <jabberraditha.com>

> What has squirrelmail/horde scalability got to do with PHP?

Is this the mantra of the PHP list, now? Come on... those are both programs
written in PHP and discussing how better one is over the other is perfectly
good traffic for this list. I'd be very interesting in seeing cold hard
numbers as for which one scales better.

attached mail follows:


> Hardik Doshi <php_hardikyahoo.com> writes:
>
>> I strongly recommend Horde web mail. We are currently
>> using it in our institute and it scales better.
>
> Better than what? Squirrelmail?
>
> Can you give us some numbers, like how many simultaneous
> Horde/Squirrelmail users you can run on some number of specific server
> boxes? Are the boxes doing anything else, perhaps running the IMAP
> daemon that Horde/SquirrelMail talk to?

Uh, well...Squirrelmail is simply a webpage. The number of simultaneous
users is defined by the web server application, aka Apache. IMAP doesn't
HAVE to be on the same box. You can use SM to connect to an another server
running your mail.

A webpage that scales better doesn't really make much sense. It's the web
server app that determines how a web site scales. It just depends on how
you configure your web server app and that the web server has plenty of
resources to handle your requests.

--
--Matthew Sims
--<http://killermookie.org>

attached mail follows:


John W. Holmes wrote:

>From: "raditha dissanayake" <jabberraditha.com>
>
>
>
>>What has squirrelmail/horde scalability got to do with PHP?
>>
>>
>
>Is this the mantra of the PHP list, now? Come on... those are both programs
>written in PHP and discussing how better one is over the other is perfectly
>good traffic for this list. I'd be very interesting in seeing cold hard
>numbers as for which one scales better.
>
>
John, though I respect your opinion on most matters I have to disagree
on this. Just becaue something is written in PHP does not mean it's
scalability is an issue for the PHP list.

This whole month we have been having nothing but mysql questions, smtp
problems and questions along the lines of which IDE is better than the
other. Now it's which mail system is better than the other.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


MIT is using the Horde web mail and so many other
organizations are using the Horde web mail. I can't
give you the numbers because i am not the one who is
administrating this. We are a university and we have
thousands of students so might imagine how better it
scales. I personally dig into the Horde code base and
it seems good and i am following them since last 5
years.

Any SquirrelMail users?

Let me know if you need any help with Horde so i can
forward you to person who is actually managing it.

Thanks,
Hardik
--- Chris Shenton <Chris.Shentonhq.nasa.gov> wrote:

> Hardik Doshi <php_hardikyahoo.com> writes:
>
> > I strongly recommend Horde web mail. We are
> currently
> > using it in our institute and it scales better.
>
> Better than what? Squirrelmail?
>
> Can you give us some numbers, like how many
> simultaneous
> Horde/Squirrelmail users you can run on some number
> of specific server
> boxes? Are the boxes doing anything else, perhaps
> running the IMAP
> daemon that Horde/SquirrelMail talk to?
>
> Thanks.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

                
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

attached mail follows:


Hi Everyone,

 

            I'm trying to build a class to handle various SQL functions.
One of them is to take a query, and return all rows. Here's what I have so
far:

 

function selectRows( $sql )

{

            $count = 0;

 

            $results = mysql_query( $sql, DB::connect() );

            $data = mysql_fetch_array( $results );

 

            return $data;

}

 

            Right now it only returns 1 row. I'm guessing this is how it
should be, considering I haven't looped thru any other rows.

 

            What I want to do is return something that holds all the rows,
however, I cannot see a decent way of doing this. I've played with putting
it into a new array, but I can't decide if that's the best way to do it.

 

            Wondering if I could get some opinions on how you all would
handle this?

 

-Dan Joseph

attached mail follows:


[snip]
I'm trying to build a class to handle various SQL functions. One of them
is to take a query, and return all rows. Here's what I have so far:

function selectRows( $sql )
{
            $count = 0;
            $results = mysql_query( $sql, DB::connect() );
            $data = mysql_fetch_array( $results );
            return $data;
}

Right now it only returns 1 row. I'm guessing this is how it should be,
considering I haven't looped thru any other rows.

What I want to do is return something that holds all the rows, however,
I cannot see a decent way of doing this. I've played with putting it
into a new array, but I can't decide if that's the best way to do it.
[/snip]

In order to get all of the data back you are going to have to loop
through it and return the array so that it will be available for
manipulation.

attached mail follows:


Hi,

> In order to get all of the data back you are going to have to loop
> through it and return the array so that it will be available for
> manipulation.

        Hmm.. I suspected this might be the case. I have modified my
functiona bit:

                function selectRows( $sql )
                {
                        $count = 0;

                        $results = mysql_query( $sql, DB::connect() );
                        
                        while ( $data = mysql_fetch_array( $results ) )
                        {
                                foreach ( $data as $name => $value )
                                {
                                        $array[$count][$name] = $value;
                                }

                                $count++;
                        }
                        
                        return $array;
                }

Then I am doing a foreach on the returned $array:

        foreach ( $jack as $data )
        {
                echo $data['id'];
        }

Seems to work ok. Thanks for the information.

-Dan Joseph

attached mail follows:


From: "Dan Joseph" <djosephnocheck.com>
> > In order to get all of the data back you are going to have to loop
> > through it and return the array so that it will be available for
> > manipulation.
>
> Hmm.. I suspected this might be the case. I have modified my
> functiona bit:
>
> function selectRows( $sql )
> {
> $count = 0;
>
> $results = mysql_query( $sql, DB::connect() );
>
> while ( $data = mysql_fetch_array( $results ) )
> {
> foreach ( $data as $name => $value )
> {
> $array[$count][$name] = $value;
> }
>
> $count++;
> }
>
> return $array;
> }

Change that to:

$array = array();
$results = mysql_query( $sql, DB::connect() );
while($data = mysql_fetch_array($result))
{ $array[] = $data; }

return $array;

No need to loop through $data.

---John Holmes...

attached mail follows:


Hi,

> $array = array();
> $results = mysql_query( $sql, DB::connect() );
> while($data = mysql_fetch_array($result))
> { $array[] = $data; }
>
> return $array;
>
> No need to loop through $data.

        Ahh, thanks for that tip. That's much cleaner.

-Dan Joseph

attached mail follows:


John W. Holmes wrote:
>
> Change that to:
>
> $array = array();
> $results = mysql_query( $sql, DB::connect() );
> while($data = mysql_fetch_array($result))
> { $array[] = $data; }
>
> return $array;

Would there be any speed/performance issuse with using something like...

array_push ( $array, $data );

vs.

$array[] = $data;

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Hi,

> Would there be any speed/performance issuse with using something like...
>
> array_push ( $array, $data );
>
> vs.
>
> $array[] = $data;

        They seem to react the same in my test script.

-Dan Joseph

attached mail follows:


On Tue, 2004-08-10 at 08:33, John Nichel wrote:
> John W. Holmes wrote:
> >
> > Change that to:
> >
> > $array = array();
> > $results = mysql_query( $sql, DB::connect() );
> > while($data = mysql_fetch_array($result))
> > { $array[] = $data; }
> >
> > return $array;
>
> Would there be any speed/performance issuse with using something like...
>
> array_push ( $array, $data );
>
> vs.
>
> $array[] = $data;

Run some tests and let us know. ;-)
I'd be interested in knowing as well.

-Robby

--
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | robbyplanetargon.com
* 503.351.4730 | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/

attached mail follows:


Robby Russell wrote:
> Run some tests and let us know. ;-)
> I'd be interested in knowing as well.

Not really worth worrying about according to this...

array_push() averaged 0.20226655006409 seconds when running the test 10
times
array[] averaged 0.20317406654358 seconds when running the test 10 times

test script :

<?php

$push = array();
$brackets = array();

function getmicrotime() {
        list( $usec, $sec ) = explode( " ", microtime() );
        return ( ( float ) $usec + ( float ) $sec );
}

function testArrayStuff() {
        global $push, $brackets;
        $start = getmicrotime();
        $array = array();
        for ( $i = 0; $i < 100000; $i++ ) {
                array_push ( $array, $i );
        }
        $stop = getmicrotime();
        $duration = $stop - $start;
        array_push ( $push, $duration );

        $start = getmicrotime();
        $array = array();
        for ( $i = 0; $i < 100000; $i++ ) {
                $array[] = $i;
        }
        $stop = getmicrotime();
        $duration = $stop - $start;
        array_push ( $brackets, $duration );
}

for ( $i = 0; $i < 10; $i++ ) {
        testArrayStuff();
}

$push_size = sizeof ( $push );
$push_total = 0;
for ( $i = 0; $i < $push_size; $i++ ) {
        $push_total += $push[$i];
}

$bracket_size = sizeof ( $brackets );
$bracket_total = 0;
for ( $i = 0; $i < $bracket_size; $i++ ) {
        $bracket_total += $brackets[$i];
}

$push_average = $push_total / $push_size;
$bracket_average = $bracket_total / $bracket_size;

echo ( "array_push() averaged " . $push_average . " seconds when running
the test " . $push_size . " times<br>\n" );
echo ( "array[] averaged " . $bracket_average . " seconds when running
the test " . $bracket_size . " times<br>\n" );

?>

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


John Nichel wrote:

> John W. Holmes wrote:
>
>>
>> Change that to:
>>
>> $array = array();
>> $results = mysql_query( $sql, DB::connect() );
>> while($data = mysql_fetch_array($result))
>> { $array[] = $data; }
>>
>> return $array;
>
>
> Would there be any speed/performance issuse with using something like...
>
> array_push ( $array, $data );
>
> vs.
>
> $array[] = $data;

I'd say the main performance hit with this approach is that we need to
(indirectly) iterate over the resultset twice. First we go into a loop
to do the actual retrieval and chuck in into the array. Then we usually
need to go into another loop to see what we have in the array.

As you mentioned in your follow up mail the difference between
array_push() and $array[]=.. is neglible similarly in most cases,
looping twice will not have a significant impact - unless of course you
are looping through a really large resultset and don't have a lot of
memory to spare.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


On Tue, 10 Aug 2004 10:31:36 -0400, Dan Joseph <djosephnocheck.com> wrote:
> Hi Everyone,
>
> I'm trying to build a class to handle various SQL functions.
> One of them is to take a query, and return all rows. Here's what I have so
> far:
>
> function selectRows( $sql )
>
> {
>
> $count = 0;
>
> $results = mysql_query( $sql, DB::connect() );
>
> $data = mysql_fetch_array( $results );
>
> return $data;
>
> }
>
> Right now it only returns 1 row. I'm guessing this is how it
> should be, considering I haven't looped thru any other rows.
>
> What I want to do is return something that holds all the rows,
> however, I cannot see a decent way of doing this. I've played with putting
> it into a new array, but I can't decide if that's the best way to do it.
>
> Wondering if I could get some opinions on how you all would
> handle this?
>
> -Dan Joseph
>

Of course, this begs the question of why you're re-implementing what
has been done so many times in the past.

http://pear.php.net/package/DB
http://pear.php.net/package/MDB
http://pear.php.net/package/MDB2
http://adodb.sourceforge.net/
http://www.phpclasses.org/browse/package/20.html

etc....

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


Hi,

 
> Of course, this begs the question of why you're re-implementing what
> has been done so many times in the past.
>
> http://pear.php.net/package/DB
> http://pear.php.net/package/MDB
> http://pear.php.net/package/MDB2
> http://adodb.sourceforge.net/
> http://www.phpclasses.org/browse/package/20.html

        I'm building a class for use with our PHP applications. Packages
like what you've linked me to are nice, but we need a little flexibility
here, so we're writing a few methods of our own.

-Dan Joseph

attached mail follows:


On Tue, 10 Aug 2004 13:37:50 -0400, Dan Joseph <djosephnocheck.com> wrote:
> Hi,
>
>
> > Of course, this begs the question of why you're re-implementing what
> > has been done so many times in the past.
> >
> > http://pear.php.net/package/DB
> > http://pear.php.net/package/MDB
> > http://pear.php.net/package/MDB2
> > http://adodb.sourceforge.net/
> > http://www.phpclasses.org/browse/package/20.html
>
> I'm building a class for use with our PHP applications. Packages
> like what you've linked me to are nice, but we need a little flexibility
> here, so we're writing a few methods of our own.
>

Flexibility?? Those classes are very flexible and have many useful
utility methods. In addition, they all support multiple DB backends (I
would call that flexibility). In addition, since they're all OO, you
can extend them (or their drivers) to create a class specific to your
needs. I fail to see how any of these classes is inflexible.

> -Dan Joseph
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


> > I'm building a class for use with our PHP applications.
> Packages
> > like what you've linked me to are nice, but we need a little flexibility
> > here, so we're writing a few methods of our own.
> >
>
> Flexibility?? Those classes are very flexible and have many useful
> utility methods. In addition, they all support multiple DB backends (I
> would call that flexibility). In addition, since they're all OO, you
> can extend them (or their drivers) to create a class specific to your
> needs. I fail to see how any of these classes is inflexible.

        Sorry, in flexibility I mean I don't have to rely on installing any
of these libraries. Something I have no option to do without going thru a
lot of red tape. Its just not worth the hassle, and this method works ok
for what we need. Its not a complex set of anything. Its just a couple
simple methods.

-Dan Joseph

attached mail follows:


From: "Dan Joseph" <djosephnocheck.com>
> > Of course, this begs the question of why you're re-implementing what
> > has been done so many times in the past.
> >
> > http://pear.php.net/package/DB
> > http://pear.php.net/package/MDB
> > http://pear.php.net/package/MDB2
> > http://adodb.sourceforge.net/
> > http://www.phpclasses.org/browse/package/20.html
>
> I'm building a class for use with our PHP applications. Packages
> like what you've linked me to are nice, but we need a little flexibility
> here, so we're writing a few methods of our own.

So have your class extend one of these and only rewrite what they do not
implement. That's one of the big ideas behind OO programming.

The procedure your original question was about is already implemented in
ADOdb, for example:

http://phplens.com/lens/adodb/docs-adodb.htm#getall

---John Holmes...

attached mail follows:


> > > http://pear.php.net/package/DB
> > > http://pear.php.net/package/MDB
> > > http://pear.php.net/package/MDB2
> > > http://adodb.sourceforge.net/
> > > http://www.phpclasses.org/browse/package/20.html
> >
> > I'm building a class for use with our PHP applications.
> Packages
> > like what you've linked me to are nice, but we need a little flexibility
> > here, so we're writing a few methods of our own.
> >
>
> Flexibility?? Those classes are very flexible and have many useful
> utility methods. In addition, they all support multiple DB backends (I
> would call that flexibility). In addition, since they're all OO, you
> can extend them (or their drivers) to create a class specific to your
> needs. I fail to see how any of these classes is inflexible.

Hey, while you guys are talking about those DB classes, I've always opted to
not use them because of associated overhead costs in cpu load, processing
time, memory requirements, etc.. In other words, pages don't display as
quickly when you add all of that overhead. Maybe things have changed
though. Does anyone have opinions or specs on how much overhead the
libraries add?

-Ed

attached mail follows:


At 10:26 AM -0700 8/10/04, Justin Patrin wrote:
>Of course, this begs the question of why you're re-implementing what
>has been done so many times in the past.
At 11:56 AM -0700 8/10/04, Ed Lazor wrote:
>Hey, while you guys are talking about those DB classes, I've always opted to
>not use them because of associated overhead costs in cpu load, processing
>time, memory requirements, etc.. In other words, pages don't display as
>quickly when you add all of that overhead. Maybe things have changed
>though. Does anyone have opinions or specs on how much overhead the
>libraries add?
>
>-Ed

As you mention, one reason for writing one's own is to cut out much
of the overhead (lots of extra code to load per page) imposed by
those abstraction classes. If you want to compare how they perform:

http://phplens.com/lens/adodb/

ADO DB has been moving some of the functions into a C extension but
of course that takes more setup time to compile the extension and
modify php.ini. Having those functions in an extension means that the
code is available without having to load and parse for each script.

Here is an option you did not mention, EZSQL:

http://www.jvmultimedia.com/home/articles.php?articleId=2

One thing you could do is to download the class and extract just the
functions you need.

--
Michael
__
||| Michael Collins
||| Kuwago Inc
||| Singapore and Seattle USA

attached mail follows:


Hello,
First of all, I should apologize for my bad English,
and I hope somebody will understand what I was trying to say..

So, the problem is, that I can't SORT or REVERSE the array.
By the way, sorry for this awful and very long php script.
And I know that many of you guys can make it look short, but please, if
you can repair the main problem,
try to leave this "long" script close to it's natural look. At least so that
I can understand the connection between my part of the script, and yours.
Thank you very mych!

<?php
if ($handle = opendir('news')) {
   while (false !== ($topic = readdir($handle))) {
       if ($topic != "." && $topic != "..") {

   $topic_b = array($topic); // the problem starts here.
   rsort($topic_b);
   //array_reverse($topic_b);

   foreach($topic_b as $topic_c){
   $date = $topic_c;
   }
   print($date);

}
}
   closedir($handle);
}
?>

This way, this will print:
2004.08.11
2004.08.31
2004.11.07

But I want to reverse this array, so that it would print:
2004.11.07
2004.08.31
2004.08.11

BTW, I thought that $topic is an array, but when I was tryng to reverse
$topic,
the browser said: "Warning: array_reverse(): The argument should be an
array".

Thank you once more,
Lab.

attached mail follows:


On 10 August 2004 15:36, Labunski wrote:

> Hello,
> First of all, I should apologize for my bad English,
> and I hope somebody will understand what I was trying to say..
>
>
> <?php
> if ($handle = opendir('news')) {
> while (false !== ($topic = readdir($handle))) {
> if ($topic != "." && $topic != "..") {
>
> $topic_b = array($topic); // the problem starts here.
> rsort($topic_b); //array_reverse($topic_b);
>
> foreach($topic_b as $topic_c){
> $date = $topic_c;
> }
> print($date);
>
> }
> }
> closedir($handle);
> }
> >
>
> This way, this will print:
> 2004.08.11
> 2004.08.31
> 2004.11.07
>
> But I want to reverse this array, so that it would print: 2004.11.07
> 2004.08.31
> 2004.08.11
>
> BTW, I thought that $topic is an array

Why? You've done nothing to make it an array -- the only thing you ever assign to it is a single (string) filename.

Try this (untested!):

<?php
  if ($handle = opendir('news')) {
    while (false !== ($topic = readdir($handle))) {
      if ($topic != "." && $topic != "..") {
        $topic_a[] = $topic;
      }
    }
    if (rsort($topic_a, SORT_STRING) {
      foreach($topic_a as $topic_c){
        print($topic_c);
      }
    }
    closedir($handle);
  }
?>
 
Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.fordleedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


I am trying to get a hosting provider(Godaddy.com) to enable the ftp_connect
extensions to php. They tell me that they cannot do so for security reasons.
Is this really such a security issue?

At php.net I read the advice:

"for ftp to work you must do ./configure --enable-ftp in php4"

...and from phpcollab.com:

"You should ask your hosting provider to install those for you, probably
they will do without much problem. Or, if they don't want to, you should
consider choosing another provider."

If it is an issue, does anyone know of a hosting provider that allows these
extensions?

-Brian Anderson

attached mail follows:


[snip]
If it is an issue, does anyone know of a hosting provider that allows
these extensions?
[/snip]

http://www.phpwebhosting.com/

attached mail follows:


Brian Anderson wrote:
> I am trying to get a hosting provider(Godaddy.com) to enable the ftp_connect
> extensions to php. They tell me that they cannot do so for security reasons.
> Is this really such a security issue?
>
> At php.net I read the advice:
>
> "for ftp to work you must do ./configure --enable-ftp in php4"
>
> ...and from phpcollab.com:
>
> "You should ask your hosting provider to install those for you, probably
> they will do without much problem. Or, if they don't want to, you should
> consider choosing another provider."
>
> If it is an issue, does anyone know of a hosting provider that allows these
> extensions?

JTL does...

http://www.jtlnet.com/

Their php info page....

http://www.jtlnet.com/phpinfo.php

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Thanks, both John and Jay. I will take a look at both those sites.

Regards,

-Brian Anderson

From: "John Nichel" <johnkegworks.com>
To: <php-generallists.php.net>
Sent: Tuesday, August 10, 2004 9:50 AM
Subject: Re: [PHP] hosting provider won't enable ftp_connect()

> Brian Anderson wrote:
> > I am trying to get a hosting provider(Godaddy.com) to enable the
ftp_connect
> > extensions to php. They tell me that they cannot do so for security
reasons.
> > Is this really such a security issue?
> >
> > At php.net I read the advice:
> >
> > "for ftp to work you must do ./configure --enable-ftp in php4"
> >
> > ...and from phpcollab.com:
> >
> > "You should ask your hosting provider to install those for you, probably
> > they will do without much problem. Or, if they don't want to, you should
> > consider choosing another provider."
> >
> > If it is an issue, does anyone know of a hosting provider that allows
these
> > extensions?
>
> JTL does...
>
> http://www.jtlnet.com/
>
> Their php info page....
>
> http://www.jtlnet.com/phpinfo.php
>
> --
> John C. Nichel
> ÜberGeek
> KegWorks.com
> 716.856.9675
> johnkegworks.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


http://www.planetargon.com/hosting/

;-)

On Tue, 2004-08-10 at 07:41, Brian Anderson wrote:
> I am trying to get a hosting provider(Godaddy.com) to enable the ftp_connect
> extensions to php. They tell me that they cannot do so for security reasons.
> Is this really such a security issue?
>
> At php.net I read the advice:
>
> "for ftp to work you must do ./configure --enable-ftp in php4"
>
> ...and from phpcollab.com:
>
> "You should ask your hosting provider to install those for you, probably
> they will do without much problem. Or, if they don't want to, you should
> consider choosing another provider."
>
> If it is an issue, does anyone know of a hosting provider that allows these
> extensions?
>
> -Brian Anderson
--
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | robbyplanetargon.com
* 503.351.4730 | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/

attached mail follows:


We should be able to do that for you -- we're "developer-friendly" 8^)

Check out our hosting plans at
http://systame.com/html/web_hosting_plans.html.

> I am trying to get a hosting provider(Godaddy.com) to enable the ftp_connect
> extensions to php. They tell me that they cannot do so for security reasons.
> Is this really such a security issue?
>
> At php.net I read the advice:
>
> "for ftp to work you must do ./configure --enable-ftp in php4"
>
> ...and from phpcollab.com:
>
> "You should ask your hosting provider to install those for you, probably
> they will do without much problem. Or, if they don't want to, you should
> consider choosing another provider."
>
> If it is an issue, does anyone know of a hosting provider that allows these
> extensions?
>
> -Brian Anderson

--
Randall Perry
sysTame

Xserve Web Hosting/Co-location
Website Design/Development
WebObjects Hosting
Mac Consulting/Sales

http://www.systame.com/

> I am trying to get a hosting provider(Godaddy.com) to enable the ftp_connect
> extensions to php. They tell me that they cannot do so for security reasons.
> Is this really such a security issue?
>
> At php.net I read the advice:
>
> "for ftp to work you must do ./configure --enable-ftp in php4"
>
> ...and from phpcollab.com:
>
> "You should ask your hosting provider to install those for you, probably
> they will do without much problem. Or, if they don't want to, you should
> consider choosing another provider."
>
> If it is an issue, does anyone know of a hosting provider that allows these
> extensions?
>
> -Brian Anderson

--
Randall Perry
sysTame

Xserve Web Hosting/Co-location
Website Design/Development
WebObjects Hosting
Mac Consulting/Sales

http://www.systame.com/

attached mail follows:


Hey all,

Thanks all for the good reference links. I will see what they offer. Bummed
if I have to switch hosts, because I have been happy with Godaddy in
general.
:)

-Brian

attached mail follows:


try "the best" hosting company: www.pair.com
their prices are not low but they are definitely professionals.

afan

At 10:47 AM 8/10/2004, Randall Perry wrote:
>We should be able to do that for you -- we're "developer-friendly" 8^)
>
>Check out our hosting plans at
>http://systame.com/html/web_hosting_plans.html.
>
>
> > I am trying to get a hosting provider(Godaddy.com) to enable the
> ftp_connect
> > extensions to php. They tell me that they cannot do so for security
> reasons.
> > Is this really such a security issue?
> >
> > At php.net I read the advice:
> >
> > "for ftp to work you must do ./configure --enable-ftp in php4"
> >
> > ...and from phpcollab.com:
> >
> > "You should ask your hosting provider to install those for you, probably
> > they will do without much problem. Or, if they don't want to, you should
> > consider choosing another provider."
> >
> > If it is an issue, does anyone know of a hosting provider that allows these
> > extensions?
> >
> > -Brian Anderson
>
>--
>Randall Perry
>sysTame
>
>Xserve Web Hosting/Co-location
>Website Design/Development
>WebObjects Hosting
>Mac Consulting/Sales
>
>http://www.systame.com/
>
>
>
> > I am trying to get a hosting provider(Godaddy.com) to enable the
> ftp_connect
> > extensions to php. They tell me that they cannot do so for security
> reasons.
> > Is this really such a security issue?
> >
> > At php.net I read the advice:
> >
> > "for ftp to work you must do ./configure --enable-ftp in php4"
> >
> > ...and from phpcollab.com:
> >
> > "You should ask your hosting provider to install those for you, probably
> > they will do without much problem. Or, if they don't want to, you should
> > consider choosing another provider."
> >
> > If it is an issue, does anyone know of a hosting provider that allows these
> > extensions?
> >
> > -Brian Anderson
>
>--
>Randall Perry
>sysTame
>
>Xserve Web Hosting/Co-location
>Website Design/Development
>WebObjects Hosting
>Mac Consulting/Sales
>
>http://www.systame.com/
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


On Tue, 10 Aug 2004 09:41:45 -0500, Brian Anderson
<listreadarielpremium.com> wrote:
> I am trying to get a hosting provider(Godaddy.com) to enable the ftp_connect
> extensions to php. They tell me that they cannot do so for security reasons.
> Is this really such a security issue?
>

I don't see how it would be a security problem. They probably just
don't understand and think you want FTP access to the server. Allowing
outbound FTP is only an issue if people sniff the network because they
can see your login in plaintext.

I thought there were PEAR packages which implemented the FTP protocol,
but it looks like they use the FTP functions in PHP. You can try to
find a PHP class which actually implements the FTP protocol (with
sockets). You may be able to find one. If not, you'll have to switch.

> At php.net I read the advice:
>
> "for ftp to work you must do ./configure --enable-ftp in php4"
>
> ....and from phpcollab.com:
>
> "You should ask your hosting provider to install those for you, probably
> they will do without much problem. Or, if they don't want to, you should
> consider choosing another provider."
>
> If it is an issue, does anyone know of a hosting provider that allows these
> extensions?
>
> -Brian Anderson
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


On Wednesday 11 August 2004 00:48, Justin Patrin wrote:

> I don't see how it would be a security problem. They probably just
> don't understand and think you want FTP access to the server.

Huh? Isn't FTP the usual mechanism for accessing your shared hosting space?

> Allowing
> outbound FTP is only an issue if people sniff the network because they
> can see your login in plaintext.

Actually any plain old ftp is subject sniffing. A better solution is to use
chrooted ssh accounts. There are enough clients out there which supports file
transfers over ssh to make this practical.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
He who attacks the fundamentals of the American broadcasting industry
attacks democracy itself.
                -- William S. Paley, chairman of CBS
*/

attached mail follows:


On Wed, 11 Aug 2004 01:12:40 +0800, Jason Wong <php-generalgremlins.biz> wrote:
> On Wednesday 11 August 2004 00:48, Justin Patrin wrote:
>
> > I don't see how it would be a security problem. They probably just
> > don't understand and think you want FTP access to the server.
>
> Huh? Isn't FTP the usual mechanism for accessing your shared hosting space?
>

It may be. It shouldn't be, though. SFTP at the very least. Getting
someone's FTP login is pretty easy compared to something secure.

> > Allowing
> > outbound FTP is only an issue if people sniff the network because they
> > can see your login in plaintext.
>
> Actually any plain old ftp is subject sniffing. A better solution is to use
> chrooted ssh accounts. There are enough clients out there which supports file
> transfers over ssh to make this practical.

I realize that any FTP can be sniffed. I was speaking to his host not
wanting to allow the FTP command on the server, which would mean
outgoing FTP requests.

Yes, it should all be SSL based.

>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> He who attacks the fundamentals of the American broadcasting industry
> attacks democracy itself.
> -- William S. Paley, chairman of CBS
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> !DSPAM:411906b964891092692678!
>
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


Hello all,

Many of us need help solving more or less complicated issues.
And what do you do? You post a message and wait for an answer to come up.
Now some people post replies to your message giving their oppinion.
Maybe this will help you, maybe not. You wait for more. Keep asking these
people who answered you, but many times you feel like your question is not
understood
and nobody is willing to spend some time to understand you.

I think this situation is very normal.
What I am trying to do is to determine the need of a paid support system
I wish to implement. For small amounts people can get help very fast.
Speaking for myself, I would rather pay some money to get help when I need
than wait for an answer that might never come up.

Please take a minute to vote.

Do you think such a paid support system is needed?

YES - http://81.196.199.2:8080/vote.php?option=yes

NO - http://81.196.199.2:8080/vote.php?option=no

attached mail follows:


[snip]
What I am trying to do is to determine the need of a paid support system
I wish to implement. For small amounts people can get help very fast.
[/snip]

The primary flaw in a system like this is that you will have to have a
lot of resources to draw from. Where do those resources come from? Do
you try to get people from lists such as these? Do you prevent those
folks from offering free advice on lists? What do you pay them? How
quickly do you guarantee a (useful) response? Just curious.

attached mail follows:


PHPDevX wrote:
> Do you think such a paid support system is needed?

Needed? No.

Can you pay me to answer questions? Hell yeah.

Will anyone pay me to answer questions? Hell no.

Didn't see the option to vote that way....

--

John Holmes

php|architect - The magazine for PHP professionals - http://www.phparch.com

attached mail follows:


* Thus wrote Jay Blanchard:
> [snip]
> What I am trying to do is to determine the need of a paid support system
> I wish to implement. For small amounts people can get help very fast.
> [/snip]
>
> The primary flaw in a system like this is that you will have to have a
> lot of resources to draw from. Where do those resources come from? Do
> you try to get people from lists such as these? Do you prevent those
> folks from offering free advice on lists? What do you pay them? How
> quickly do you guarantee a (useful) response? Just curious.

answers.google.com might be a viable model.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


John Holmes wrote:
> PHPDevX wrote:
>
>> Do you think such a paid support system is needed?
>
>
> Needed? No.
>
> Can you pay me to answer questions? Hell yeah.
>
> Will anyone pay me to answer questions? Hell no.
>
> Didn't see the option to vote that way....
>

Why would anyone pay you when all of your answers are wrong? ;)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


John Nichel wrote:

> Why would anyone pay you when all of your answers are wrong? ;)

Hey! At least I'm consistanly wrong! I'm dependable like that...

--

John Holmes

php|architect - The magazine for PHP professionals - http://www.phparch.com

attached mail follows:


Hi,

Is there a way to have global persistent variable with PHP? I would like
to reproduce the use of the ASP <Application("name")= "value">
possibility. The variable "name" will be available to every users...

Thank-you in advance,

Kind regards.

Jean-Yves

attached mail follows:


[snip]
Is there a way to have global persistent variable with PHP? I would like

to reproduce the use of the ASP <Application("name")= "value">
possibility. The variable "name" will be available to every users...
[/snip]

http://us2.php.net/manual/en/language.variables.scope.php

attached mail follows:


Not like asp's application("") there isnt. You can use phps $_SESSION
var, which is similar to asps Session(). I dont think php runs the
same asp, in order for asp's application vars to work, you would think
that asp must be running in some state continuously, and i dont think
php does that. I should read a little more on that to be sure. But
on first though, answer is nope.

Jason

Jean-Yves Jourdain <contactterreorange.com> wrote:
>
> Hi,
>
> Is there a way to have global persistent variable with PHP? I would like
> to reproduce the use of the ASP <Application("name")= "value">
> possibility. The variable "name" will be available to every users...
>
> Thank-you in advance,
>
> Kind regards.
>
> Jean-Yves
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


On Tue, 2004-08-10 at 08:36, Jean-Yves Jourdain wrote:
> Hi,
>
> Is there a way to have global persistent variable with PHP? I would like
> to reproduce the use of the ASP <Application("name")= "value">
> possibility. The variable "name" will be available to every users...
>
> Thank-you in advance,
>
> Kind regards.
>
> Jean-Yves

This is where you would probably want to put that value in the database
somewhere.

-Robby

--
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON | www.planetargon.com
* Portland, OR | robbyplanetargon.com
* 503.351.4730 | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/

attached mail follows:


[snip]
s there a way to have global persistent variable with PHP? I would like
to reproduce the use of the ASP <Application("name")= "value">
possibility. The variable "name" will be available to every users...
[/snip]

One other thing I should have mentioned...neither ASP or PHP is
'persistent', they are both stateless. We introduce pseudo-state through
the use of sessions and/or cookies.

attached mail follows:


Im not so sure asp is completely stateless is it. The application var
will hold a var as long as the server is running, for any visitor. The
var doesnt need to be set each page load either..
eg. Application("counter").. you can add to the counter on any page, by
any visitor, at any time, and it will maintain that var untill your
restart your server. This suggests some sort of state doesnt ot??

Let me know if im wrong.

Jason

"Jay Blanchard" <jay.blanchardniicommunications.com> wrote:
>
> [snip]
> s there a way to have global persistent variable with PHP? I would like
> to reproduce the use of the ASP <Application("name")= "value">
> possibility. The variable "name" will be available to every users...
> [/snip]
>
> One other thing I should have mentioned...neither ASP or PHP is
> 'persistent', they are both stateless. We introduce pseudo-state through
> the use of sessions and/or cookies.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


[snip]
Im not so sure asp is completely stateless is it. The application var
will hold a var as long as the server is running, for any visitor. The
var doesnt need to be set each page load either..
eg. Application("counter").. you can add to the counter on any page, by
any visitor, at any time, and it will maintain that var untill your
restart your server. This suggests some sort of state doesnt ot??
[/snip]

It depends on how you define "state". The ASP book that I have here says
that it is stateless. The value of a variable may be set and "held" for
each user, but there is no persistent connection to the variable. This
action is pretty much like sessions in PHP

attached mail follows:


Hi,

Wednesday, August 11, 2004, 1:36:45 AM, you wrote:
JYJ> Hi,

JYJ> Is there a way to have global persistent variable with PHP? I would like
JYJ> to reproduce the use of the ASP <Application("name")= "value">
JYJ> possibility. The variable "name" will be available to every users...

JYJ> Thank-you in advance,

JYJ> Kind regards.

JYJ> Jean-Yves

you can do this with msession or stick the variable in a database or
file. The best way would depend on exactly what you were trying to
achieve and who sets this value.

--
regards,
Tom

attached mail follows:


Jean-Yves Jourdain wrote:

> Is there a way to have global persistent variable with PHP? I would like
> to reproduce the use of the ASP <Application("name")= "value">
> possibility. The variable "name" will be available to every users...

No. If the values are read-only, you can use an .ini file and
parse_ini_file(). If they are read/write, use a database...

--

John Holmes

php|architect - The magazine for PHP professionals - http://www.phparch.com

attached mail follows:


Im reading up a little on it, from the msdn site, "make your ASP pages
stateless if possible, relying on Session or Application variables for
transient state only" Interesting, but not conculsive. ASP sucks
anyways..
Bottom line, PHP is definately stateless, and there is no Application()
equivilent in php.

Cheers
Jason

"Jay Blanchard" <jay.blanchardniicommunications.com> wrote:
>
> [snip]
> Im not so sure asp is completely stateless is it. The application var
> will hold a var as long as the server is running, for any visitor. The
> var doesnt need to be set each page load either..
> eg. Application("counter").. you can add to the counter on any page, by
> any visitor, at any time, and it will maintain that var untill your
> restart your server. This suggests some sort of state doesnt ot??
> [/snip]
>
> It depends on how you define "state". The ASP book that I have here says
> that it is stateless. The value of a variable may be set and "held" for
> each user, but there is no persistent connection to the variable. This
> action is pretty much like sessions in PHP
>

attached mail follows:


Jason Davidson wrote:

> Im not so sure asp is completely stateless is it. The application var
> will hold a var as long as the server is running, for any visitor. The
> var doesnt need to be set each page load either..
> eg. Application("counter").. you can add to the counter on any page, by
> any visitor, at any time, and it will maintain that var untill your
> restart your server. This suggests some sort of state doesnt ot??

No... that's simply a variable available to any script. Similar to any
$_SERVER value if it's read only or a little different if it's read/write.

"stateless" means you can not tell who made one request from another.
You simulate state by using cookies to tell who is making requests or IP
addresses, sessions, etc, but these are are simulated state because the
state-data is still coming from the client. If I can simulate the exact
same request as you just made for a website (including cookies, IP, etc,
which is possible), then as far as the web server is concerned, the
requests came from the exact same person.

Oh, and <?php echo 'something to do with PHP, just in case
Raditha Dissanayake is reading'; ?>

--

John Holmes

php|architect - The magazine for PHP professionals - http://www.phparch.com

attached mail follows:


Thanks to everybody for the answers. I'll store the data somewhere
(probably in a file).

Kind regards,
Jean-Yves

-----
In article <28357.1092155033zworg.com>,
 jdavidsonzworg.com (Jason Davidson) wrote:

> Im reading up a little on it, from the msdn site, "make your ASP pages
> stateless if possible, relying on Session or Application variables for
> transient state only" Interesting, but not conculsive. ASP sucks
> anyways..
> Bottom line, PHP is definately stateless, and there is no Application()
> equivilent in php.
>
> Cheers
> Jason
>
> "Jay Blanchard" <jay.blanchardniicommunications.com> wrote:
> >
> > [snip]
> > Im not so sure asp is completely stateless is it. The application var
> > will hold a var as long as the server is running, for any visitor. The
> > var doesnt need to be set each page load either..
> > eg. Application("counter").. you can add to the counter on any page, by
> > any visitor, at any time, and it will maintain that var untill your
> > restart your server. This suggests some sort of state doesnt ot??
> > [/snip]
> >
> > It depends on how you define "state". The ASP book that I have here says
> > that it is stateless. The value of a variable may be set and "held" for
> > each user, but there is no persistent connection to the variable. This
> > action is pretty much like sessions in PHP
> >

attached mail follows:


Any MVC pattern gurus out there? I have a quick question on app design
following an MVC pattern (which I'm attempting for the first time).

Let's say I have two controllers, home and news. Both of these
controllers will access the news data, and will need to access a
library of functions that retrieve that news data out of the database,
manipulate it, etc.

My first guess was that a function to retrieve news items and prepare
them for use in the View would be declared in the Controller. However,
since two Controllers want to do the same thing, this doesn't make
sense. (I'm a big fan of DRY too (Don't Repeat Yourself).

So I'm guessing these news related functions need to exist in an
external library shared & accessed by both Controllers, however this
means that each controller isn't truly self-contained.

Or maybe the Model is more than just data, and the functions used to
retrieve and prepare the data for use in the View are part of the
Model??

A few hints to help me better grasp this grey area would be appreciated!

---
Justin French
http://indent.com.au

attached mail follows:


On 11/08/2004, at 2:20 AM, Justin French wrote:

> Any MVC pattern gurus out there? I have a quick question on app
> design following an MVC pattern (which I'm attempting for the first
> time).

Nevermind... some extended googling helped!
http://www.phppatterns.com/index.php/article/articleview/11/

---
Justin French
http://indent.com.au

attached mail follows:


* Justin French <justin.frenchindent.com.au>:
> Any MVC pattern gurus out there? I have a quick question on app design
> following an MVC pattern (which I'm attempting for the first time).
>
> Let's say I have two controllers, home and news. Both of these
> controllers will access the news data, and will need to access a
> library of functions that retrieve that news data out of the database,
> manipulate it, etc.
>
> My first guess was that a function to retrieve news items and prepare
> them for use in the View would be declared in the Controller. However,
> since two Controllers want to do the same thing, this doesn't make
> sense. (I'm a big fan of DRY too (Don't Repeat Yourself).
>
> So I'm guessing these news related functions need to exist in an
> external library shared & accessed by both Controllers, however this
> means that each controller isn't truly self-contained.
>
> Or maybe the Model is more than just data, and the functions used to
> retrieve and prepare the data for use in the View are part of the
> Model??

That's how I tend to think of MVC and use it in practice. Typically, I
develop an API for accessing the data, and this contains all the
business logic -- if data is of this type, insert these extra entries in
this link table, etc. The database plus the business logic make up the
Model, then. My controller scripts then use the APIs for fetching and
manipulating the data, and then pass content to the templates (the
View).

I never think of the controller scripts as self-contained; I think of
them as traffic controllers. They take input from the user, interpret
that into requests to the Model, then take any information returned by
the model and pass it to the view, and then take the content returned by
the view and return it to the user.

--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthewgarden.org | http://vermontbotanical.org

attached mail follows:


Hello,

I want to be sure, that preg_replace replaces all matches. But it
doesn't accept the /g modifier. And anyhow, there's no preg_replace_all
like there is an preg_match_all. Will preg_replace replace everything by
default?

Regards
Marten

attached mail follows:


* Marten Lehmann <lehmanncnm.de>:
> I want to be sure, that preg_replace replaces all matches. But it
> doesn't accept the /g modifier. And anyhow, there's no preg_replace_all
> like there is an preg_match_all. Will preg_replace replace everything by
> default?

Yes. preg_replace is greedy by default.

If you *don't* want it to replace everything, you need to pass a fourth
argument, which tells it the number of replacements to make. See the
docs for preg_replace for more details.

--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthewgarden.org | http://vermontbotanical.org

attached mail follows:


> I want to be sure, that preg_replace replaces all matches. But it
> doesn't accept the /g modifier. And anyhow, there's no preg_replace_all
> like there is an preg_match_all. Will preg_replace replace everything by
> default?

from php.net:

mixed preg_replace ( mixed pattern, mixed replacement, mixed subject
[, int limit])

Searches subject for matches to pattern and replaces them with
replacement. If limit is specified, then only limit matches will be
replaced; if limit is omitted or is -1, then all matches are replaced.

attached mail follows:


On Tue, 10 Aug 2004 18:51:43 +0200, Marten Lehmann <lehmanncnm.de> wrote:
> Hello,
>
> I want to be sure, that preg_replace replaces all matches. But it
> doesn't accept the /g modifier. And anyhow, there's no preg_replace_all
> like there is an preg_match_all. Will preg_replace replace everything by
> default?
>

Everytyhing in the original string that matches it will replace.

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

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


On 10 Aug 2004 16:53:59 -0000, in php.general you wrote:

>Yes. preg_replace is greedy by default.

Err, global, that is (although it's also greedy per default, but then
again, that's also the case for ereg-functions and perl)

"greedy" is the term of whether or not a range of matches should be
expanded to as long as possible, e.g.:
pattern: /<.*>/
string: one <foo> two <bar> three

.. wil match "<foo> two <bar>" and not just "<foo>".

.*? on the other hand (or the U pattern modifier) makes the capture
ungreedy.

... just trying to clear up a common mix-up in terms :)

--
- Peter Brodersen

attached mail follows:


* Peter Brodersen <phpter.dk>:
> On 10 Aug 2004 16:53:59 -0000, in php.general you wrote:
>
> > Yes. preg_replace is greedy by default.
>
> Err, global, that is (although it's also greedy per default, but then
> again, that's also the case for ereg-functions and perl)

Umm, not in perl. Perl will only replace the *first* match, unless the g
switch is passed to the s/// construct (e.g., s/a/b/g will replace all
occurrences of a with b; s/a/b/ will only replace the first). In other
words, perl's substitution operator is not *global* by default; PHP's
preg_replace is, however.

And regexps are only *greedy* when using wildcards for quantifiers, not by
default (e.g., s/a/b/ only replaces a single occurence of a; s/a*/b/
will replace an 0 or more occurences of a followed by anything with b --
aaaab -> bb, as does ab -> bb). In other words, regexps are not *greedy*
by default, either.

> "greedy" is the term of whether or not a range of matches should be
> expanded to as long as possible, e.g.:

Good point; I was a bit hasty in my terminology. I should have said
'*global* by default'.

--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthewgarden.org | http://vermontbotanical.org

attached mail follows:


Peter Brodersen wrote:
> On 10 Aug 2004 16:53:59 -0000, in php.general you wrote:
>
>
>>Yes. preg_replace is greedy by default.
>
>
> Err, global, that is (although it's also greedy per default, but then
> again, that's also the case for ereg-functions and perl)
<snip>

Regular expressions in Perl are not greedy by default. You have to
specify the 'g' for it to be greedy.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


On 10 Aug 2004 18:24:54 -0000, in php.general you wrote:

>> > Yes. preg_replace is greedy by default.
>>
>> Err, global, that is (although it's also greedy per default, but then
>> again, that's also the case for ereg-functions and perl)
>
>Umm, not in perl. Perl will only replace the *first* match, unless the g
>switch is passed to the s/// construct (e.g., s/a/b/g will replace all
>occurrences of a with b; s/a/b/ will only replace the first). In other
>words, perl's substitution operator is not *global* by default; PHP's
>preg_replace is, however.

I can see what I wrote could be misunderstood. I mentioned that it is
greedy per default, which also is the case for ereg_* and perl.

>And regexps are only *greedy* when using wildcards for quantifiers, not by
>default (e.g., s/a/b/ only replaces a single occurence of a; s/a*/b/
>will replace an 0 or more occurences of a followed by anything with b --
>aaaab -> bb, as does ab -> bb). In other words, regexps are not *greedy*
>by default, either.

Err, the *quantifiers* are still greedy per default (which can be
negated), but of course it requires that quantifiers actually are used
:)

So, the "greedy"-terminology simply relates to quantifiers.

--
- Peter Brodersen

attached mail follows:


On Tue, 10 Aug 2004 14:50:26 -0400, in php.general you wrote:

>>>Yes. preg_replace is greedy by default.
>> Err, global, that is (although it's also greedy per default, but then
>> again, that's also the case for ereg-functions and perl)
><snip>
>Regular expressions in Perl are not greedy by default. You have to
>specify the 'g' for it to be greedy.

You might want to read the last part of my post, about the common
mix-up of the meaning of "greedy" and "global" - Q.E.D. :)

1. "greedy" is a term used to specify the behaviour of *quantifiers*
(like {x,y}, +, ?, *)

2. The g-flag does not stand for "greedy", but "global". This
behaviour has nothing to do with quantifiers, and using the g-flag
doesn't change whether or not a quantifier is greedy. The U-flag does
that, though.

3. From perldoc perlre:

       By default, a quantified subpattern is "greedy", that is,
       it will match as many times as possible (given a particu­
       lar starting location) while still allowing the rest of
       the pattern to match. If you want it to match the minimum
       number of times possible, follow the quantifier with a
       "?". Note that the meanings don't change, just the
       "greediness":

There really is a common mix-up between these two words, as you have
just proved :)

(I'm pretty sure that we all agree of the actual behaviour of /g,
though - this is only an issue regarding words)

--
- Peter Brodersen

attached mail follows:


Thank you!!!

Naty

"Justin Patrin" <papercranegmail.com> wrote in message
news:432beae04080916491adca72bmail.gmail.com...
> Please don't send the same message twice.
>
> Response below.
>
> On Mon, 9 Aug 2004 20:32:12 -0300, Naty <natess2khotmail.com> wrote:
> > Hi !!!
> > I'm new with php, I just install php and apache, I test with info.php
and
> > all
> > it's working.
> > Now I'm trying to install a thirds party webapp that seams to have
problems
> > with sessions, I received a warning error like
> >
> > "Warning: Cannot modify header information - headers already sent by
(output
> > started at C:\Program Files\Apache
> > Group\Apache2\htdocs\webappphp\index.php:3) in C:\Program Files\Apache
> > Group\Apache2\htdocs\webappphp\functions.php on line 26
> >
> > Warning: Unknown:
> > open(/C:/php/sessions/\sess_452f0a7e4f766da1ecc65a4eca8d9cb8, O_RDWR)
> > failed: Invalid argument (22) in Unknown on line 0
> >
> > Warning: Unknown: Failed to write session data (files). Please verify
that
> > the current setting of session.save_path is correct
(N;/C:/php/sessions/) in
> > Unknown on line 0"
> >
> > In the php.ini I have
> > session.save_path = "N;/C:/php/sessions/"
>
> Why do you have this in your save_path? this is definately not right. Try:
> session.save_path = "C:/php/sessions/"
>
> Make sure that the user that PHP is running as has full access to that
> directory and restart Apache. Then try again.
>
> >
> > Maybe somebody can help me!
> > Regards
> >
> > Naty
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > !DSPAM:411806e5291851697419290!
> >
> >
>
>
> --
> DB_DataObject_FormBuilder - The database at your fingertips
> http://pear.php.net/package/DB_DataObject_FormBuilder
>
> paperCrane --Justin Patrin--

attached mail follows:


[snip]
> Why would anyone pay you when all of your answers are wrong? ;)

Hey! At least I'm consistanly wrong! I'm dependable like that...
[/snip]

Hey! If John gets paid for being dependably wrong, I want to get paid
for being dependably wrong!

attached mail follows:


I was going to post another follow-up question in a pending thread here but
it seems to have been deleted. Anyway, I am trying to write a download
script that will downloaded files from my site. All these files need to be
protected so just anybody cant come to the site and download them. I have
already created a login environment for this site and just need to make my
file downloads work. Currently they are in a directory protected by
.htaccess.

I was told on the previous thread that I needed to place the files that are
protected by .htaccess ouside of the webroot in order for PHP to have rights
to them. My web root is /home/lgxdlr/mainwebsite_html/ I put the secure
directory called test in /home/lgxdlr/

I am trying to dowload a file using readfile(), but PHP still cant seem to
get to the file. Here is my code:

<?php
$file = "/home/lgxdlr/test/".$_GET['file']."";
if (file_exists(basename($file))) {
  header("Content-Description: File Transfer");
  header("Content-Type: application/force-download");
  header("Content-Disposition: attachment; filename=".basename($file));
  readfile($file);
} else {
  echo "$file<br>";
  echo basename($file);
  echo "<br>No File Found";
}
?>

If anyone can give me a hand with this please post.

Thanks,

Aaron

attached mail follows:


I was going to post another follow-up question in a pending thread here but
it seems to have been deleted. Anyway, I am trying to write a download
script that will downloaded files from my site. All these files need to be
protected so just anybody cant come to the site and download them. I have
already created a login environment for this site and just need to make my
file downloads work. Currently they are in a directory protected by
.htaccess.

I was told on the previous thread that I needed to place the files that are
protected by .htaccess ouside of the webroot in order for PHP to have rights
to them. My web root is /home/dlr/mainwebsite_html/ I put the secure
directory called test in /home/dlr/

I am trying to dowload a file using readfile(), but PHP still cant seem to
get to the file. Here is my code:

<?php
$file = "/home/dlr/test/".$_GET['file']."";
if (file_exists(basename($file))) {
  header("Content-Description: File Transfer");
  header("Content-Type: application/force-download");
  header("Content-Disposition: attachment; filename=".basename($file));
  readfile($file);
} else {
  echo "$file<br>";
  echo basename($file);
  echo "<br>No File Found";
}
?>

If anyone can give me a hand with this please post.

Thanks,

Aaron

attached mail follows:


On Thursday 12 August 2004 01:06, Aaron Todd wrote:

> I am trying to dowload a file using readfile(), but PHP still cant seem to
> get to the file.

And what exactly does that mean? Any error messages?

> Here is my code:
>
> <?php
> $file = "/home/lgxdlr/test/".$_GET['file']."";
> if (file_exists(basename($file))) {

Lookup what basename() does to see why using it with file_exists() in this way
is most likely wrong (given what you're trying to do).

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Wind velocity increases in direct proportion to how well your hat fits
                -- Murphy's Horse Laws n17
*/

attached mail follows:


Aaron Todd wrote:
<snip>
> <?php
> $file = "/home/dlr/test/".$_GET['file']."";
> if (file_exists(basename($file))) {
> header("Content-Description: File Transfer");
> header("Content-Type: application/force-download");
> header("Content-Disposition: attachment; filename=".basename($file));
> readfile($file);
> } else {
> echo "$file<br>";
> echo basename($file);
> echo "<br>No File Found";
> }
> ?>

Where are you opening the file?

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Aaron Todd wrote:
<snip>
> <?php
> $file = "/home/dlr/test/".$_GET['file']."";
> if (file_exists(basename($file))) {
> header("Content-Description: File Transfer");
> header("Content-Type: application/force-download");
> header("Content-Disposition: attachment; filename=".basename($file));
> readfile($file);
> } else {
> echo "$file<br>";
> echo basename($file);
> echo "<br>No File Found";
> }
> ?>

Belay my last post...you're using readfile and not fread.

Okay, what error is the script outputting? You should remove the ''
from in front of readfile() so that it will output an error if it's the
problem.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Thanks for your reply,

I am not getting an error at all. I have coded some error traping so if the
files is not found it will tell you instead of displaying an error. As a
test I took all of that out so the script was:

  $file = "/home/dlr/test/".$_GET['file'].""
  header("Content-Description: File Transfer");
  header("Content-Type: application/force-download");
  header("Content-Disposition: attachment; filename=".basename($file));
  readfile($file);

I also took out the as you suggested.

Like that it brings up a download window like it should and then downloads a
file with the correct name, but it is only about 400 bytes and cannot be
read.

Thanks again for your help,

Aaron

"John Nichel" <johnkegworks.com> wrote in message
news:41190F92.6000500kegworks.com...
> Aaron Todd wrote:
> <snip>
> > <?php
> > $file = "/home/dlr/test/".$_GET['file']."";
> > if (file_exists(basename($file))) {
> > header("Content-Description: File Transfer");
> > header("Content-Type: application/force-download");
> > header("Content-Disposition: attachment; filename=".basename($file));
> > readfile($file);
> > } else {
> > echo "$file<br>";
> > echo basename($file);
> > echo "<br>No File Found";
> > }
> > ?>
>
> Belay my last post...you're using readfile and not fread.
>
> Okay, what error is the script outputting? You should remove the ''
> from in front of readfile() so that it will output an error if it's the
> problem.
>
> --
> John C. Nichel
> ÜberGeek
> KegWorks.com
> 716.856.9675
> johnkegworks.com

attached mail follows:


The other guys addressed how to get the script working, but I thought I
might also mention that you're presenting a potential security hole in your
app by not filtering the file name before using it. You'll also want to use
the realpath command on the full file name and path.

> -----Original Message-----
> $file = "/home/dlr/test/".$_GET['file']."";

attached mail follows:


Why would this be a security hole if I do not filter the file name before I
use it?

Thanks,

Aaron

"Ed Lazor" <Ed.Lazord20News.com> wrote in message
news:php.general-193359news.php.net...
> The other guys addressed how to get the script working, but I thought I
> might also mention that you're presenting a potential security hole in
your
> app by not filtering the file name before using it. You'll also want to
use
> the realpath command on the full file name and path.
>
> > -----Original Message-----
> > $file = "/home/dlr/test/".$_GET['file']."";

attached mail follows:


"Aaron Todd" aaloki88hotmail.com> wrote in message

> > $file = "/home/dlr/test/".$_GET['file']."";

> Why would this be a security hole if I do not filter the file

> name before I use it?

http://www.yourdomain.com/yourfile.php?file=../../path/to/any/file/on/machine

---John Holmes...

attached mail follows:


Hello, I'm trying to get the hang of OOP here but can't quite figure
out how to relate these classes. I've got one for the main project,
one for the database, and one for a user. Somehow I need to get the
user access to the database, without cumbersome constructor calls
involving a copy of the instance of the class itself.

// main project class
class gfusion {
    protected static $db;
    function __construct() {
        $this->db = new db;
    }
}

// database class
class db {
    private $link;
    private $query;
    private $result;
    ...
    function query($query);
    function fetch_row();
    function fetch_rows();
    ...
}

// user class
class user {
    private $id;
    private $group_id;
    private $login;
    private $password;
    /* Somehow I need to get the db class instance here. */

    function __construct($id = false) {
        if (is_numeric($id)) {
            print_r($this);
            $this->db->query('SELECT * FROM user WHERE id = ' . $id);
            $user_info = $this->db->get_row();

            $this->id = $user_info['id'];
            $this->group_id = $user_info['group_id'];
            $this->login = $user_info['login'];
            $this->password = $user_info['password'];
        }
    }
    ...
}

 
I tried extending the user class from the project class, but that
didn't work, because the $db var was empty. I tried changing it to
static, but it didn't inherit the $db variable for some reason. So,
how can I make this work, so I can write a bunch of classes that can
blindly use $this->db or something similar without having to worry
about setting it in the constructor? I thought about setting it as a
global, but that didn't seem very... OOP.

--
Joel Kitching
http://midgardmanga.keenspace.com/

attached mail follows:


> Hello, I'm trying to get the hang of OOP here but can't quite figure
> out how to relate these classes. I've got one for the main project,
> one for the database, and one for a user. Somehow I need to get the
> user access to the database, without cumbersome constructor calls
> involving a copy of the instance of the class itself.

<snip class>

>
> I tried extending the user class from the project class, but that
> didn't work, because the $db var was empty. I tried changing it to
> static, but it didn't inherit the $db variable for some reason. So,
> how can I make this work, so I can write a bunch of classes that can
> blindly use $this->db or something similar without having to worry
> about setting it in the constructor? I thought about setting it as a
> global, but that didn't seem very... OOP.
>
> --
> Joel Kitching
> http://midgardmanga.keenspace.com/
>

This is a great class to learn how OO works in PHP5.

class DB_Mysql {

  protected $user; // Database username
  protected $pass; // Database password
  protected $dbhost; // Database host
  protected $dbname; // Database name
  protected $dbh; // Database handle

  public function __construct($user, $pass, $dbhost, $dbname) {
        $this->user = $user;
        $this->pass = $pass;
        $this->dbhost = $dbhost;
        $this->dbname = $dbname;
  }

  protected function connect() {
        $this->dbh = mysql_connect($this->dbhost, $this->user, this->pass);

        if (!is_resource($this->dbh)) {
          throw new Exception("Cannot connect to the database");
        }

        if (!mysql_select_db($this->dbname, $this->dbh)) {
          throw new Exception("No such database by that name");
        }
  }

  public function execute($query) {
        if (!$this->dbh) {
          $this->connect();
        }

        $ret = mysql_query($query, $this->dbh);

        if (!$ret) {
          throw new Exception("There is an issue with the query string");
        } elseif (!is_resource($ret)) {
          return TRUE;
        } else {
          $stmt = new DB_MysqlStatement($this->dbh, $query);
          $stmt->result = $ret;
          return $stmt;
        }
  }

}

class DB_MysqlStatement {

  public $result;
  public $query;
  protected $dbh;

  public function __contruct($dbh, $query) {
        $this->query = $query;
        $this->dbh = $dbh;

        if (!is_resource($dbh)) {
          throw new Exception("Cannot connect to the database");
        }
  }

  public function fetch_row() {
        if (!$this->result) {
          throw new Exception("There is an issue with the query string");
        }
        return mysql_fetch_row($this->query);
  }

  public function fetch_assoc() {
        return mysql_fetch_assoc($this->result);
  }

  public function fetchall_assoc() {
        $retval = array();
        while ($row = $this->fetch_assoc()) {
          $retval[] = $row;
        }
        return $retval;
  }

}

Then call it like:

$dbhObj = new DB_Mysql("user","passwd","localhost","DBname");

$query = "SELECT * FROM user WHERE id = ' . $id";

$result = $dbhObj->execute($query);

while ($row = $result->fetch_assoc()) {
  //do stuff with $row array
}

attached mail follows:


From: "Joel Kitching" <linoliumgmail.com>

> Hello, I'm trying to get the hang of OOP here but can't quite figure
> out how to relate these classes. I've got one for the main project,
> one for the database, and one for a user. Somehow I need to get the
> user access to the database, without cumbersome constructor calls
> involving a copy of the instance of the class itself.
>
> // main project class
> class gfusion {
> protected static $db;
> function __construct() {
> $this->db = new db;
> }
> }
>
>
> // database class
> class db {
> private $link;
> private $query;
> private $result;
> ...
> function query($query);
> function fetch_row();
> function fetch_rows();
> ...
> }
>
>
> // user class
> class user {
> private $id;
> private $group_id;
> private $login;
> private $password;
> /* Somehow I need to get the db class instance here. */
>
> function __construct($id = false) {
> if (is_numeric($id)) {
> print_r($this);
> $this->db->query('SELECT * FROM user WHERE id = ' . $id);
> $user_info = $this->db->get_row();
>
> $this->id = $user_info['id'];
> $this->group_id = $user_info['group_id'];
> $this->login = $user_info['login'];
> $this->password = $user_info['password'];
> }
> }
> ...
> }
>
>
> I tried extending the user class from the project class, but that
> didn't work, because the $db var was empty. I tried changing it to
> static, but it didn't inherit the $db variable for some reason. So,
> how can I make this work, so I can write a bunch of classes that can
> blindly use $this->db or something similar without having to worry
> about setting it in the constructor? I thought about setting it as a
> global, but that didn't seem very... OOP.

See here: http://www.php.net/manual/en/language.oop5.decon.php

and note this: Note: Parent constructors are not called implicitly. In order
to run a parent constructor, a call to parent::__construct() is required.

---John Holmes...

attached mail follows:


Hi!!
I'm trying to find editors or IDE that let me create and develop a php
project.
Somebody can recommned me tools ?
Regards

Naty

attached mail follows:


* Naty <natess2khotmail.com>:
> I'm trying to find editors or IDE that let me create and develop a php
> project.
> Somebody can recommned me tools ?

Could you start a holy war any more easily...? The subject of
editors/IDEs is prone to start a holy war.

Regardless... I use VIM with the Project plugin, phpdoc plugin, and php
syntax highlighting (which depends on the X/HTML, CSS, and javascript
syntax highlighting, too). I find this more than adequate for my PHP
coding needs (and, really, any coding and text editing).

You're likely to get suggestions for emacs, as well, and I'd be very
surprised if one or more commercial editors weren't offered. Basically,
you're going to need to weed through the suggestions and find the tools
that suit you.

--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthewgarden.org | http://vermontbotanical.org

attached mail follows:


Naty wrote:
> Hi!!
> I'm trying to find editors or IDE that let me create and develop a php
> project.
> Somebody can recommned me tools ?
> Regards
>
> Naty
>

I can recommend the 'Newbie Guide'.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


I'm using windows no mac for now!
I saw some people a couple of years ago working in php with PowerBuilder,
but It's seems too complicated, for that reason in this days there must be
other tools.
I need use, css files, mysql database, javaScripts basically !
Regards

Naty

"Matthew Weier O'Phinney" <matthewgarden.org> wrote in message
news:slrnchi41c.nbn.matthewwebmaster.garden.org...
> * Naty <natess2khotmail.com>:
> > I'm trying to find editors or IDE that let me create and develop a php
> > project.
> > Somebody can recommned me tools ?
>
> Could you start a holy war any more easily...? The subject of
> editors/IDEs is prone to start a holy war.
>
> Regardless... I use VIM with the Project plugin, phpdoc plugin, and php
> syntax highlighting (which depends on the X/HTML, CSS, and javascript
> syntax highlighting, too). I find this more than adequate for my PHP
> coding needs (and, really, any coding and text editing).
>
> You're likely to get suggestions for emacs, as well, and I'd be very
> surprised if one or more commercial editors weren't offered. Basically,
> you're going to need to weed through the suggestions and find the tools
> that suit you.
>
> --
> Matthew Weier O'Phinney | WEBSITES:
> Webmaster and IT Specialist | http://www.garden.org
> National Gardening Association | http://www.kidsgardening.com
> 802-863-5251 x156 | http://nationalgardenmonth.org
> mailto:matthewgarden.org | http://vermontbotanical.org

attached mail follows:


* Naty <natess2khotmail.com>:
> I'm using windows no mac for now!

I'm not on a mac, either... actually, I've been using linux exclusively
for over four years now. However, I've used vim on windows without a
hitch -- there are windows binaries available on their site,
http://www.vim.org

> I saw some people a couple of years ago working in php with PowerBuilder,
> but It's seems too complicated, for that reason in this days there must be
> other tools.
> I need use, css files, mysql database, javaScripts basically !

So, you basically need a text editor with good syntax highlighting for
X/HTML, PHP, CSS, SQL, and javascript. As I said, I have that in Vim. I
also know EditPlus has that and is either shareware or freeware.

If you're looking for an IDE, can't help you.

> "Matthew Weier O'Phinney" <matthewgarden.org> wrote in message
> news:slrnchi41c.nbn.matthewwebmaster.garden.org...
> > * Naty <natess2khotmail.com>:
> > > I'm trying to find editors or IDE that let me create and develop a php
> > > project.
> > > Somebody can recommned me tools ?
> >
> > Could you start a holy war any more easily...? The subject of
> > editors/IDEs is prone to start a holy war.
> >
> > Regardless... I use VIM with the Project plugin, phpdoc plugin, and php
> > syntax highlighting (which depends on the X/HTML, CSS, and javascript
> > syntax highlighting, too). I find this more than adequate for my PHP
> > coding needs (and, really, any coding and text editing).
> >
> > You're likely to get suggestions for emacs, as well, and I'd be very
> > surprised if one or more commercial editors weren't offered. Basically,
> > you're going to need to weed through the suggestions and find the tools
> > that suit you.

--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthewgarden.org | http://vermontbotanical.org

attached mail follows:


[snip]
I'm using windows no mac for now!
I saw some people a couple of years ago working in php with
PowerBuilder,
but It's seems too complicated, for that reason in this days there must
be
other tools.
I need use, css files, mysql database, javaScripts basically !
[/snip]

Open http://www.google.com in the browser of your choice
Type "PHP IDE" in the little box that appears there.
Click on the links of returned results.

attached mail follows:


>> > Could you start a holy war any more easily...? The subject of
>> > editors/IDEs is prone to start a holy war.
>> >
>> > Regardless... I use VIM with the Project plugin, phpdoc plugin, and
>> >php syntax highlighting

>You're likely to get suggestions for emacs, as well, and I'd be very
>surprised if one or more commercial editors weren't offered.

VIM!
Emacs!
VIM!
Emacs!
VIM!
KWrite!

KWrite?!

Real men write code using a chisel and hammer on granite stone. You bet
your ass you'll learn how to write small, tight, clean code quickly.

--
--Matthew Sims
--<http://killermookie.org>

attached mail follows:


From: "Jay Blanchard"
> Open http://www.google.com in the browser of your choice
> Type "PHP IDE" in the little box that appears there.
> Click on the links of returned results.

I clicked on all of the links and nothing happened except for some web pages
appearing. Now what?

---John Holmes...

attached mail follows:


Matthew Weier O'Phinney wrote:

> So, you basically need a text editor with good syntax highlighting for
> X/HTML, PHP, CSS, SQL, and javascript. As I said, I have that in Vim. I
> also know EditPlus has that and is either shareware or freeware.
>
> If you're looking for an IDE, can't help you.

Eclipse + phpeclipse
http://www.eclipse.org/
http://sourceforge.net/projects/phpeclipse

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services

attached mail follows:


Matthew Sims wrote:
>>>>Could you start a holy war any more easily...? The subject of
>>>>editors/IDEs is prone to start a holy war.
>>>>
>>>>Regardless... I use VIM with the Project plugin, phpdoc plugin, and
>>>>php syntax highlighting
>
>
>>You're likely to get suggestions for emacs, as well, and I'd be very
>>surprised if one or more commercial editors weren't offered.
>
>
> VIM!
> Emacs!
> VIM!
> Emacs!
> VIM!
> KWrite!
>
> KWrite?!
>
> Real men write code using a chisel and hammer on granite stone. You bet
> your ass you'll learn how to write small, tight, clean code quickly.
>

Pffft. I 'write' code in my head, and plug a FireWire cable into my ear. ;)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


John W. Holmes wrote:
> From: "Jay Blanchard"
>
>>Open http://www.google.com in the browser of your choice
>>Type "PHP IDE" in the little box that appears there.
>>Click on the links of returned results.
>
>
> I clicked on all of the links and nothing happened except for some web pages
> appearing. Now what?
>
> ---John Holmes...
>

You have to spin around in your chair three times, and chant, "There's
no place like 127.0.0.1. There's no place like 127.0.0.1"

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


BBEdit is the tool of the Gods.

Jon

Lester Caine wrote:

> Matthew Weier O'Phinney wrote:
>
>> So, you basically need a text editor with good syntax highlighting for
>> X/HTML, PHP, CSS, SQL, and javascript. As I said, I have that in Vim. I
>> also know EditPlus has that and is either shareware or freeware.
>> If you're looking for an IDE, can't help you.
>
>
> Eclipse + phpeclipse
> http://www.eclipse.org/
> http://sourceforge.net/projects/phpeclipse
>

attached mail follows:


*coughs* Pico!

Real men don't have enough money to buy all that stone. They just use
tissue paper, toilet paper, or whatever's available that breaks down
easily enough to hide all errors with zero culpability.
--
Peter Ellis - pellisnaturalaxis.com
Web Design and Development Consultant
naturalaxis | http://www.naturalaxis.com/

On Tue, 2004-08-10 at 12:07 -0700, Matthew Sims wrote:
> >> > Could you start a holy war any more easily...? The subject of
> >> > editors/IDEs is prone to start a holy war.
> >> >
> >> > Regardless... I use VIM with the Project plugin, phpdoc plugin, and
> >> >php syntax highlighting
>
> >You're likely to get suggestions for emacs, as well, and I'd be very
> >surprised if one or more commercial editors weren't offered.
>
> VIM!
> Emacs!
> VIM!
> Emacs!
> VIM!
> KWrite!
>
> KWrite?!
>
> Real men write code using a chisel and hammer on granite stone. You bet
> your ass you'll learn how to write small, tight, clean code quickly.
>
> --
> --Matthew Sims
> --<http://killermookie.org>

attached mail follows:


> BBEdit is the tool of the Gods.
>
> Jon

Zeus would be proud of you.

--
--Matthew Sims
--<http://killermookie.org>

attached mail follows:


Hello,

I'm working on a site that cannot use PHP exactly, so I'm trying to work
around that limitation with remotely hosted scripting by tricking the server
into thinking the PHP content is actually javascript.

I've been able to do this before, but this time I'm having a few issues. I
need to be able to pass all the variables in the URL and POST variables to
the external script, but it seems it won't work this way unless I directly
pass them in the src attribute of the script tag.

Does anyone know a way to get the POST and GET variables to still pass to
the external script? I was thinking there was a way with JavaScript but I'm
not that great with it.

Thanks,
Stephen Craton
http://www.melchior.us
http://php.melchior.us
http://www.chatness.us

attached mail follows:


I was just wondering if anyone out there is using PHP for an embeded
development or knows of any devices that use PHP on their system.

Thanks,

Aaron Todd

attached mail follows:


Hi All,

I have a registration page that hasn't changed in several weeks. Today
it decided to freak-out by throwing an error;
'Cannot redeclare myfunctionname() on line 10 of myfunctions.inc'

Nothing has changed in either the calling page, or the function. The
only thing that has changed since these files were put into production
is the upgrade on php to 5.

I've looked through the release notes and found nothing. I looked
through the manual and found nothing that I can really put my finger on.
I was able to correct the problem with changing the 'include()' to
'include_once()', but I really want to know why this happened and why it
didn't throw that error until now.

alex hogan

 

*************************************************************************************
The contents of this e-mail and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom it is addressed. The
views stated herein do not necessarily represent the view of the company. If you are
not the intended recipient of this e-mail you may not copy, forward, disclose, or
otherwise use it or any part of it in any form whatsoever. If you have received this
e-mail in error please e-mail the sender.
*************************************************************************************

attached mail follows:


From: "Alex Hogan" <Alex.Hoganalliedelec.com>
> I have a registration page that hasn't changed in several weeks. Today
> it decided to freak-out by throwing an error;
> 'Cannot redeclare myfunctionname() on line 10 of myfunctions.inc'
>
> Nothing has changed in either the calling page, or the function. The
> only thing that has changed since these files were put into production
> is the upgrade on php to 5.

Did your error_reporting level change with the upgrade? This was more than
likely silently ignored with PHP4 and now showing as a warning/error in PHP5
or just dependent upon your error_reporting level.

---John Holmes...

attached mail follows:


It's probably not PHP 5 and more likely that someone changed the php.ini
error reporting settings in the process of upgrading (or maybe PHP 5 has a
different set of default settings?).

You should probably trace through your application and note what files are
being loaded, in what order, etc.. so thath you can identify why the error
occurred. Using include_once fixes the problem but may not address bigger
issues.

-Ed

> -----Original Message-----
> Hi All,
>
>
> I have a registration page that hasn't changed in several weeks. Today
> it decided to freak-out by throwing an error;
> 'Cannot redeclare myfunctionname() on line 10 of myfunctions.inc'
>
> Nothing has changed in either the calling page, or the function. The
> only thing that has changed since these files were put into production
> is the upgrade on php to 5.
>
> I've looked through the release notes and found nothing. I looked
> through the manual and found nothing that I can really put my finger on.
> I was able to correct the problem with changing the 'include()' to
> 'include_once()', but I really want to know why this happened and why it
> didn't throw that error until now.
>
>
> alex hogan

attached mail follows:


> Did your error_reporting level change with the upgrade? This
> was more than likely silently ignored with PHP4 and now
> showing as a warning/error in PHP5 or just dependent upon
> your error_reporting level.

No..,

I was careful to set 5 up with as many of the same settings as the
previous version. I only had half a day to change the production
environment so I wanted to make sure there was no lag. Unless there was
something that I missed.

At first I thought that I had either duplicated the function someplace
else, but that wasn't the case.

alex hogan
*************************************************************************************
The contents of this e-mail and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom it is addressed. The
views stated herein do not necessarily represent the view of the company. If you are
not the intended recipient of this e-mail you may not copy, forward, disclose, or
otherwise use it or any part of it in any form whatsoever. If you have received this
e-mail in error please e-mail the sender.
*************************************************************************************

attached mail follows:


On Tue, 10 Aug 2004 14:07:09 -0500, Alex Hogan
<alex.hoganalliedelec.com> wrote:
> > Did your error_reporting level change with the upgrade? This
> > was more than likely silently ignored with PHP4 and now
> > showing as a warning/error in PHP5 or just dependent upon
> > your error_reporting level.
>
> No..,
>
> I was careful to set 5 up with as many of the same settings as the
> previous version. I only had half a day to change the production
> environment so I wanted to make sure there was no lag. Unless there was
> something that I missed.
>
> At first I thought that I had either duplicated the function someplace
> else, but that wasn't the case.
>

Well, it's very likely that that file was being included twice. You
just can't do an include() on the same file twice if it defines
functions or classes. Look through your code and see all of the places
where the include was happening. Perhaps the file that includes that
file is being included twice.

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

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


[snip]
> Well, it's very likely that that file was being included
> twice. You just can't do an include() on the same file twice
> if it defines functions or classes. Look through your code
> and see all of the places where the include was happening.
> Perhaps the file that includes that file is being included twice.
[/snip]

I checked that. I have all the includes at the top of the page only
being brought in from a config file.
I checked the config file for that directory and it only calls the files
once. No duplication.
I even checked the classes to insure that there wasn't any duplicate
functionality or duplicate calls.

Apparently I must've been calling it from someplace else that I can't
find, and changing to include_once() fixed the problem. I just don't
understand why it worked for as long as it did before now.

alex hogan
*************************************************************************************
The contents of this e-mail and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom it is addressed. The
views stated herein do not necessarily represent the view of the company. If you are
not the intended recipient of this e-mail you may not copy, forward, disclose, or
otherwise use it or any part of it in any form whatsoever. If you have received this
e-mail in error please e-mail the sender.
*************************************************************************************

attached mail follows:


Any recommendations on how to make PHP run faster?

 

I have a script pulling a lot of data from MySQL and generating reports and
spitting out data (flush) as it's processing so I can see what's going on.
It was taking around 10 seconds to process each order. I reduced the total
number of orders being processed. I expected the script to take less time
because there were fewer orders to process, but I was surprised to discover
that time spent processing each order also reduced almost in half. I
figured PHP's memory limit per script at 8mb might be the bottleneck, so I
upped it to 128, restarted apache, and reran the script. Increasing
available memory had no effect.

 

MySQL is taking most of the cpu while running the script, but I figured I'd
make sure to boost PHP as much as possible before going to the MySQL list
for MySQL performance tips.

 

Thanks,

 

Ed

 

attached mail follows:


[snip]
> I figured PHP's memory limit per script at 8mb might be the
> bottleneck, so I upped it to 128, restarted apache, and reran
> the script. Increasing available memory had no effect.
[/snip]

This may have already been addressed, but did you index any key fields?

alex hogan
*************************************************************************************
The contents of this e-mail and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom it is addressed. The
views stated herein do not necessarily represent the view of the company. If you are
not the intended recipient of this e-mail you may not copy, forward, disclose, or
otherwise use it or any part of it in any form whatsoever. If you have received this
e-mail in error please e-mail the sender.
*************************************************************************************

attached mail follows:


[snip]
Any recommendations on how to make PHP run faster?
[/snip]

A multiple CPU box. (It's a legitimate answer!)

attached mail follows:


> [snip]
> Any recommendations on how to make PHP run faster?
> [/snip]
>
> A multiple CPU box. (It's a legitimate answer!)

I usually add more gerbils to my spinning wheel.

--
--Matthew Sims
--<http://killermookie.org>

attached mail follows:


If your problem is with a long running MySQL Query, and many of mine have
been, I would suggest you read

http://dev.mysql.com/doc/mysql/en/Optimizer_Issues.html

Your objective is to make sure that all your database queries avoid the
deadly "table scan" as a part of their query plan.

Good Luck,

Warren Vail

-----Original Message-----
From: Jay Blanchard [mailto:jay.blanchardniicommunications.com]
Sent: Tuesday, August 10, 2004 12:16 PM
To: Ed Lazor; php-generallists.php.net
Subject: RE: [PHP] PHP performance

[snip]
Any recommendations on how to make PHP run faster?
[/snip]

A multiple CPU box. (It's a legitimate answer!)

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

attached mail follows:


Jay Blanchard wrote:
> [snip]
> Any recommendations on how to make PHP run faster?
> [/snip]
>
> A multiple CPU box. (It's a legitimate answer!)
>

Lot of good that did. I just threw 8 socket 7 AMD processors into a
box, and PHP isn't even the slightest bit faster.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


> -----Original Message-----
>This may have already been addressed, but did you index any key fields?

I do have some indices created, but I'll check to see if there are more than
can boost things.

Thanks =)

Ed

attached mail follows:


I was just wondering if anyone out there is using PHP for an embeded
development or knows of any devices that use PHP on their system. An
example of what I am talking about would be a Linksys router. They run an
embedded Linux web server and do management through a browser. I am
wondering if I could do the same but also run some php scripts.

Thanks,

Aaron Todd

attached mail follows:


[snip]
...the second time that this was sent...
[/snip]

Aaron,

For both of your original requests today you have sent them twice,
several minutes apart. You have

a. A bug in your e-mail client which is causing it to send the e-mail
twice OR
2. The keyboard intefcae mechanism is broken.

My bet is 2. Please do not send e-mails twice. It will more often than
not double the chances that your question will receive no response.

attached mail follows:


Jay Blanchard wrote:
> [snip]
> ...the second time that this was sent...
> [/snip]
>
> Aaron,
>
> For both of your original requests today you have sent them twice,
> several minutes apart. You have
>
> a. A bug in your e-mail client which is causing it to send the e-mail
> twice OR
> 2. The keyboard intefcae mechanism is broken.
>
> My bet is 2. Please do not send e-mails twice. It will more often than
> not double the chances that your question will receive no response.
>

PEBKAC? ;)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


[snip]
Real men write code using a chisel and hammer on granite stone. You bet
your ass you'll learn how to write small, tight, clean code quickly.
[/snip]

If only we wrote our e-mail the same way!

attached mail follows:


Hello,

I'm in need of some help here. I'm working on a search engine script that
searches basically anywhere. One thing I'm trying to do is open an external
directory to read all the files to search. However, I can't just put a URL
into the readdir() function without getting an error.

How would I go about reading an external directory?

Thanks,
Stephen Craton
http://www.melchior.us
http://php.melchior.us
http://www.chatness.us

attached mail follows:


[snip]
I'm in need of some help here. I'm working on a search engine script
that
searches basically anywhere. One thing I'm trying to do is open an
external
directory to read all the files to search. However, I can't just put a
URL
into the readdir() function without getting an error.

How would I go about reading an external directory?
[/snip]

http://www.php.net/curl

attached mail follows:


On Tue, 10 Aug 2004 15:04:42 -0500, Stephen Craton
<webmastermelchior.us> wrote:
> Hello,
>
> I'm in need of some help here. I'm working on a search engine script that
> searches basically anywhere. One thing I'm trying to do is open an external
> directory to read all the files to search. However, I can't just put a URL
> into the readdir() function without getting an error.
>
> How would I go about reading an external directory?

If you're talking about a URL "directory" then you can't. You can only
get what the webserver sends to you. If the result page happens to be
a directory listing, you can parse it for links to files the same as
any normal webpage.

>
> Thanks,
> Stephen Craton
> http://www.melchior.us
> http://php.melchior.us
> http://www.chatness.us
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--