[PHP] Website and Mozilla/Firefox

2005-01-10 Thread Lester Caine
All of a sudden I am having problems with www.php.net, selecting 
download or manual flashes up the relevant page, and then it goes blank. 
It's doing it on three machines that have been accessing those pages 
fine for weeks, with both Firefox1 and Mozilla1.7, and nothing has been 
changed on the machines.
If I switch to my gash client machine that has IE on, things are OK, and 
changing mirrors gives the same problem.

Anybody seeing/seen the same problem?
I don't fancy having to use IE just to look at the php pages :(
--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP Accellerator into Zend Engine2 by default

2005-01-10 Thread kioto
PHP is scripting language interpreted and not compiled.
I want know about the difference beetwean the bytecode of JSP and ASP.NET
than PHP-Accelerator. Why this extension isn't a built-in into Zend 
Engine parsing ?
This is a better solution to comparison  the performace of PHP versus 
other technologies like JSP and ASP.NET ?

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


SV: [PHP] Website and Mozilla/Firefox

2005-01-10 Thread Tommy Skarateppen
I have exactly the same problem. I've never had problems displaying the
php.net site with Firefox before, but now suddenly it flashes the correct
page for a short moment before it goes blank. It seems like I'm beeing
redirected to a new location. If I manage to hit the Esc-button, before I'm
redirected, I can view the page. What's happening? Anyone have a solution
for this? As Lester Caine says, I don't fancy having to use IE just to look
at the php pages...

-Tommy

-Opprinnelig melding-
Fra: Lester Caine [mailto:[EMAIL PROTECTED] 
Sendt: 10. januar 2005 09:24
Til: php-general@lists.php.net
Emne: [PHP] Website and Mozilla/Firefox


All of a sudden I am having problems with www.php.net, selecting 
download or manual flashes up the relevant page, and then it goes blank. 
It's doing it on three machines that have been accessing those pages 
fine for weeks, with both Firefox1 and Mozilla1.7, and nothing has been 
changed on the machines.
If I switch to my gash client machine that has IE on, things are OK, and 
changing mirrors gives the same problem.

Anybody seeing/seen the same problem?
I don't fancy having to use IE just to look at the php pages :(

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

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

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



[PHP] exec() function

2005-01-10 Thread akshay
exec() function is not working.
Is there any setting in PHP.ini
--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: SV: [PHP] Website and Mozilla/Firefox

2005-01-10 Thread Richard Davey
Hello Tommy,

Monday, January 10, 2005, 9:30:23 AM, you wrote:

TS I have exactly the same problem. I've never had problems displaying the
TS php.net site with Firefox before, but now suddenly it flashes the correct
TS page for a short moment before it goes blank. It seems like I'm beeing
TS redirected to a new location. If I manage to hit the Esc-button, before I'm
TS redirected, I can view the page. What's happening? Anyone have a solution
TS for this? As Lester Caine says, I don't fancy having to use IE just to look
TS at the php pages...

Same happens here too - I think we can safely say someone has utterly
foo-bar'd the PHP site in a recent change.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

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



Re: [PHP] Website and Mozilla/Firefox

2005-01-10 Thread John Holmes
Lester Caine wrote:
All of a sudden I am having problems with www.php.net, selecting 
download or manual flashes up the relevant page, and then it goes blank. 
It's doing it on three machines that have been accessing those pages 
fine for weeks, with both Firefox1 and Mozilla1.7, and nothing has been 
changed on the machines.
If I switch to my gash client machine that has IE on, things are OK, and 
changing mirrors gives the same problem.
I switched from using the us2.php.net mirror to the us4.php.net mirror 
and things were fine.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Website and Mozilla/Firefox

2005-01-10 Thread Lester Caine
John Holmes wrote:
  I switched from using the us2.php.net mirror to the us4.php.net mirror
and things were fine.
That has been 'knobled' now.
At least now I know I'm not going mad ;)
--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] exec() function

2005-01-10 Thread tr
akshay  wrote / napsal (a):
exec() function is not working.
Is there any setting in PHP.ini
Do you use PHP5?
If yes, use instead:   example:  $var=shell_exec('ls');
trobi
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] *** glibc detected *** double free or corruption: error

2005-01-10 Thread Alex Greg
On Mon, 10 Jan 2005 06:58:21 +0600, Raditha Dissanayake
[EMAIL PROTECTED] wrote:
 Alex Greg wrote:
 
 (apologies if this reaches the list twice - the first time I sent it,
 it didn't arrive within 12 hours)
 
 Hi,
 
 Recently I migrated the front-end of our bulletin board (running
 phpBB, patched against the recently highlight vulnerability) to a pair
 of servers running Fedora Core 3. I compiled Apache 1.3.33 and PHP
 4.3.10 from source. The MySQL database is running on a separate machine.
 
 This morning, the servers slowed down to the point that they were
 almost completely unresponsive. After a while I managed to SSH into
 the machines and saw that the httpd processes had grown to 35MB each
 and were using up all the swap and RAM on the machines (they have 1GB
 RAM, 1GB swap). I then set MaxClients to 30 and restarted Apache, but
 the slowdown happened again:
 
 
 I then checked the error log and found this:
 
 *** glibc detected *** double free or corruption: 0x097ec7e8 ***
 
 
 Quite curiously I had this same problem just yesterday and spent quite a
 bit of time scratching around trying to get it to work again. I upgraded
 all of apache, glibc and php to know avail. Though this error had been
 seen many times before by others i found nothing relevent in google. In
 my case however it turned out to be a really trivial and stupid mistake:
 I had AddModule lines for the both the PHP4 and PHP5 SO in my httpd.conf
 file.  Please check your own httpd.conf file. If not that it could also
 be conflicting extensions.

On Mon, 10 Jan 2005 06:58:21 +0600, Raditha Dissanayake
[EMAIL PROTECTED] wrote:
 Alex Greg wrote:
 
 (apologies if this reaches the list twice - the first time I sent it,
 it didn't arrive within 12 hours)
 
 Hi,
 
 Recently I migrated the front-end of our bulletin board (running
 phpBB, patched against the recently highlight vulnerability) to a pair
 of servers running Fedora Core 3. I compiled Apache 1.3.33 and PHP
 4.3.10 from source. The MySQL database is running on a separate machine.
 
 This morning, the servers slowed down to the point that they were
 almost completely unresponsive. After a while I managed to SSH into
 the machines and saw that the httpd processes had grown to 35MB each
 and were using up all the swap and RAM on the machines (they have 1GB
 RAM, 1GB swap). I then set MaxClients to 30 and restarted Apache, but
 the slowdown happened again:
 
 
 I then checked the error log and found this:
 
 *** glibc detected *** double free or corruption: 0x097ec7e8 ***
 
 
 Quite curiously I had this same problem just yesterday and spent quite a
 bit of time scratching around trying to get it to work again. I upgraded
 all of apache, glibc and php to know avail. Though this error had been
 seen many times before by others i found nothing relevent in google. In
 my case however it turned out to be a really trivial and stupid mistake:
 I had AddModule lines for the both the PHP4 and PHP5 SO in my httpd.conf
 file.  Please check your own httpd.conf file. If not that it could also
 be conflicting extensions.

Hi,


I've checked our httpd.conf files, and we're only loading PHP once:


LoadModule php4_modulelibexec/libphp4.so
...
AddModule mod_php4.c


Additionally, does anyone know why the httpd processes are growing so
big? This is common under mod_perl as it caches compiled code in
memory, but PHP doesn't do this so I've no idea why the httpd
processes are in the region of 35MB each. The only application we're
running on these servers is phpBB. Possibly PHP is leaking memory?


The reason why we didn't see this on our Fedora Core 1 servers is
because the glibc on Fedora Core 3 reports these corruptions (whereas
FC1's glibc doesn't). However, we do still see the 35MB httpd
processes on Fedora Core 1. From the FC3 release notes:


   glibc
 The version of glibc provided with Fedora Core 3 performs
 additional internal sanity checks to prevent and detect data
 corruption as early as possible. By default, should corruption
 be detected, a message similar to the following will be displayed
 on standard error (or logged via syslog if stderr is not open):

 *** glibc detected *** double free or corruption: 0x0937d008 ***

 By default, the program that generated this error will also be
 killed; however, this (and whether or not an error message is
 generated) can be controlled via the MALLOC_CHECK_ environment
 variable. The following settings are supported:

   0 -- Do not generate an error message, and do not kill the program
   1 -- Generate an error message, but do not kill the program
   2 -- Do not generate an error message, but kill the program
   3 -- Generate an error message and kill the program

 Note

 If MALLOC_CHECK_ is explicitly set a value other than 0, this
 causes glibc to perform more tests that are more extensive than
 the default, and may impact performance.

 Should you have 

[PHP] strange sessions

2005-01-10 Thread Tim Burgan
Hello,
I'm experiencing a weird thing regarding sessions - that I'm using for 
user authorisation.

I have a page that the public can view (index.php) that includes a 
login button. When the login button is clicked a new window pops-up and 
asks for username and password. The user is then logged-in. The parent 
page then detects using sessions that the user is logged-in and includes 
the text and link Joe Bloggs: [logout].

All the public content on this website is viewed via index.php. For 
example, a URL to about us or contact details may be 
index.php?keyword=about or index.php?keyword=contact.

The a user is not logged in, all links within the page work fine, but 
when the user IS logged in, a hyperlink from one page to another page 
(whose URL contains a different 'keyword') doesn't work. The browsers 
address bar updates to reflect the new page, but the web page never 
changes (even when I physically type a different 'keyword' into the 
address bar). Changing physical files (ie. index.php to main.php) does work.

As soon as I click 'logout' which destroys the user's session, 
everything returns to normal.

Is there something I'm missing here?
Thank you for your time.
Regards
Tim
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Website and Mozilla/Firefox

2005-01-10 Thread M. Sokolewicz
Lester Caine wrote:
John Holmes wrote:
  I switched from using the us2.php.net mirror to the us4.php.net mirror
and things were fine.

That has been 'knobled' now.
At least now I know I'm not going mad ;)
it's because of an issue with the JS scripts. Just have to wait and see 
if anyone gets to fixing it. Just turning off Javascript when visiting 
the manual works fine.

The reason us4. work(s|ed) is because it's not up-to-date (yet)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] unpacking $_POST when example[1], example[2] in form.

2005-01-10 Thread Benjamin Edwards
If I have a form with elements like

input type=text name=example[1]
input type=text name=example[2]

If example was not an array it would be accessed using

$_POST[example]

But how do I access the varable if it is an array like above.

Ben





Re: [PHP] Website and Mozilla/Firefox

2005-01-10 Thread M. Sokolewicz
M. Sokolewicz wrote:
Lester Caine wrote:
John Holmes wrote:
  I switched from using the us2.php.net mirror to the us4.php.net mirror
and things were fine.

That has been 'knobled' now.
At least now I know I'm not going mad ;)
it's because of an issue with the JS scripts. Just have to wait and see 
if anyone gets to fixing it. Just turning off Javascript when visiting 
the manual works fine.

The reason us4. work(s|ed) is because it's not up-to-date (yet)
turning automatic search completion off via my.php.net works aswell 
(but to get there you also need to turn off JS)

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


Re: [PHP] unpacking $_POST when example[1], example[2] in form.

2005-01-10 Thread Thomas Munz
$_POST[example][1]
$_POST[example][2]

 If I have a form with elements like

 input type=text name=example[1]
 input type=text name=example[2]

 If example was not an array it would be accessed using

 $_POST[example]

 But how do I access the varable if it is an array like above.

 Ben

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



[PHP] What program to use to make thumbnail images?

2005-01-10 Thread John Holmes
What do you guys recommend for making thumbnails from uploaded images? I 
know of the GD extension, Imagemagik and netpbm. Any other 
recommendations or opinions on which of the above work best with PHP? 
Thanks.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] $_REQUEST

2005-01-10 Thread Benjamin Edwards
Trying to get my head around relationship between/use of  $_GET, $_POST and  
$_REQUEST.

It seems to me that  $_REQUEST is most useful as if it is used in place of 
$_POST/$_GET it would be possible to change posting method without changing the 
code. 

I am kind of assuming that $_REQUEST is and aggregate of $_POST, $_GET and 
$_FILES.  Is this correct or are there differences.

Ben








Re: [PHP] $_REQUEST

2005-01-10 Thread Thomas Munz
Be carfull with this super var. This var is a merge of the GET, POST and 
FILES, and so only 1 index can only exists. If you have an index in the POST 
field called 'test' and also and index calles test in the FILES or GET var, 
than only one index of them is avaible and the other are gone

I recommend to use the GET, POST and FILES var instead of the REQUEST var..

Am Montag, 10. Januar 2005 13:33 schrieb Benjamin Edwards:
 Trying to get my head around relationship between/use of  $_GET, $_POST and
  $_REQUEST.

 It seems to me that  $_REQUEST is most useful as if it is used in place of
 $_POST/$_GET it would be possible to change posting method without changing
 the code.

 I am kind of assuming that $_REQUEST is and aggregate of $_POST, $_GET and
 $_FILES.  Is this correct or are there differences.

 Ben

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



Re: [PHP] $_REQUEST

2005-01-10 Thread John Holmes
Benjamin Edwards wrote:
I am kind of assuming that $_REQUEST is 
and aggregate of $_POST, $_GET and $_FILES.  
Is this correct or are there differences.
It's a combo of $_GET, $_POST and $_COOKIE.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] On large application organization [long and possibly boring]

2005-01-10 Thread Jay Blanchard
[snip]
 Josh, I am interested in what you mean by but there may be a better
 overall approach. 

The reason I say that is because, though I'm no expert on application
design, in my own code I've found that whenever I'm tempted to use a big
switch, it's probably a better idea for me to make a class hierarchy.  I
just have a hard time imagining a case where a big switch accurately
represents the problem to be solved, since in real life solving problems
is more complicated than a flat set of totally isolated operations.
[/snip]

The switch in this case is being used by the application as you would a
main() in C++ to a large degree. Here is an example

error checking and validation (ECV) function / class is loaded at the
top because it can be used for all switch cases;
database connection module is loaded at top, it can be used for all
switch cases

form A is handled by case A. form A is unique in the tables that it
utilizes.
form B is handled by case B. form B is unique in the tables that it
utilizes.
and so on...perhaps 20 - 30 forms

Also, the completion of form A may dictate that n more forms must be
completed. The user completing form A needs only to see the forms
designated during the processing of form A. In a couple of cases
subsequent forms will require the successful completion of additional
forms.

The forms in this case are quite independent of each other from a
processing point of view. They do rely on certain holistic items, such
as ECV and DB connections that are also held in seperate files.

As for management. Since there are several developers working on the
project this method of management works quite cleanly. Each can complete
isolated form coding without disturbing another developer's progress.
All have applications flowcharts and have the hooks to the ECV API and
DB connection API. If a module needs to be taken off line it does not
affect the operation of the remainder of the application.

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



Re: [PHP] Website and Mozilla/Firefox

2005-01-10 Thread Erwin Kerk
M. Sokolewicz wrote:
M. Sokolewicz wrote:
Lester Caine wrote:
John Holmes wrote:
  I switched from using the us2.php.net mirror to the us4.php.net 
mirror

and things were fine.


That has been 'knobled' now.
At least now I know I'm not going mad ;)
it's because of an issue with the JS scripts. Just have to wait and 
see if anyone gets to fixing it. Just turning off Javascript when 
visiting the manual works fine.

The reason us4. work(s|ed) is because it's not up-to-date (yet)

turning automatic search completion off via my.php.net works aswell 
(but to get there you also need to turn off JS)

Seems to be solved...
Erwin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: unable to load curl

2005-01-10 Thread Jason Barnett
Sagar C Nannapaneni wrote:
Hi,
I've got a strange issue here
i'm using apache2 with php 4.3.9 on win 2000.
I've pointed the php extension directory to
extension_dir = C:\php\extensions
where all the extension dlls reside.
All extensions are working and all dlls are loading properly,,
What do you mean by this statement?  How do you know this if you claim 
that cURL is not loading (it is an extension)...  have you tried phpinfo() ?

but when i try to load curl i'm getting an error saying that
Unable to load module. C:\php\extensions\php_curl.dll could not be found
But i can see the file from the file browser.
Please help me out...
/sagar

--
Teach a person to fish...
Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://php.net/manual/
php-general archives: http://marc.theaimsgroup.com/?l=php-generalw=2
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP Accellerator into Zend Engine2 by default

2005-01-10 Thread Jason Barnett
Kioto wrote:
PHP is scripting language interpreted and not compiled.
I want know about the difference beetwean the bytecode of JSP and ASP.NET
than PHP-Accelerator. Why this extension isn't a built-in into Zend 
Engine parsing ?
This is a better solution to comparison  the performace of PHP versus 
other technologies like JSP and ASP.NET ?
Because caching PHP code is one of the product lines offered by Zend, 
the company that sponsors PHP.  (I mean that in the loosest way 
possible, hopefully I won't get bludgeoned for saying this!)

So you are welcome to use the PHP-Accelerator software or any of the 
other caching programs out there... but asking Zend / the PHP developers 
to give this away with the core PHP download is a bit like biting the 
hand that feeds you.

--
Teach a person to fish...
Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://php.net/manual/
php-general archives: http://marc.theaimsgroup.com/?l=php-generalw=2
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: strange sessions

2005-01-10 Thread Jason Barnett
What was your question?
Well if the problem is continuing sessions you need to either use 
cookies or append a session id to the end of a URL.

--
Teach a person to fish...
Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://php.net/manual/
php-general archives: http://marc.theaimsgroup.com/?l=php-generalw=2
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: unable to load curl

2005-01-10 Thread Jason Barnett
Please respond to the newsgroup and not to my personal email.
quoteIs it a file access/ownership thing?/quote
This is possible.  Have you checked permissions for PHP user?  My 
original question remains unanswered though and it is probably a better 
place to start...

 extension_dir = C:\php\extensions

 where all the extension dlls reside.
 All extensions are working and all dlls are loading properly,,
What do you mean by this statement? How do you know this if you claim
that cURL is not loading (it is an extension)... have you tried phpinfo() ?
--
Teach a person to fish...
Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://php.net/manual/
php-general archives: http://marc.theaimsgroup.com/?l=php-generalw=2
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: What program to use to make thumbnail images?

2005-01-10 Thread zerof
John Holmes wrote:
What do you guys recommend for making thumbnails from uploaded images? I 
know of the GD extension, Imagemagik and netpbm. Any other 
recommendations or opinions on which of the above work best with PHP? 
Thanks.

--
Good choice,
http://coppermine.sourceforge.net/demo/
---
zerof
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] *** glibc detected *** double free or corruption: error

2005-01-10 Thread Richard Lynch
  By default, the program that generated this error will also be
  killed; however, this (and whether or not an error message is
  generated) can be controlled via the MALLOC_CHECK_ environment
  variable. The following settings are supported:

0 -- Do not generate an error message, and do not kill the
 program
1 -- Generate an error message, but do not kill the program
2 -- Do not generate an error message, but kill the program
3 -- Generate an error message and kill the program

  Note

  If MALLOC_CHECK_ is explicitly set a value other than 0, this
  causes glibc to perform more tests that are more extensive than
  the default, and may impact performance.

Try setting MALLOC_CHECK_ to 0 -- to get back to your old behaviour.

Perhaps it is glibc's error-checking and logging and whatever internal
state it is keeping that is causing more problems than it fixes...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] long running page on apache 2

2005-01-10 Thread Richard Lynch
Bret Hughes wrote:
 As I begin to write this I wonder if this really an apache issue but
 will ask here to see if anyone has some idea.

 We have a php interface to our system running apache 2 on fedora 1 box.
 One page calls a script that does a system() call on a script that runs
 for several minutes.  The issue is that no other calls to the server
 will return from the client until the script returns.  I like the

From the *same* browser?

Cuz, like, some browsers only allow one connection at a time, others limit
it to 4, some let you configure it, some don't...

Check your browser settings or try a different browser to access other
content while the first browser plugs away at the slow stuff.

You can also throw something like Apache Benchmark at your server to see
if the children are behaving.  It should be pretty apparent if things are
out of whack with that, I should think.

 ability to watch the progress of this script but is suppose I can send
 the output to a file and occasionally retrieve the contents of the file
 but that seems really inefficient.  If there is another way to have
 apache process additional requests, from the same client, that would be
 a good thing.  As far as  can tell, the same apache process is is used
 each time, but i am having trouble verifying that to my satisfaction.

Always seems to me like the same child will get used unless you actually
manage to get TWO requests through at the same time.

Presumably, this is more efficient, as it avoids having to page memory to
swap in another child.

 All work is done in https and there is extensive use of php sessions on
 the system if that makes a difference.

Shouldn't matter, I don't think.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] strange sessions

2005-01-10 Thread Richard Lynch
Tim Burgan wrote:
 The a user is not logged in, all links within the page work fine, but
 when the user IS logged in, a hyperlink from one page to another page
 (whose URL contains a different 'keyword') doesn't work. The browsers
 address bar updates to reflect the new page, but the web page never
 changes (even when I physically type a different 'keyword' into the
 address bar). Changing physical files (ie. index.php to main.php) does
 work.

 As soon as I click 'logout' which destroys the user's session,
 everything returns to normal.

 Is there something I'm missing here?

Can't be sure without looking at it, but the first thing to check is what
th elinks really are when you are logged in.

Use View Source in your browser to see what the HREF= actually has as a
value.

After that, I'd say start looking at your session code -- particularly
checknig your error logs.  If you don't have any error-checking going on
in your login code, now is the time to add it.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] How do I start at a specific position in an array? Is there

2005-01-10 Thread Richard Lynch
Thomas Goyne wrote:
 On Sun, 09 Jan 2005 15:59:43 +0100, M. Sokolewicz [EMAIL PROTECTED] wrote:

 that's not a SPECIFIC place in the array, that's just current, next and
 previous. AFAIK there is no way to explicitly set the internal pointer
 of the array to a spcified place. I used a function which basically
 looped trough the array until it got to the correct depth, and then
 returned it by referencebut it's not very efficient :S


 Why would you ever want to do that other than to waste cycles?

I'll give you a simple case.

I have a GTK PHP MP3 ID3 editor application I'm working on.

When one opens a file in a directory, I provide next/prev buttons to
quickly page to the next/prev file in the directory.

Getting the next/prev to work is simple enough, but...

I've got the whole array built from opendir/readdir, and sorted it into
alphabetical order.

I've got a filename inside that array, from the pre-defined
GtkFileSelection dialog.

So I need to initialize the internal array pointer to the position of the
file within that array, there is no such PHP function.

See also:
http://bugs.php.net/bug.php?id=31375

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] mail() w/ postfix problem in Fedora Core 3

2005-01-10 Thread Nathaniel Price
I've been searching for the solution to this problem to no avail.
I recently did a clean install of FC3 on a server that was running RH8. 
There were a number of PHP scripts that I had configured to send out 
email for notices or passwords or the like. However, now that I've 
upgraded I can't send mail through the mail() command in PHP.

My problem is exactly like what I found here, but unfortunately that 
question was left unanswerd: 
https://www.redhat.com/archives/fedora-list/2004-December/msg06708.html

To summarize, I have no problem sending email via SMTP (one of the apps 
I run has the option to choose between using PHP mail() or using it's 
own SMTP client). Whenever I try to send mail with mail(), apache logs 
the following error:
  sendmail: fatal: chdir /var/spool/postfix: Permission denied
Postfix logs nothing.

I have checked the permissions on the /var/spool/postfix directory, and 
they seem to be in order:
  drwxr-xr-x  16 root   root4096 Nov 23 05:11 postfix

php.ini is configured with:
  sendmail_path = /usr/sbin/sendmail -t -i
/usr/sbin/sendmail is a link to /etc/alternatives/mta which is a link to 
/usr/sbin/sendmail.postfix. All of these are world readable and executable.

This setting is not overriden anywhere else (tested with phpinfo()).
Does anyone know what's wrong and how to fix it? If not, is there a 
drop-in replacement for the sendmail command that will just forward the 
request to postfix via SMTP?

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


Re: [PHP] Global class instances mysteriously set to NULL

2005-01-10 Thread Richard Lynch
James \(IFMS\) wrote:
 I'm struggling to narrow this down, and am chasing my tail to figure
 this out. I apologise for the imprecise nature.

 PHP: 4.3.2 (latest RHEL 3 version; php-4.3.2-19.ent.src.rpm)
 OS: Linux kernel 2.4.21-15.0.3.EL
 Distro: RHEL 3, all updates

 I have an app that defines two global class instances, one for the
 database connection, the other for handling user authentication. The
 first is instantiated in uDatabase.php the other in uAuthenticate.php.

 In building a page, there are several files that call require_once with
 one or the other file, e.g.

 require_once 'uAuthenticate.php';

 Which creates an a global instance of a class defined in another file,
 performs some checks, c.

 I'm using require_once with the understanding that once this file has
 been included, that any subsequent require_once call to the same file
 will be ignored.

 My problem is that it appreas that in some cases require_once destroys
 the instance, i.e. var_dump($Auth); or var_dump($Database) displays NULL.

 I'm currently trying to determine rhyme or reason for the problem, but
 haven't found any pattern. It comes and goes depending on which file
 first calls require_once and the order, but makes no sense.

 ANY ideas apreciated. :-)

Most likely, somewhere along the way, one of your files is triggering some
condition which 'unsets' your variable.

It's also possible that you've got your require's out of sequence
somewhere in there.

Personally, I always structure my code so that there is only one place
where any given file will be require'd so I don't need require_once.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Super Gloabals Array

2005-01-10 Thread Elvie Limbo
Is it possible to put information into $_REQUEST super global array with 
using POST or GET?  
My problem is that I need information to be available globally but I don't 
want to use a form to do it.
Any pointers would be greatly appreciated.  

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



Re: [PHP] Which script runs first?

2005-01-10 Thread Richard Lynch
Rory Browne wrote:
 I don't know much about frames(I hate the things), but the only thing
 I'd count on would be that the main frame will be loaded first. would
 it be possible to load your session variables in this?

I wouldn't even count on the WHOLE file being loaded either...

EG:
FRAMESET ...
  FRAME ...
  FRAME ...
  NOFRAMES
Tons of stuff here -- the browser *could* be smart enough to start
loading them things up there before it processes all this...
  /NOFRAME
/FRAMESET
Much less a bunch of JavaScript garbage here.

 Another possibility would be to have the left frame do the loading of
 variables, and have the frame on the right as loading. Then when the
 left frame has loaded the variables, you can use javascript( using
 document.frames IIRC) to load the right page. This way you can be sure
 that the left page is loaded before the right page, since it is the
 left page that actually does do the loading of the right page. Your
 page is kinda screwed though if a visitor turns off javascript, like I
 do when I have the displeasure of having to use IE on Windows.

 Apologies Rens if you recieved this twice. I forgot to CC it the first
 time.

 On Sat, 08 Jan 2005 13:17:54 +0100, Rens Admiraal
 [EMAIL PROTECTED] wrote:
 The way frames are loaded is actually dependent of many things I think
 (size and browser e.g.), so, most secure is to use javascript, or, let
 PHP check if the var is set, and if not, reload...

 you can do this like this:

 javascript:
 left.php:
 body onload=parent.frames['targetframename'].location='page' // can
 be a little different, but I think it is correct...

 PHP method:
 in main.php:
 if (!isset ($_SESSION[var])) header (location:
 {$_SERVER[PHP_SELF]}); // or something like this what will do the
 same...

 [EMAIL PROTECTED] wrote:

 Hi there!
 
 I have two frames, one with left.php in the left frame and one with
 main.php in the right frame.
 
 I refresh the contents of main.hp at the end of left.php.  (With help
 of
 Javascript actually, maybe could be done with HEADER(...))
 
 My Question:
 Is it ALWAYS so that left.php must be executed before the right frame
 is
 loaded? I wonder this because a session-variable are set in left.php
 that
 main.php is dependent of. So this session-variable must be set before
 main.php is loaded.
 
 
 /G
 @varupiraten.se
 
 
 

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



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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Super Gloabals Array

2005-01-10 Thread John Nichel
Elvie Limbo wrote:
Is it possible to put information into $_REQUEST super global array with 
using POST or GET?  
My problem is that I need information to be available globally but I don't 
want to use a form to do it.
Any pointers would be greatly appreciated.  

$_SESSION ?  It won't be in the _REQUEST array, but it will be available 
globally.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mail() w/ postfix problem in Fedora Core 3

2005-01-10 Thread Richard Lynch
Nathaniel Price wrote:
 I've been searching for the solution to this problem to no avail.

 I recently did a clean install of FC3 on a server that was running RH8.
 There were a number of PHP scripts that I had configured to send out
 email for notices or passwords or the like. However, now that I've
 upgraded I can't send mail through the mail() command in PHP.

 My problem is exactly like what I found here, but unfortunately that
 question was left unanswerd:
 https://www.redhat.com/archives/fedora-list/2004-December/msg06708.html

 To summarize, I have no problem sending email via SMTP (one of the apps
 I run has the option to choose between using PHP mail() or using it's
 own SMTP client). Whenever I try to send mail with mail(), apache logs
 the following error:
sendmail: fatal: chdir /var/spool/postfix: Permission denied

Confirm what user PHP is running as.  http://php.net/phpinfo.php

su to that user.

try to do:
cd /var/spool/postfix

Or is 'chdir' not 'cd' ?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] How do I start at a specific position in an array? Is there

2005-01-10 Thread Robert Cummings
On Mon, 2005-01-10 at 11:28, Richard Lynch wrote:
 Thomas Goyne wrote:
  On Sun, 09 Jan 2005 15:59:43 +0100, M. Sokolewicz [EMAIL PROTECTED] wrote:
 
  that's not a SPECIFIC place in the array, that's just current, next and
  previous. AFAIK there is no way to explicitly set the internal pointer
  of the array to a spcified place. I used a function which basically
  looped trough the array until it got to the correct depth, and then
  returned it by referencebut it's not very efficient :S
 
 
  Why would you ever want to do that other than to waste cycles?
 
 I'll give you a simple case.
 
 I have a GTK PHP MP3 ID3 editor application I'm working on.
 
 When one opens a file in a directory, I provide next/prev buttons to
 quickly page to the next/prev file in the directory.
 
 Getting the next/prev to work is simple enough, but...
 
 I've got the whole array built from opendir/readdir, and sorted it into
 alphabetical order.
 
 I've got a filename inside that array, from the pre-defined
 GtkFileSelection dialog.
 
 So I need to initialize the internal array pointer to the position of the
 file within that array, there is no such PHP function.

Why not change your structure? Sounds like you want a linked list,
better yet a doubly linked list. So create a double linked list class,
link up your entries, and keep a hash available for fast lookup into the
linked list where the keys are the filenames or whatever you want to use
as an index, and the value is a reference to the interesting linked list
node.

Given that scenario you will have a currNode object which is the
currently selected song, and when someone moves up or down the list you
just do something like:

if( $currNode-hasNext() )
{
$currNode = $currNode-next();
}

Moving backward would be as simple as:

if( $currNode-hasPrevious() )
{
$currNode = $currNode-previous();
}

And if the user selects an arbitrary file:

$currNode = $lookupArray[$index];

This kind of structure works a lot like a doubly threaded red-black tree
:) Although a red-black tree would keep your entries in sorted order
whenever you add new entries in O( lg n ) time.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Super Gloabals Array

2005-01-10 Thread trobi
Elvie Limbo  wrote / napísal (a):
Is it possible to put information into $_REQUEST super global array with 
using POST or GET?  
My problem is that I need information to be available globally but I don't 
want to use a form to do it.
Any pointers would be greatly appreciated.  

 

use sessions or cookies.
trobi
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Super Gloabals Array

2005-01-10 Thread Richard Lynch
Elvie Limbo wrote:
 Is it possible to put information into $_REQUEST super global array with
 using POST or GET?
 My problem is that I need information to be available globally but I don't
 want to use a form to do it.
 Any pointers would be greatly appreciated.

E.  Yeah, I guess...

$_REQUEST starts off with $_POST/$_GET/$_COOKIES in it, but if you cram
something else in there, it's going to be there, almost for sure.

It's *NOT* a Good Idea, though.

What are you storing?

Just make your own arayy $_FOO and then declare it global in any functions
that use it.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] long running page on apache 2

2005-01-10 Thread Bret Hughes
On Mon, 2005-01-10 at 10:17, Richard Lynch wrote:
 Bret Hughes wrote:
  As I begin to write this I wonder if this really an apache issue but
  will ask here to see if anyone has some idea.
 
  We have a php interface to our system running apache 2 on fedora 1 box.
  One page calls a script that does a system() call on a script that runs
  for several minutes.  The issue is that no other calls to the server
  will return from the client until the script returns.  I like the
 
 From the *same* browser?
 
 Cuz, like, some browsers only allow one connection at a time, others limit
 it to 4, some let you configure it, some don't...
 
 Check your browser settings or try a different browser to access other
 content while the first browser plugs away at the slow stuff.
 
 You can also throw something like Apache Benchmark at your server to see
 if the children are behaving.  It should be pretty apparent if things are
 out of whack with that, I should think.
 
  ability to watch the progress of this script but is suppose I can send
  the output to a file and occasionally retrieve the contents of the file
  but that seems really inefficient.  If there is another way to have
  apache process additional requests, from the same client, that would be
  a good thing.  As far as  can tell, the same apache process is is used
  each time, but i am having trouble verifying that to my satisfaction.
 
 Always seems to me like the same child will get used unless you actually
 manage to get TWO requests through at the same time.
 
 Presumably, this is more efficient, as it avoids having to page memory to
 swap in another child.
 
  All work is done in https and there is extensive use of php sessions on
  the system if that makes a difference.
 
 Shouldn't matter, I don't think.
 

Thanks for the reply.  It turns out that it was session usage.  See my
other post if you haven't already.

Bret


 -- 
 Like Music?
 http://l-i-e.com/artists.htm

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



Re: [PHP] Super Gloabals Array

2005-01-10 Thread Rasmus Lerdorf
Elvie Limbo wrote:
Is it possible to put information into $_REQUEST super global array with 
using POST or GET?  
My problem is that I need information to be available globally but I don't 
want to use a form to do it.
Any pointers would be greatly appreciated.  
No.  Use $GLOBALS instead.
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mail() w/ postfix problem in Fedora Core 3

2005-01-10 Thread Rasmus Lerdorf
Nathaniel Price wrote:
I've been searching for the solution to this problem to no avail.
I recently did a clean install of FC3 on a server that was running RH8. 
There were a number of PHP scripts that I had configured to send out 
email for notices or passwords or the like. However, now that I've 
upgraded I can't send mail through the mail() command in PHP.

My problem is exactly like what I found here, but unfortunately that 
question was left unanswerd: 
https://www.redhat.com/archives/fedora-list/2004-December/msg06708.html

To summarize, I have no problem sending email via SMTP (one of the apps 
I run has the option to choose between using PHP mail() or using it's 
own SMTP client). Whenever I try to send mail with mail(), apache logs 
the following error:
  sendmail: fatal: chdir /var/spool/postfix: Permission denied
Postfix logs nothing.

I have checked the permissions on the /var/spool/postfix directory, and 
they seem to be in order:
  drwxr-xr-x  16 root   root4096 Nov 23 05:11 postfix

php.ini is configured with:
  sendmail_path = /usr/sbin/sendmail -t -i
/usr/sbin/sendmail is a link to /etc/alternatives/mta which is a link to 
/usr/sbin/sendmail.postfix. All of these are world readable and executable.

This setting is not overriden anywhere else (tested with phpinfo()).
Does anyone know what's wrong and how to fix it? If not, is there a 
drop-in replacement for the sendmail command that will just forward the 
request to postfix via SMTP?
As always, the way to debug this is to sudo to the web server user id 
and issue the /usr/sbin/sendmail -t -i command on a mail message and 
figure out why it isn't working.  This has nothing to do with PHP.

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


Re: [PHP] How do I start at a specific position in an array? Is there

2005-01-10 Thread Richard Lynch
Robert Cummings wrote:
 On Mon, 2005-01-10 at 11:28, Richard Lynch wrote:
 Thomas Goyne wrote:
  On Sun, 09 Jan 2005 15:59:43 +0100, M. Sokolewicz [EMAIL PROTECTED]
 wrote:
 
  that's not a SPECIFIC place in the array, that's just current, next
 and
  previous. AFAIK there is no way to explicitly set the internal
 pointer
  of the array to a spcified place. I used a function which basically
  looped trough the array until it got to the correct depth, and then
  returned it by referencebut it's not very efficient :S
 
 
  Why would you ever want to do that other than to waste cycles?

 I'll give you a simple case.

 I have a GTK PHP MP3 ID3 editor application I'm working on.

 When one opens a file in a directory, I provide next/prev buttons to
 quickly page to the next/prev file in the directory.

 Getting the next/prev to work is simple enough, but...

 I've got the whole array built from opendir/readdir, and sorted it into
 alphabetical order.

 I've got a filename inside that array, from the pre-defined
 GtkFileSelection dialog.

 So I need to initialize the internal array pointer to the position of
 the
 file within that array, there is no such PHP function.

 Why not change your structure? Sounds like you want a linked list,
 better yet a doubly linked list. So create a double linked list class,
 link up your entries, and keep a hash available for fast lookup into the
 linked list where the keys are the filenames or whatever you want to use
 as an index, and the value is a reference to the interesting linked list
 node.

Uhhhm.  Yeah.

I could spend hours finding/writing a doubly-linked list class, which will
be a good bit slower and WAY more memory-bloated than the built-in PHP
doubly-linked list (aka 'array') and, in theory, I could code it so that
the 'set_current' function existed and was maybe a bit faster than walking
the PHP array...

But every *other* operation would be a lot slower, and I only need to walk
the list to initialize the internal current pointer once, when the user is
already distracted and slowed down by the Open File dialog.

I think the user experience will be *much* better without all that, though.

 if( $currNode-hasNext() )
 {
 $currNode = $currNode-next();
 }

if ($current != $array[count($array) - 1]) $current = next($array);

 Moving backward would be as simple as:

 if( $currNode-hasPrevious() )
 {
 $currNode = $currNode-previous();
 }

if ($current != $array[0]) $current = prev($array);

Actually, the buttons are disabled if you are on the first/last item, so
the checks for hasNext/hasPrevious are done elsewhere anyway.

 And if the user selects an arbitrary file:

 $currNode = $lookupArray[$index];

No, no, no.

The FileSelection already returns the filename.

Of course, I just *built* that array based on the directory they chose, so
could initialize the $current_index as the array got built...

So I'd need to keep an *INVERSE* array internally to do:
$current_index = $inversearray[$filename];

So then I'd be keeping track of the $current_index, at which point I'd not
even *NEED* to bother with next/prev and friends:  I'd just have a global
variable for the integer index in the array, and play with that in PHP.

No bloated class objects to track something as simple as an integer from 0
to (count($array) - 1)

Maybe I'll just ditch the internal prev/next stuff and use $CURRENT_INDEX
as a global everywhere and write my own prev/next functions to do integer
arithmetic instead.  Seems kinda silly when it's all already built-in to
PHP *except* set_current() but there ya go.

 This kind of structure works a lot like a doubly threaded red-black tree
 :) Although a red-black tree would keep your entries in sorted order
 whenever you add new entries in O( lg n ) time.

You're comparing O(lg n) in PHP to O(lg n) in built-in C from PHP.  Not
the same at all until we start hitting the kind of numbers that aren't
even useful for the number of files in a single directory.

I'm *not* going to set this box up to have 10,000 files in the same
directory. Puhlease!

The only time something is added to my tree is when they open up a new
directory, at which point the whole tree is re-built from scratch, since
it will have zero (0) elements in common with the previous tree.

As much as I love Object-Oriented programming, it amazes me what lengths
people will go to in order to use it no matter how inappropriate it may be
to the task at hand. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] How do I start at a specific position in an array? Is there

2005-01-10 Thread Marek Kilimajer
Richard Lynch wrote:
I'll give you a simple case.
I have a GTK PHP MP3 ID3 editor application I'm working on.
When one opens a file in a directory, I provide next/prev buttons to
quickly page to the next/prev file in the directory.
Getting the next/prev to work is simple enough, but...
I've got the whole array built from opendir/readdir, and sorted it into
alphabetical order.
I've got a filename inside that array, from the pre-defined
GtkFileSelection dialog.
So I need to initialize the internal array pointer to the position of the
file within that array, there is no such PHP function.
for(;;) loop would not work?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: What program to use to make thumbnail images?

2005-01-10 Thread Jason Morehouse
John Holmes wrote:
What do you guys recommend for making thumbnails from uploaded images? I 
know of the GD extension, Imagemagik and netpbm. Any other 
recommendations or opinions on which of the above work best with PHP? 
Thanks.

Imagemagik is your best bet IMHO.  It's the most configurable and gives 
the best results.  It's too bad it can't be built directly into php, but 
I think there is a pear module for it.  Myself, I just use the command 
line --- but be sure and take all the necessarily precautions when 
making system calls!

--
Jason Morehouse
Vendorama - Create your own online store
http://www.vendorama.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Global class instances mysteriously set to NULL

2005-01-10 Thread James \(IFMS\)
Most likely, somewhere along the way, one of your files is triggering some
condition which 'unsets' your variable.
That's what it looks like. I can't find anything in the documentation or 
on the 'Net that describes such a condition. That's why I originally 
posted the question.

Personally, I always structure my code so that there is only one place
where any given file will be require'd so I don't need require_once.
Out of long habit from other languages I'm used to simply listing all 
dependencies at the begining and letting the compiler sort things out.

I want the failure that require provides, but don't want to have to 
map out all these class file dependencies so laziness demanded 
require_once. :-)

Still learning the quirks of PHP. Every language has them.
(Now C++... yikes! That's a very quirky language. Once you learn where 
the Don't Do That rule applies, it's fine. I'm NOT trying to start any 
stupid language flame fest. Just saying that language was the one that 
gave me the most heartburn to date.)

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


[PHP] if(date(Y-m-d)

2005-01-10 Thread John Taylor-Johnston
Hi,
I would like some help to improve this script. I'm a teacher with a schedule of 
17 weeks.
Instead of using if(date(Y-m-d) = $week3)  I would like to do a for i = 1 
to 17 and if the current date date(Y-m-d) = week[i] I would like to echo 
This is week $week[i];

Can someone show me how please?


?php
#old code:
$week1 = 2005-01-17;
$week2 = 2005-01-24;
...
$week17 = 2005-05-09;

if(date(Y-m-d) = $week3)
{
echo this is week 3);
}
?

Thanks,
John

--
John Taylor-Johnston
-
If it's not Open Source, it's Murphy's Law.

 '''Collège de Sherbrooke:
 ô¿ôhttp://www.collegesherbrooke.qc.ca/languesmodernes/
  - 819-569-2064

  °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures
 /(_)\  Université de Sherbrooke
  ^ ^   http://compcanlit.ca/ T: 819.569.2064

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



[PHP] Comparison Operator

2005-01-10 Thread Chadwick, Russell
 
Could anyone tell me why this code echos?
 
?php
 $value = 0;
 $curval = 'A';
 if ($value == $curval) {
  echo WTH, Overbr;
 }
?


[PHP] does php ready for enteprise ?

2005-01-10 Thread Supri anto
dear all,

i' m want to start developing some mid scale apps ! i have discuss
with my friend and i have one question. i wonder does php ready for
enterprise?

thanks

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



[PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Jason Morehouse
Hello.  I'm not sure if this is an apache problem or php... but 
wondering if anyone has come across the same problem.

-rw---1 root root   test.html
-rw---1 root root   test.php
Trying to access test.html via a browser servers up the apache 403 error 
page.  The test.php however produces:

Warning: Unknown: failed to open stream: Permission denied in Unknown on 
line 0 Warning: Unknown: Failed opening '/www/test.php' for inclusion 
(include_path='.:/www/php') in Unknown on line 0

Any ideas?
Thanks!
--
Jason Morehouse
Vendorama - Create your own online store
http://www.vendorama.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP Accellerator into Zend Engine2 by default

2005-01-10 Thread Manuel Lemos
Hello,
on 01/10/2005 07:21 AM Kioto said the following:
PHP is scripting language interpreted and not compiled.
PHP is compiled into bytecodes before executing since PHP 4.
There is also a real PHP to executable code compiler named Roadsend.
http://www.roadsend.com/

I want know about the difference beetwean the bytecode of JSP and ASP.NET
than PHP-Accelerator. Why this extension isn't a built-in into Zend 
Engine parsing ?
Because Zend is not charity. They sell it as a normal comercial add-on 
to Zend engine.


This is a better solution to comparison  the performace of PHP versus 
other technologies like JSP and ASP.NET ?
It is probably equivalent (just to not be biased).
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Comparison Operator

2005-01-10 Thread Jason Morehouse
Russell Chadwick wrote:
 
Could anyone tell me why this code echos?
 
?php
 $value = 0;
 $curval = 'A';
 if ($value == $curval) {
  echo WTH, Overbr;
 }
?
$value = 0 means false.  And your comparison is false.  Try:
?php
 $value = '0';
 $curval = 'A';
 if ($value == $curval) {
   echo WTH, Overbr;
 }
# OR
 $value = 0;
 $curval = 'A';
 if ($value === $curval) {
   echo WTH, Overbr;
 }
?
?


--
Jason Morehouse
Vendorama - Create your own online store
http://www.vendorama.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] where can i find some tutorials aout sockets ?

2005-01-10 Thread Andrew Kreps
On Sun, 9 Jan 2005 03:00:35 +0200, Serban Nicolae
[EMAIL PROTECTED] wrote:
 where can i find some tutorials aout sockets ?
 
 

I don't know of any tutorials as such, but the manual has some good
information.  I usually find it useful to familiarize myself with the
functions available before diving into tutorials.  Here's a link:

http://us3.php.net/manual-lookup.php?pattern=socketlang=en

Good luck!

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



Re: [PHP] if(date(Y-m-d)

2005-01-10 Thread Andrew Kreps
On Mon, 10 Jan 2005 13:08:28 -0500, John Taylor-Johnston
[EMAIL PROTECTED] wrote:
 Hi,
 I would like some help to improve this script. I'm a teacher with a schedule 
 of 17 weeks.
 Instead of using if(date(Y-m-d) = $week3)  I would like to do a for i = 1 
 to 17 and if the current date date(Y-m-d) = week[i] I would like to echo 
 This is week $week[i];
 
 Can someone show me how please?
 
 ?php
 #old code:
 $week1 = 2005-01-17;
 $week2 = 2005-01-24;
 ...
 $week17 = 2005-05-09;
 
 if(date(Y-m-d) = $week3)
 {
 echo this is week 3);
 }
 ?
 

You're actually pretty close.  What I would do is remove the dashes
from the equation and make that date a unique number.  The advantage
of the date format you're using is that the date represented as a
number will always be sequential.  So, if you do this:

$week1 = 20050110;
$week2 = 20050117;
$week3 = 20050124;

if(date(Ymd) = $week1)
{
echo this is week 1;
}

Now you'll have to create your logic in reverse, so that it will
trigger the latest date first, because every date from now until week
17 will be greater than $week1.  So, something like:

if (date(Ymd) = $week17)
{
 echo This is week 17;
}
elseif (date(Ymd) = $week16)
{
echo This is week 16;
}

etc.  

Does that make sense?

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



[PHP] PHP College Scholarships?

2005-01-10 Thread Andrew Wickham
Does anyone know of any college scholarships for PHP or Computer Science. I
need some non-college specific ones.

The reason I ask is obviously because I need some help going to college
through scholarships, and I have been programming in PHP for about 6 years
now. 

Please help me out guys!

Andrew Wickham

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



Re: [PHP] if(date(Y-m-d)

2005-01-10 Thread Andrew Kreps
On Mon, 10 Jan 2005 13:08:28 -0500, John Taylor-Johnston
[EMAIL PROTECTED] wrote:
 Hi,
 I would like some help to improve this script. I'm a teacher with a schedule 
 of 17 weeks.
 Instead of using if(date(Y-m-d) = $week3)  I would like to do a for i = 1 
 to 17 and if the current date date(Y-m-d) = week[i] I would like to echo 
 This is week $week[i];
 
 Can someone show me how please?

Ok, let me take another stab at this and answer the actual question
you asked.  What can I say, I haven't had my coffee this morning.  :)

Try this code:

$weeks = array (20050107, 20050110, 20050115);

for ($i = count($weeks) - 1;  $i = 0;  $i--)
{
if (date (Ymd) = $weeks[$i])
{
print This is week  . ($i + 1);
break;
}
}

It counts backwards, since you'll want to test the latest week first. 
You could count forward in the for loop if you create the weeks array
with the weeks counting down.  I don't particuarly like having a break
in the loop, but it gets the job done.  If you didn't have it in
there, you would see the print statement for every week that has
passed, as opposed to the current one.

Was this a better answer?

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



[PHP] Error in foreach?

2005-01-10 Thread Brad Brening
Hello all;

I have encountered a very strange error on one of our customers sites.
Their script returns the following error:

Warning:Invalid argument supplied for foreach

This is in response to the following line:

foreach ($_GET as $key = $value)

All I am trying to do is parse the querystring!

Any ideas?

Thanks;

Brad

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



RE: [PHP] Comparison Operator

2005-01-10 Thread Jay Blanchard
[snip]
Could anyone tell me why this code echos?
 
?php
 $value = 0;
 $curval = 'A';
 if ($value == $curval) {
  echo WTH, Overbr;
 }
?
[/snip]

Because it has an echo statement in it. And '==' is not '==='

From http://us3.php.net/manual/en/language.operators.comparison.php

If you compare an integer with a string, the string is converted to a
number. If you compare two numerical strings, they are compared as
integers. These rules also apply to the switch statement.

http://us3.php.net/manual/en/language.types.string.php#language.types.st
ring.conversion

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



RE: [PHP] does php ready for enteprise ?

2005-01-10 Thread Jay Blanchard
[snip]
i' m want to start developing some mid scale apps ! i have discuss
with my friend and i have one question. i wonder does php ready for
enterprise?
[/snip]

Yes, it does/is.

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



Re: [PHP] How do I start at a specific position in an array? Is there

2005-01-10 Thread Robert Cummings
On Mon, 2005-01-10 at 12:44, Richard Lynch wrote:
 Robert Cummings wrote:
  On Mon, 2005-01-10 at 11:28, Richard Lynch wrote:
  Thomas Goyne wrote:
   On Sun, 09 Jan 2005 15:59:43 +0100, M. Sokolewicz [EMAIL PROTECTED]
  wrote:
  
   that's not a SPECIFIC place in the array, that's just current, next
  and
   previous. AFAIK there is no way to explicitly set the internal
  pointer
   of the array to a spcified place. I used a function which basically
   looped trough the array until it got to the correct depth, and then
   returned it by referencebut it's not very efficient :S
  
  
   Why would you ever want to do that other than to waste cycles?
 
  I'll give you a simple case.
 
  I have a GTK PHP MP3 ID3 editor application I'm working on.
 
  When one opens a file in a directory, I provide next/prev buttons to
  quickly page to the next/prev file in the directory.
 
  Getting the next/prev to work is simple enough, but...
 
  I've got the whole array built from opendir/readdir, and sorted it into
  alphabetical order.
 
  I've got a filename inside that array, from the pre-defined
  GtkFileSelection dialog.
 
  So I need to initialize the internal array pointer to the position of
  the
  file within that array, there is no such PHP function.
 
  Why not change your structure? Sounds like you want a linked list,
  better yet a doubly linked list. So create a double linked list class,
  link up your entries, and keep a hash available for fast lookup into the
  linked list where the keys are the filenames or whatever you want to use
  as an index, and the value is a reference to the interesting linked list
  node.
 
 Uhhhm.  Yeah.
 
 I could spend hours finding/writing a doubly-linked list class, which will
 be a good bit slower and WAY more memory-bloated than the built-in PHP
 doubly-linked list (aka 'array') and, in theory, I could code it so that
 the 'set_current' function existed and was maybe a bit faster than walking
 the PHP array...
 
 But every *other* operation would be a lot slower, and I only need to walk
 the list to initialize the internal current pointer once, when the user is
 already distracted and slowed down by the Open File dialog.
 
 I think the user experience will be *much* better without all that, though.
 
  if( $currNode-hasNext() )
  {
  $currNode = $currNode-next();
  }
 
 if ($current != $array[count($array) - 1]) $current = next($array);
 
  Moving backward would be as simple as:
 
  if( $currNode-hasPrevious() )
  {
  $currNode = $currNode-previous();
  }
 
 if ($current != $array[0]) $current = prev($array);
 
 Actually, the buttons are disabled if you are on the first/last item, so
 the checks for hasNext/hasPrevious are done elsewhere anyway.
 
  And if the user selects an arbitrary file:
 
  $currNode = $lookupArray[$index];
 
 No, no, no.
 
 The FileSelection already returns the filename.
 
 Of course, I just *built* that array based on the directory they chose, so
 could initialize the $current_index as the array got built...
 
 So I'd need to keep an *INVERSE* array internally to do:
 $current_index = $inversearray[$filename];
 
 So then I'd be keeping track of the $current_index, at which point I'd not
 even *NEED* to bother with next/prev and friends:  I'd just have a global
 variable for the integer index in the array, and play with that in PHP.
 
 No bloated class objects to track something as simple as an integer from 0
 to (count($array) - 1)
 
 Maybe I'll just ditch the internal prev/next stuff and use $CURRENT_INDEX
 as a global everywhere and write my own prev/next functions to do integer
 arithmetic instead.  Seems kinda silly when it's all already built-in to
 PHP *except* set_current() but there ya go.
 
  This kind of structure works a lot like a doubly threaded red-black tree
  :) Although a red-black tree would keep your entries in sorted order
  whenever you add new entries in O( lg n ) time.
 
 You're comparing O(lg n) in PHP to O(lg n) in built-in C from PHP.  Not
 the same at all until we start hitting the kind of numbers that aren't
 even useful for the number of files in a single directory.
 
 I'm *not* going to set this box up to have 10,000 files in the same
 directory. Puhlease!
 
 The only time something is added to my tree is when they open up a new
 directory, at which point the whole tree is re-built from scratch, since
 it will have zero (0) elements in common with the previous tree.
 
 As much as I love Object-Oriented programming, it amazes me what lengths
 people will go to in order to use it no matter how inappropriate it may be
 to the task at hand. :-)

I was going to write a lengthy response to your berating, but then I
remembered you're a procedural zealot and the above comments aren't much
better than the bait on the end of a troll's line.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |

Re: [PHP] Comparison Operator

2005-01-10 Thread tg-php
Ahh.. the trick question. hah..  Ok, let me see if I remember this (although it 
doesn't seem to follow the logic in my head.. I know someone else will explain 
it better but let me take a crack at it):

When comparing a two different variable types that PHP thinks it knows how to 
compare, it will try.  In this case, I believe the 'A' gets converted to a 
true/false type thing (0 or 1).. although I thought it'd convert to a 1 so 
you'd have if (1 == 0) which would be false.

At any rate, something like that is happening and it's comparing values that 
you don't think you're comparing.

Try using the triple equal sign operator (===) instead of the dobule (==).  
This forces PHP to not do the conversion.. to compare EXACT values.  Using === 
means that 0 does not equal '0' because 0 is an int and '0' is a string.

Someone else will give a better explaination soon, just wanted to give you 
something so you weren't stuck/frustrated/etc for too long.

-TG

= = = Original message = = =

Could anyone tell me why this code echos?
 
?php
 $value = 0;
 $curval = 'A';
 if ($value == $curval) 
  echo WTH, Overbr;
 
?


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

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



Re: [PHP] Comparison Operator

2005-01-10 Thread trobi
Chadwick, Russell  wrote / napísal (a):
Could anyone tell me why this code echos?
?php
$value = 0;
$curval = 'A';
if ($value == $curval) {
 echo WTH, Overbr;
}
?
 

Try ===
If you use ==
$value is compared to $curval
$value is integer so
php converts $curval to integer
so it contains no digtis so
it assumes that $curval=0;
why it is.

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


Re: [PHP] does php ready for enteprise ?

2005-01-10 Thread trobi
Supri anto  wrote / napísal (a):
dear all,
i' m want to start developing some mid scale apps ! i have discuss
with my friend and i have one question. i wonder does php ready for
enterprise?
thanks
 

It has the smell of flame.
I will ignore it.
trobi
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Comparison Operator

2005-01-10 Thread Brad Pauly
On Mon, 10 Jan 2005 10:26:16 -0800, Chadwick, Russell
[EMAIL PROTECTED] wrote:
 
 Could anyone tell me why this code echos?
 
 ?php
  $value = 0;
  $curval = 'A';
  if ($value == $curval) {
   echo WTH, Overbr;
  }
 ?

The string is converted to an integer when compared with an integer.
See this link for more info.

http://us3.php.net/manual/en/language.operators.comparison.php 

Try using === instead.

Brad

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



Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Brad Pauly
On Mon, 10 Jan 2005 13:49:26 -0500, Jason Morehouse [EMAIL PROTECTED] wrote:
 Hello.  I'm not sure if this is an apache problem or php... but
 wondering if anyone has come across the same problem.
 
 -rw---1 root root   test.html
 -rw---1 root root   test.php
 
 Trying to access test.html via a browser servers up the apache 403 error
 page.  The test.php however produces:
 
 Warning: Unknown: failed to open stream: Permission denied in Unknown on
 line 0 Warning: Unknown: Failed opening '/www/test.php' for inclusion
 (include_path='.:/www/php') in Unknown on line 0
 
 Any ideas?

It's a permissions problem. Both of those files are owned by the root
user and I would guess that apache is not running as root (and it
shouldn't be!). Find out who apache is running as (commonly www or
nobody) and give that user access to those files.

Brad

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



Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread trobi
Jason Morehouse  wrote / napísal (a):
Hello.  I'm not sure if this is an apache problem or php... but 
wondering if anyone has come across the same problem.

-rw---1 root roottest.html
-rw---1 root roottest.php
Trying to access test.html via a browser servers up the apache 403 
error page.  The test.php however produces:

Warning: Unknown: failed to open stream: Permission denied in Unknown 
on line 0 Warning: Unknown: Failed opening '/www/test.php' for 
inclusion (include_path='.:/www/php') in Unknown on line 0

Any ideas?
Thanks!
What about:   
as root:
chmod 775 test.php  
then
chmod 775 test.html

Theese comands gives the right to read and execute to web server runing 
with nobody rights
to read and execute above mentioned files.

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


RE: [PHP] does php ready for enteprise ?

2005-01-10 Thread Chris W. Parker
Supri anto mailto:[EMAIL PROTECTED]
on Monday, January 10, 2005 10:45 AM said:

 i' m want to start developing some mid scale apps ! i have discuss
 with my friend and i have one question. i wonder does php ready for
 enterprise?

what qualifications do you require in an application before you can
consider it ready for enterprise? in my opinion (and countless 1000's
of others i'm sure) it is more than ready for the enterprise.



chris.

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



Re: [PHP] does php ready for enteprise ?

2005-01-10 Thread Richard Davey
Hello Supri,

Monday, January 10, 2005, 6:45:19 PM, you wrote:

Sa i' m want to start developing some mid scale apps ! i have discuss
Sa with my friend and i have one question. i wonder does php ready
Sa for enterprise?

I would say so:

http://www.zend.com/platform

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

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



Re: [PHP] Re: Comparison Operator

2005-01-10 Thread John Nichel
Jason Morehouse wrote:
Russell Chadwick wrote:
 
Could anyone tell me why this code echos?
 
?php
 $value = 0;
 $curval = 'A';
 if ($value == $curval) {
  echo WTH, Overbr;
 }
?

$value = 0 means false.  And your comparison is false.  Try:
If the comparison is false, the echo shouldn't be executed.
This if statement is evaluating to true, because...
If you compare an integer with a string, the string is converted to a 
number.

http://us4.php.net/manual/en/language.operators.comparison.php
snip
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Richard Lynch
Jason Morehouse wrote:
 Hello.  I'm not sure if this is an apache problem or php... but
 wondering if anyone has come across the same problem.

 -rw---1 root root test.html
 -rw---1 root root test.php

 Trying to access test.html via a browser servers up the apache 403 error
 page.  The test.php however produces:

 Warning: Unknown: failed to open stream: Permission denied in Unknown on
 line 0 Warning: Unknown: Failed opening '/www/test.php' for inclusion
 (include_path='.:/www/php') in Unknown on line 0

 Any ideas?

Apache (and the PHP Module within it) run as a specific user.

That user is not (and SHOULD NOT be) 'root'

You need to figure out what user Apache runs as.

It's set in httpd.conf by the 'User' directive.

Because Apache/PHP does not run as 'root', Apache/PHP do not have
permission to *READ* the file.

If they can't *READ* the file, they can't deliver it to the surfer.

You need to change the permissions on the file to be *READABLE* by the
'User' of Apache/PHP.

Example
chmod 644 test.html
chmod 644 test.php

However, it would probably be even *better* to chown the files to some
less-powerful user than 'root'

chown _SOME_USER_ test.html
chown _SOME_USER_ test.php

You'll *still* need them to be read-able by Apache/PHP -- But in the
unlikely event that somebody Evil manages to gain write-access to the
files, at least they won't be root-owned, which would be even *worse* than
just a normal user's files getting hacked.

You really need to read a tutorial on Unix file permsissions, and you have
*GOT* to stop making HTML and PHP files as 'root' user!

Danger Will Robinson Danger!

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] if(date(Y-m-d)

2005-01-10 Thread Travis Conway
Maybe this will help.  Just keep adding to $var[] until you add all your 
weeks.  Then execute it.  This is written to run on the command line, but 
you can replace the \n with br to get your breaks in HTML.

?
   $var = Array();
   $var[] = 2005-01-02;
   $var[] = 2005-01-09;
   $var[] = 2005-01-16;
   $numweeks = count($var);
   echo Number of weeks:  . $numweeks . \n;
   $today = date(Y-m-d);
   for ($i=0;$i$numweeks;$i++) {
   if ($today = $var[$i]) {
   $lastweek = $i + 1;
   }
   }
   echo This is week $lastweek.\n;
?
HTH
Trav
www.pinkbunnysuit.com
- Original Message - 
From: John Taylor-Johnston [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Monday, January 10, 2005 12:08 PM
Subject: [PHP] if(date(Y-m-d) 


Hi,
I would like some help to improve this script. I'm a teacher with a 
schedule of 17 weeks.
Instead of using if(date(Y-m-d) = $week3)  I would like to do a for i 
= 1 to 17 and if the current date date(Y-m-d) = week[i] I would like to 
echo This is week $week[i];

Can someone show me how please?
?php
#old code:
$week1 = 2005-01-17;
$week2 = 2005-01-24;
...
$week17 = 2005-05-09;
if(date(Y-m-d) = $week3)
{
echo this is week 3);
}
?
Thanks,
John
--
John Taylor-Johnston
-
If it's not Open Source, it's Murphy's Law.
'''Collège de Sherbrooke:
ô¿ôhttp://www.collegesherbrooke.qc.ca/languesmodernes/
 - 819-569-2064
 °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures
/(_)\  Université de Sherbrooke
 ^ ^   http://compcanlit.ca/ T: 819.569.2064

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


Re: [PHP] does php ready for enteprise ?

2005-01-10 Thread Richard Lynch
Supri anto wrote:
 i' m want to start developing some mid scale apps ! i have discuss
 with my friend and i have one question. i wonder does php ready for
 enterprise?

PHP is ready.

Are you? :-)

All you need to do is Google for PHP Enterprise and read a few pages to
figure out the answer to your question.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Jason Wong
On Tuesday 11 January 2005 02:49, Jason Morehouse wrote:
 Hello.  I'm not sure if this is an apache problem or php... but
 wondering if anyone has come across the same problem.

It's a file permissions problem as can be seen clearly below (which you've 
thoughtfully included).

 -rw---1 root root test.html
 -rw---1 root root test.php

Only root can access those files. Unless you're running apache as root 
(hopefully you're not) then apache won't be able to read those files and 
hence ...

 Trying to access test.html via a browser servers up the apache 403 error
 page.  The test.php however produces:

 Warning: Unknown: failed to open stream: Permission denied in Unknown on
 line 0 Warning: Unknown: Failed opening '/www/test.php' for inclusion
 (include_path='.:/www/php') in Unknown on line 0

 Any ideas?

Change the ownership of those files to that of the user running apache or make 
them readable by others (chmod o+r).

-- 
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
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Jason Morehouse
Richard Lynch wrote:
Jason Morehouse wrote:
Hello.  I'm not sure if this is an apache problem or php... but
wondering if anyone has come across the same problem.
-rw---1 root root   test.html
-rw---1 root root   test.php
Trying to access test.html via a browser servers up the apache 403 error
page.  The test.php however produces:
Warning: Unknown: failed to open stream: Permission denied in Unknown on
line 0 Warning: Unknown: Failed opening '/www/test.php' for inclusion
(include_path='.:/www/php') in Unknown on line 0
Any ideas?

Apache (and the PHP Module within it) run as a specific user.
That user is not (and SHOULD NOT be) 'root'
You need to figure out what user Apache runs as.
It's set in httpd.conf by the 'User' directive.
Because Apache/PHP does not run as 'root', Apache/PHP do not have
permission to *READ* the file.
If they can't *READ* the file, they can't deliver it to the surfer.
You need to change the permissions on the file to be *READABLE* by the
'User' of Apache/PHP.
Example
chmod 644 test.html
chmod 644 test.php
However, it would probably be even *better* to chown the files to some
less-powerful user than 'root'
chown _SOME_USER_ test.html
chown _SOME_USER_ test.php
You'll *still* need them to be read-able by Apache/PHP -- But in the
unlikely event that somebody Evil manages to gain write-access to the
files, at least they won't be root-owned, which would be even *worse* than
just a normal user's files getting hacked.
You really need to read a tutorial on Unix file permsissions, and you have
*GOT* to stop making HTML and PHP files as 'root' user!
I don't need a lesson in file permissions, thanks.  Apache runs as 
nobody.  The problem isn't trying to get apache to display test.php, 
it's having it display the proper 403 error page, rather than a php 
error when it doesn't have access to a page.

Each page, test.html and test.php have the same permissions.  The html 
page gives the expected 403 error message when I try and access it 
(thats what I want).  The other, php script doesn't.  This is a security 
concern for me as it reveals paths on my system in the event a page has 
the wrong permissions.  Why does apache not server the 403 on the php 
page?  Maybe  this is better off in the apache list.

--
Jason Morehouse
Vendorama - Create your own online store
http://www.vendorama.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How do I start at a specific position in an array? Is there

2005-01-10 Thread Richard Lynch
Marek Kilimajer wrote:
 Richard Lynch wrote:
 I'll give you a simple case.

 I have a GTK PHP MP3 ID3 editor application I'm working on.

 When one opens a file in a directory, I provide next/prev buttons to
 quickly page to the next/prev file in the directory.

 Getting the next/prev to work is simple enough, but...

 I've got the whole array built from opendir/readdir, and sorted it into
 alphabetical order.

 I've got a filename inside that array, from the pre-defined
 GtkFileSelection dialog.

 So I need to initialize the internal array pointer to the position of
 the
 file within that array, there is no such PHP function.

 for(;;) loop would not work?

Yes, and since the array is small it's no big deal -- I already have
that working.

It just would be more clean to have a set_current function to set the
internal array iterator to the correct position.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Error in foreach?

2005-01-10 Thread tg-php
Sounds like $_GET isn't populated or has been over-written.  Try doing the 
classic print_r on $_GET to see what it contains before you do the foreach.

If you are using a form (rather than an a_href link) to pass the GET data and 
you're using all checkboxes or something else that returns nothing or doesn't 
set the GET variables, you might see if that's the problem.

But yeah, print out the $_GET data right before the foreach and see what's in 
it.  I'm guessing it doesn't contain an array because either no data was passed 
to the query string (is the PHP script in a frame and the parent frameset is 
receiving the GET data or something?) or it's been overwritten earlier in the 
script.

I try to make it a practice never (rarely at least) to do a $_POST['something'] 
= somevalue or $_GET['something'] = somevalue.  I like to consider those 
'sacred' variables that are only set by a POST or GET form action (or an a_href 
tag in some cases of GET data).  Once you start manipulating them in your code 
to 'fix' or 'adjust' them, then you run into issues where you may have 
overwritten your originally submitted data and you can get this kind of 
confusion.

Let us know what you find out.

-TG

= = = Original message = = =

Hello all;

I have encountered a very strange error on one of our customers sites.
Their script returns the following error:

Warning:Invalid argument supplied for foreach

This is in response to the following line:

foreach ($_GET as $key = $value)

All I am trying to do is parse the querystring!

Any ideas?

Thanks;

Brad


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

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



RE: [PHP] Error in foreach?

2005-01-10 Thread Jay Blanchard
[snip]
I have encountered a very strange error on one of our customers sites.
Their script returns the following error:

Warning:Invalid argument supplied for foreach

This is in response to the following line:

foreach ($_GET as $key = $value)

All I am trying to do is parse the querystring!

Any ideas?
[/snip]

What happens when you print_r($_GET); ?

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



Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Travis Conway
you have to allow others to read it.
You have it so only root can access the file.  Try this:
chmod 644 test.php
while logged in as root.  This should put the file as
-rw-r--r-- 1 root root test.php
HTH
Travis
- Original Message - 
From: Jason Morehouse [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Monday, January 10, 2005 12:49 PM
Subject: [PHP] 403 not working -- apache 2 / php5 / linux


Hello.  I'm not sure if this is an apache problem or php... but 
wondering if anyone has come across the same problem.

-rw---1 root root test.html
-rw---1 root root test.php
Trying to access test.html via a browser servers up the apache 403 error 
page.  The test.php however produces:

Warning: Unknown: failed to open stream: Permission denied in Unknown on 
line 0 Warning: Unknown: Failed opening '/www/test.php' for inclusion 
(include_path='.:/www/php') in Unknown on line 0

Any ideas?
Thanks!
--
Jason Morehouse
Vendorama - Create your own online store
http://www.vendorama.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Jonel Rienton
man chmod, i gather you're new to linux/*nix
http://jonel.road14.com
--
I not know English well, but I know 7 computer languages.
anonymous
On Jan 10, 2005, at 12:49 PM, Jason Morehouse wrote:
Hello.  I'm not sure if this is an apache problem or php... but 
wondering if anyone has come across the same problem.

-rw---1 root root   test.html
-rw---1 root root   test.php
Trying to access test.html via a browser servers up the apache 403 
error page.  The test.php however produces:

Warning: Unknown: failed to open stream: Permission denied in Unknown 
on line 0 Warning: Unknown: Failed opening '/www/test.php' for 
inclusion (include_path='.:/www/php') in Unknown on line 0

Any ideas?
Thanks!
--
Jason Morehouse
Vendorama - Create your own online store
http://www.vendorama.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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


Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Jason Morehouse
Jonel Rienton wrote:
man chmod, i gather you're new to linux/*nix
I don't need a lesson in file permissions, thanks.  Apache runs as 
nobody.  The problem isn't trying to get apache to display test.php, 
it's having it display the proper 403 error page, rather than a php 
error when it doesn't have access to a page.

Each page, test.html and test.php have the same permissions.  The html 
page gives the expected 403 error message when I try and access it 
(thats what I want).  The other, php script doesn't.  This is a security 
concern for me as it reveals paths on my system in the event a page has 
the wrong permissions.  Why does apache not server the 403 on the php 
page?  Maybe  this is better off in the apache list.


--
Jason Morehouse
Vendorama - Create your own online store
http://www.vendorama.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Comparison Operator

2005-01-10 Thread Chadwick, Russell
 
The function this is from sometimes uses $_POST or $_GET input, so
sometimes its comparing 1337 with '1337' and === would break that.
 
so I'll have to use something like:
 
if (($value == $curval)  !(is_string ($curval)  ($value == 0))) 
 
unless there is a better way



From: Brad Pauly [mailto:[EMAIL PROTECTED]
Sent: Mon 2005-01-10 11:41
To: Chadwick, Russell
Cc: php-general@lists.php.net
Subject: Re: [PHP] Comparison Operator



On Mon, 10 Jan 2005 10:26:16 -0800, Chadwick, Russell
[EMAIL PROTECTED] wrote:

 Could anyone tell me why this code echos?

 ?php
  $value = 0;
  $curval = 'A';
  if ($value == $curval) {
   echo WTH, Overbr;
  }
 ?

The string is converted to an integer when compared with an integer.
See this link for more info.

http://us3.php.net/manual/en/language.operators.comparison.php

Try using === instead.

Brad

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





[PHP] Unique, hard session timeout on a shared server

2005-01-10 Thread kjohnson
I have researched a few ways to set a hard session timeout on a shared 
server. Does anyone have comments on the advantages/disadvantages of each 
approach? Are there other alternatives?

1. Override the php.ini settings in an .htaccess file:

php_value session.gc_maxlifetime 900
php_value session.gc_divisor 1
php_value session.gc_probability 1

2. Put a previous request timestamp into the session, and compare it to 
the current timestamp on a request.

3. Set a meta refresh to a kill session script.

Will there be a performance hit for all applications on the server under 
the first method?

TIA

Kirk

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



Re: [PHP] Error in foreach?

2005-01-10 Thread Matt M.
 This is in response to the following line:
 
 foreach ($_GET as $key = $value)

is $_GET an array?

when in doubt, print it out

try:
print_r($_GET)

or even check

is_array($_GET)

might be an earlier version of php

http://us2.php.net/manual/en/reserved.variables.php#reserved.variables.get

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



[PHP] sorting mysql results

2005-01-10 Thread Sebastian
I have a list of rows in the database and i would like to sort them in two
categories.
example,

echo $row['name'] . '-' . $row['type'];

// output:

row 1 - files

row 2 - files

row 3 - music

row 4 - files

I would like this output:

files
--
row 1 - files
row 2 - files
row 4 - files

music
---
row 3 - music

if the $row['type'] is music i want to output an hr and the results below
it but below the files results.. makes sense?
i thought i remember doing this once using a dummy var but cant remember
how. i guess i could always run a second query, but would like to avoid
that.

thanks for any help.

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



Re: [PHP] Re: Comparison Operator

2005-01-10 Thread John Nichel
[EMAIL PROTECTED] wrote:
Yeah, I stated that it was being converted to an integer, but what I didn't 
think about was that 'A' didn't contain any integers so it would end up being 
zero.  I believe if it had been 'A23' then it would have been converted to 23.
But if it had evaluated to false than the if statement might still evaluate to true if it came out to be if (FALSE == FALSE), right?   FALSE == FALSE equates to TRUE, yes?
Right, since both sides of the comparison evaluated to 0 (false), the 
comparison itself is true.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Jason Barnett
the wrong permissions.  Why does apache not server the 403 on the php 
page?  Maybe  this is better off in the apache list.


Yeah, this is really better on an Apache list... but...
http://httpd.apache.org/docs/mod/core.html#errordocument
--
Teach a person to fish...
Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://php.net/manual/
php-general archives: http://marc.theaimsgroup.com/?l=php-generalw=2
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mail() w/ postfix problem in Fedora Core 3 FIXED

2005-01-10 Thread Nathaniel Price
Nathaniel Price wrote:
I've been searching for the solution to this problem to no avail.
I recently did a clean install of FC3 on a server that was running 
RH8. There were a number of PHP scripts that I had configured to send 
out email for notices or passwords or the like. However, now that I've 
upgraded I can't send mail through the mail() command in PHP.

My problem is exactly like what I found here, but unfortunately that 
question was left unanswerd: 
https://www.redhat.com/archives/fedora-list/2004-December/msg06708.html

[snip]
I found out what the problem was on the fedora-users mailing list. It 
turns out that it was a 'problem' with Fedora Core 3. By default it uses 
SELinux to secure the httpd binary against executing other stuff it's 
not supposed to, including the postfix sendmail-compatible interface. 
FC's documentation on SELinux can be found here:

http://fedora.redhat.com/docs/selinux-apache-fc3/
Thanks for your help and suggestions on this admittedly non-obvious problem.
Nathaniel
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: What program to use to make thumbnail images?

2005-01-10 Thread Curt Zirzow
* Thus wrote Jason Morehouse:
 John Holmes wrote:
 What do you guys recommend for making thumbnails from uploaded images? I 
 know of the GD extension, Imagemagik and netpbm. Any other 
 recommendations or opinions on which of the above work best with PHP? 
 Thanks.
 
 
 Imagemagik is your best bet IMHO.  It's the most configurable and gives 
 the best results.  It's too bad it can't be built directly into php, but 
 I think there is a pear module for it.  Myself, I just use the command 
 line --- but be sure and take all the necessarily precautions when 
 making system calls!

Actually imagemagick can be built directly into php:
  http://pecl.php.net/imagick

It lacks a lot of documentation and the installation file is
outdated,  but has lots of code examples.


Curt
-- 
Quoth the Raven, Nevermore.

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



[PHP] Re: PHP College Scholarships?

2005-01-10 Thread Daniel Schierbeck
Andrew Wickham wrote:
Does anyone know of any college scholarships for PHP or Computer Science. I
need some non-college specific ones.
The reason I ask is obviously because I need some help going to college
through scholarships, and I have been programming in PHP for about 6 years
now. 

Please help me out guys!
Andrew Wickham
Sorry, I don't live in the US, so I don't know if there are any 
scholarships - But I'm kind of curious about what you guys pay for a 
college education. Are scholarships common, or do almost everyone have 
to pay? I come from Denmark, and our education system is entirely tax 
funded, so I'm unfamiliar with those things (but as I said, curious ;))

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


Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Curt Zirzow
* Thus wrote trobi:
 Jason Morehouse  wrote / napísal (a):
 
 Hello.  I'm not sure if this is an apache problem or php... but 
 wondering if anyone has come across the same problem.
 
 -rw---1 root roottest.html
 -rw---1 root roottest.php
 
 What about:   
 as root:
 chmod 775 test.php  
 then
 chmod 775 test.html

chmod 644 is more appropriate.

Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] does php ready for enteprise ?

2005-01-10 Thread Brent Baisley
One of the big arguments for PHP being ready for the enterprise is 
that, hey, Yahoo uses it! But it's more the reason why Yahoo uses it. 
Part of the reason is that PHP is scalable because of it's a shared 
nothing architecture, so you can scale it horizontally just about 
indefinitely. Plus it's a lot easier to develop in than Java or C++.

On Jan 10, 2005, at 1:45 PM, Supri anto wrote:
dear all,
i' m want to start developing some mid scale apps ! i have discuss
with my friend and i have one question. i wonder does php ready for
enterprise?
thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Curt Zirzow
* Thus wrote Jason Morehouse:
 Richard Lynch wrote:
 Jason Morehouse wrote:
 
 Hello.  I'm not sure if this is an apache problem or php... but
 wondering if anyone has come across the same problem.
 
 -rw---1 root root   test.html
 -rw---1 root root   test.php
 
 Trying to access test.html via a browser servers up the apache 403 error
 page.  The test.php however produces:
 ...
 
 Apache (and the PHP Module within it) run as a specific user.
 
 That user is not (and SHOULD NOT be) 'root'
  ...
 
 
 I don't need a lesson in file permissions, thanks.  Apache runs as 
 nobody.  The problem isn't trying to get apache to display test.php, 
 it's having it display the proper 403 error page, rather than a php 
 error when it doesn't have access to a page.

Your Original Post did not state that you knew why the error
occured, we can't reminds after all.

 
 Each page, test.html and test.php have the same permissions.  The html 
 page gives the expected 403 error message when I try and access it 
 (thats what I want).  The other, php script doesn't.  This is a security 
 concern for me as it reveals paths on my system in the event a page has 
 the wrong permissions.  Why does apache not server the 403 on the php 
 page?  Maybe  this is better off in the apache list.

It is recommended *not* to have 'display_errors=on' for a production
server for this very reason. Have the errors go to syslog or
something similar.

Curt
-- 
Quoth the Raven, Nevermore.

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



Re: [PHP] if(date(Y-m-d)

2005-01-10 Thread Bret Hughes
On Mon, 2005-01-10 at 12:08, John Taylor-Johnston wrote:
 Hi,
 I would like some help to improve this script. I'm a teacher with a schedule 
 of 17 weeks.
 Instead of using if(date(Y-m-d) = $week3)  I would like to do a for i = 1 
 to 17 and if the current date date(Y-m-d) = week[i] I would like to echo 
 This is week $week[i];
 
 Can someone show me how please?
 
 
 ?php
 #old code:
 $week1 = 2005-01-17;
 $week2 = 2005-01-24;
 ...
 $week17 = 2005-05-09;
 
 if(date(Y-m-d) = $week3)
 {
 echo this is week 3);
 }
 ?
 

(Mistakenly sent to the OP only and I could not stand having my code not
seen by all :)  tested in a shell not web page so YMMV.  Now as I look
at it, a valid date in the last week would not work since there was no
end defined.  I added a 18th date and modified the if to  next week
date.  This code should work with no assumptions that today is even in
the range of weeks defined.

You practically wrote it already.  Also you can use a for loop to load
the array of dates.
$m=1;
$d=11;
$y=2005;

//Load week array
$week= array();
for ($i=0; $i= 17; $i++ ) {
$week[$i] = date(Y-m-d,mktime(0, 0, 0, $m  , $d + (7*$i), $y));
}
$today=date(Y-m-d);
for ($i=0; $i= 16; $i++ ){
if ($today =  $week[$i] and $today  $week[$i+1] ){
echo This is week . ($i + 1) .  that began on $week[$i]\n;
exit;
}
}
echo could not find what week $today is in\n;
echo start date is $y-$m-$d\n;
echo end date is $week[17]\n;


HTH

Bret

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



Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Jason Wong
On Tuesday 11 January 2005 04:13, Jason Morehouse wrote:

 I don't need a lesson in file permissions, thanks.  Apache runs as
 nobody.  The problem isn't trying to get apache to display test.php,
 it's having it display the proper 403 error page, rather than a php
 error when it doesn't have access to a page.

Maybe you should have made more explicit in your original post what your 
question was (as is evident in the number of inappropriate responses that you 
have received).

 Each page, test.html and test.php have the same permissions.  The html
 page gives the expected 403 error message when I try and access it
 (thats what I want).  The other, php script doesn't.  This is a security
 concern for me as it reveals paths on my system in the event a page has
 the wrong permissions.

Well it will display said error message IFF you have display_errors enabled. 
On a production machine display_errors should *not* be enabled.

 Why does apache not server the 403 on the php 
 page?  Maybe  this is better off in the apache list.

No idea.

-- 
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
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Bret Hughes
On Mon, 2005-01-10 at 15:21, Jason Morehouse wrote:
 Jonel Rienton wrote:
  man chmod, i gather you're new to linux/*nix
 
 I don't need a lesson in file permissions, thanks.  Apache runs as 
 nobody.  The problem isn't trying to get apache to display test.php, 
 it's having it display the proper 403 error page, rather than a php 
 error when it doesn't have access to a page.
 
 Each page, test.html and test.php have the same permissions.  The html 
 page gives the expected 403 error message when I try and access it 
 (thats what I want).  The other, php script doesn't.  This is a security 
 concern for me as it reveals paths on my system in the event a page has 
 the wrong permissions.  Why does apache not server the 403 on the php 
 page?  Maybe  this is better off in the apache list.


Ahh.  well I guess everyone got a refresher on *nix perms at least :)  I
see what you are concerned about but am wondering if relying on the
underlying file system perms is a good thing to begin with.  Still, I
have no answer for your question.  It is an interesting one and I hope
you will enlighten us once you find the answer.

FWIW it sounds to me to be a php issue.  Apache sees the php extension
and passes it off to php who then pukes on the perms.

Bret

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



Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Rasmus Lerdorf
Jason Morehouse wrote:
Jonel Rienton wrote:
man chmod, i gather you're new to linux/*nix

I don't need a lesson in file permissions, thanks.  Apache runs as 
nobody.  The problem isn't trying to get apache to display test.php, 
it's having it display the proper 403 error page, rather than a php 
error when it doesn't have access to a page.

Each page, test.html and test.php have the same permissions.  The html 
page gives the expected 403 error message when I try and access it 
(thats what I want).  The other, php script doesn't.  This is a security 
concern for me as it reveals paths on my system in the event a page has 
the wrong permissions.  Why does apache not server the 403 on the php 
page?  Maybe  this is better off in the apache list.
Because Apache doesn't try to open the file.  And you should never have 
display_errors enabled on a production server.  That's for development 
purposes.  Always log your php errors to a file when you put a server 
online.

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


Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Jason Morehouse
Richard Lynch wrote:
A!  Now we see the question!  Why doesn't it yield 403 like it should
First and foremost, use php.ini or httpd.conf or .htaccess to *NOT* let
PHP send error messages OF ANY KIND to the browser on a production site.
[You could also use ini_set within a script if the file in question is to
be include'd into other files.]
You should do this anyway.
Admittedly, your server still behaves not quite like you want, as *.html
yields a 403 response, and *.php yields a 200 response, and a page of no
content.  But at least the Bad Guys don't see your server internals.
I don't think there's any way you can configure Apache to pre-empt the PHP
trying to read the file -- though I presume Apache *could* be altered to
behave that way...  Except it would be rather difficult for Apache to
'know' a priori what User PHP runs as, given suexec, CGI setups, etc...
Depending on your application, you might be able to wrap all the access
to files through a known good PHP file, and then use PHP error handling
(http://php.net/set_error_handler) to determine if this error occurred,
and then send a 403 header.
Probably an Apache list would be better suited to knowing for sure any way
around this...  You could maybe tweak the PHP source to detect this
condition and send 403 instead of trying to include() the file, which is
what it seems to be doing.
Yeah, thanks all.  I usually have error logging off, but enabled it from 
time to time when hunting down bugs (and forget to add it back).

Anyway, I guess I'll have to deal with just blank pages coming up in the 
event of a .php 403... not a big deal really, I just prefer constancy.

I still don't really get why apache hands parsing off to php when it 
knows it doesn't have read access to the file, but I'll save that for 
another list!

Thanks again.
-J
--
Jason Morehouse
Vendorama - Create your own online store
http://www.vendorama.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Security - chmod 777 - PHP upload/write

2005-01-10 Thread SED
Hi,

Sometimes when I write a PHP-script and upload it to a ISP through password
protected FTP, the only way to write data to a folder is to run chmod 777
for that folder, I want to write (or save) a data to (e.g. file-upload,
flat-file-database). However, if I do so, I have been told, everyone can
write data to that file, which is a security risk. Is that true?

If I do so, is it right that anyone can write a data to that folder? E.g.
PHP-script that can reveal everything?

Regards,
SED

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



Re: [PHP] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Rasmus Lerdorf
Jason Barnett wrote:
the wrong permissions.  Why does apache not server the 403 on the php 
page?  Maybe  this is better off in the apache list.


Yeah, this is really better on an Apache list... but...
http://httpd.apache.org/docs/mod/core.html#errordocument
No, it has nothing to do with Apache.  Apache doesn't open the file, PHP 
does.  You could argue that PHP should try to throw a 403 on a 
permissions error, but the problem is that it is really too late in the 
game to do so once we get to the content handler phase where PHP lives.
It could be hacked to do it a number of ways, but it wouldn't be pretty 
and it wouldn't be very consistent either since we would have to only do 
it if no output has been sent on the request yet.  So a sub-request or 
an auto-prepend would both change the behaviour.

Turning off display_errors really is the answer to the particular 
security concern raised here.

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


Re: [PHP] sorting mysql results

2005-01-10 Thread Andrew Kreps
On Mon, 10 Jan 2005 16:38:18 -0500, Sebastian
[EMAIL PROTECTED] wrote:
 I have a list of rows in the database and i would like to sort them in two
 categories.
 example,
 
 echo $row['name'] . '-' . $row['type'];
 
 // output:
 
 row 1 - files
 

add order by `type` to your sql statement, and then put something like
the following in your mysql loop:

// initialize $prevType above

if ($prevType !== $row['type'])
{
print hr . $row['type'] . --br;  // Or whatever you
want the header to look like
}
$prevType = $row['type'];

That should do the trick.

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



Re: [PHP] if(date(Y-m-d)

2005-01-10 Thread Richard Lynch
 On Mon, 10 Jan 2005 13:08:28 -0500, John Taylor-Johnston
 [EMAIL PROTECTED] wrote:
 Hi,
 I would like some help to improve this script. I'm a teacher with a
 schedule of 17 weeks.
 Instead of using if(date(Y-m-d) = $week3)  I would like to do a for
 i = 1 to 17 and if the current date date(Y-m-d) = week[i] I would
 like to echo This is week $week[i];

 Can someone show me how please?

You could also consider using http://php.net/date with the 'W' (ISO-8601
week number of year, weeks starting on Monday (added in PHP 4.1.0))
argument or 'z'  (The day of the year (starting from 0)) and divide by 7.

You'd need to compute your offset to your 'first' week that you care
about, but...

?php
  //PHP 4.1.0 and up:
  $start_week = date('W', mktime(0, 0, 0, 9, 4, 2005));
  echo This is week: , date('W', mktime(0, 0, 0, 10, 1, 2005)) -
$start_week, BR\n;
?

Depending on what you are doing and how you are already storing dates,
this could be cleaner.

Watch out, though, as you'll have issues on New Year's Eve if that's in
the middle of a 17-week period, as I suspect it is...

You could also just use:
?php
  $start_week = mktime(0, 0, 0, 8, 2, 2005);
  function seconds_to_week($seconds){
return $seconds / (60*60*24*7);
  }
  echo This is week: , seconds_to_week(mktime(0, 0, 0, 9, 17, 2005)),
BR\n;
?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



  1   2   >