RE: [PHP] object reflection in php?

2002-03-18 Thread Coggeshall, John


Why are you going through all of this trouble, exactly?

If you are looking to store the instance of the object in the databaes,
why not just use serialize()/unserialize()?? 

John




-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 18, 2002 10:43 AM
To: Filippo Veneri
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] object reflection in php?



On Monday, March 18, 2002, at 06:28  AM, Filippo Veneri wrote:

 Just to make myself understood:

 class obj {
   var $field;
   function obj( $value ) {
 $this-field = $value;
   }
 }

 $o = new obj( field value );

 How can i know, if possible,  that the instance of
 obj pointed to by $o has a field named field?

 This would be useful to write an object to a database
 without knowing its structure 'a-priori'.

Couldn't you just add another method called return_field_name() to the

class?  Then you could run this method from the script and you will be 
given the value of the field name.  Your code would look like this:

class obj
{
   var $field;

   function obj($value)
   {
 $this-field = $value;
   }

   function return_field_name()
   {
 return $this-field;
   }
}

then in your code you would do something like:
?php
   $o = new obj(field value);
   print $o-return_field_name();
?

This might not work, I don't know much about OO.


Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
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] printing in HTML or PHP

2002-03-18 Thread Coggeshall, John


For that matter, even better... Why bother with PHP at all?

?php

/* code here */
?
link rel=stylesheet type=text/css href=default.css
?php

/* More code here */

?

-Original Message-
From: John Steele [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 18, 2002 7:53 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] printing in HTML or PHP


  PHP doesn't have to parse this string (since it contains no PHP
variables, why pass it through the parser?), and it's easier to read:

echo 'link rel=stylesheet type=text/css href=default.css';

On Monday, March 18, 2002, at 02:57  PM, Daniel Ferreira Castro wrote:

I would like to print the line bellow on my HTML generated by a PHP 
file. How can I do it?

The line is:
link rel=stylesheet type=text/css href=default.css

?php

print link rel=\stylesheet\ type=\text/css\ href=\default.css\ 
/;

?

E

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  Dynamic Web Design  PHP/MySQL/Linux/Hosting
 *  www.steelesoftconsulting.com [EMAIL PROTECTED]
 */


-- 
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] WHOIS in PHP

2002-03-18 Thread Coggeshall, John


Read my article on connecting to Internet services (Creating a WHOIS
interface):

http://www.zend.com/zend/spotlight/connecting.php

John


-Original Message-
From: Analysis  Solutions [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 18, 2002 4:48 PM
To: PHP List
Subject: Re: [PHP] WHOIS in PHP


On Mon, Mar 18, 2002 at 02:58:18PM -0500, Brian wrote:

 Does anyone out there know how to execute a WHOIS query from within 
 PHP?

I use this on a NetBSD system:

   exec(whois -h whois.geektools.com $Domain, $Result);

--Dan

-- 
PHP scripts that make your job easier
  http://www.analysisandsolutions.com/code/
 SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y

-- 
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] Execute php script inside an HTML page???

2002-03-12 Thread Coggeshall, John


If you are running apache, open httpd.conf and search for .php (the line
where it specifies what types of files are PHP files)... Simply add
.html to the list.

John

-Original Message-
From: Lic. Carlos A. Triana Torres [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, March 12, 2002 3:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Execute php script inside an HTML page???


Hello all,
Can I execute a php script from an HTML document? I mean, with the
file named with html extension? Thanks



-- 
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] Re: PHP-Based Authentication Security?

2002-03-07 Thread Coggeshall, John


.htaccess and pw files are pointless, who wants to maintain potentially
10 or 20 of these things? Furthermore, it's gotta do more than just
serve a single file at a time -- that's simple... I needed
directly-level security.

The solution I came up with was to use a module called mod_auth_any,
which (with a little minor adjustment) can execute a PHP script from the
console and rely on it's response to grant authentication or not. That
gives me Apache-level security without Apache-authentication.

John


-Original Message-
From: J Smith [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 06, 2002 3:58 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: PHP-Based Authentication Security?



An easier way to do it might be to use HTTP authentication with apache 
using .htaccess and .htpasswd files, which can be placed in the secure 
directories. (Or use one global .htpasswd file and have all .htaccess
files 
point to it.)

Another possibility would be to set up two PHP scripts, one being some 
kind of form to enter a username, password, etc., and another to check
the 
input and act as a pass-thru for the file to be downloaded. The second 
script could look something like this (obviously simplified):

if ($authenticated)
{
header(Content-type: whatever/text);
readfile($filename);
}
else
{
print You can't download this.
}

Which you would call as something like:

http://www.example.com/path/download.php?filename=somefile.txt

Obviously, you need to take care of a few security problems, like making

sure they don't do something like

http://www.example.com/path/download.php?filename=/etc/passwd

And you'd have to make sure the file exists and such before sending it
out. 
And determine the MIME type of the file. (I usually do this by
extension.) 
But overall, it would work. I have a similar script, minus the 
authentication feature. 

J


John Coggeshall wrote:

 
 Hey all..
 
 I've got a question -- I'd like to restrict access to entire 
 directories based on if the user has been authenticated or not. 
 Basically, I'd like to set up a auto-include *FROM APACHE* to run a 
 PHP script prior to sending any documents what-so-ever and only send 
 the requested document if the PHP script allows it. So..
 
 Request Made - PHP Script Runs - PHP Checks Authentication - PHP 
 says OK - Apache sends file normally
 
 Or..
 
 Request Made - PHP Script Runs - PHP Checks Authentication - PHP 
 says NO - Apache stops dead in it's tracks or displays a HTTP error
 
 Is this possible? It has to work for any document or MIME type and be 
 restrictable by directory... (i.e. I just want this happening in a 
 /secure/ directory)
 
 John
 


-- 
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] Makeing $string into CAPS

2002-03-07 Thread Coggeshall, John


$str = strtoupper($str);

John

-Original Message-
From: Philip J. Newman [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 06, 2002 4:19 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Makeing $string into CAPS 


How can I make a $string = hello  into $string = HELLO?

Philip J. Newman
PhilipNZ :: Design Solutions
http://www.philipnz.com/
[EMAIL PROTECTED]
ICQ# 20482482
+64 25 6144012

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




[PHP] PHP-Based Authentication Security?

2002-03-06 Thread Coggeshall, John


Hey all..

I've got a question -- I'd like to restrict access to entire directories
based on if the user has been authenticated or not. Basically, I'd like
to set up a auto-include *FROM APACHE* to run a PHP script prior to
sending any documents what-so-ever and only send the requested document
if the PHP script allows it. So..

Request Made - PHP Script Runs - PHP Checks Authentication - PHP says
OK - Apache sends file normally

Or..

Request Made - PHP Script Runs - PHP Checks Authentication - PHP says
NO - Apache stops dead in it's tracks or displays a HTTP error

Is this possible? It has to work for any document or MIME type and be
restrictable by directory... (i.e. I just want this happening in a
/secure/ directory)

John


-Original Message-
From: Steven Walker [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 06, 2002 3:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP] FYI Using Qmail  PHP


To whom it may concern,

I recently had an ordeal trying to get PHP generated email to work using

with qmail. After switching web servers, suddenly my automated emails 
were not working, coming out blank or with mime attachments.

If anybody runs into the problem, the fix is quite simple (but obscure).

Simply use single '\n' rather than '\r\n'. For some reason (I don't know

why) qmail doesn't like the CRLF.

Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]


-- 
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