php-general Digest 10 Mar 2008 19:08:53 -0000 Issue 5340

Topics (messages 271189 through 271219):

Re: Unexcepted $this
        271189 by: Anup Shukla
        271192 by: Murat BEÞER
        271193 by: Murat BEÞER
        271197 by: Ray Hauge
        271205 by: Philip Thompson
        271218 by: Ray Hauge

Re: SMTP
        271190 by: Alain Roger
        271199 by: Andrés Robinet
        271202 by: Daniel Brown
        271216 by: Alain Roger

Re: Links hierarchy maintenance
        271191 by: Per Jessen

PHP5 strtotime
        271194 by: Samuel Marshall
        271201 by: Larry Garfield

SESSION Array problem - possibly different PHP versions?
        271195 by: Angelo Zanetti
        271200 by: Daniel Brown
        271206 by: Angelo Zanetti
        271211 by: Al

cart in a session
        271196 by: Bill
        271198 by: Daniel Brown

Re: path_info in fastcgi setting
        271203 by: Daniel Brown

Re: Whats faster? simplexml_load_string or simplexml_load_file?
        271204 by: Daniel Brown

Why use session_register()?
        271207 by: Lamonte H
        271208 by: Greg Donald
        271209 by: Daniel Brown
        271210 by: Daniel Brown
        271212 by: Al
        271213 by: Lamonte H
        271214 by: Dave Goodchild

Re: Generating JavaScript menus on-the-fly
        271215 by: Roberto Mansfield
        271217 by: Ken Kixmoeller

Question about user management...
        271219 by: Jason Pruim

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
I am sorry. Please disregard my previous post.
I think i am wrong on that.

--
Regards,
Anup Shukla

--- End Message ---
--- Begin Message ---
So what do you thing about on this thing ?

Anup Shukla yazmış:
I am sorry. Please disregard my previous post.
I think i am wrong on that.


--- End Message ---
--- Begin Message ---
So what do you thing about on this thing ?

Anup Shukla yazmış:
I am sorry. Please disregard my previous post.
I think i am wrong on that.


--- End Message ---
--- Begin Message ---
Murat BEŞER wrote:
I can't under stood but PHP gaves me an error:

"UnExcepted $this" for " || $this->getFileExtension($file) == 'jpg' "

When I removed jpg extension check it's okay... PHP script runs well.

What is the problem :)

public function loadImages($folder) {
        $result = $this->filemanager->fecthFiles($folder);
        $images = array();
        if (sizeof($result)>=1 && $result !== false) {
            foreach ($result as $file) {
if ($this->getFileExtension($file) == 'gif' || $this->getFileExtension($file) == 'png' || $this->getFileExtension($file) == 'jpg') {
                    $images[] = array('name'=>$file);
                }
            }
        }
        return $images;
    }


Try storing the value in a variable first. It'll also have the side-effect of being marginally faster too.

$extension = $this->getFileExtension($file);

if ($extension == 'gif' || $extension || 'png' || $extension == 'jpg') {
        // do something
}

That might help, but I would think that the way you had it would also work. Let us know what happens when you use the variable like I showed above.

Thanks,
--
Ray Hauge
www.primateapplications.com

--- End Message ---
--- Begin Message ---
On Mar 10, 2008, at 8:32 AM, Ray Hauge wrote:

Murat BEŞER wrote:
I can't under stood but PHP gaves me an error:
"UnExcepted $this" for " || $this->getFileExtension($file) == 'jpg' "
When I removed jpg extension check it's okay... PHP script runs well.
What is the problem :)
public function loadImages($folder) {
       $result = $this->filemanager->fecthFiles($folder);
       $images = array();
       if (sizeof($result)>=1 && $result !== false) {
           foreach ($result as $file) {
if ($this->getFileExtension($file) == 'gif' || $this- >getFileExtension($file) == 'png' || $this->getFileExtension($file) == 'jpg') {
                   $images[] = array('name'=>$file);
               }
           }
       }
       return $images;
   }

Try storing the value in a variable first. It'll also have the side- effect of being marginally faster too.

Good call.


$extension = $this->getFileExtension($file);

if ($extension == 'gif' || $extension || 'png' || $extension == 'jpg') {

Correction:

... $extension == 'png' ...

Personally, I like the in_array() version better - it cleaner and you can expand upon it more more easily.

$extensions = array('gif, 'png', 'jpg' [, 'm4a'[, 'etc']]);
if (in_array($extension, $extensions)) { ... }


        // do something
}

That might help, but I would think that the way you had it would also work. Let us know what happens when you use the variable like I showed above.

Thanks,
--
Ray Hauge


HTH,
~Philip

"Personally, most of my web applications do not have to factor 13.7 billion years of space drift in to the calculations, so PHP's rand function has been great for me..." ~S. Johnson


--- End Message ---
--- Begin Message ---
Philip Thompson wrote:
On Mar 10, 2008, at 8:32 AM, Ray Hauge wrote:

Murat BEŞER wrote:
I can't under stood but PHP gaves me an error:
"UnExcepted $this" for " || $this->getFileExtension($file) == 'jpg' "
When I removed jpg extension check it's okay... PHP script runs well.
What is the problem :)
public function loadImages($folder) {
       $result = $this->filemanager->fecthFiles($folder);
       $images = array();
       if (sizeof($result)>=1 && $result !== false) {
           foreach ($result as $file) {
if ($this->getFileExtension($file) == 'gif' || $this->getFileExtension($file) == 'png' || $this->getFileExtension($file) == 'jpg') {
                   $images[] = array('name'=>$file);
               }
           }
       }
       return $images;
   }

Try storing the value in a variable first. It'll also have the side-effect of being marginally faster too.

Good call.


$extension = $this->getFileExtension($file);

if ($extension == 'gif' || $extension || 'png' || $extension == 'jpg') {

Correction:

... $extension == 'png' ...

Personally, I like the in_array() version better - it cleaner and you can expand upon it more more easily.

$extensions = array('gif, 'png', 'jpg' [, 'm4a'[, 'etc']]);
if (in_array($extension, $extensions)) { ... }


    // do something
}

That might help, but I would think that the way you had it would also work. Let us know what happens when you use the variable like I showed above.

Thanks,
--
Ray Hauge


HTH,
~Philip

"Personally, most of my web applications do not have to factor 13.7 billion years of space drift in to the calculations, so PHP's rand function has been great for me..." ~S. Johnson



Thanks for the catch. I work from home and I hadn't had my coffee yet in the morning. I usually check my news and email right after I get up and before I go to work :)

I have been starting to use in_array more often as well. Far too many times I'll have to go back and add more options later, then the IF statement gets huge. Someday I'll kick the habit for good though.

Oh, it might also be a bit easier to store the acceptable extensions in an array before the IF statement

$ext = $this->getFileExtension($file);
$acceptableExtensions = array('png', 'gif', 'jpg');

if ( in_array($ext, $acceptableExtensions) ) {
        // do something
}

That way the conditional doesn't grow as more and more values get added.

--
Ray Hauge
www.primateapplications.com

--- End Message ---
--- Begin Message ---
Hi Ray,

in my php.ini i have :
SMTP = localhost
smtp_port = 25
sendmail_from = [EMAIL PROTECTED]

but my website (testing machine) is on localhost (which has also the IP
195.126.5.1)

i think the problem is not in php.ini but more on SMTP server side (in
settings, maybe password for authentication).

A.

On Sun, Mar 9, 2008 at 10:16 PM, Ray Hauge <[EMAIL PROTECTED]>
wrote:

> Alain Roger wrote:
> > Hi,
> >
> > i know that this is not necessary the best forum for that, but i need to
> get
> > a real feedback and i guess you already faced the same issue as mine.
> > basically, i develop php web application on windows XP platform.
> > So i have apache 2.24 installed and PHP 5.2.4.
> >
> > now i would like to test if my application send emails, so i've checked
> my
> > php.ini file and it seems ok.
> > i tried to use IIS from windows to define a default SMTP server, but as
> my
> > emails are not sent, i guess something is wrong with IIS.
> >
> > so does it exist a free SMTP server (similar that linux daemon) but
> running
> > on windows XP ?
> > if yes, where can i find it and what steps should i perform to be sure
> my
> > emails are sent ?
> >
> > i do not want to transfer all my web application each time i want to
> test
> > email sending...
> > i would like to test it locally.
> >
> > thanks for your feedback.
> >
>
> I could be wrong, but I thought that you had to specify the SMTP server
> in the php.ini file.
>
> http://us2.php.net/manual/en/ref.mail.php#ini.smtp
>
>  > now i would like to test if my application send emails, so i've
> checked my
>  > php.ini file and it seems ok.
>
> Maybe that means you already did that.  The second issue might be that
> your SMTP server is MS Exchange, and it requires authentication.
>
> If that is the case, then search for php SMTP authentication:
>
>
> http://www.google.com/search?q=php+smtp+authentication&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
>
> --
> Ray Hauge
> www.primateapplications.com
>



-- 
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Alain Roger [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 10, 2008 3:16 AM
> To: Ray Hauge
> Cc: PHP General List
> Subject: Re: [PHP] SMTP
> 
> Hi Ray,
> 
> in my php.ini i have :
> SMTP = localhost
> smtp_port = 25
> sendmail_from = [EMAIL PROTECTED]
> 
> but my website (testing machine) is on localhost (which has also the IP
> 195.126.5.1)
> 
> i think the problem is not in php.ini but more on SMTP server side (in
> settings, maybe password for authentication).
> 
> A.
> 
> On Sun, Mar 9, 2008 at 10:16 PM, Ray Hauge <[EMAIL PROTECTED]>
> wrote:
> 
> > Alain Roger wrote:
> > > Hi,
> > >
> > > i know that this is not necessary the best forum for that, but i need
> to
> > get
> > > a real feedback and i guess you already faced the same issue as mine.
> > > basically, i develop php web application on windows XP platform.
> > > So i have apache 2.24 installed and PHP 5.2.4.
> > >
> > > now i would like to test if my application send emails, so i've checked
> > my
> > > php.ini file and it seems ok.
> > > i tried to use IIS from windows to define a default SMTP server, but as
> > my
> > > emails are not sent, i guess something is wrong with IIS.
> > >
> > > so does it exist a free SMTP server (similar that linux daemon) but
> > running
> > > on windows XP ?
> > > if yes, where can i find it and what steps should i perform to be sure
> > my
> > > emails are sent ?
> > >
> > > i do not want to transfer all my web application each time i want to
> > test
> > > email sending...
> > > i would like to test it locally.
> > >
> > > thanks for your feedback.
> > >
> >
> > I could be wrong, but I thought that you had to specify the SMTP server
> > in the php.ini file.
> >
> > http://us2.php.net/manual/en/ref.mail.php#ini.smtp
> >
> >  > now i would like to test if my application send emails, so i've
> > checked my
> >  > php.ini file and it seems ok.
> >
> > Maybe that means you already did that.  The second issue might be that
> > your SMTP server is MS Exchange, and it requires authentication.
> >
> > If that is the case, then search for php SMTP authentication:
> >
> >
> > http://www.google.com/search?q=php+smtp+authentication&ie=utf-8&oe=utf-
> 8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
> >
> > --
> > Ray Hauge
> > www.primateapplications.com
> >
> 
> 
> 
> --
> Alain
> ------------------------------------
> Windows XP SP2
> PostgreSQL 8.2.4 / MS SQL server 2005
> Apache 2.2.4
> PHP 5.2.4
> C# 2005-2008

I'm curious what's the error you get when you use the "mail" function?

Also, if you have SMTP running on port 25 you should be able to "telnet
localhost 25" and run some SMTP commands (EHLO, etc).

Beware as well that some ISPs block port 25 so you may need to use their SMPT
server instead of yours, if you can telnet your SMTP server but not send emails,
then you either:
1 - Need to authenticate yourself against your SMTP server, or
2 - You have port 25 blocked, and need to use your ISP's server, or an external
SMTP server that you can talk to on a port other than 25.

Regards,

Rob


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com




--- End Message ---
--- Begin Message ---
On Sun, Mar 9, 2008 at 4:38 PM, Alain Roger <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  i know that this is not necessary the best forum for that, but i need to get
>  a real feedback and i guess you already faced the same issue as mine.
>  basically, i develop php web application on windows XP platform.
>  So i have apache 2.24 installed and PHP 5.2.4.
>
>  now i would like to test if my application send emails, so i've checked my
>  php.ini file and it seems ok.
>  i tried to use IIS from windows to define a default SMTP server, but as my
>  emails are not sent, i guess something is wrong with IIS.

    So which HTTP server are you using?  You stated earlier that you
have Apache 2.24 on there, but here you say that you're using IIS.  If
you're using Apache, the IIS web server configuration will have
nothing to do with anything.

>  so does it exist a free SMTP server (similar that linux daemon) but running
>  on windows XP ?

    I may be incorrect on this, but I'm pretty sure that
Win2K/XP/Vista have Microsoft Exchange bundled in for SMTP.  Check in
Add/Remove Programs > Windows Components > Internet Information
Services (I think, but I'm guessing.... I really don't use Windows
that often).  Even though it has the same name (IIS), in this case,
it's the category for all Internet services.  There should be
something mentioning SMTP there.

>  if yes, where can i find it and what steps should i perform to be sure my
>  emails are sent ?

    Check the logs for Exchange/SMTP or whatever other MTA you decide
to use and see if there's anything mentioned about the problem.  It
could be an authentication/negotiation issue.  Also, check your
Windows firewall (or third-party software) to ensure that you can
connect to localhost:25.  The easiest way to test this is as follows:

Start > Run
Type: cmd
Type: telnet localhost 25
If it connects, type: HELO localhost
Note the response.

    You can then try sending a message through the server manually, if
you'd like.  While still connected via Telnet as shown above, type the
following (replacing things as necessary):

MAIL FROM: [EMAIL PROTECTED]
RCPT TO: [EMAIL PROTECTED]
DATA
Subject: Testing Email from Telnet
This is a test.
.

    Always end with a period on a line of its own.  That should show
you what, if any, error messages are being kicked out by your SMTP
server.

-- 
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

--- End Message ---
--- Begin Message ---
Hi Ray,

we tested it with telnet and it seems that it works... but my mail client
does not receive it. :-(
php mail function just tells me that email can not be delivered.
here is the function:

> if (mail($to, $subject, $body))
>     {
>         echo("<p>Message successfully sent!</p>");
>     }
>     else
>     {
>         echo("<p>Message delivery failed...</p>");
>     }
>

and it returns false... so message delivery failed.
and i use on the same local PC so no ISP. server is used.

Al.

I'm curious what's the error you get when you use the "mail" function?
>
> Also, if you have SMTP running on port 25 you should be able to "telnet
> localhost 25" and run some SMTP commands (EHLO, etc).
>
> Beware as well that some ISPs block port 25 so you may need to use their
> SMPT
> server instead of yours, if you can telnet your SMTP server but not send
> emails,
> then you either:
> 1 - Need to authenticate yourself against your SMTP server, or
> 2 - You have port 25 blocked, and need to use your ISP's server, or an
> external
> SMTP server that you can talk to on a port other than 25.
>
> Regards,
>
> Rob
>
>
> Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
> 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL
> 33308 |
> TEL 954-607-4207 | FAX 954-337-2695 |
> Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE:
> bestplace |
>  Web: bestplace.biz  | Web: seo-diy.com
>
>
>
>


-- 
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

--- End Message ---
--- Begin Message ---
Adil Drissi wrote:

> should be displayed differently. I was wondering if
> there is a way to do the same thing without the
> overhead of all that "if " statements.

If you're using PHP (or any other interpreted language) overhead is a
fact of life, there's little you can do about it. 


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
I use PayPal as my ecommerce solution and I have a PHP script that captures
variables posted from PayPal to populate my database. The time variable
string is sent in the following format: HH:MM:SS DD Mmm YY, YYYY PST. The
script worked fine but since I upgraded to PHP5 the dates inputted into my
database (MySQL) are showing some date in 1969. Can anyone say what is
causing this or how to correct it? Thanks.

 

Samuel Marshall

 

 

 


--- End Message ---
--- Begin Message ---
On Monday 10 March 2008, Samuel Marshall wrote:
> I use PayPal as my ecommerce solution and I have a PHP script that captures
> variables posted from PayPal to populate my database. The time variable
> string is sent in the following format: HH:MM:SS DD Mmm YY, YYYY PST. The
> script worked fine but since I upgraded to PHP5 the dates inputted into my
> database (MySQL) are showing some date in 1969. Can anyone say what is
> causing this or how to correct it? Thanks.
>
> Samuel Marshall

PHP's error value for dates translates to 6 PM 31 December 1969 when 
formatted, that is, right before the Epoc.  That happens when you feed 
strtotime a string it can't parse, for instance.  Looking at the string you 
list, the year is listed twice.  I very much doubt strtotime can grok that.  
You'll need to do at least some manual parsing of the date string.

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
Hi All, 

I have a problem that only occurs on our live server and not our local
server.

It works fine locally.

Basically I am using a session array to store values of product colours. A
user can add colours to the session array.

The session is defined as follows:

$_SESSION['color'][$counter] = $color;

Obviously the first time we validate and the $counter is set to 0.

When more colours are added the $counter variable increments and should
increment the value of the array.

The colours are added through a popup window. Before I open the popup window
I print_r($_SESSION['color']) to view the contents of the array and make
sure that they are valid and it is an array.

Output is as follows: 

[color] => Array ( [0] => #339933 [1] => #cccc00 ) etc...



Then once the popup opens I do the same print_r 

And it now shows: [color] => #339933 

There fore it isn't an array of colors within the session array. How can PHP
change this? Also the strange thing is that locally it works fine but not
live. So I am guessing that there is a problem with a certain version of
PHP?

Also Im not sure what else could be causing this problem?

Any ideas or hints would be appreciated.

Thanks




Kind regards, 
Angelo Zanetti 
Application Developer   
________________________________


Web: http://www.elemental.co.za 



--- End Message ---
--- Begin Message ---
On Mon, Mar 10, 2008 at 9:22 AM, Angelo Zanetti <[EMAIL PROTECTED]> wrote:
>  There fore it isn't an array of colors within the session array. How can PHP
>  change this? Also the strange thing is that locally it works fine but not
>  live. So I am guessing that there is a problem with a certain version of
>  PHP?

    From where is the color data coming in to the script, a database?
Check to make sure that the array is being populated.  Also, you're
not attempting to pass the session from your dev box to your live box,
are you?

-- 
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

--- End Message ---
--- Begin Message ---

-----Original Message-----
From: Daniel Brown [mailto:[EMAIL PROTECTED] 
Sent: 10 March 2008 16:04
To: Angelo Zanetti
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] SESSION Array problem - possibly different PHP versions?

On Mon, Mar 10, 2008 at 9:22 AM, Angelo Zanetti <[EMAIL PROTECTED]>
wrote:
>  There fore it isn't an array of colors within the session array. How can
PHP
>  change this? Also the strange thing is that locally it works fine but not
>  live. So I am guessing that there is a problem with a certain version of
>  PHP?

    From where is the color data coming in to the script, a database?
Check to make sure that the array is being populated.  Also, you're
not attempting to pass the session from your dev box to your live box,
are you?


Hi Daniel, thanks for the reply.

The system works as follows.

There is a colour picker, when a user clicks on a colour then it opens a
popup window with the color set as a GET variable.

They can then enter the price per colour etc... once done, they save it. It
then saves the details to a session.

The user then closes the window and it refreshes the parent page which has
the colour picker and a listing of selected colours already choosen, after
the refresh it shows the array values (print_r) and is correct the first
time:

[color] => Array ( [0] => #339933

Then if they do the same procedure again, once the popup opens it shows the
session variable as:

[color] => #339933

But nothing has been done to the SESSION variables since the save, so
somehow between the the click and the popup opening something strange is
happening.

Like I mentioned it works on a local laptop as well as our local server so
its strange, I have tried many times closing the browser to ensure all
sessions are cleared.

Any ideas what might be causing this error? 

Thanks very much


--- End Message ---
--- Begin Message --- Put a print_r($_SESSION) at the top and bottom of your page code so you can see what's happening.

Also check your code that updates the session assignment by the GET value. It appears your code maybe unset()ing the session assignments.

Are you using Cookies? If so, check this code carefully as it can cause non obvious things depending on whether the client machine has cookies enabled or disabled.

Angelo Zanetti wrote:
Hi All,
I have a problem that only occurs on our live server and not our local
server.

It works fine locally.

Basically I am using a session array to store values of product colours. A
user can add colours to the session array.

The session is defined as follows:

$_SESSION['color'][$counter] = $color;

Obviously the first time we validate and the $counter is set to 0.

When more colours are added the $counter variable increments and should
increment the value of the array.

The colours are added through a popup window. Before I open the popup window
I print_r($_SESSION['color']) to view the contents of the array and make
sure that they are valid and it is an array.

Output is as follows:
[color] => Array ( [0] => #339933 [1] => #cccc00 ) etc...



Then once the popup opens I do the same print_r And it now shows: [color] => #339933
There fore it isn't an array of colors within the session array. How can PHP
change this? Also the strange thing is that locally it works fine but not
live. So I am guessing that there is a problem with a certain version of
PHP?

Also Im not sure what else could be causing this problem?

Any ideas or hints would be appreciated.

Thanks




Kind regards, Angelo Zanetti Application Developer
________________________________


Web: http://www.elemental.co.za


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

Is it a good idea to put a cart in a session var since the cart will be an 
array ?

Thanks 



--- End Message ---
--- Begin Message ---
On Sat, Mar 8, 2008 at 4:18 PM, Bill <[EMAIL PROTECTED]> wrote:
> Hi
>
>  Is it a good idea to put a cart in a session var since the cart will be an
>  array ?

    Yes, and it's far more secure than putting the actual data into a
cookie, since that can be changed on the client-side to alter prices
and other data.

-- 
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

--- End Message ---
--- Begin Message ---
On Sun, Mar 9, 2008 at 7:54 AM, Ian M. Evans <[EMAIL PROTECTED]> wrote:
>  Under Apache and the PHP module:
>  a) test.php path_info is blank
>  b) test.php/ppp path_info=/ppp
>
>  Under PHP FastCGI:
>  c) test.php path_info is test.php
>  d) test.php/ppp path_info=/ppp
>
>  Not sure why it's not blank in 'c' and instead equals the filename.

    Are both tests being done through Nginx?

    There are several differences you'll come across over time when
using PHP compiled different ways.  That may just another one of them.
 Because I actually think that it's Nginx' response to PHP when
querying the environment, meaning more of an issue with Nginx than
PHP.

    Just a guess, though.  I've never used that HTTP server before, so
I'll defer to someone else with experience with Nginx.

-- 
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

--- End Message ---
--- Begin Message ---
On Sat, Mar 8, 2008 at 11:18 PM, Lamonte <[EMAIL PROTECTED]> wrote:
> I was wondering this because at the moment using simplexml_load_file
>  makes my script go at about 2 seconds per page load, in a loop.  Then I
>  created a cache system so it doesn't keep loading the xml file, but I'm
>  wondering if theres a faster way to load xml QUICKER, is it possible
>  with "file_get_contents" and "simplexml_load_string" ?

    Yes, and you may notice performance enhancements because you're
now going to parse the XML data line-by-line as opposed to parsing the
entire file at once.

-- 
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

--- End Message ---
--- Begin Message ---
Is it necessary to use session_register()?  What exactly was the point of
this function if you can set sessions using $_SESSION it self?

--- End Message ---
--- Begin Message ---
On 3/10/08, Lamonte H <[EMAIL PROTECTED]> wrote:
> Is it necessary to use session_register()?  What exactly was the point of
>  this function if you can set sessions using $_SESSION it self?

session_register() accepts a variable parameter list and does not
require a call to session_start() prior to it's use.

http://php.net/session_register


-- 
Greg Donald
http://destiney.com/

--- End Message ---
--- Begin Message ---
On Mon, Mar 10, 2008 at 12:08 PM, Lamonte H <[EMAIL PROTECTED]> wrote:
> Is it necessary to use session_register()?  What exactly was the point of
>  this function if you can set sessions using $_SESSION it self?
>

    RTFM: http://php.net/session-register.php

    It's the old way of doing it, and will only work with
register_globals on anyway.  It also depends on how antiquated the
version of PHP is that you're using.

-- 
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

--- End Message ---
--- Begin Message ---
On Mon, Mar 10, 2008 at 12:15 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Mon, Mar 10, 2008 at 12:08 PM, Lamonte H <[EMAIL PROTECTED]> wrote:
>  > Is it necessary to use session_register()?  What exactly was the point of
>  >  this function if you can set sessions using $_SESSION it self?
>  >
>
>     RTFM: http://php.net/session-register.php

    :-\ Sorry, should be:
        http://php.net/session-register

-- 
</Dan>

Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>

--- End Message ---
--- Begin Message ---
Read the current php manual.

Lamonte H wrote:
Is it necessary to use session_register()?  What exactly was the point of
this function if you can set sessions using $_SESSION it self?


--- End Message ---
--- Begin Message ---
So you wouldn't need to use session_start() when dealing with
session_register()?

On 3/10/08, Daniel Brown <[EMAIL PROTECTED]> wrote:
>
> On Mon, Mar 10, 2008 at 12:15 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> > On Mon, Mar 10, 2008 at 12:08 PM, Lamonte H <[EMAIL PROTECTED]> wrote:
> >  > Is it necessary to use session_register()?  What exactly was the
> point of
> >  >  this function if you can set sessions using $_SESSION it self?
> >  >
> >
> >     RTFM: http://php.net/session-register.php
>
>    :-\ Sorry, should be:
>        http://php.net/session-register
>
> --
> </Dan>
>
> Daniel P. Brown
> Senior Unix Geek
> <? while(1) { $me = $mind--; sleep(86400); } ?>
>

--- End Message ---
--- Begin Message ---
session_register is old school. RTFM.

On Mon, Mar 10, 2008 at 4:26 PM, Al <[EMAIL PROTECTED]> wrote:

> Read the current php manual.
>
> Lamonte H wrote:
> > Is it necessary to use session_register()?  What exactly was the point
> of
> > this function if you can set sessions using $_SESSION it self?
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
If you are building select menus on the fly using javascript, look at
php's json_encode function. It will create a JSON representation of your
php data structure. Makes "passing" data sets to javascript very easy.
Just build your array of allowed options in php, plug the data into your
javascript via json_encode() and let javascript build the menu options.


Ken Kixmoeller wrote:
> Hey - - -- - -- --
> 
> I keep a profile of a user's rights and responsibilities in tables.
> Since this profile defines what a user can do in the system I am
> designing, I'd like to build a JavaScript menu navigation scheme. I need
> it to be driven programmatically, because the Admin users can add and
> remove tasks to the system or to a given user at-will.
> 
> I already built a similar thing using CSS-only menus, but it just wasn't
> aesthetically flexible enough. I am exploring other options, but I am
> wondering if any of you have done something similar and have any samples
> or advice.
> 
> Ken

--- End Message ---
--- Begin Message --- Thank you -- I don't know about those functions -- I'll check them out (for general knowledge, too)...

Ken


On Mar 10, 2008, at 12:01 PM, Roberto Mansfield wrote:

If you are building select menus on the fly using javascript, look at
php's json_encode function. It will create a JSON representation of your
php data structure. Makes "passing" data sets to javascript very easy.
Just build your array of allowed options in php, plug the data into your javascript via json_encode() and let javascript build the menu options.


Ken Kixmoeller wrote:
Hey - - -- - -- --

I keep a profile of a user's rights and responsibilities in tables.
Since this profile defines what a user can do in the system I am
designing, I'd like to build a JavaScript menu navigation scheme. I need
it to be driven programmatically, because the Admin users can add and
remove tasks to the system or to a given user at-will.

I already built a similar thing using CSS-only menus, but it just wasn't
aesthetically flexible enough. I am exploring other options, but I am
wondering if any of you have done something similar and have any samples
or advice.

Ken

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



--- End Message ---
--- Begin Message ---
Hi Everyone, Happy Monday to all of you!

I am trying to think through a user management issue for a application I am working on. What I want to do, is be able to provide a multi user environment (All accessing the same page, but depending on company name they get different data) and be able to give certain people the ability to add/remove users.

What I was thinking about doing was a combination of the company name (Which I set right now) and then a access level such as "50" for the "Owner" of the program, "40" for the "Managers" and "30" for the "user" of the program. also leaving me room to add other levels if required..

Although now that I'm typing this out.... I think I may have thought my way through the problem....

What about setting up a separate login/password with a different web address so that "Owner's" can go to an admin section and add/remove users... promote/demote users... And all that fun kind of stuff.

Is there any issues that anyone can see with what I'm thinking? Either with my original solution, or my secondary solution? :)


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]




--- End Message ---

Reply via email to