[PHP] Static methods have access to private members

2007-05-16 Thread Theodore Root
I have a question regarding static methods in PHP5.x. Specifically, it 
seems that one can access member variables declared private from static 
methods, just as you can from instance methods.  I was wondering if this 
is by design, or if this feature might go away.  I have worked up an 
example, hopefully it won't get mangled:


?php

class TestClass
{
   private $myVar;
  
   public static function loadAllObjects()

   {
   $vars = array();
   $tempVar = new TestClass();
   $tempVar-myVar = Example;
   $vars[] = $tempVar;
   return $vars;   
   }

}


$test = TestClass::loadAllObjects();

print_r($test);


?


This code executes fine on PHP 5.2.0 with no errors or warnings, even 
though one might say that I have accessed the private $myVar from 
outside the instance of TestClass created in $tempVar.  This feature 
is useful to me because I'd like to create a static method on my 
DB-persisted objects that lets me load an array of all of a given type 
of object from a database, building each one without having to use 
setters/getters for each member variable (not because thats difficult, 
but because its nice to be able to have private members that can't be 
accessed at all from the outside world), while avoiding lazy loading.  
So essentially, my questions is, is the above functionality intended?



Thanks!

-TJ

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



Re: [PHP] RE: non-text data

2006-08-14 Thread Dave Shariff Yadallee - System Administrator a.k.a. The Root of the Problem
On Mon, Aug 14, 2006 at 02:40:53PM +1000, Chris wrote:
 John Meyer wrote:
 Gd,
 BTW, came into this late, have we gotten the old store your images in the
 filesystem and save the file name in the database argument yet?
 
 Nope, haven't done that one yet, do you want to start it off or shall I? ;)
 
 -- 
 Postgresql  php tutorials
 http://www.designmagick.com/


Careful where you light your match.

You may blow up if you are not careful.
 
 -- 
 This message has been scanned for viruses and
 dangerous content by MailScanner, and is
 believed to be clean.
 

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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



[PHP] apache 1.3.33 + PHP chunked Transfer-Encoding forbidden error

2005-08-30 Thread Root
Здравствуйте, php-general.

Hi all.
I have some problem with my Apache server.
When some user try open php script using mobile fone  some chat
program I get this errors on my log file:

[Mon Aug 29 18:37:39 2005] [error] [client 127.0.0.1] chunked Transfer-Encoding 
forbidden: /chat/index.php
[Mon Aug 29 18:40:46 2005] [error] [client 127.0.0.1] chunked Transfer-Encoding 
forbidden: /chat/index.php
[Mon Aug 29 19:04:55 2005] [error] [client 127.0.0.1] chunked Transfer-Encoding 
forbidden: /chat/index.php
[Mon Aug 29 19:16:01 2005] [error] [client 127.0.0.1] chunked Transfer-Encoding 
forbidden: /chat/index.php
[Mon Aug 29 21:08:17 2005] [error] [client 127.0.0.1] chunked Transfer-Encoding 
forbidden: /chat/index.php
[Mon Aug 29 21:18:56 2005] [error] [client 127.0.0.1] chunked Transfer-Encoding 
forbidden: /chat/index.php

How i can solve this problem?

-- 
С уважением,
 Root  mailto:[EMAIL PROTECTED]

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



[PHP] Question about Safe Mode

2005-01-31 Thread Rick Root
I have a little home made CMS that writes files... on the server I've
recently installed this CMS on, those files get written as apache:apache ...
that file uses include to include other files that are not owned by
apache, and this doesn't work.
Warning: main(): SAFE MODE Restriction in effect. The script whose uid
is 48 is not allowed to access ./inc_pagecontent.php owned by uid 538 in
/home/virtual/site36/fst/var/www/html/test.php on line 3
So...  how do I work around this?  Can I get php to write the files so
they aren't owned by apache but rather thwn owner of the php script
that creates them?
Thanks.
Rick


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.2 - Release Date: 1/28/2005
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Parse Error, Unexpected $

2004-07-19 Thread Jim Root
I see one problem, but not the one you are talking about. 

 // Convert Values to Variables:
   $Title = $_POST[Title];

This (and the rest of the post fields) should have quotes:

$Title = $_POST[Title];

(php looks for a constant named Title, instead of the string Title)

What line gives you the parse error?

On Mon, 19 Jul 2004 11:10:09 +0100, Harlequin
[EMAIL PROTECTED] wrote:
 I've checked my syntax but obviously missing something.
 
 Would anyone mind a quick scan:
 
 // Convert Values to Variables:
   $Title = $_POST[Title];
   $ChristianName = $_POST[ChristianName];
   $MiddleName = $_POST[MiddleName];
   $Surname = $_POST[Surname];
   $HomePhone = $_POST[HomePhone];
   $Address01 = $_POST[Address01];
   $Address02 = $_POST[Address02];
   $Address03 = $_POST[Address03];
   $City = $_POST[City];
   $Postcode = $_POST[Postcode];
   $Country = $_POST[Country];
   $Nationality = $_POST[Nationality];
   $Gender = $_POST[Gender];
   $WorkPermitRequired = $_POST[WorkPermitRequired];
   $MyStatus = $_POST[MyStatus];
 
 // Dump Data Into MembersData:
   $UserDataDump = INSERT INTO MembersData (Title, ChristianName,
 MiddleName, Surname, DOB, TelephoneHome, Address01, Address02, Address03,
 AddressCity, AddressPostcode, AddressCountry, Nationality, Gender,
 WorkPermit, Status)
 
 VALUES('$Title','$ChristianName','$MiddleName','$Surname','$HomePhone','$Add
 ress01','$Address02','$Address03','$City','$Postcode','$Country','$Nationali
 ty','$Gender','$WorkPermitRequired','$MyStatus');
mysql_query($UserDataDump) or die(Couldn't Create User Data Entry. MySQL
 Error:  . mysql_error());
 
 --
 -
  Michael Mason
  Arras People
  www.arraspeople.co.uk
 -
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Jim Root
[EMAIL PROTECTED]

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



Re: [PHP] Parse Error, Unexpected $

2004-07-19 Thread Jim Root
   else
   {
echo Hi...!;
 ?

You are missing a } at the end of the else. It should be:

else
{
echo Hi...!;
}
?

On Mon, 19 Jul 2004 12:02:47 +0100, Harlequin
[EMAIL PROTECTED] wrote:
 Jim
 
 I deleted a whole load of lines and still get the error. I've narrowed it
 down to this code:
 
 ?php
 // Verify User Input:
   echo brbrbr;
 
   $requiredFields =
 array('Title','ChristianName','Surname','HomePhone','Address01','City','Post
 code','Country','Gender','WorkPermitRequired','MyStatus');
 
   $errors = array();
   forEach($requiredFields as $fieldName)
   {
 // If using post, change $_GET to $_POST instead
   if (empty($_POST[$fieldName]))
   {
 // The field is empty
   $errors[] = 'Required field ' . $fieldName . ' empty!';
   }
   }
   if (count($errors))
   {
 // Empty fields detected!
   echo Sorry ;
   echo $_SESSION['UserCName'];
   echo brbr;
   echo The Following Fields Require Input ~ Please Go Back.;
   echo brbr;
 
   forEach($errors as $error)
   {
   echo $error . 'brbr';
   }
   }
   else
   {
echo Hi...!;
 ?
 
 But the error (line 40) is actually the last line...! :|
 
 --
 -
  Michael Mason
  Arras People
  www.arraspeople.co.uk
 -
 Jim Root [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
 
  I see one problem, but not the one you are talking about.
 
   // Convert Values to Variables:
 $Title = $_POST[Title];
 
  This (and the rest of the post fields) should have quotes:
 
  $Title = $_POST[Title];
 
  (php looks for a constant named Title, instead of the string Title)
 
  What line gives you the parse error?
 
  On Mon, 19 Jul 2004 11:10:09 +0100, Harlequin
  [EMAIL PROTECTED] wrote:
   I've checked my syntax but obviously missing something.
  
   Would anyone mind a quick scan:
  
   // Convert Values to Variables:
 $Title = $_POST[Title];
 $ChristianName = $_POST[ChristianName];
 $MiddleName = $_POST[MiddleName];
 $Surname = $_POST[Surname];
 $HomePhone = $_POST[HomePhone];
 $Address01 = $_POST[Address01];
 $Address02 = $_POST[Address02];
 $Address03 = $_POST[Address03];
 $City = $_POST[City];
 $Postcode = $_POST[Postcode];
 $Country = $_POST[Country];
 $Nationality = $_POST[Nationality];
 $Gender = $_POST[Gender];
 $WorkPermitRequired = $_POST[WorkPermitRequired];
 $MyStatus = $_POST[MyStatus];
  
   // Dump Data Into MembersData:
 $UserDataDump = INSERT INTO MembersData (Title, ChristianName,
   MiddleName, Surname, DOB, TelephoneHome, Address01, Address02,
 Address03,
   AddressCity, AddressPostcode, AddressCountry, Nationality, Gender,
   WorkPermit, Status)
  
  
 VALUES('$Title','$ChristianName','$MiddleName','$Surname','$HomePhone','$Add
  
 ress01','$Address02','$Address03','$City','$Postcode','$Country','$Nationali
   ty','$Gender','$WorkPermitRequired','$MyStatus');
  mysql_query($UserDataDump) or die(Couldn't Create User Data Entry.
 MySQL
   Error:  . mysql_error());
  
   --
   -
Michael Mason
Arras People
www.arraspeople.co.uk
   -
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 
  --
  Jim Root
  [EMAIL PROTECTED]
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Jim Root
[EMAIL PROTECTED]

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



[PHP] Print statement : Thanx for all who helped ;)

2001-10-22 Thread root

I'd like to thank all those who helped me with the print statement prob,
it was simple a matter of adding the appropriate string joiner and it
worked flawlessly ;)))

Regards,

Rick


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Upload File Path Problem

2001-10-05 Thread root

$imagefile contains the name of the file in the temp dir. So the name is some 
mess like phpx . If you want the file you do copy() or something other. 
After the script is done the file is deleted. I prefer using $HTTP_POST_VARS
do var_dump($HTTP_POST_VARS) to see debug info.

Andrey Hristov
IcyGEN Corporation
Building Solutions
http://www.icygen.com

On Friday 05 October 2001 18:41, you wrote:
 All,

 I am putting together a simple upload program where an
 HTML form calls a php script passing a file which is
 then used to upload. I am running this locally
 currently, prior to rolling out to a test server.

 My problem is this. The variable $filename I am
 passing from the form to the php script is having the
 path corrupted. In the php script if I echo
 $filename_name the file name is being passed correctly
 (test.txt) but when I echo the $filename variable it
 contains a value of \\php2 when infact the correct
 value should be c:\test.txt.


 I include below my sample code. If anyone has any
 ideas I would be most grateful.

 Thanks in advance,


 Roger

 upload.html
 ==

 HTML

 FORM form enctype=multipart/form-data METHOD=POST
 ACTION = uploadrjb.php3 
 PRE
 Upload file   : INPUT TYPE=file INPUT
 NAME=userfileBR
 Image Description : INPUT TYPE=text
 NAME=description SIZE=40 align=leftBR
 First Name: INPUT TYPE=text NAME=firstname
 SIZE=30 align=left  Last Name: INPUT TYPE=text
 NAME=lastname SIZE=30 align=leftBR
 Location  : SELECT NAME=location 
 OPTION VALUE =01Dagenham/OPTION
 OPTION VALUE =02Romford/OPTION
 OPTION VALUE =03Other/OPTION /SELECTBR
 Age   : INPUT TYPE=text NAME=age SIZE=2
 ALIGN=rightBR
 Email Address : INPUT TYPE=text NAME=email
 SIZE=30 ALIGN=leftBR
 INPUT TYPE=SUBMIT Value=UploadBR
 /PRE
 /FORM

 /HTML

 uploadrjb.php3
 ==
 ?php

 //echo $userfile; BR

 echo File= . $userfile;
   echo File= . $userfile_name;

 //echo Description= . $description;
 //echo Age=  . $age;
 //echo First Name =  . $firstname;
 //echo Last Name =  . $lastname;
 //echo Location = . $location;
 //echo Email = . $email;

 if ( isset($userfile)  ) {
   if ( copy(c:\\ . $userfile_name,
 c:\\bollocks.txt) ) {
   echo(BFile Successfully copied/B);
   } else {
   echo(BError: Failed to copy file...B);
   }
 }
 ?






 __
 Do You Yahoo!?
 NEW from Yahoo! GeoCities - quick and easy web site hosting, just
 $8.95/month. http://geocities.yahoo.com/ps/info1

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] ftp_get giving problem

2001-09-26 Thread root

Hi,

In my php program I am trying to download a file from server. My web
server and file downloading server is diffrent. When use ftp_get command
it is giving the result true. But the file is not there in client
system. Please help me.

anil
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Alternative to phpMyAdmin

2001-07-16 Thread root

Yea, I do mean SSH. Oops.







On Saturday 14 July 2001 18:29, you wrote:
 You probably mean SSH tunnel, which is quite feasable--  Hank Marquardt
 posted this earlier to the list:

 --- BEGIN QUOTE ---

 Works just fine ... as does postgres --

 ssh -N -2 -f -C -c blowfish -L3306:yourdatabase.server.here:3306
 [EMAIL PROTECTED]

 or the other usual tricks work too ... like going through a firewall
 (fyi ... clear text on the *other* side of the firewall):

 ssh -N -2 -f -C -c blowfish -L3306:db_behind_thefirewall:3306
 [EMAIL PROTECTED]

 The only oddity is that you will have to use the local host *address*
 127.0.0.1 to connect from the mysql client as it normally looks for a
 local socket if you use 'localhost', so your connection will be:

 mysql -h 127.0.0.1

 for postgres examples, change the port numbers (3306) to 5432

 --- END QUOTE ---

 -Original Message-
 From: Evan Nemerson [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, July 14, 2001 6:02 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Alternative to phpMyAdmin


 What if you were to open an SSL tunnel to the DB host, then connect
 through
 that???

  like you said... as long as the database provider accepts connections
  from outside, you can administer it from anywhere.
 
  if the provider doesn't accept incoming connections, no amount of
  tools and software will work for you.
 
   -Original Message-
   From: Alexander Skwar [mailto:[EMAIL PROTECTED]]On Behalf Of
   Subject: RE: [PHP] Alternative to phpMyAdmin
  
if you install mysql on a windoze machine then you can administer
ANY 
  
   mysql database going through the socket.
  
   Okay, for a development this may be fine, but I still fail to see
   how a tool that runs on your own computer (no matter if it's a
   Windows tool, or a Linux tool) can help you administer databases
   which are not on the same computer (unless the mysql database on the
  
   providers server can be contacted from any machine and not just from
  
   localhost).

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Little question

2001-05-09 Thread root

This snippet should be used as an example of badly written and presented 
code. It tries too hard to do a simple job and in the result fails dismally. 
I suggest Gabrielle, that you try to be a little more careful in your coding 
and not so smart. I can find no less than four errors that I put down to 
poorly constructed code rather than poor syntax. As a hint, why are you 
trying to nest cals to PHP - your ? are not properly nested. Had you put 
them on separate lines and properly indented them, you would have seen that.

Why do you have a colon after your if call etc ...


On Tue, 08 May 2001 19:56, you wrote:
 Hi, Folks...
 I have this little snippet of code:

 
?
$myOra=MY STRING
 
?
if (!(empty($myOra) || $myOra=)){
?
   br
   table width=550 border=0 align=center
   tr bgcolor=ff
   td colspan=3font
 size=2bOrario:/b?print($myOra)?/font/td /tr
   /table
 
?
} endif
?

 It should print a little table with the string MY STRING...
 ... unfortunately, it doesn't.

 Any suggestion

 BTW: I run this code on the following configuration:

 PHP Version: 4.0.4pl1
 MySQL API version: 3.23.22-beta
 Server API: httpd on a RHLinux 7.1

 Thanks in advance

 Gabriele Biondo

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] ALERTE: VIRUS DETECTE DANS UN MESSAGE ENVOYE PAR php-general-return-49852-jnapieraj=nordnet.fr@lists.php.net

2001-04-23 Thread root


 A L E R T E   V I R U S


  Notre système de détection automatique anti-virus 
  a détecté un virus dans un message qui vous a été
  envoyé par  jessica [EMAIL PROTECTED].

La distribution de ce message a été stoppée.

  Veuillez vous rapprocher de l'émetteur  jessica [EMAIL PROTECTED] pour
  régler avec lui le problème.


  ***

 V I R U S   A L E R T


  Our anti-virus system has detected a virus in an 
  email sent by  jessica [EMAIL PROTECTED].

We have stopped the delivery of this email.

  We invite you to contact  jessica [EMAIL PROTECTED]
  to solve the problem.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] HOWTO handle sessions ?

2001-02-09 Thread Rob Root

HI,

Pick up a copy of the "PHP Developer's Cookbook". They devoted a whole
chapter to sessions.

Regards,


Rob Root



Evelio Martinez wrote:

 Hi!
 Does anyone know of some good examples of sessions?

 --
 Evelio Martnez

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Passing files to a browser

2001-02-08 Thread Rob Root

HI,

I am having problems passing files through to a browser.  First I tried:

?php
$fp = fopen("test.pdf", "r");
header("content-type: application/pdf");
fpassthru($fp);
fclose($fp);
?

And got an Acrobat instance with no file displayed. Then I tried:

?php
$fp = fopen("test.txt", "r");
header("content-type: text/plain");
fpassthru($fp);
fclose($fp);
?

And got:
Hello, World
br
bWarning/b:  1 is not a valid File-Handle resource in
b/home/robr/public_html/php/getpdf.php/b on line b5/bbr

Help!!

rr


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Passing files to a browser

2001-02-08 Thread Rob Root

HI,

Getting rid of the fclose makes the error go away with the .txt file, but I
am still getting a blank display with




Javier Muniz wrote:

 Actually, if you read the manual entry for fpassthru, it states that the
 filehandle will be closed by fpassthru upon reading.
 So you're trying to close your filehandle twice... get rid of the
 fclose($fp) at the end and you should be fine.

 -jm

 -Original Message-
 From: Christian Reiniger [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 08, 2001 11:19 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Passing files to a browser

 On Thursday 08 February 2001 18:43, Rob Root wrote:

  ?php
  $fp = fopen("test.txt", "r");
  header("content-type: text/plain");
  fpassthru($fp);
  fclose($fp);
  ?
 
  And got:
  Hello, World
  br
  bWarning/b:  1 is not a valid File-Handle resource in
  b/home/robr/public_html/php/getpdf.php/b on line b5/bbr

 That most likely means the fopen () failed.

 --
 Christian Reiniger
 LGDC Webmaster (http://sunsite.dk/lgdc/)

 This is JohnC IMHO, I compaired tri-word groupings here and in his plan
 and got a good match.

 - /. posting discussing the likelihood that an AC post that claimed to
 be
 posted by John Carmack during his honeymoon (and having the login info
 at
 home) was actually from him.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]