Re: [PHP] Save page

2004-05-12 Thread Nadim Attari
Brandon Holtsclaw [EMAIL PROTECTED] a écrit dans le message de
news:[EMAIL PROTECTED]
 try something like

 $handle = fopen (http://www.pagetoget.com/thispage.html;, rb);
 $contents = ;
 do {
 $data = fread($handle, 1024);
 if (strlen($data) == 0) {
 break;
 }
 $contents .= $data;
 } while(true);
 fclose ($handle);


From the PHP manual:
// Another example, let's get a web page into a string.  See also
file_get_contents().
$html = implode ('', file ('http://www.example.com/'));

 then you have all text from the .html page in $contents and you can do a
 fwrite on it to a local file, echo it, str_rep etc etc etc

 Brandon Holtsclaw
 [EMAIL PROTECTED]


 - Original Message - 
 From: Mike Mapsnac [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, May 10, 2004 10:37 AM
 Subject: [PHP] Save page


  Hello
 
  I' m writing php script that will request page and save it locally. The
 page
  URL will be parameter (example: http://www.pagetoget.com/thispage.html).
 How
  php can request such page and save it locally on the file?
 
  Thanks

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



Re: [PHP] User/Group rights system?

2004-05-12 Thread Burhan Khalid
david david wrote:
Hello,

Does anyone know of an open source user/group based
permission system built with php/MySQL?
That is, the effective rights for any user on a
specific secured object are computed from various
permit/deny permissions assigned to the user or any of
the groups he/she belongs to.
Drupal [ http://www.drupal.org ] has this functionality built in, but I 
don't know of a standalone script that does this.

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


Re: [PHP] What is the GD library and what can I do with it ?

2004-05-12 Thread Burhan Khalid
Pete wrote:

Hello Rob,


What is your local environment?  (OS, PHP version, etc.)
If you're running windows, most likely all you will have to do is change
your php.ini.


The OS used is Windows XP.

Open your php.ini file, set your extension_dir variable to where the 
extensions directory is.  If you installed php in c:\php, then the 
directory is c:\php\extensions.

The gd library is bundled with the .zip package for Windows.  If you 
downloaded the .exe (binary installer), you may be missing some 
extensions.  Download the .zip file for Windows, uncompress it, and then 
copy all the files from the extensions directory into your local php 
install folder.

Once you've done that, uncomment remove the ; from the line in php.ini 
that reads ;extension=gd.dll ( I think that's what its called, may also 
be gd2.dll ).  Save php.ini, restart your web server, and then view the 
output from phpinfo();

Should see the gd extension enabled :)

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


RE: [PHP] PHP Sessions on Windows

2004-05-12 Thread rich
 How does one get sessions working on Windows? I have modified my php.ini
 file so that session.save_path = C:\Temp, restarted and Apache.
 Still I get
 this error message:

 Warning: session_start(): open(/tmp\sess_26310affee160329c9e50f27663f8971,
 O_RDWR) failed: No such file or directory (2) in
 c:\apache\htdocs\dbmdata\admin\61646d696e.php on line 2


check you have edited the correct php.ini -- run ? phpinfo() ? and check
where the ini file is to make sure you changed the correct one...

hth
rich

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



php-general Digest 12 May 2004 07:24:51 -0000 Issue 2758

2004-05-12 Thread php-general-digest-help

php-general Digest 12 May 2004 07:24:51 - Issue 2758

Topics (messages 185936 through 185955):

Re: php calender
185936 by: Daniel Clark
185937 by: Torsten Roehr

include (or require) doesn't seem to work
185938 by: Daniel Barbar
185939 by: Torsten Roehr
185940 by: Torsten Roehr
185941 by: Daniel Clark

Re: HTTP_RAW_POST_DATA
185942 by: Chris Boget
185943 by: John W. Holmes
185944 by: Chris Shiflett
185945 by: Travis Low

Automatically send auth info
185946 by: motorpsychkill

Re: loading 250kb include files, performance degration?
185947 by: Justin French

PHP Sessions on Windows
185948 by: David Mitchell
185950 by: Daniel Clark
185955 by: rich

User/Group rights system?
185949 by: david david
185953 by: Burhan Khalid

Re: What is the GD library and what can I do with it ?
185951 by: Pete
185954 by: Burhan Khalid

Re: Save page
185952 by: Nadim Attari

Administrivia:

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

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

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


--
---BeginMessage---
It could be a HTML table with links on the properties to view more details.

 I am currently working on a site for a vacation rental company.   They
 want
 the ability to show users the availability of certain properties.  The
 availability will be held in a mysql db so I assume I will have to
 dynamically build a small javascript menu or somethingI am just
 looking
 for some good suggestions and examples from other's who have done this.

 I am not a fan of generating javascript from php.

 Thanks,
 Eddie
---End Message---
---BeginMessage---
Edward Peloke [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am currently working on a site for a vacation rental company.   They
want
 the ability to show users the availability of certain properties.  The
 availability will be held in a mysql db so I assume I will have to
 dynamically build a small javascript menu or somethingI am just
looking
 for some good suggestions and examples from other's who have done this.

 I am not a fan of generating javascript from php.

 Thanks,
 Eddie

Hi Eddie,

there is a great calendar package in PEAR:
http://pear.php.net/package/Calendar

There is a good example of how to build an HTML calendar from it:
http://pear.php.net/manual/en/package.datetime.calendar.intro-inahurry.php
(scroll down to the middle of the page)

I don't know why you want to use javascript here. I would do it this way:

- select all dates of free vacation properties of the given/current month
- put the dates from the DB result into an array
- create the calendar with the example from above and check for every day if
there is an entry for the day in your array
- if so give the table cell a specific color and/or link to page containing
detailed information
- otherwise blank the cell out or whatever

Hope this helps!

Regards, Torsten
---End Message---
---BeginMessage---
Hi,

 I'm almost ashamed to ask this question as surely enough the
problem is something very basic but, nonetheless, I can't put my finger on
it. I'm trying to implement the concept of a library (library.php) on PHP
where I define (once) all auxiliary functions and then use them in a file
(for instance index.php) via the 'require' or 'include' constructs. Here's a
reduced version of what I'm doing:



index.php:

?php
$lang = (isset($_REQUEST['lang']) ? $_REQUEST['lang'] : es);
echo index.php: include_path is  . (ini_get('include_path')).br;
require(http://tristan/library.php?lang=$lang;);
my_function(en);
?



library.php:

?php
echo library.php: Called with $_SERVER[HTTP_HOST]:/$_SERVER[REQUEST_URI]
br;
function my_function($lang = es) {
echo my_function() says $lang;
}
echo library.php: loadedbr;
?



When I load index.php I get the following:



index.php: include_path is .:/usr/local/php/4.3.6/lib/php
library.php: Called with tristan://library.php?lang=es
library.php: loaded



Fatal error: Call to undefined function: my_function() in
/www/htdocs/index.php on line 5



It seems that the name space on index.php never gets updated
with the function definitions made on library.php. What am I doing wrong?
Thanks! Cheers,



Daniel
---End Message---
---BeginMessage---
Daniel Barbar [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

  I'm almost ashamed to ask this question as surely enough the
 problem is something very basic but, nonetheless, I can't put my finger on
 it. I'm trying to implement the concept of a library (library.php) on PHP
 where I define (once) all auxiliary functions and then use them in a file
 (for instance index.php) via the 'require' or 'include' constructs. Here's
a
 reduced version of what I'm 

[PHP] function imagecreatefromjpeg()

2004-05-12 Thread PHP
Hello,

I use the function imagecreatefromjpeg() to create thumbnails of my
pictures.
This is the code I use :

?php
function thumbnail($i,$nw,$p,$nn) {
$img=imagecreatefromjpeg($i);
$ow=imagesx($img);
$oh=imagesy($img);
$scale=$nw/$ow;
$nh=ceil($oh*$scale);
$newimg=imagecreate($nw,$nh);
imagecopyresized($newimg,$img,0,0,0,0,$nw,$nh,$ow,$oh);
imagejpeg($newimg, $p.$nn);
return true;
}

#thumbnail(filetouse,newwidth,newpath,newname);
thumbnail(/img/x.jpg,100,/img/thm/,xt.jpg);
?

It works for some of my pictures, but with some pictures the result is an
imagefile with filesize zero. When I check the log files then I see that
these lines has occured:

[11-May-2004 23:16:15] PHP Warning:  imagecreatefromjpeg() [a
href='http://www.php.net/function.imagecreatefromjpeg'function.imagecreatef
romjpeg/a]: '/home/infos/domalle/miweb/pizias/photodir/6.jpg' is not a
valid JPEG file in /home/infos/domalle/miweb/pizias/TestOnResize2/resize.php
on line 42

[11-May-2004 23:16:15] PHP Warning:  imagesx(): supplied argument is not a
valid Image resource in
/home/infos/domalle/miweb/pizias/TestOnResize2/resize.php on line 43

[11-May-2004 23:16:15] PHP Warning:  imagesy(): supplied argument is not a
valid Image resource in
/home/infos/domalle/miweb/pizias/TestOnResize2/resize.php on line 44

[11-May-2004 23:16:15] PHP Warning:  Division by zero in
/home/infos/domalle/miweb/pizias/TestOnResize2/resize.php on line 45

[11-May-2004 23:16:15] PHP Warning:  imagecopyresized(): supplied argument
is not a valid Image resource in
/home/infos/domalle/miweb/pizias/TestOnResize2/resize.php on line 49

The only difference that I can find between imagefiles with which it works
and the ones where it does not work is the filesize.
An image file with which it works : 60 Kb
An image file with which it doesn't work : 1400 Kb

Could someone please advice me on a solution that works in all cases ?

Thanks in advance,
Dominique

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



[PHP] PHP5 and static attributes

2004-05-12 Thread Rudy Metzger
Dear all,

I have a problem with 'referencing' static attributes. I have the
following class tree.

// --- CLASS A -
class A
{
  protected static $myInstance;
}

// --- CLASS B --
class B extends class A
{
}

// --- CLASS C --
class C extends class B
{

public function Debug()
{
  echo self::$myInstance; // does not work (undefined)
  echo parent::$myInstance;  // also does not work
  echo A::$myInstance; // works
}

}

-
The Problem is that you always have to know in which class the static
was defined to reference it. Or is there something like
static::$myInstance or this::$myInstance or class::$myInstance. If not,
it maybe would be a great idea to add something to PHP, otherwise you
always have to track in which class the static had been defined if you
want to reference it!

Thanx for reading and if someone knows how to solve this, please let me
know!

Cheerio
/rudy

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



[PHP] Ordering alphabetical in secondary select string

2004-05-12 Thread R.G. Vervoort




Does anyone have a suggestion how I can order a list with names in a
secondary select string.



The first string selects a number of locations where people work



From this string I get several id's form people (in the location table there
are no names but id's form the people table) that work on those locations



No I make another select to get the name form the people table using the id
I got before.



I would like to have the table ordered alphabetical by the name of the
people



Since the number op people is very long is will be to slow working the other
way around (first selecting people and then  looking for the location)



Example:



Location 1Name A

Name B

Name C

Location 3Name D

Name E

Location 5Name F

Location 2Name G

Location 9Name H

Location 7Name I

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



RE: [PHP] php calender

2004-05-12 Thread Angelo Zanetti
read the archives this question was asked last week.

cheers
angelo

-Original Message-
From: Edward Peloke [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 11, 2004 9:12 PM
To: PHP Mailing Lists
Subject: [PHP] php calender


I am currently working on a site for a vacation rental company.   They want
the ability to show users the availability of certain properties.  The
availability will be held in a mysql db so I assume I will have to
dynamically build a small javascript menu or somethingI am just looking
for some good suggestions and examples from other's who have done this.

I am not a fan of generating javascript from php.

Thanks,
Eddie

 WARNING:  The information contained in this message and any attachments is
intended only for the use of the individual or entity to which it is
addressed.  This message may contain information that is privileged,
confidential and exempt from disclosure under applicable law.  It may also
contain trade secrets and other proprietary information for which you and
your employer may be held liable for disclosing.  You are hereby notified
that any unauthorized dissemination, distribution or copying of this
communication is strictly prohibited.  If you have received this
communication in error,  please notify [EMAIL PROTECTED] by E-Mail and then
destroy this communication in a manner appropriate for privileged
information.

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


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

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



[PHP] Re: include (or require) doesn't seem to work

2004-05-12 Thread Daniel Barbar
Thanks Torsten! Using the file-system relative path made it work (I had
tried only with the absolute path, which ddidn't work). However, I checked
again and I did have 'allow_url_fopen = On' in /etc/php.ini. I'll take a
closer look later and report the problem if I find it. Thanks again,

Daniel

Torsten Roehr [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
  Try including it as a local file:
  require_once library.php'; // if it is in the same directory as the file
 you

 Forgot a quote here, sorry:
 require_once 'library.php';

 Torsten

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



[PHP] Send username password in HTTP headers

2004-05-12 Thread Nagendra Prasad
Hi, 
I have a problem. I'm posting some XML data to my client's website using HTTP 
Post. Assume I'm posting to getxml.php (hosted on my clients server). Now my 
client has put authentication on his website using 
header('WWW-Authenticate: Basic realm=Private Area'); 

Now the page getxml.php asks me to prove my identity before it acceps my xml 
posts. 
So how do I send the username  pwd when I'm posting the xml details? 
My client doesn't want to forego this authentication concept. 

To post, this is what I'm doing 

-- 
function dopost( $host, $usepath, $postdata = , $logfilename ) { 
//Global $logfilename; 
// 
// open socket to files that accept posts on other servers 
// 
$fp = fsockopen( $host, 80, $errno, $errstr, 60 ); 
// 
// check that the socket has been opened successfully 
// 
if( !$fp ) { 
//print -$errstr ($errno)-br\n; 
$this-postURL = http://.$host.$usepath.?.$postdata; 
$this-writeToErrorLog($logfilename); 
} 
else { 

#write the data to the encryption cgi 
fputs( $fp, POST $usepath HTTP/1.0\n); 
$strlength = strlen( $postdata ); 
fputs( $fp, Content-type: application/x-www-form-urlencoded\n ); 
fputs( $fp, Content-length: .$strlength.\n\n ); 
fputs( $fp, $postdata.\n\n ); 
// 
// clear the response data 
// 
$output = ; 


// 
// read the response from the remote cgi 
// 
// while content exists, keep retrieving document in 1K chunks 
// 
while( !feof( $fp ) ) { 
$output .= fgets( $fp, 1024); 
} 
// 
// close the socket connection 
// 
fclose( $fp); 
} 
// 
// return the response 
// 
return $output; 
} 

-- 
Also I have tried the following, still it doesn't work 

fputs( $fp, POST $usepath HTTP/1.0\n); 
$strlength = strlen( $postdata ); 
//fputs( $fp, Authorization:  . base64_encode ( $username . : . 
$password) . \n); 
//fputs( $fp, Authorization:  . base64_encode (guest:guest).\n); 
fputs( $fp, Authorization:  . guest:guest.\n); 
fputs( $fp, Content-type: application/x-www-form-urlencoded\n ); 

fputs( $fp, Content-length: .$strlength.\n\n ); 
fputs( $fp, $postdata.\n\n ); 

Still nothing works out.. 
Plz help me. I need this badly now.

Regards
TNP
Professional Services
ZUSTEK INDIA
__


-- Original Message ---
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 12 May 2004 09:51:48 -
Subject: WELCOME to [EMAIL PROTECTED]

 Hi! This is the ezmlm program. I'm managing the
 [EMAIL PROTECTED] mailing list.
 
 I'm working for my owner, who can be reached
 at [EMAIL PROTECTED]
 
 Acknowledgment: I have added the address
 
[EMAIL PROTECTED]
 
 to the php-general mailing list.
 
 Welcome to [EMAIL PROTECTED]
 
 Please save this message so that you know the address you are
 subscribed under, in case you later want to unsubscribe or change 
 your subscription address.
 
 --- Administrative commands for the php-general list ---
 
 I can handle administrative requests automatically. Please
 do not send them to the list address! Instead, send
 your message to the correct command address:
 
 For help and a description of available commands, send a message to:
[EMAIL PROTECTED]
 
 To subscribe to the list, send a message to:
[EMAIL PROTECTED]
 
 To remove your address from the list, just send a message to
 the address in the ``List-Unsubscribe'' header of any list
 message. If you haven't changed addresses since subscribing,
 you can also send a message to:
[EMAIL PROTECTED]
 
 or for the digest to:
[EMAIL PROTECTED]
 
 For addition or removal of addresses, I'll send a confirmation
 message to that address. When you receive it, simply reply to it
 to complete the transaction.
 
 If you need to get in touch with the human owner of this list,
 please send a message to:
 
 [EMAIL PROTECTED]
 
 Please include a FORWARDED list message with ALL HEADERS intact
 to make it easier to help you.
 
 --- Enclosed is a copy of the request I received.
 
 Return-Path: [EMAIL PROTECTED]
 
 Received: (qmail 64646 invoked by uid 1010); 12 May 2004 09:51:48 -
 Delivered-To: ezmlm-scan-php-general-
 [EMAIL PROTECTED]
 Delivered-To: ezmlm-php-general-sc.1084355448.dihjfmikeehgilooihaa-
 [EMAIL PROTECTED]
 Received: (qmail 64579 invoked from network); 12 May 2004 09:51:46 -
 Received: from unknown (HELO osi-tech.com) (203.199.179.83)
   by pb1.pair.com with SMTP; 12 May 2004 09:51:46 -
 Received: from osi-tech.com (osi-tech.com [127.0.0.1])
   by osi-tech.com (8.11.6/8.11.6) with ESMTP id i4C9wB914286
 
   for php-general-sc.1084355448.dihjfmikeehgilooihaa-nthumuluru=osi-
 [EMAIL PROTECTED]; Wed, 12 May 2004 15:28:11 +0530 From: 
 Nagendra Prasad [EMAIL PROTECTED] To: php-general-
 [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 Subject: Re: confirm subscribe to [EMAIL PROTECTED]
 Date: Wed, 12 May 2004 15:28:11 +0530
 Message-Id: [EMAIL PROTECTED]
 In-Reply-To: 

Re: [PHP] function imagecreatefromjpeg()

2004-05-12 Thread Petr U.
On Wed, 12 May 2004 10:48:24 +0200
PHP [EMAIL PROTECTED] wrote:

  [11-May-2004 23:16:15] PHP Warning:  imagecreatefromjpeg() [a
 
href='http://www.php.net/function.imagecreatefromjpeg'function.imagecreatef 
romjpeg/a]: '/home/infos/domalle/miweb/pizias/photodir/6.jpg' is not a 
valid JPEG file in /home/infos/domalle/miweb/pizias/TestOnResize2/resize.php 
on line 42

Are you really sure this image is _really_ correct JPEG ? Check it. I don't
know anything about JPEG file history (changes in file format), but I think no
major changes was there in last time (http://www.ijg.org/files/ latest
source is from '98) - we can eliminate old varsion of jpeg library i think.
So check if that file is really correct JPEG image..

-- 
Petr U.

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



Re: [PHP] function imagecreatefromjpeg()

2004-05-12 Thread PHP
I checked to open it with Fireworks and I got an error, but other programs
like MS Internet Explorer can open it perfectly.

The files on which PHP gives an error are the same as the ones that
Fireworks can't open and vice versa.

Is there a solution to fix these files, since they are not really corrupt ?

Thanks a lot,
Dominique

Petr U. [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
 On Wed, 12 May 2004 10:48:24 +0200
 PHP [EMAIL PROTECTED] wrote:

   [11-May-2004 23:16:15] PHP Warning:  imagecreatefromjpeg() [a
  

href='http://www.php.net/function.imagecreatefromjpeg'function.imagecreatef

 romjpeg/a]: '/home/infos/domalle/miweb/pizias/photodir/6.jpg' is not a 
 valid JPEG file in
/home/infos/domalle/miweb/pizias/TestOnResize2/resize.php 
 on line 42

 Are you really sure this image is _really_ correct JPEG ? Check it. I
don't
 know anything about JPEG file history (changes in file format), but I
think no
 major changes was there in last time (http://www.ijg.org/files/ latest
 source is from '98) - we can eliminate old varsion of jpeg library i
think.
 So check if that file is really correct JPEG image..

 -- 
 Petr U.

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



[PHP] Sessions not working on Linux - Apache

2004-05-12 Thread Zac Hillier - Net Affectors
Running on apache 1.3

session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.name = i
session.auto_start = 0
session.cookie_lifetime = 0
session_start() is included in the top of each page.

When I test session files are being written into the /tmp folder and the 
session variable is corerctly added to the url when moving to another 
page, BUT the sessions do not appear to be working?

I can set a session var on one page and display it there but when moving 
to another page the session var is no longer available?

If I look in the tmp folder a relevant sess_nnn file is there but 
contains no data. I've checked permissions and the /tmp folder is world 
writable and the sess_nnn file is owned by the web server and is writable?

Can anyone suggest what to test next or where the problem may be?

Thanks

Zac

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


[PHP] Using PHP4 4.3.4 as a CGI

2004-05-12 Thread Mark Constable
Debian testing system with a recent update to php-cgi 4.3.4.

I have been using the /usr/bin/php4 binary as a some.cgi with
a shbang line of #!/usr/bin/php4 which worked fine up until
this recent 4.3.4 update. Now the new 4.3.4 php4 binary does
not produce a Content-type: index/html\n\n header nor does
it receive any GPC (GET POST etc) variables at all. I've been
throught the new php.ini and I cannot see any parameters or
advice as to what may have changed.

Could anyone advise me how to re-enable receiving incoming
variables for a /usr/bin/php4 binary used as a CGI please ?

--markc

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



[PHP] Methods for instatiating an object

2004-05-12 Thread Jordi Canals
Hi all,

It is not a big issue, but that is something that I never had clear. 
I've been looking at the manual and found no answer, so I will ask with 
an example:

When instantiating an object, I could do it in two different ways:

A)  $object = new MyClass;
B)  $object = new MyClass;
I cannot understand the exect difference betwen the two methods. Because 
there is not yet an object, the second example does not return a 
reference to an existing object.

I think perhaps the diference is:

1) In case A, PHP creates a new object and returns a Copy of this new 
object, so really I will have the object two instances for the object in 
memory ...

2) In case B, PHP creates a noew object and returns a reference to this 
newly created object. In this case there is only one instance of the object.

Does it works that way? If not, What is exactly the difference?

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


Re: [PHP] Methods for instatiating an object

2004-05-12 Thread Mark Constable
On Wed, 12 May 2004 08:41 pm, Jordi Canals wrote:
 A)$object = new MyClass;
 B)$object = new MyClass;

 1) In case A, PHP creates a new object and returns a Copy of this new
 object, so really I will have the object two instances for the object in
 memory ...

 2) In case B, PHP creates a noew object and returns a reference to this
 newly created object. In this case there is only one instance of the
 object.

 Does it works that way? If not, What is exactly the difference?

You are quite correct...

 http://php.net/references

--markc

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



[PHP] PHP in Uppsala, Sweden

2004-05-12 Thread Anders Hellström
Hi,


I don't know how many PHP users there are here in Uppsala, Sweden, but there are bound 
to be a few given the size of the city, and the university probably helps too.

I've set up a mailing list where we can talk in a more relaxed manner where things 
don't have to be strictly PHP related like on a major list like this, or for you who 
simply prefer to ask questions in Swedish. If anybody's interested we could meet up 
IRL every now and then, and grab a beer while talking about what we've been doing in 
PHP or something. (e.g. Perl Monger style)


You can subscribe to the list here: http://www.uaphp.org/
or by sending an e-mail to: mailto:[EMAIL PROTECTED]


Looking forward to meeting you all, online or IRL!


--
Anders Hellström

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



Re: [PHP] Methods for instatiating an object

2004-05-12 Thread Rudy Metzger
On Wed, 2004-05-12 at 12:41, Jordi Canals wrote:
 Hi all,
 
 It is not a big issue, but that is something that I never had clear. 
 I've been looking at the manual and found no answer, so I will ask with 
 an example:
 
 When instantiating an object, I could do it in two different ways:
 
 A)$object = new MyClass;
 B)$object = new MyClass;
 
 I cannot understand the exect difference betwen the two methods. Because 
 there is not yet an object, the second example does not return a 
 reference to an existing object.
 
 I think perhaps the diference is:
 
 1) In case A, PHP creates a new object and returns a Copy of this new 
 object, so really I will have the object two instances for the object in 
 memory ...
Only until the garbage collection cleans up the first instance. So you
_always_ create one instance for the garbage collector only.
 
 2) In case B, PHP creates a noew object and returns a reference to this 
 newly created object. In this case there is only one instance of the object.
 
 Does it works that way? If not, What is exactly the difference?
It is as you say. The problem is normally negligible, but makes a big
difference if there is alot done in the constructor of the object (e.g.
scanning a huge file for certain strings). Then this will slow things
down. This however is solved in PHP5.
 
 TIA,
 Jordi.
Cheerio
/rudy


signature.asc
Description: This is a digitally signed message part


Re: [PHP] function imagecreatefromjpeg()

2004-05-12 Thread Petr U.
On Wed, 12 May 2004 12:08:29 +0200
PHP [EMAIL PROTECTED] wrote:

  Is there a solution to fix these files, since they are not really corrupt ?

I don't know :)

-- 
Petr U.

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



[PHP] php installer

2004-05-12 Thread
Hi:
I want to make a php install package on Win32 contain my php.ini 
and auto add .php file map to IIS5.0,but i don't know where the IIS 
file map is stored,i searched 'php' in registry and all ini file in
system dir,but no result returned.
who know the key?


 Best Regards
 beforefly
 [EMAIL PROTECTED]
 2004-05-12 15:40:54

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



[PHP] parsing value by URL

2004-05-12 Thread gowthaman ramasamy
hello list,
I have a problem in passing the value to another PHP script from the
first one. can any one help me to debug it.

I generate the following URL from first script to pass two variables to
next script. But the values are not passed on. But the URL invokes the
second script (ya with out parsing the variables).

NOTE: the url which is sent to browser is FINE and looks like this 
http://gowtham/forphp/detailedresults.php?name=testrun_hetero_srtdoutfirstfile=hello
But I am not able to print the variables $name and $firstfile

many thanks in advance 
gowtham

scripts are
Script 1
__

FORM ACTION=?php echo $PHP_SELF ? METHOD=POST
ENCTYPE=text/plain   

?php
if(isset($_POST['submit']))
   
  
{   
does many things

$detail_file='testrun_hetero_srtdout';
echo A
HREF=\http:/gowtham/forphp/detailedresults.php?name=$detail_filefirstfile=$files\ 
clik to see detailed page/A
}



script 2
_

second script ... that is detailedresults.php
?php
print $name;
print $name;
?














-- 
Ra. Gowthaman,
Graduate Student,
Bioinformatics Lab,
Malaria Research Group,
ICGEB , New Delhi.
INDIA

Phone: 91-9811261804
   91-11-26173184; 91-11-26189360 #extn 314

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



Re: [PHP] Methods for instatiating an object

2004-05-12 Thread Jordi Canals
Rudy Metzger wrote:
It is as you say. The problem is normally negligible, but makes a big
difference if there is alot done in the constructor of the object (e.g.
scanning a huge file for certain strings). Then this will slow things
down. This however is solved in PHP5.
Thanks to all for your answers. They have been so clear.

I think it's interesting to know how that works. Knowing only that it 
works, some times is not enought. ;)

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


Re: [PHP] parsing value by URL

2004-05-12 Thread Richard Davey
Hello,

Wednesday, May 12, 2004, 12:42:30 PM, you wrote:

gr script 2
gr _

gr second script ... that is detailedresults.php
gr ?php
gr print $name;
gr print $name;
?

You've probably got Register Globals turned off (and quite rightly)
which means try this in script 2:

echo $_GET['name'];
echo $_GET['firstfile'];

See the section of the PHP manual on register globals to understand
why.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



[PHP] parsing value by URL-worked

2004-05-12 Thread gowthaman ramasamy
thanks a lot dear Zac and richard
that worked. I earlier tried $_POST[name] but not $_GET[name].
thanks again
i ll reset what richard mentioned.

On Wed, 2004-05-12 at 17:12, Zac Hillier - Net Affectors wrote:
 try $_GET[name]
 
 Zac
 
 

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



Re: [PHP] Resequencing logic

2004-05-12 Thread Burhan Khalid
Matt Grimm wrote:

I apologize if this message is a repeat; I've had trouble posting with 
Thunderbird.

I'm interested in how you folks would approach the following issue:

You have a list of data, in a user-defined sequence.  For instance, a list 
of song titles that can be rearranged on a web page in any order. I don't 
think I have the best grasp of the logic involved, and as such, the problem 
is a real pain for me.  I use this approach:
I think you are after http://www.brainjar.com/dhtml/tablesort/demo.html

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


Re: [PHP] parsing value by URL

2004-05-12 Thread Mark Constable
On Wed, 12 May 2004 09:42 pm, gowthaman ramasamy wrote:
 I have a problem in passing the value to another PHP script from the
 first one. can any one help me to debug it.

 FORM ACTION=?php echo $PHP_SELF ? METHOD=POST
 ENCTYPE=text/plain
 ?php
 if(isset($_POST['submit']))
 {
   does many things

 $detail_file='testrun_hetero_srtdout';
 echo A
 HREF=\http:/gowtham/forphp/detailedresults.php?name=$detail_filefirstfile
=$files\ clik to see detailed page/A }

 second script ... that is detailedresults.php
 ?php
   print $name;
   print $name;
 ?

Perhaps register_globals = Off ? Here is one debugging hint...

 ?php
 echo '!-- '.var_export($_REQUEST,true)).' --';
 // do whatever else
 ?

and view the source of the resulting page. Assumes PHP v4.1.0+

--markc

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



[PHP] Re: PHP5 and static attributes

2004-05-12 Thread Aidan Lister
Do you have to access that variable statically?

If you're scope is the class:
echo $this-myInstance;

Otherwise,
echo C::$myInstance will access it outside the class (I think), even though
it's inherited.



Rudy Metzger [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Dear all,

 I have a problem with 'referencing' static attributes. I have the
 following class tree.

 // --- CLASS A -
 class A
 {
   protected static $myInstance;
 }

 // --- CLASS B --
 class B extends class A
 {
 }

 // --- CLASS C --
 class C extends class B
 {

 public function Debug()
 {
   echo self::$myInstance; // does not work (undefined)
   echo parent::$myInstance;  // also does not work
   echo A::$myInstance; // works
 }

 }

 -
 The Problem is that you always have to know in which class the static
 was defined to reference it. Or is there something like
 static::$myInstance or this::$myInstance or class::$myInstance. If not,
 it maybe would be a great idea to add something to PHP, otherwise you
 always have to track in which class the static had been defined if you
 want to reference it!

 Thanx for reading and if someone knows how to solve this, please let me
 know!

 Cheerio
 /rudy

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



Re: [PHP] parsing value by URL-worked

2004-05-12 Thread Richard Davey
Hello,

Wednesday, May 12, 2004, 12:53:44 PM, you wrote:

gr thanks a lot dear Zac and richard
gr that worked. I earlier tried $_POST[name] but not $_GET[name].
gr thanks again

No worries. One point though - make sure you use $_GET['name'] and
*not* $_GET[name] (note the lack of quotes) - there is a big
difference between the two, the un-quoted version will cause PHP to
check its defined constants first, so you're adding un-needed overhead
and potential error warnings just by missing out those two little
characters :)

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



RE: [PHP] PHP Sessions on Windows

2004-05-12 Thread David Mitchell
OK, I managed to get it working. 

I first attempted to edit the php.ini so that the session save path was
C:\Temp. No matter what I did, the save path always showed up in phpinfo()
as /tmp. So I created folder on the root of C: called tmp and everything
worked.

Thanks,

Dave

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



[PHP] default and another constructor

2004-05-12 Thread Lieve Vissenaeken
Please ,could anybody help me ? I'm not so familiar with PHP.

I've the following problem with my code  when I try to make an object from
the class forum with the code $test=new forum().  I always get a warning
on this: Warning: Missing argument 1 for forum() in
/lvdata/www/tennis/php/sql.inc
Is it not possible to just make a default constructor and an other
constructor like in JAVA ?
Thanks for helping


class forum
{
 var $naam;
 var $tijd;
 var $tekst;

 function forum()
 {
 }


 function forum($naam,$tijd,$tekst)
 {
  $this-naam=$naam;
  $this-tijd=$tijd;
  $this-tekst=$tekst;
}
}


$test=new forum();

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



Re: [PHP] Sessions not working on Linux - Apache

2004-05-12 Thread John Nichel
Zac Hillier - Net Affectors wrote:
Running on apache 1.3

session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.name = i
session.auto_start = 0
session.cookie_lifetime = 0
session_start() is included in the top of each page.

When I test session files are being written into the /tmp folder and the 
session variable is corerctly added to the url when moving to another 
page, BUT the sessions do not appear to be working?

I can set a session var on one page and display it there but when moving 
to another page the session var is no longer available?

If I look in the tmp folder a relevant sess_nnn file is there but 
contains no data. I've checked permissions and the /tmp folder is world 
writable and the sess_nnn file is owned by the web server and is writable?

Can anyone suggest what to test next or where the problem may be?

Thanks

Zac
What version of PHP?  How are you 'setting' session variables?

--
John C. Nichel
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] default and another constructor

2004-05-12 Thread Mark Constable
On Wed, 12 May 2004 10:43 pm, Lieve Vissenaeken wrote:
 Please ,could anybody help me ? I'm not so familiar with PHP.

 I've the following problem with my code  when I try to make an object from
 the class forum with the code $test=new forum().  I always get a
 warning on this: Warning: Missing argument 1 for forum() in
 /lvdata/www/tennis/php/sql.inc
 Is it not possible to just make a default constructor and an other
 constructor like in JAVA ?
 Thanks for helping

No, you cannot do this kind of method overloading, not like 
this anyway. If you are using PHP5 you can kind of emulate 
overloading by using the __call() function... some googling 
will find examples.

You can at least make the below work by removing the first
forum() instance and using

 function forum($naam=NULL,$tijd=NULL,$tekst=NULL)

and test the incoming variables with isset() before attempting
to use any of them.

 class forum
 {
  var $naam;
  var $tijd;
  var $tekst;

  function forum()
  {
  }

  function forum($naam,$tijd,$tekst)
  {
   $this-naam=$naam;
   $this-tijd=$tijd;
   $this-tekst=$tekst;
 }
 }


 $test=new forum();

--markc

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



Re: [PHP] default and another constructor

2004-05-12 Thread Rudy Metzger
Strange that you get this error. Normally you should get a Fatal error:
Cannot redeclare forum::forum() 

PHP does not support 'function overloading', at least not in a way java
is doing it. One of the drawbacks of a free typed langauge (in contrary
to a strictly typed one).

cheerio
/rudy

On Wed, 2004-05-12 at 14:43, Lieve Vissenaeken wrote:
 Please ,could anybody help me ? I'm not so familiar with PHP.
 
 I've the following problem with my code  when I try to make an object from
 the class forum with the code $test=new forum().  I always get a warning
 on this: Warning: Missing argument 1 for forum() in
 /lvdata/www/tennis/php/sql.inc
 Is it not possible to just make a default constructor and an other
 constructor like in JAVA ?
 Thanks for helping
 
 
 class forum
 {
  var $naam;
  var $tijd;
  var $tekst;
 
  function forum()
  {
  }
 
 
  function forum($naam,$tijd,$tekst)
  {
   $this-naam=$naam;
   $this-tijd=$tijd;
   $this-tekst=$tekst;
 }
 }
 
 
 $test=new forum();


signature.asc
Description: This is a digitally signed message part


Re: [PHP] default and another constructor

2004-05-12 Thread Rudy Metzger
On Wed, 2004-05-12 at 15:18, Mark Constable wrote:
 On Wed, 12 May 2004 10:43 pm, Lieve Vissenaeken wrote:
  Please ,could anybody help me ? I'm not so familiar with PHP.
 
  I've the following problem with my code  when I try to make an object from
  the class forum with the code $test=new forum().  I always get a
  warning on this: Warning: Missing argument 1 for forum() in
  /lvdata/www/tennis/php/sql.inc
  Is it not possible to just make a default constructor and an other
  constructor like in JAVA ?
  Thanks for helping
 
 No, you cannot do this kind of method overloading, not like 
 this anyway. If you are using PHP5 you can kind of emulate 
 overloading by using the __call() function... some googling 
 will find examples.
 
 You can at least make the below work by removing the first
 forum() instance and using
 
  function forum($naam=NULL,$tijd=NULL,$tekst=NULL)
 
 and test the incoming variables with isset() before attempting
 to use any of them.
If you assign default values to the method arguments, you cannot test
them with isset() anymore, as they will be set.
 
  class forum
  {
   var $naam;
   var $tijd;
   var $tekst;
 
   function forum()
   {
   }
 
   function forum($naam,$tijd,$tekst)
   {
$this-naam=$naam;
$this-tijd=$tijd;
$this-tekst=$tekst;
  }
  }
 
 
  $test=new forum();
 
 --markc


signature.asc
Description: This is a digitally signed message part


Re: [PHP] Sessions not working on Linux - Apache

2004-05-12 Thread Zac
 What version of PHP?  How are you 'setting' session variables?

Version 4.2.2

$_SESSION[test] = 'testData';

Cheers

Zac

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


Re: [PHP] Sessions not working on Linux - Apache

2004-05-12 Thread John Nichel
Zac wrote:
Thanks for your response:

PHP Version 4.2.2

$_SESSION[test] = 'testData';

Regards

Zac
Please respond to the list, and not to an individual user (unless asked 
of course).

Try adding quotes around your key...

$_SESSION['test'] = testData;

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


[PHP] Max file size for uploads?

2004-05-12 Thread Robert Sossomon
I have an upload script that I am trying to allow for 725MB, I have
written the script to handle files of that size, and I modified the
upload_max_filesize = 730M

I tried uploading a 15MB file and it blew up (current error message is
not in my brain).

Is there a true max size or do I just have something messed up somewhere
that I need to tweak??

Thanks,
Robert

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



Re: [PHP] default and another constructor

2004-05-12 Thread Lieve Vissenaeken
Thanks Mark for helping me out...
The way you describe it with function
forum($naam=NULL,$tijd=NULL,$tekst=NULL) is a good trick !!

Kind Regards.

Mark Constable [EMAIL PROTECTED] schreef in bericht
news:[EMAIL PROTECTED]
 On Wed, 12 May 2004 10:43 pm, Lieve Vissenaeken wrote:
  Please ,could anybody help me ? I'm not so familiar with PHP.
 
  I've the following problem with my code  when I try to make an object
from
  the class forum with the code $test=new forum().  I always get a
  warning on this: Warning: Missing argument 1 for forum() in
  /lvdata/www/tennis/php/sql.inc
  Is it not possible to just make a default constructor and an other
  constructor like in JAVA ?
  Thanks for helping

 No, you cannot do this kind of method overloading, not like
 this anyway. If you are using PHP5 you can kind of emulate
 overloading by using the __call() function... some googling
 will find examples.

 You can at least make the below work by removing the first
 forum() instance and using

  function forum($naam=NULL,$tijd=NULL,$tekst=NULL)

 and test the incoming variables with isset() before attempting
 to use any of them.

  class forum
  {
   var $naam;
   var $tijd;
   var $tekst;
 
   function forum()
   {
   }
 
   function forum($naam,$tijd,$tekst)
   {
$this-naam=$naam;
$this-tijd=$tijd;
$this-tekst=$tekst;
  }
  }
 
 
  $test=new forum();

 --markc

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



Re: [PHP] Max file size for uploads?

2004-05-12 Thread Richard Davey
Hello Robert,

Wednesday, May 12, 2004, 2:37:23 PM, you wrote:

RS I have an upload script that I am trying to allow for 725MB, I have
RS written the script to handle files of that size, and I modified the
RS upload_max_filesize = 730M

RS I tried uploading a 15MB file and it blew up (current error message is
RS not in my brain).

RS Is there a true max size or do I just have something messed up somewhere
RS that I need to tweak??

POST file size is the other one.

and that's HELL of a file size.. what is it, an ISO dump site? ;)

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP] Sessions not working on Linux - Apache - FOllow Up

2004-05-12 Thread Zac
Have looked at this more and can now tell you that this is definatley 
down to the server not writing any contents into the sess_nnn file.

Does anyone have any ideas why this would happen? I've checked all 
permissions and tried changing the save_path to another folder that I 
created specifically for the sessions with global write permissions this 
had no effect.

Made sure the $_SESSION[name] had '  - $_SESSION['name'] made no 
difference. (Thanks though)

Any help really appreciated.

Zac


Running on apache 1.3

session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.name = i
session.auto_start = 0
session.cookie_lifetime = 0
session_start() is included in the top of each page.

When I test session files are being written into the /tmp folder and the 
session variable is corerctly added to the url when moving to another 
page, BUT the sessions do not appear to be working?

I can set a session var on one page and display it there but when moving 
to another page the session var is no longer available?

If I look in the tmp folder a relevant sess_nnn file is there but 
contains no data. I've checked permissions and the /tmp folder is world 
writable and the sess_nnn file is owned by the web server and is writable?

Can anyone suggest what to test next or where the problem may be?

Thanks

Zac

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


Re: [PHP] HTTP_RAW_POST_DATA

2004-05-12 Thread Michal Migurski
   Check the value of always_populate_raw_post_data in php.ini on
  both servers.
 
  Thats such a funny name.

 Not to mention misleading, since it doesn't always populate
 $HTTP_RAW_POST_DATA when enabled. Always should mean always.

Anyone have any clue why this is the case? Is there a performance reason
that raw post data must be explicitly enabled, or is it more of a
protective measure for overly permissive beginner scripts?

Inquiring minds demand answers!

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



Re: [PHP] default and another constructor

2004-05-12 Thread Mark Constable
On Wed, 12 May 2004 11:27 pm, Rudy Metzger wrote:
 On Wed, 2004-05-12 at 15:18, Mark Constable wrote:
  You can at least make the below work by removing the first
  forum() instance and using
 
   function forum($naam=NULL,$tijd=NULL,$tekst=NULL)
 
  and test the incoming variables with isset() before attempting
  to use any of them.

 If you assign default values to the method arguments, you cannot test
 them with isset() anymore, as they will be set.

# cat null_test.php
?php
class forum {

  function forum($naam=NULL,$tijd=NULL,$tekst=NULL) {

  var_export($naam);
  echo \n;
  var_export($tijd);
  echo \n;
  var_export($tekst);
  echo \n;
 }
}
$test=new forum('hi');
?
# php null_test.php
'hi'
NULL
NULL

--markc

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



RE: [PHP] Max file size for uploads?

2004-05-12 Thread Robert Sossomon
I get this error message now in my httpd error log:

[Wed May 12 10:07:01 2004] [error] [client 66.43.177.38] Requested
content-length of 69888498 is larger than the configured limit of
524288, referer: http://dinghy.homeip.net/upload.php

Any thoughts?

TIA!

Robert

-Original Message-
From: Richard Davey [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 9:43 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Max file size for uploads?


Hello Robert,

Wednesday, May 12, 2004, 2:37:23 PM, you wrote:

RS I have an upload script that I am trying to allow for 725MB, I have 
RS written the script to handle files of that size, and I modified the 
RS upload_max_filesize = 730M

RS I tried uploading a 15MB file and it blew up (current error message 
RS is not in my brain).

RS Is there a true max size or do I just have something messed up 
RS somewhere that I need to tweak??

POST file size is the other one.

and that's HELL of a file size.. what is it, an ISO dump site? ;)

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
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] default and another constructor

2004-05-12 Thread Michal Migurski
 No, you cannot do this kind of method overloading, not like this anyway.
 If you are using PHP5 you can kind of emulate overloading by using the
 __call() function... some googling will find examples.

 You can at least make the below work by removing the first forum()
 instance and using

  function forum($naam=NULL,$tijd=NULL,$tekst=NULL)

Another option, if you wish to have varying argument lists, is to define
the methods with no arguments at all, and use the func_get_args(),
func_num_args(), and func_get_arg() functions described here:

http://php.net/manual/en/ref.funchand.php

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



Re: [PHP] Max file size for uploads?

2004-05-12 Thread Mark Pecaut
On Wed, May 12, 2004 at 10:07:09AM -0400, Robert Sossomon wrote:
 I get this error message now in my httpd error log:
 
 [Wed May 12 10:07:01 2004] [error] [client 66.43.177.38] Requested
 content-length of 69888498 is larger than the configured limit of
 524288, referer: http://dinghy.homeip.net/upload.php
 
 Any thoughts?

If you are using apache, this might help:

http://httpd.apache.org/docs/mod/core.html#limitrequestbody

-Mark

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



Re: [PHP] PHP5 and static attributes

2004-05-12 Thread Curt Zirzow
* Thus wrote Rudy Metzger ([EMAIL PROTECTED]):
 Dear all,
 
 I have a problem with 'referencing' static attributes. I have the
 following class tree.
 
 // --- CLASS A -
 class A
 {
   protected static $myInstance;
 }
 
 // --- CLASS B --
 class B extends class A
 {
 }
 
 // --- CLASS C --
 class C extends class B
 {
 
 public function Debug()
 {
   echo self::$myInstance; // does not work (undefined)
   echo parent::$myInstance;  // also does not work
   echo A::$myInstance; // works
 }
 
 }
 
 -
 The Problem is that you always have to know in which class the static
 was defined to reference it. Or is there something like
 static::$myInstance or this::$myInstance or class::$myInstance. If not,
 it maybe would be a great idea to add something to PHP, otherwise you
 always have to track in which class the static had been defined if you
 want to reference it!

What version of php are you using? It appears to work with RC1 to
CVS version. The actual result I get is:

public function Debug() {

  echo self::$myInstance;   // works
  echo parent::$myInstance; // error: Cannot access protected property
  echo A::$myInstance;  // error: Cannot access protected property
}

Its expected for the errors on the last two since you're accessing
the protected variable from outsite the public scope of Debug().


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



RE: [PHP] PHP Sessions on Windows

2004-05-12 Thread Ford, Mike [LSS]
 -Original Message-
 From: David Mitchell [mailto:[EMAIL PROTECTED] 
 Sent: 12 May 2004 13:21
 
 OK, I managed to get it working. 
 
 I first attempted to edit the php.ini so that the session 
 save path was C:\Temp. No matter what I did, the save path 
 always showed up in phpinfo() as /tmp. So I created folder on 
 the root of C: called tmp and everything worked.

This still looks like PHP is not looking for the php.ini file where you
think it is.  I strongly suggest you follow the previous advice to work out
where PHP is actually expecting your php.ini to be, before you have a need
to change another initialization parameter.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS,  LS6
3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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



[PHP] FIXED: Max file size for uploads?

2004-05-12 Thread Robert Sossomon
It's fixed now..

If using Apache on RedHat here is everything to fix at once:

FIRST AND FOREMOST DECIDE THE MAX SIZE YOU WANT IN MB, ADD A COUPLE MORE
TO IT, AND THEN CONVERT TO BYTES (MB * 1024 * 1024)

1.  httpd/conf.d/php.conf 
LimitRequestBody  ?? #byte size you calculated

2.  /etc/php.ini
max_file_size = ???M #Max size in MB
post_max_size = ???M #Max size in MB

/etc/init.d/httpd restart

Then upload!  

HTH!!

Robert

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



Re: [PHP] Send username password in HTTP headers

2004-05-12 Thread Chris Shiflett
--- Nagendra Prasad [EMAIL PROTECTED] wrote:
 I'm posting some XML data to my client's website using HTTP Post.
 Assume I'm posting to getxml.php (hosted on my clients server).
 Now my client has put authentication on his website using 
 header('WWW-Authenticate: Basic realm=Private Area');
 
 Now the page getxml.php asks me to prove my identity before it
 acceps my xml posts. So how do I send the username  pwd when I'm
 posting the xml details?

Include an Authorization header, which should look something like this:

Authorization: Basic bXluYW1lOm15cGFzcw==

The encoded string is just the result of this:

base64_encode('myname:mypass')

Substitute with the correct username and password.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



[PHP] Linux command in PHP

2004-05-12 Thread Mike Mapsnac
I have script  that basically process a file. If  something found in the 
file, the script send email.

Today I tried to add another  option, that gives sound and send email.
The script works ok when I run from  shell. But when I add the code to 
cronjob, the email is send but NO SOUND. Any ideas what can cause such 
problem?

# Below the code that start the xmms sound
$alert = /usr/bin/xmms /home/mike/Desktop/song1.mp3;
`$alert';
_
Is your PC infected? Get a FREE online computer virus scan from McAfee® 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

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


[PHP] Memory usage

2004-05-12 Thread Oliver Hankeln
Hi!

I get memory exceded errors and want to find out why. So I am looking 
for a way to determine how much memory is currently beeing used by my 
script. Is this possible?
getPID + reading from /proc dosent work because php is an apache module. 
(I can´t change this)

Thanks!

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


RE: [PHP] Linux command in PHP

2004-05-12 Thread Jay Blanchard
[snip]
Today I tried to add another  option, that gives sound and send email.
The script works ok when I run from  shell. But when I add the code to 
cronjob, the email is send but NO SOUND. Any ideas what can cause such 
problem?

# Below the code that start the xmms sound
$alert = /usr/bin/xmms /home/mike/Desktop/song1.mp3;
`$alert';
[/snip]

The problem is caused by bad code. See http://www.php.net/exec

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



[PHP] Re: Automatically send auth info

2004-05-12 Thread Jason Barnett
Motorpsychkill wrote:

Hi all,

Some of my webpages are no longer working with the IE browser after MS
implemented some security patches which disable sending authentication info
through the URL:
http://user:[EMAIL PROTECTED]

This no longer works with IE, but is fine with most other browsers.  Does
anybody know of a workaround using PHP to send the user  pass in the
background, i.e. without user interaction?
Thanks for your help!

-m
Are you using a web form?  You can just grab the values from the form if 
that's the case.  But I suppose that you are not doing that, so you 
could just add some variables for username / password as part of the 
query string.  Just realize, you're now sending login info in plain text!

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


RE: [PHP] PHP Sessions on Windows

2004-05-12 Thread Daniel Clark
I think you need to restart PHP to pickup the new php.ini changes.

My php.ini is in the windows directory (I believe).

 -Original Message-
 From: David Mitchell [mailto:[EMAIL PROTECTED]
 Sent: 12 May 2004 13:21

 OK, I managed to get it working.

 I first attempted to edit the php.ini so that the session
 save path was C:\Temp. No matter what I did, the save path
 always showed up in phpinfo() as /tmp. So I created folder on
 the root of C: called tmp and everything worked.

 This still looks like PHP is not looking for the php.ini file where you
 think it is.  I strongly suggest you follow the previous advice to work
 out
 where PHP is actually expecting your php.ini to be, before you have a need
 to change another initialization parameter.

 Cheers!

 Mike

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



Re: [PHP] Send username password in HTTP headers

2004-05-12 Thread Nagendra Prasad
Hi,
That worked,
Thanks a lot..

Regards
TNP
Professional Services
ZUSTEK INDIA
__


-- Original Message ---
From: Chris Shiflett [EMAIL PROTECTED]
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Sent: Wed, 12 May 2004 08:55:55 -0700 (PDT)
Subject: Re: [PHP] Send username  password in HTTP headers

 --- Nagendra Prasad [EMAIL PROTECTED] wrote:
  I'm posting some XML data to my client's website using HTTP Post.
  Assume I'm posting to getxml.php (hosted on my clients server).
  Now my client has put authentication on his website using 
  header('WWW-Authenticate: Basic realm=Private Area');
  
  Now the page getxml.php asks me to prove my identity before it
  acceps my xml posts. So how do I send the username  pwd when I'm
  posting the xml details?
 
 Include an Authorization header, which should look something like this:
 
 Authorization: Basic bXluYW1lOm15cGFzcw==
 
 The encoded string is just the result of this:
 
 base64_encode('myname:mypass')
 
 Substitute with the correct username and password.
 
 Hope that helps.
 
 Chris
 
 =
 Chris Shiflett - http://shiflett.org/
 
 PHP Security - O'Reilly
  Coming Fall 2004
 HTTP Developer's Handbook - Sams
  http://httphandbook.org/
 PHP Community Site
  http://phpcommunity.org/
--- End of Original Message ---

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



Re: [PHP] Linux command in PHP

2004-05-12 Thread Curt Zirzow
* Thus wrote Mike Mapsnac ([EMAIL PROTECTED]):
 I have script  that basically process a file. If  something found in the 
 file, the script send email.
 
 Today I tried to add another  option, that gives sound and send email.
 The script works ok when I run from  shell. But when I add the code to 
 cronjob, the email is send but NO SOUND. Any ideas what can cause such 
 problem?
 
 # Below the code that start the xmms sound
 $alert = /usr/bin/xmms /home/mike/Desktop/song1.mp3;

 `$alert';

This is an X problem, not php. xmms has no clue what :display to 
run xmms on.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



RE: [PHP] default and another constructor

2004-05-12 Thread Ford, Mike [LSS]
 -Original Message-
 From: Rudy Metzger [mailto:[EMAIL PROTECTED] 
 Sent: 12 May 2004 14:27
 
 On Wed, 2004-05-12 at 15:18, Mark Constable wrote:
  
   function forum($naam=NULL,$tijd=NULL,$tekst=NULL)
  
  and test the incoming variables with isset() before 
  attempting to use 
  any of them.
 If you assign default values to the method arguments, you 
 cannot test them with isset() anymore, as they will be set.

Not if the default is NULL -- isset(NULL) is false.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services, JG125, James Graham 
Building, Leeds Metropolitan University, Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

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



[PHP] Re: include from another URL

2004-05-12 Thread AcZ
Nik wrote:
Hi there,
I'm new to these groups so forgive me if I'm asking at the wrong place (tell me where 
then :)
Ok,
I'm not PHP guru but I need to create a simple script that would do this:
Include a content from another URL into the current output. I have done something like
this:
-- code start
?php
 include 'http://myotherurl.com:8080';
?
-- code end
and it seems to work with one exception: it produces a warning message saying 
something like
 Warning: main(): stream does not support seeking in .../web-root/index.php on line 9
where line #9 is: include 'http://myotherurl.com:8080'; from above code.
It then shows a message from 'http://myotherurl.com:8080'
Thanks!!!
Nik
Nik,

try fopen instead of include..

http://br.php.net/manual/en/function.fopen.php
look at comments...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Memory usage

2004-05-12 Thread Curt Zirzow
* Thus wrote Oliver Hankeln ([EMAIL PROTECTED]):
 Hi!
 
 I get memory exceded errors and want to find out why. So I am looking 
 for a way to determine how much memory is currently beeing used by my 
 script. Is this possible?
 getPID + reading from /proc dosent work because php is an apache module. 
 (I can´t change this)

Its possible:
  http://us2.php.net/memory_get_usage

You'll most likely need to recompile php with:
  --enable-memory-limit


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] function gethostbyname - how can i deactivate cache / force look-up???

2004-05-12 Thread Tobes
Hi there -
in a script I use the function gethostbyname to resolve a hostname
(www.example.com) into an IP-address.
Unfortunately, the host name that I try to resolve changes its IP address
frequently.
Since the function gethostbyname caches its results, it sooner or later
returns a wrong IP-address.

How can I deactivate cache for this function (or force the look-up) or what
other function could I use to get the IP-address?

Thanks a lot for your help in advance!!!

Tobes =)

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



[PHP] changing http to https

2004-05-12 Thread David T-G
Hi, all --

We have lovely variables like $_SERVER['SCRIPT_URI'] so that we don't
have to hard-code the site or script name into our files, and that's
great; it even includes the SID for me if cookies are off.  I'd like to
be able to point someone to https://sitename/script.php to log in
securely, but I see no way of changing the request method or port number
or such.  So far all I've dreamed up is to either manually build

  https://{$_SERVER['HTTP_HOST']}{$_SERVER['SCRIPT_NAME']}

or perhaps

  str_replace('http','https',$_SERVER['SCRIPT_URI'])

which both seem kinda kludgey.

Any better ideas?


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Max file size for uploads?

2004-05-12 Thread raditha dissanayake
Robert Sossomon wrote:

I have an upload script that I am trying to allow for 725MB, I have
written the script to handle files of that size, and I modified the
upload_max_filesize = 730M
I tried uploading a 15MB file and it blew up (current error message is
not in my brain).
Is there a true max size or do I just have something messed up somewhere
that I need to tweak??
 

There are quite a few some have already been mentioned, in other posts 
but I invite you to look at http://www.radinks.com/upload/config.php 
that will give you a good idea about all the settings involved.

Having said that you probably ought to switch to FTP or SFTP if you want 
to transfer so much data. Web servers are always optimized to deliver 
thousands of files at once instead of accepting large incoming files.

Thanks,
Robert
 



--
Raditha Dissanayake.
-
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions 

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


Re: [PHP] PHP Sessions on Windows

2004-05-12 Thread John W. Holmes
David Mitchell wrote:

I first attempted to edit the php.ini so that the session save path was
C:\Temp. No matter what I did, the save path always showed up in phpinfo()
as /tmp. So I created folder on the root of C: called tmp and everything
worked.
You were not editing the correct php.ini, then.

--
---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] loading 250kb include files, performance degration?

2004-05-12 Thread raditha dissanayake
Merlin wrote:

Hi there,

I am working on a complex webapp written in php. Recently I was 
reading about performance issues and after analysing the code I found 
that most of the files load 5 external php include files to run. All 
together those include files make about 250KB (there are 5 files).

how about trying out turck MMCache?

--
Raditha Dissanayake.
-
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions 

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


Re: [PHP] Max file size for uploads?

2004-05-12 Thread Brian Dunning
Is there a true max size or do I just have something messed up 
somewhere
that I need to tweak??
I've got a client who needs their customers to upload large files for 
printing this way - and it stops at 30MB. There is some setting in 
Windows XP that we have not been able to change. It's been a lot of fun 
digging through Microsoft support docs but have had no luck. The IIS 
setting seems to override whatever you tell PHP to do.

- Brian

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


Re: [PHP] search query analyzer

2004-05-12 Thread raditha dissanayake
Paul Godard wrote:

Hi

I am looking for some good ideas to combine some fields with query operators (multiple words, or/and, //, range of numerical values...).

Let's say I have 2 fields (numerical  text) to combine where the serach criteria can 
be as complicated as this :
- year : 1950, 1960-1965, not1980-2000, 2002
- subject : (boy and bicycle) or (man and tractor)
Is there a bullet proof function that can filter such field values and return a valid sql query?
 

I sure hope not, if such things existed in the API we would all be out 
of jobs :-)

before you get started, i suggest taking a look at full text indexing , 
you will find that a lot friendlier than ordinary look ups.

--
Raditha Dissanayake.
-
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions 

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


Re: [PHP] HTTP_RAW_POST_DATA

2004-05-12 Thread raditha dissanayake
Chris Boget wrote:

same configuration.  Where would I look to discover why one
server would have data held in $HTTP_RAW_POST_DATA
whereas the other server would not?
 

Check the value of always_populate_raw_post_data in php.ini 
on both servers.
   

That was it.  Thank you so very much!!

Chris

 

NOw I am very curious, the raw_post_data doesn't always get populated 
even with that setting. If i have not been barking up the wrong tree all 
these years that variable only gets populated if the content type is not 
url-encoded or multipart/form-data. If you are indeed using one of these 
types please be so kind as to share more info about your set up, this is 
something i would like to reproduce.

best regards
raditha
--
Raditha Dissanayake.
-
http://www.radinks.com/print/upload.php
SFTP, FTP and HTTP File Upload solutions 

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


[PHP] Submit button as image

2004-05-12 Thread Sam

What do you do with this?
Submit.x=22Submit.y=13

if($_GET['Submit.x']  0) ???

Is there some smarter way of dealing with an image as a submit button?

input name=Submit type=image value=doesNOTseemTOmatter

Thanks

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



[PHP] Constant questions

2004-05-12 Thread René Fournier
Hi,

I have two questions involving Constants.

1. I want to refer to a refer to a Constant by its value (which is 
unique), and return its name. E.g.,:

define (SEND_DS,1);
define (SEND_DS_ACK,2);
define (RESEND_DS,3);
define (STARTUP_DS,12);
For example, if I receive 3, I would like to echo RESEND_DS--the 
name of the constant. Is there a simply way to do this? Or am I better 
using an Associative Array (which is what I was thinking)? Then I could 
such refer to an element by its key or value (both of which are 
unique). I suppose this more of a performance/elegance issue, than 
outright problem. Just curious what you think.

2. Let's say I have a Constant called MY_NAME, the value of which is 
Rene, and I pass it to a function, such as:

function example ($val) {
echo ???;
}
example (MY_NAME);

Such that the output will be MY_NAME. If I echo $val, the output will 
be Rene. But I want to see the constants Name, not Value. Any ideas?

Thanks.

...Rene

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


RE: [PHP] Submit button as image

2004-05-12 Thread Chris W. Parker
Sam mailto:[EMAIL PROTECTED]
on Wednesday, May 12, 2004 10:10 AM said:

 What do you do with this?

nothing. i usually don't give my image buttons a name value so that
never shows up. what it's meant for is server side image maps. the
browser is telling the server where on the image the user clicked. then
you as the programmer decide where the user be taken depending on where
they clicked.

 Is there some smarter way of dealing with an image as a submit button?
 
 input name=Submit type=image value=doesNOTseemTOmatter

maybe the following will suffice?

input type=image src=path/to/file.jpg /


hth,
chris.

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



Re: [PHP] Submit button as image

2004-05-12 Thread Curt Zirzow
* Thus wrote Sam ([EMAIL PROTECTED]):
 
 What do you do with this?
 Submit.x=22Submit.y=13
 
 if($_GET['Submit.x']  0) ???

$_GET['Submit_x']; 

php converts .x to _x to be compatible accross browser versions.

 
 Is there some smarter way of dealing with an image as a submit button?
 
 input name=Submit type=image value=doesNOTseemTOmatter

mozilla/firefox is the only browser that I know of that will pass
the value.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] Re: Submit button as image

2004-05-12 Thread Justin Patrin
Sam wrote:

What do you do with this?
Submit.x=22Submit.y=13
if($_GET['Submit.x']  0) ???

Is there some smarter way of dealing with an image as a submit button?

input name=Submit type=image value=doesNOTseemTOmatter

Thanks
Well, it comes through as an image map in most browsers. I've found that 
you can't rely on the value of a submit button anyway as it is usually 
possible to just hit enter in a form to submit it, which, in most 
browsers, doesn't send the submit button. Use a hidden or ohter field to 
check for submission.

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


Re: [PHP] Constant questions

2004-05-12 Thread Richard Davey
Hello René,

Wednesday, May 12, 2004, 6:29:13 PM, you wrote:

RF Such that the output will be MY_NAME. If I echo $val, the output will
RF be Rene. But I want to see the constants Name, not Value. Any ideas?

No easy way I can think of, but you could do:

$array = get_defined_constants();

and then search $array for your value, returning the key if found.

-- 
Best regards,
 Richard Davey
 http://www.launchcode.co.uk / PHP Development Services
 http://www.phpcommunity.org/wiki/296.html / PHP Community

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



Re: [PHP] Constant questions

2004-05-12 Thread Curt Zirzow
* Thus wrote Ren Fournier ([EMAIL PROTECTED]):
 Hi,
 
 I have two questions involving Constants.
 
 1. I want to refer to a refer to a Constant by its value (which is 
 unique), and return its name. E.g.,:
 
   define (SEND_DS,1);
   define (SEND_DS_ACK,2);
   define (RESEND_DS,3);
   define (STARTUP_DS,12);
 
 For example, if I receive 3, I would like to echo RESEND_DS--the 
 name of the constant. Is there a simply way to do this? Or am I better 
 using an Associative Array (which is what I was thinking)? Then I could 
 such refer to an element by its key or value (both of which are 
 unique). I suppose this more of a performance/elegance issue, than 
 outright problem. Just curious what you think.

Constants are more for the programmer to use within the program to
avoid hard coding arbitrary numbers embeded deep inside code.

You can use a combination of both Constants and arrays to achive
your task:

define('SEND_DS', 1);
define('SEND_DS_ACK', 2);
...

$lookup = array(
  SEND_DS  = 'SEND_DS',
  SEND_DS_ACK  = 'SEND_DS_ACK',
);


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] Reshuffling an array

2004-05-12 Thread Todd Cary
I do the following:

  $eventList = array();
  $eventList[] = Any;
  $dbh = db_open($host, $user, $password, $database);
  if($dbh) {
$sthdl = db_get_event_data($dbh);
while ($row = mysql_fetch_object($sthdl)) {
  $eventList[] = $row-EV_EVENT;
}
  } else {
$eventList[] = * None found *;
  }
  asort( $eventList );
Now I want to put Any as the first item.  What is the best way to do 
this?  Often the sort puts it as an item down the list.

Todd

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


RE: [PHP] Re: Automatically send auth info

2004-05-12 Thread motorpsychkill
 Are you using a web form?  You can just grab the values from the form if
 that's the case.  But I suppose that you are not doing that, so you
 could just add some variables for username / password as part of the
 query string.  Just realize, you're now sending login info in plain text!

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

No, it's not a web form.  I'm trying to include an IP addressed video camera
into my webpage.  The problem is that the video camera is password protected
using htaccess.  I don't have the option to remove the password.

I tried looking through the PEAR auth libraries but I didn't find anything
that *passed* authentication info, but only prompted for it, etc.

I thought there would be a class that would allow me to send the username
and password to a website and then include it, something like the following
pseudo-code:

?php

$crap = new get_website();
$crap-website_address(http://127.0.0.1;);
$crap-website_username(joe);
$crap-website_password(shmoe);
$crap-retune_website();


?

The camera used to be accessible with:

http://joe:[EMAIL PROTECTED]

But it is no longer available via Internet Explorer since the new MS
security updates on most windows boxes.

Thanks again.

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



[PHP] Re: Reshuffling an array

2004-05-12 Thread Justin Patrin
Todd Cary wrote:

I do the following:

  $eventList = array();
  $eventList[] = Any;
  $dbh = db_open($host, $user, $password, $database);
  if($dbh) {
$sthdl = db_get_event_data($dbh);
while ($row = mysql_fetch_object($sthdl)) {
  $eventList[] = $row-EV_EVENT;
}
  } else {
$eventList[] = * None found *;
  }
  asort( $eventList );
Now I want to put Any as the first item.  What is the best way to do 
this?  Often the sort puts it as an item down the list.

Todd
Take out the $eventList[] = Any; at the top and at the bottom:

array_unshift($eventList, 'Any');

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


RE: [PHP] Re: Automatically send auth info

2004-05-12 Thread jon roig
I may be mistaken, but I think you can use CURL to grab that data. Check
out the options available here:

http://us3.php.net/manual/en/function.curl-setopt.php

In particular, you may want to look at CURLOPT_USERPWD


- jon roig

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.668 / Virus Database: 430 - Release Date: 4/24/2004
 

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



[PHP] Strange music playing behavior

2004-05-12 Thread Ryan Schefke
I'm getting some strange behavior trying to play music. The script below
works fine standalone. However, when I put it into a larger script the music
doesn't play but all of the echo statements work and when I view the source
the embed tags are fine, etc. What could the issue be? If you need me to
send the larger file let me know.

 

?php 
/* MUSIC? */
require($_SERVER['DOCUMENT_ROOT']./tgwedding/configuration.inc);
require(SITEROOT./mysql_connect.php);
$ID = 1;
$query_music = SELECT playMusic, songSelection, musicFile FROM preferences
WHERE customerID='$ID';
$result_music = @mysql_query($query_music);
$row_music = mysql_fetch_array($result_music, MYSQL_NUM);//store this record
as an array row
echo $row_music[0];
if ($row_music[0] == 1) { // play music
if ($row_music[1] == s) {
echo $row_music[1];
echo $row_music[2];
echo 'embed src=songs/'.$row_music[2].' hidden=true
autostart=true loop=true 
noembed
bgsound src=songs/'.$row_music[2].' loop=infinite 
/noembed'; 
} else {
echo 'embed src='.MUSICDIRECTORY.$row_music[2].' hidden=true
autostart=true loop=true 
noembed
bgsound src='.MUSICDIRECTORY.$row_music[2].' loop=infinite 
/noembed'; 
}
}
/* MUSIC? */
mysql_close();
? 



RE: [PHP] Strange music playing behavior

2004-05-12 Thread Jay Blanchard
[snip]
I'm getting some strange behavior trying to play music. The script below
works fine standalone. However, when I put it into a larger script the
music
doesn't play but all of the echo statements work and when I view the
source
the embed tags are fine, etc. What could the issue be? If you need me
to
send the larger file let me know.
[snip]

Since the code snippet you sent works I would have to say that something
about this code being plugged into other code is a problem. I believe
that is what it is. For sure.

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



Re: [PHP] Reshuffling an array

2004-05-12 Thread John W. Holmes
From: Todd Cary [EMAIL PROTECTED]

 I do the following:

$eventList = array();
$eventList[] = Any;
$dbh = db_open($host, $user, $password, $database);
if($dbh) {
  $sthdl = db_get_event_data($dbh);
  while ($row = mysql_fetch_object($sthdl)) {
$eventList[] = $row-EV_EVENT;
  }
} else {
  $eventList[] = * None found *;
}
asort( $eventList );

 Now I want to put Any as the first item.  What is the best way to do
 this?  Often the sort puts it as an item down the list.

Remove the line adding 'Any' at the beginning of your code and use
array_unshift() to add it at the end.

   $eventList = array();
   $dbh = db_open($host, $user, $password, $database);
   if($dbh) {
 $sthdl = db_get_event_data($dbh);
 while ($row = mysql_fetch_object($sthdl)) {
   $eventList[] = $row-EV_EVENT;
 }
   } else {
 $eventList[] = * None found *;
   }
   asort( $eventList );
   array_unshift($eventList,'Any');

do you really need to maintain the numeric keys to the array by using
asort() instead of just sort()? If so, this may not work. You may be able to
use array_splice($input, 0, 0, array('Any')) or array_merge().

---John Holmes...

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



RE: [PHP] Strange music playing behavior

2004-05-12 Thread Ryan Schefke
I know it's a lot of code but it's below.  Again, when I have the /* MUSIC?
*/ section as a standalone file (making sure to open and close the database
and include the correct require statements) it works fine; however, when
added to the code below (music section 4 paragraphs down) it doesn't play
but all the embed tags and echo statements are displaying correctly.

Any clues to keep me from banging my head against the wall?

==

?php
require($_SERVER['DOCUMENT_ROOT']./tgwedding/configuration.inc);
require(SITEROOT./mysql_connect.php);
require(SITEROOT./finduserID.php);

$query = SELECT TO_DAYS(weddingDate) - TO_DAYS(SYSDATE()), couplesName FROM
customers WHERE customers.customerID='$ID';
$result = @mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_NUM);//store this record as an array
row

$query_preferences = SELECT bridalpartyMessage FROM preferences WHERE
customerID='$ID';
$result_preferences = @mysql_query($query_preferences);
$row_preferences = mysql_fetch_array($result_preferences, MYSQL_NUM);//store
this record as an array row

/* MUSIC? */
$query_music = SELECT playMusic, songSelection, musicFile FROM preferences
WHERE customerID='$ID';
$result_music = @mysql_query($query_music);
$row_music = mysql_fetch_array($result_music, MYSQL_NUM);//store this record
as an array row
echo $row_music[0];
if ($row_music[0] == 1) { // play music
if ($row_music[1] == s) {
echo $row_music[1];
echo $row_music[2];
echo 'embed src=songs/'.$row_music[2].' hidden=true
autostart=true loop=true 
noembed
bgsound src=songs/'.$row_music[2].' loop=infinite 
/noembed'; 
} else {
echo 'embed src='.MUSICDIRECTORY.$row_music[2].'
hidden=true autostart=true loop=true 
noembed
bgsound src='.MUSICDIRECTORY.$row_music[2].'
loop=infinite 
/noembed'; 
}
}
/* MUSIC? */



?
html
head
?php echo 'title'.$row[1].'\'s Wedding Website'.'/title'; ?
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
link href=stylesheet.css rel=stylesheet type=text/css
/head

body
div align=center
  table width=725 border=0 cellpadding=20 cellspacing=0
class=brideandgroom
!--DWLayoutTable--
tr 
?PHP   
   require(headerimage.php);   
?
div align=right 
  ?php 
echo $row[1];
?
/div/td
/tr
  /table
  table width=725 border=0 cellpadding=0 cellspacing=0
bgcolor=#FFDFDF class=daysuntilwedding
!--DWLayoutTable--
tr 
  td width=16 height=25nbsp;/td
  td width=300 valign=middle 
?PHP
  $today = date(l F jS, Y);
  echo $today; 
  ?
  /td
  td width=14nbsp;/td
  td width=382 align=right valign=middle
  ?php 
require(SITEROOT./daystowedding.php);
   ?
/td
  td width=13nbsp;/td
/tr
  /table
  table width=725 border=0 cellpadding=0 cellspacing=0
!--DWLayoutTable--
tr 
  td height=5 colspan=2 valign=toptable width=100% border=0
cellpadding=0 cellspacing=0 class=firstthinstrip
  !--DWLayoutTable--
  tr 
td width=725 height=5/td
  /tr
/table/td
/tr
tr 
  td height=5 colspan=2 valign=toptable width=100% border=0
cellpadding=0 cellspacing=0 class=secondthinstrip
  !--DWLayoutTable--
  tr 
td width=725 height=5/td
  /tr
/table/td
/tr
tr 
  td width=172 height=400 valign=toptable width=100%
height=100% border=0 cellpadding=0 cellspacing=0
bordercolor=#99CCFF bgcolor=#CEE7FF class=pinkborderlrb
  !--DWLayoutTable--
  tr 
td width=172 height=395 valign=top
?PHP
require(showlists.php);
?
  /td
  /tr
/table/td
  td width=553 valign=toptable width=100% height=100%
border=0 cellpadding=20 cellspacing=0 bgcolor=#CEE7FF
class=pinkborderrb
  !--DWLayoutTable--
  tr 
td width=508 height=395 valign=topdiv align=center

?php echo  'img src=images/header_bridalparty.gif';

 ? 

?php 
echo 'p'.$row_preferences[0].'/p';
echo 'pfont size=1Sorted by first
name:/font/p';
 ?
?PHP   
$query_lists = SELECT position, firstName,
lastName, story, theirPhoto FROM mentions WHERE customerID='$ID' ORDER BY
firstName ASC;
$result_lists = @mysql_query($query_lists);
//  $row_lists = mysql_fetch_array($result_lists,
MYSQL_NUM);

while ($row_lists = mysql_fetch_array($result_lists, 

RE: [PHP] Strange music playing behavior

2004-05-12 Thread Jay Blanchard
[snip]
I know it's a lot of code but it's below.  Again, when I have the /*
MUSIC?
*/ section as a standalone file (making sure to open and close the
database
and include the correct require statements) it works fine; however, when
added to the code below (music section 4 paragraphs down) it doesn't
play
but all the embed tags and echo statements are displaying correctly.

Any clues to keep me from banging my head against the wall?
[/snip]

Top posting rocks!

It looks like you're outputting your embed tags before the html even
starts. Try placing the code somewhere mid-page...between the body
tags

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



RE: [PHP] Strange music playing behavior

2004-05-12 Thread Ryan Schefke
I just tried it between the body tags, that doesn't make a difference.  As
I mentioned, when I run it standalone it will work fine and it's a php file,
not html so the html tags aren't needed.

...this is painful!

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 2:30 PM
To: Ryan Schefke; Php-General-Help
Subject: RE: [PHP] Strange music playing behavior

[snip]
I know it's a lot of code but it's below.  Again, when I have the /*
MUSIC?
*/ section as a standalone file (making sure to open and close the
database
and include the correct require statements) it works fine; however, when
added to the code below (music section 4 paragraphs down) it doesn't
play
but all the embed tags and echo statements are displaying correctly.

Any clues to keep me from banging my head against the wall?
[/snip]

Top posting rocks!

It looks like you're outputting your embed tags before the html even
starts. Try placing the code somewhere mid-page...between the body
tags

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



Re: [PHP] Strange music playing behavior

2004-05-12 Thread John Nichel
Jay Blanchard wrote:
Top posting rocks!

You like to live dangerously.  ;)

--
John C. Nichel
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] Strange music playing behavior

2004-05-12 Thread Ryan Schefke
I fixed it, thanks!  It turns out my src=  location was wrong since I
moved the file.  I just freaked cause I thought it was an issue with
php+html.

Sorry, Ryan

-Original Message-
From: Ryan Schefke [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 2:35 PM
To: 'Jay Blanchard'; 'Php-General-Help'; 'Ryan Schefke'
Subject: RE: [PHP] Strange music playing behavior

I just tried it between the body tags, that doesn't make a difference.  As
I mentioned, when I run it standalone it will work fine and it's a php file,
not html so the html tags aren't needed.

...this is painful!

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 2:30 PM
To: Ryan Schefke; Php-General-Help
Subject: RE: [PHP] Strange music playing behavior

[snip]
I know it's a lot of code but it's below.  Again, when I have the /*
MUSIC?
*/ section as a standalone file (making sure to open and close the
database
and include the correct require statements) it works fine; however, when
added to the code below (music section 4 paragraphs down) it doesn't
play
but all the embed tags and echo statements are displaying correctly.

Any clues to keep me from banging my head against the wall?
[/snip]

Top posting rocks!

It looks like you're outputting your embed tags before the html even
starts. Try placing the code somewhere mid-page...between the body
tags

-- 
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] Strange music playing behavior

2004-05-12 Thread Jay Blanchard
[snip]
 Top posting rocks!
 

You like to live dangerously.  ;)
[/snip]

Dammit! I forgot the [sarcasm] tags! :)

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



[PHP] PHP Session Handlers

2004-05-12 Thread Paul Higgins
Hi all,

I just read this tutorial:  
http://www.phpbuilder.com/columns/ying2602.php3

I understand what each function does and what to do in each function.  
However, my question is this:  If I write my own session handling functions, 
do I have to explicity call them myself?  If so, when do I call them?

Thanks

_
MSN Toolbar provides one-click access to Hotmail from any Web page – FREE 
download! http://toolbar.msn.com/go/onm00200413ave/direct/01/

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


Re: [PHP] PHP Session Handlers

2004-05-12 Thread John W. Holmes
From: Paul Higgins [EMAIL PROTECTED]

 I just read this tutorial:
 http://www.phpbuilder.com/columns/ying2602.php3

 I understand what each function does and what to do in each function.
 However, my question is this:  If I write my own session handling
functions,
 do I have to explicity call them myself?  If so, when do I call them?

No, you'll just use sessions as normal and these functions will be used by
PHP when needed. For instance, at the end of the script when PHP needs to
save the current session variables, it'll call your write() function. You
just use sessions as normal, though.

---John Holmes...

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



[PHP] Using PHP4 4.3.4 as a CGI

2004-05-12 Thread Mark Constable
Debian testing system with a recent update to php-cgi 4.3.4.

I have been using the /usr/bin/php4 binary as a some.cgi with
a shbang line of #!/usr/bin/php4 which worked fine up until
this recent 4.3.4 update. Now the new 4.3.4 php4 binary does
not produce a Content-type: index/html\n\n header nor does
it receive any GPC (GET POST etc) variables at all. I've been
throught the new php.ini and I cannot see any parameters or
advice as to what may have changed.

Could anyone advise me how to re-enable receiving incoming
variables for a /usr/bin/php4 binary used as a CGI please ?

--markc

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



[PHP] SuExec and PHP

2004-05-12 Thread Travis Low
Greetings.  We have a need for our PHP scripts to run as the user and group 
associated with each Apache virtual domain on our Redhat server.  Currently, 
all PHP scripts run as nobody.nobody.

I know that the apache suexec module allows CGI scripts to run as the user and 
group of the virtual host, but that doesn't seem to be the case for PHP scripts 
run under the apache php module (mod_php).

So my questions are:

(1) Can we use suexec to force PHP scripts (running under mod_php) to run as 
the user/group associated with the virtual host?  If so, how?  Are there any 
special configuration tricks to make this happen?

(2) If we CAN'T use suexec with mod_php, I assume we can run PHP as CGI to 
solve our problem.  However, I'm worried about performance.  Have any of you 
done this on linux?  Is it difficult to configure?  Do you have to audit all of 
your PHP scripts?  Etc., etc.

I did read the pages http://www.php.net/security.cgi_bin and 
http://www.php.net/manual/en/security.apache.php, but did not come away with 
clear answers to my questions.  There were also a lot of contradictory comments 
at the bottom of those pages, and a whole mess of stuff on google, so I'm 
getting more lost, not less.  Please help!

cheers,

Travis

--
Travis Low
mailto:[EMAIL PROTECTED]
http://www.dawnstar.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: include (or require) doesn't seem to work

2004-05-12 Thread Torsten Roehr
Daniel Barbar [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Thanks Torsten! Using the file-system relative path made it work (I had
 tried only with the absolute path, which ddidn't work). However, I checked
 again and I did have 'allow_url_fopen = On' in /etc/php.ini. I'll take a
 closer look later and report the problem if I find it. Thanks again,

 Daniel

Using the absolute path works as well - but you have to use the full LOCAL
file path, e.g. /htdocs/www/your-domain etc.

You can get this value from $_SERVER['DOCUMENT_ROOT'].

Regards, Torsten


 Torsten Roehr [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
   Try including it as a local file:
   require_once library.php'; // if it is in the same directory as the
file
  you
 
  Forgot a quote here, sorry:
  require_once 'library.php';
 
  Torsten

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



[PHP] Re: User/Group rights system?

2004-05-12 Thread Torsten Roehr
David David [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 Does anyone know of an open source user/group based
 permission system built with php/MySQL?

 That is, the effective rights for any user on a
 specific secured object are computed from various
 permit/deny permissions assigned to the user or any of
 the groups he/she belongs to.

 PEAR::Auth seems only to support basic user
 authentication.



Take a look at PEAR's LiveUser:
http://pear.php.net/package/LiveUser

Regards, Torsten

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



[PHP] mcrypt pdflib configuration

2004-05-12 Thread William Holroyd
I've already posted this question in comp.lang.php but no one seemed to have
an answer to it.

So I've got PHP to recognize mcrypt and pdflib in the phpinfo() output, but
trying to use any of the functions fail with ...undefined function
called... There aren't any configurable files with either distro and
neither mention php.ini settings need to be made. Restarting the apache
server does not fix this and no errors are reported while starting.

The most recent stable releases Apache 2.0.49 and PHP 4.3.6 are being used
with mcrypt 2.4 (stable, but 2.6.4 is most recent) and pdflib 5.0.3p1 (most
recent stable release) libraries, running on Windows 2003 Server Enterprise
with all updates applied.

I picked up a copy of Visual Studio .NET Enterprise but am also stumped of
how to compile these functions from source which I would prefer to do at
this point.

Any help on either topic is much appreciated.

-William

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



[PHP] Re: Memory usage

2004-05-12 Thread Torsten Roehr
Oliver Hankeln [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi!

 I get memory exceded errors and want to find out why. So I am looking
 for a way to determine how much memory is currently beeing used by my
 script. Is this possible?
 getPID + reading from /proc dosent work because php is an apache module.
 (I can´t change this)

 Thanks!

Maybe this script will help you:
http://phpsysinfo.sourceforge.net/

Regards, Torsten

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



[PHP] Breaking out of a loop...

2004-05-12 Thread René Fournier
Hi,

I have this code (below) that waits for particular data to come over 
the socket (ENX), at which point it breaks out of the loop and does 
other things. Presently, it will loop forever, until it receives 
ENXa good startbut I also need it to break-out if the loop runs 
longer than five seconds. This is where I'm having a problem. It seems 
that it is only reading once data comes over the socket, so it is stuck 
on that first  'while' line (while(($buf = 
socket_read($socket,128,PHP_BINARY_READ)) !== false) {).

$timer = time();
while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) {
$data .= $buf;
$elapsed = time() - $timer; 
if(preg_match(/ENX/, $data)) {
break;
} elseif ($elapsed  5) {
echo TOO LONG!\n;
break;
}
}
Maybe set non-blocking / blocking socket is the answer? Only problem is 
I can't find much [good] documentation describing what blocking and 
non-blocking sockets are good for, etc. Any ideas? Thanks.

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


Re: [PHP] HTTP_RAW_POST_DATA

2004-05-12 Thread Chris Shiflett
--- Michal Migurski [EMAIL PROTECTED] wrote:
 Anyone have any clue why this is the case? Is there a performance
 reason that raw post data must be explicitly enabled, or is it more
 of a protective measure for overly permissive beginner scripts?

If it was always enabled, it sure would make a DoS attack easy. I'd just
send lots of huge POST requests to any PHP script on your server. Hope you
have migs and megs of memories, as Strong Bad would say. :-)

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] Breaking out of a loop...

2004-05-12 Thread Curt Zirzow
* Thus wrote Ren Fournier ([EMAIL PROTECTED]):
 Hi,
 
 I have this code (below) that waits for particular data to come over 
 the socket (ENX), at which point it breaks out of the loop and does 
 other things. Presently, it will loop forever, until it receives 
 ENX—a good start—but I also need it to break-out if the loop runs 
 longer than five seconds. This is where I'm having a problem. It seems 
 that it is only reading once data comes over the socket, so it is stuck 
 on that first  'while' line (while(($buf = 
 socket_read($socket,128,PHP_BINARY_READ)) !== false) {).
 
   $timer = time();
   while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) {
   $data .= $buf;
   $elapsed = time() - $timer; 
   if(preg_match(/ENX/, $data)) {
   break;
   } elseif ($elapsed  5) {
   echo TOO LONG!\n;
   break;
   }
   }
 
 Maybe set non-blocking / blocking socket is the answer? Only problem is 
 I can't find much [good] documentation describing what blocking and 
 non-blocking sockets are good for, etc. Any ideas? Thanks.

blocking - wait for response or till timeout
non-blocking - return right away

If you use blocking and then set the timeout for the read, you can
just check for socket_last_error() after the loop.

socket_set_block($socket);
socket_set_option($socket, SO_RCVTIMEO, 5000); // milliseconds iirc
while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) {
  //...
}
if ($error = socket_last_error($socket) ) {
  echo socket error [$error]: . socket_strerror($error);
}


or something like that.

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] HTTP_RAW_POST_DATA

2004-05-12 Thread Michal Migurski
  Anyone have any clue why this is the case? Is there a performance
  reason that raw post data must be explicitly enabled, or is it more of
  a protective measure for overly permissive beginner scripts?

 If it was always enabled, it sure would make a DoS attack easy. I'd just
 send lots of huge POST requests to any PHP script on your server. Hope
 you have migs and megs of memories, as Strong Bad would say. :-)

Isn't this potentially a DoS attack vector anyway? I don't need a server
to accept or read my obscenely long POST requests to clog the pipes with
them. Would the proper way to handle this risk be to disallow POST at the
webserver level, or does turning always_populate_raw_post_data off cause
the connection to be automatically dropped after Connection: close?

-mike.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



  1   2   >