[PHP] Re: php reference behavior

2002-12-17 Thread Peter Clarke
22 Manopohuji wrote:


hi, i'm running into some weird behavior with php references.  i
distilled it down to some test code below:

 'dean' );

$var1['arrayref']  =  & $array;

$var2  =  $var1;

echo "var1:\n";
print_r( $var1 );

echo "var2:\n";
print_r( $var2 );

$var1['arrayref']  =  NULL;

echo "var1:\n";
print_r( $var1 );

echo "var2:\n";
print_r( $var2 );

?>

it seems that setting a hash key to a reference to something, and then
repointing that key to NULL, apparently sets the original 'something' to
NULL instead of just 'repointing' the hash key!  am i missing something
obvious here, or is this behavior not what you'd normally expect?  i
wrote similar code in perl, and it behaved as i expected: the second
hash still pointed to the original target (i am almost certain c/c++ and
java also behave this way).  so what is going on with php?  does anyone
know how to get it to do what i want it to do --  i.e., merely unset the
key mapping of one of the hashes, leaving the other hash still pointing
at the target?  thansk for any insight you might be able to give!

xomina






Have a look at: http://www.php.net/manual/en/language.references.php
They are not like C pointers, they are symbol table aliases.

Instead of:
$var1['arrayref']  =  NULL;
use:
unset($var1['arrayref']);


Peter


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




[PHP] Re: Security

2003-01-20 Thread Peter Clarke
Phil Ewington wrote:

Hi,

Can PHP run as a different user for different sites on the same server. The
reason I ask is a client that has a PHP web site on our RAQ4 has had a PHP
application written by someone else and wants us to upload it. Can PHP be
configured to allow certain web sites access to files and directories within
their web root only?

TIA

Phil Ewington
Technical Director


Have a look at open_basedir, it won't run as a different user but it 
will restrict the files the site can access.
http://www.php.net/manual/en/features.safe-mode.php#AEN5968
This can be set for each VirtualHost in apache's httpd.conf
php_admin_value open_basedir /path/to/accessable/files

Peter Clarke


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



[PHP] Re: chown() despiration

2003-01-23 Thread Peter Clarke
Urb Lejeune wrote:

I could do this in perl but I'm being stubborn :-)

When I run the following code as a regular user, everything fails.
When I run it as root the directory is created and the chmod
works. However, chown reports:

chown failed: Operation not permitted

Here is the code.

  $Directory2Create = "/home/e-govdemo/htdocs";
  mkdir($Directory2Create,0777);
  chown($Directory2Create,"egovdemo");
  chmod($Directory2Create,0777);

  "egovdemo" is a legal user name as can be seen from this partial
directory listin.

egovdemo nobody   4096 Sep  6 11:29 Logs   

  also tried
  chown($Directory2Create,"egovdemo:nobody");
  chown($Directory2Create,"637");
  chown($Directory2Create,"637:99");

To help save my few reamining hairs and could someone with
root privilege try it and see if it's me or PHP?

Thanks

Urb



It works fine with PHP 4.2.2 from the command line run as root on my 
Linux system (using a user on my system) produced:

drwxrwxrwx2 leagas   root 4096 Jan 23 16:43 test


Peter


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



[PHP] Re: google-apis

2003-03-10 Thread Peter Clarke
Jens Lehmann wrote:
James wrote:

LWP is a perl thing.  Curl is probably the best thing to use.
Have you tried using googles php api which they provide free?
http://www.google.com/apis/


I had a look at the API, but I'm not sure if it's appropriate and easy 
to use with PHP. It's still beta and might change again (or maybe I've 
to pay for every query soon). Has anyone already used the api? Is it 
simple to (for instance) find out all listed pages of www.foo.com which 
are in the Top 1000?

Jens


You'll need to have PEAR::SOAP installed (very easy with php-4.3).
Get SOAP_Google.php from http://www.sebastian-bergmann.de/?page=google
You'll need to register with google to get an licenseKey.
Then a simple search:

$google = new SOAP_Google('your license key');

$result = $google->search(
  array(
'query' => 'sebastian bergmann'
  )
);
if (false !== $result) {
  print_r($result);
} else {
  echo 'Query failed.';
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Need Help: Please click on Test Link

2003-07-17 Thread Peter Clarke
Suhas Pharkute wrote:
http://sspsoft.com/test/ip2ll.php (in case if you cannot get it, please
click on http://ns1.webhostdns.us and then click on the website link.)
which should identify your Country, State, City. Please click on one of the
buttons to provide feedback.
I'm in London, England
and got the following result:
United Kingdom, England, Southend-on-Sea
So providing feedback with your options is a little tricky.
England is a country not a state. It'll cause confusion if you regard it 
as such.
Southend-on-Sea is not where I'm located. Close but no cigar :)

Peter

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


[PHP] Re: scoring/sorting db search results based on score

2003-07-17 Thread Peter Clarke
Dave wrote:

looking for code snippets or links to examples of the following;

- Have a database with multiple fields that will be searched against (happens to
be PostgreSQL in this instance, but we can migrate any MySQL based
examples/code)
- We wish to score search results - ie: a match in "keywords" is worth 5 points,
"title" worth 3, and "description" worth 1, perhaps even so far as multiple
matches producing multiples of the point value(though that can be a later
consideration)
- Once we get the results, we would want to display in the order of the scoring,
most points first etc...
Obviously there are convoluted ways to accomplish, but I am looking to maximize
the database performance, limit the number of recursive searches, and use the
database/PHP each handle their portion of the search/score/ranking based on
their strengths and use of system resources.
appreciate any feedback

Dave


There is a module for Postgres that does indexed full text searching, 
with ranking:
http://www.sai.msu.su/~megera/oddmuse/index.cgi/Tsearch_V2_Readme

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


[PHP] Re: Hi All

2003-07-23 Thread Peter Clarke
Shishir Kumar Mishra wrote:

Hi All,

I am reading one XML which has some german characters.  I am sending this data to PHP script but when try to echo ;it  prints some other character. 
eg. XML has "für"   but output  is coming like " für "; 

My script is like following:



$loc = "UTF-8";
putenv("LANG=$loc");
setlocale (LC_ALL, 'de_DE');
echo "".$producttext[2]; 
?>  

in XML file : producttext  has value like "für" ;

regards..
Shishir Kumar Mishra
Agni Software (P) Ltd.
www.agnisoft.com
What are you outputting to?
Is it able to display UTF-8?
Does it know that the string is UTF-8?
an html page would tell a browser with:

Peter



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


Re: [PHP] REVISED: PHP timeout doing fread from Apache Coyote

2003-07-24 Thread Peter Clarke
Robert Fitzpatrick wrote:

Sorry, the correct request and response is below, the one I copied before
was from the browser:
Request:
Request:POST /XMLCommunicationServlet HTTP/1.0
Content-Type: application/x-www-form-urlencoded
User-Agent: PHP XMLRPC
Host: api.newedgenetworks.com:80
Connection: keep-alive
Try not having the connection kept alive. (just a thought)

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


[PHP] Re: help please was: openssl php 4.3.1

2003-03-27 Thread Peter Clarke
Kalin Mintchev wrote:
here is a real example:

$fp = fopen ("http://store.el.net/index.html";, "r");
while (!feof($fp)) {
   echo fgets ($fp,4096);
  }
this works fine...

if you try it with https you'll get an error - file not found from php

I've just tried with https and it works fine. Are you sure you have php 
compiled --with-openssl ? Does phpinfo() show https in it's list of 
registered streams?
Registered PHP Streams => php, http, ftp, https, ftps, compress.zlib

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


[PHP] Re: php4isapi.dll and header("Location: ...")

2003-06-06 Thread Peter Clarke
Eric Tonicello wrote:
Hi !

Have somebody successed with the function <  header("Location: http://...";)

using the php4isapi.dll ???


My code works well with PHP using the CGI php.exe, but impossible to make it
work with the ISAPI module !!!
Configuration:
-Windows 2000 server
- PHP 4.3.2
"php.ini" :
- output_buffering = on
Have you tried:
ob_end_clean();
header("Location: http://...";);
to throw away the contents of the output buffer before sending the 
Location header, then its nice and clean.

Peter

- zlib.output_compression = on

Any idea ??
Other bugs with ISAPI module ???
Thanks for help !

Eric Tonicello




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


[PHP] Re: Applying XSL to XML with PHP

2002-07-25 Thread Peter Clarke

Ctan wrote:
> I'm trying to apply XSL to XML stored in a MySQL database with PHP. How do I
> go about doing this? I've tried following the example on php.net but I seem
> to run into a lot of trouble. Here's how the code looks like (BTW aml is XML
> stored in the argument Table):
> 
> 
> if (! empty($searchword ))
> 
>$query = "SELECT aml FROM arguments WHERE aml LIKE '%$searchword%'";
>$result = mysql_query($query) or die ("Query failed");
>$line = mysql_fetch_array($result, MYSQL_ASSOC);
> 
> // Create an array
> $arguments = array('/_xml'=> $line);
> 
> //XSL file
> $xsl = "./sheet1.xsl"; 
> 
> // Create an XSLT processor
> $xslthandler = xslt_create();
> 
> // Perform the transformation
> $html = xslt_process( $xslthandler, 'arg:/_xml', $xsl, NULL, $arguments);
> 
> // Detect errors
> if (!$html) die ('XSLT processing error: '.xslt_error($xslthandler));
> 
> // Destroy the XSLT processor
> xslt_free($xslthandler);
> 
> // Output the resulting HTML
> print $html;  
> 
> 
> What I get on the screen is:
> 
> 
> Array ( [0] => "With the contents of my variable...")
> 
> 
> And:
> 
> 
> Warning: Sablotron error on line 1: XML parser error 2: syntax error in
> /home/httpd/html/ctan/resultworkingcopy2.php on line 93 XSLT processing
> error: XML parser error 2: syntax error
> 
> 
> What gives? I really need to solve this urgent. Thanks...
> 
> Chia

What is the xml. There may be a content encoding problem or some other 
xml issue.

Peter


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




[PHP] Re: Applying XSL to XML with PHP

2002-07-25 Thread Peter Clarke


ctan wrote:
> The XML would be something like this... 
> 
> 



Just noticed something...
$line = mysql_fetch_array($result, MYSQL_ASSOC);
returns an array. Your $arguments array wants a string.
So..

$xml = join($line, '');
$arguments = array('/_xml'=> $xml);

Peter


> 
> Hope this helps...
> 
> chia
> 
> -Original Message-
> From: Peter Clarke [mailto:[EMAIL PROTECTED]] 
> Sent: 25 July 2002 13:06
> To: Ctan
> Cc: [EMAIL PROTECTED]
> Subject: Re: Applying XSL to XML with PHP
> 
> 
> Ctan wrote:
> 
>>I'm trying to apply XSL to XML stored in a MySQL database with PHP. 
>>How do I go about doing this? I've tried following the example on 
>>php.net but I seem to run into a lot of trouble. Here's how the code 
>>looks like (BTW aml is XML stored in the argument Table):
>>
>>
>>if (! empty($searchword ))
>>
>>   $query = "SELECT aml FROM arguments WHERE aml LIKE '%$searchword%'";
>>   $result = mysql_query($query) or die ("Query failed");
>>   $line = mysql_fetch_array($result, MYSQL_ASSOC);
>>
>>// Create an array
>>$arguments = array('/_xml'=> $line);
>>
>>//XSL file
>>$xsl = "./sheet1.xsl";
>>
>>// Create an XSLT processor
>>$xslthandler = xslt_create();
>>
>>// Perform the transformation
>>$html = xslt_process( $xslthandler, 'arg:/_xml', $xsl, NULL, 
>>$arguments);
>>
>>// Detect errors
>>if (!$html) die ('XSLT processing error: '.xslt_error($xslthandler));
>>
>>// Destroy the XSLT processor
>>xslt_free($xslthandler);
>>
>>// Output the resulting HTML
>>print $html;  
>>
>>
>>What I get on the screen is:
>>
>>
>>Array ( [0] => "With the contents of my variable...")
>>
>>
>>And:
>>
>>
>>Warning: Sablotron error on line 1: XML parser error 2: syntax error 
>>in /home/httpd/html/ctan/resultworkingcopy2.php on line 93 XSLT 
>>processing
>>error: XML parser error 2: syntax error
>>
>>
>>What gives? I really need to solve this urgent. Thanks...
>>
>>Chia
> 
> 
> What is the xml. There may be a content encoding problem or some other 
> xml issue.
> 
> Peter
> 
> 
> 
> 



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




[PHP] Re: $this in an XML data handler ... in a class

2002-07-03 Thread Peter Clarke


"Clay Loveless" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Here's a brain-bender ... At least it is for me at the moment. : )
>
> When I use an XML parser inside a class, the xml_*_handler functions
aren't
> recognizing "$this->" variables. I can kind of see why ... But would like
it
> to work anyway. : )
>
> Here's an example:
>
> class Blah
> {
> var $xmlparser;
> var $current_element;
>
> // ...
>
> function _parseXML($data)
> {
> $this->xmlparser = xml_parser_create();
> xml_set_element_handler(
> $this->xmlparser,
> array($this,"_xml_start_element"),
> array($this,"_xml_end_element"));
> xml_set_character_data_handler(
> $this->xmlparser,
> array($this,"_xml_character_data"));
> xml_parse($this->xmlparser, $data);
> xml_parser_free($this->xmlparser);
> }
>
> function _xml_start_element($p, $e_name, $e_attributes)
> {
> $this->current_element = $e_name;
> }
>
> function _xml_end_element($p, $e_name)
> {
> // ...
> }
>
> function _xml_character_data($p, $data)
> {
> echo "element is: ".$this->current_element."\n";
> echo "data is: $data\n";
> }
>
> } // end of class Blah
>
>
>
> When this XML parser gets called from within the Blah class, the "element
> is:" portion of _xml_character_data comes out blank!
>
> This sort of makes sense, because the callback functions are "children" of
> the xml_parser_create "parent" ... But should that make the children
> ignorant of the "grandparent" variables referred to by $this->varname?
>
> I hope this makes sense ... Has anyone else encountered this sort of
> problem? I'm an old hat at PHP, but am relatively new to both XML parsing
> and writing my own classes.
>
> Thanks,
> Clay
>


Have a look at:
http://www.php.net/manual/en/function.xml-set-object.php

xml_set_object($this->parser, &$this);



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




Re: [PHP] Re: $this in an XML data handler ... in a class

2002-07-04 Thread Peter Clarke

I hadn't noticed that. My php.ini was set to on, changing it to off gave the
warning.
Having changed:
xml_set_object($this->parser,&$this);
to:
xml_set_object($this->parser,$this);
Stops the warning and the parser works fine.

This is the class I'm using and it works fine:

class parse_words_xml  {
 var $words;

 function parse_words_xml($xml_data) {
 $this->words = array();
 $this->parser = xml_parser_create();
 xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false);
 xml_set_element_handler($this->parser,"tag_open","tag_close");
 xml_set_character_data_handler($this->parser,"cdata");
 $this->parse($xml_data);
 }

 function parse($xml_data) {
  xml_set_object($this->parser,$this);
  reset ($xml_data);
  while (list (, $data) = each ($xml_data)) {
  if (!xml_parse($this->parser, $data)) {
  die(sprintf( "XML error: %s at line %d\n\n",
  xml_error_string(xml_get_error_code($this->parser)),
  xml_get_current_line_number($this->parser)));
  }
  }

 }

 function tag_open($parser,$tag,$attributes) {
 $this->current_tag = $tag;
 switch($tag){
 case 'Word':
$this->id = $attributes['id'];
$this->words[$attributes['id']] = 1;
 break;
 default:
 break;
 }
 }

 function cdata($parser,$cdata) {
  $this->temp = $cdata;
 }

 function tag_close($parser,$tag) {
 switch($tag){
 case 'Word':
$this->words[$this->id] = $this->temp;
$this->temp = '';
 break;
 default:
 break;
 }
 }

}


"Clay Loveless" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Unfortunately, the xml_set_object function does not work to solve this
> problem. I tried using it, and my results were the same as they were when
I
> was not using it.
>
> [I found that the array($this, 'function_name') method instead of 'string
> function_name' for the xml_set_*_handler functions worked just as well,
only
> without this Warning message one gets from PHP 4.2.1 upon using
> xml_set_object($this->parser, &$this):
>
> "PHP Warning:  Call-time pass-by-reference has been deprecated - argument
> passed by value;  If you would like to pass it by reference, modify the
> declaration of xml_set_object().  If you would like to enable call-time
> pass-by-reference, you can set allow_call_time_pass_reference to true in
> your INI file.  However, future versions may not support this any
longer."]
>
>
> Still searching for an answer on this one ...
>
> Thanks,
> -Clay
>
>
>
> > "Peter Clarke" <[EMAIL PROTECTED]>
> >
> > Have a look at:
> > http://www.php.net/manual/en/function.xml-set-object.php
> >
> > xml_set_object($this->parser, &$this);
> >
> >
> >
> > "Clay Loveless" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >> Here's a brain-bender ... At least it is for me at the moment. : )
> >>
> >> When I use an XML parser inside a class, the xml_*_handler functions
> > aren't
> >> recognizing "$this->" variables. I can kind of see why ... But would
like
> > it
> >> to work anyway. : )
> >>
> >> Here's an example:
> >>
> >> class Blah
> >> {
> >> var $xmlparser;
> >> var $current_element;
> >>
> >> // ...
> >>
> >> function _parseXML($data)
> >> {
> >> $this->xmlparser = xml_parser_create();
> >> xml_set_element_handler(
> >> $this->xmlparser,
> >> array($this,"_xml_start_element"),
> >> array($this,"_xml_end_element"));
> >> xml_set_character_data_handler(
> >> $this->xmlparser,
> >> array($this,"_xml_character_data"));
> >> xml_parse($this->xmlparser, $data);
> >> xml_parser_free($this->xmlparser);
> >> }
> >>
> >> function _xml_start_element($p, $e_name, $e_attributes)
> >> {
> >> $this->current_element = $e_name;
> >> }
> >>
> >> function _xml_end_element($p, $e_name)
> >> {
> >> // ...
> >> }
> >>
> >> function _xml_character_data($p, $data)
> >> {
> >> echo "element is: ".$this->current_element."\n";
> >> echo "data is: $data\n";
> >> }
> >>
> >> } // end of class Blah
> >>
> >>
> >>
> >> When this XML parser gets called from within the Blah class, the
"element
> >> is:" portion of _xml_character_data comes out blank!
> >>
> >> This sort of makes sense, because the callback functions are "children"
of
> >> the xml_parser_create "parent" ... But should that make the children
> >> ignorant of the "grandparent" variables referred to by $this->varname?
> >>
> >> I hope this makes sense ... Has anyone else encountered this sort of
> >> problem? I'm an old hat at PHP, but am relatively new to both XML
parsing
> >> and writing my own classes.
> >>
> >> Thanks,
> >> Clay
> >>
> >
> >
>


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




[PHP] Re: xslt_process

2002-07-22 Thread Peter Clarke



Ctan wrote:
> Hi all,
> 
> I'm trying to use xslt_process() to transform a variable containing XML data
> with an xsl file into a result using PHP. Incidentally the XML is from an
> external source, i.e. a database. However despite following the examples in
> www.php.net I am unable to do so. The code works out to something like this:
> 
> 
> if (! empty($searchword ))
> 
>$query = "SELECT aml FROM arguments WHERE aml LIKE '%$searchword%'";
>$result = mysql_query($query) or die ("Query failed");
>$line = mysql_fetch_array($result, MYSQL_ASSOC);
> 
> var_dump($line);
> 
> // Create an array
> $arguments = array('/_xml'=> $line);
> 
> //XSL file
> $xsl = "./sheet1.xsl"; 
> 
> // Create an XSLT processor
> $xslthandler = xslt_create();
> 
> // Perform the transformation
> $html = xslt_process( $xslthandler, 'arg:/_xml', $xsl, NULL, $arguments);
> 
> // Detect errors
> if (!$html) die ('XSLT processing error: '.xslt_error($xslthandler));
> 
> // Destroy the XSLT processor
> xslt_free($xslthandler);
> 
> // Output the resulting HTML
> print $html;  
> 
> 
> What I get on the screen is:
> 
> 
> Array ( [0] => "With the contents of my variable...")
> 
> 
> And:
> 
> 
> Warning: Sablotron error on line 1: XML parser error 2: syntax error in
> /home/httpd/html/ctan/resultworkingcopy2.php on line 93
> XSLT processing error: XML parser error 2: syntax error
> 
> 
> What gives? I'm really frustrated and would greatly appreciate it if someone
> would point out where I've made an error before I start ripping all my hair
> out! Thanks... Thanks... Thanks!
> 
> Regards,
> Chia

I may be missing something, but your not parsing XML. Your $line 
contains an array of data from the database, not xml.





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




[PHP] Re: xslt_process

2002-07-22 Thread Peter Clarke



Ctan wrote:
 > Hi all,
 >
 > I'm trying to use xslt_process() to transform a variable containing 
XML data
 > with an xsl file into a result using PHP. Incidentally the XML is from an
 > external source, i.e. a database. However despite following the 
examples in
 > www.php.net I am unable to do so. The code works out to something 
like this:
 >
 >
 > if (! empty($searchword ))
 >
 >$query = "SELECT aml FROM arguments WHERE aml LIKE '%$searchword%'";
 >$result = mysql_query($query) or die ("Query failed");
 >$line = mysql_fetch_array($result, MYSQL_ASSOC);
 >
 > var_dump($line);
 >
 > // Create an array
 > $arguments = array('/_xml'=> $line);
 >
 > //XSL file
 > $xsl = "./sheet1.xsl";
 >
 > // Create an XSLT processor
 > $xslthandler = xslt_create();
 >
 > // Perform the transformation
 > $html = xslt_process( $xslthandler, 'arg:/_xml', $xsl, NULL, $arguments);
 >
 > // Detect errors
 > if (!$html) die ('XSLT processing error: '.xslt_error($xslthandler));
 >
 > // Destroy the XSLT processor
 > xslt_free($xslthandler);
 >
 > // Output the resulting HTML
 > print $html; 
 >
 >
 > What I get on the screen is:
 >
 >
 > Array ( [0] => "With the contents of my variable...")
 >
 >
 > And:
 >
 >
 > Warning: Sablotron error on line 1: XML parser error 2: syntax error in
 > /home/httpd/html/ctan/resultworkingcopy2.php on line 93
 > XSLT processing error: XML parser error 2: syntax error
 >
 >
 > What gives? I'm really frustrated and would greatly appreciate it if 
someone
 > would point out where I've made an error before I start ripping all 
my hair
 > out! Thanks... Thanks... Thanks!
 >
 > Regards,
 > Chia

I may be missing something, but your not parsing XML. Your $line
contains an array of data from the database, not xml.






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




[PHP] Re: Securing PHP code..

2003-11-25 Thread Peter Clarke
Video Populares Et Optimates wrote:

Hi!

I'm pondering on a problem here. Being a C/C++, Java and Visual Basic developer, the 
aspect of reverse engineering code from (compiled) programs, hasn't occupied my mind 
that much.
Now, developing PHP scripts on large scale I have started to think otherwise. How do 
you all secure your code? I'd really appreciate if someone could give me the bare and 
gritty specifics on how it is possible to protect server side scripts such as PHP..
Thanks in advance,
Video Populares et Optimates


Have a look at Zend Encoder
http://www.zend.com/store/products/zend-safeguard-suite.php
There are others also.

Peter

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


[PHP] Re: php 4.1 and DOMXML question.

2002-01-16 Thread Peter Clarke

function getNodeContent ($node) {
$content = '';
$nodechild = $node->children();
if ( is_array( $nodechild ) ) {
reset ($nodechild);
while (list (, $val) = each ($nodechild)) {
if ( $val->type == XML_TEXT_NODE ) {
 $content .= $val->content;
}
}
return $content;
}
}

Peter


"Aaron" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> How the hell do I get the content of a node
>
> before all I had to do was go $node->content
>
> now it doesnt seem to work.
>
> I know they changed $node->name to $node->tagname.
>
> I tried, content, tagcontent, value, mmm some other things. I give up,
> couldnt find any info anywhere either...
>
> theres a set_content() method but doenst seem to be a get_content()
> method :(.
>


-- 
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] Re: php 4.1 and DOMXML question.

2002-01-17 Thread Peter Clarke


"Aaron" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Well that works. But its a little bizzare. I have to do that to get the
> content of a node even when that node has no children...
>
> e.g.
> 
> 
> SOME TEXT GOES HERE
> 
> 
>
> So even if the current node is "morestuff" I still have to do the
> currentnode->children etc. blah.
>
> which is a bit dodgey

Ah but the content of the node IS a child of the node. Everything inside a
node is it's child
eg:
html line 1html line 2
The children of  are:
'html line 1' AND '' AND 'html line 2'

Peter


> Peter Clarke wrote:
>
> >function getNodeContent ($node) {
> >$content = '';
> >$nodechild = $node->children();
> >if ( is_array( $nodechild ) ) {
> >reset ($nodechild);
> >while (list (, $val) = each ($nodechild)) {
> >if ( $val->type == XML_TEXT_NODE ) {
> > $content .= $val->content;
> >}
> >}
> >return $content;
> >}
> >}
> >
> >Peter
> >
> >
> >"Aaron" <[EMAIL PROTECTED]> wrote in message
> >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> >>How the hell do I get the content of a node
> >>
> >>before all I had to do was go $node->content
> >>
> >>now it doesnt seem to work.
> >>
> >>I know they changed $node->name to $node->tagname.
> >>
> >>I tried, content, tagcontent, value, mmm some other things. I give up,
> >>couldnt find any info anywhere either...
> >>
> >>theres a set_content() method but doenst seem to be a get_content()
> >>method :(.
> >>
> >
> >
>
>
>


-- 
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] Re: XML / XSLT parsing using PHP

2002-01-24 Thread Peter Clarke

"Lasse Laursen" <[EMAIL PROTECTED]> wrote in message
02c301c1a4c4$42e03620$[EMAIL PROTECTED]">news:02c301c1a4c4$42e03620$[EMAIL PROTECTED]...
> Hi,
>
> We are about to develop a CMS that uses XML and XSLT.
>
> The XML files contains some static information (header, footers and common
> non-dynamic information). We would like to have a XML file that would
> contain a field like:
>
> 
>   <...>
>   <...>
>   <...>
> 
>
> Before the XML file is loaded into the PHP script that uses the
xslt_process
> routine to convert the XML/XSLT files into plain HTML we would like to
> replace the  field with come dynamic content (eg. some other
> variables, etc.)
>
> What's the easiest way to do that? SAX or?
>

Load the XML into a variable,
do whatever changes to it,
then process the variable with xslt_process.


> Furthermore the 'xslt_process' function requires the following parameters:
>
> xslt_process (resource xh, string xml, string xsl [, string result [,
array
> arguments [, array parameters]]])
>
> where the XML and XSLT variables are references to files. - The XML file
is
> in our example a variable (eg. $current_xml_file = "x";) and therefor
we
> cannot use the xslt_process function? Of cause we can store the XML var.
in
> a temporary location and then read the file, but that's an extreamly ugly
> approach! :) Any ideas?
>

Have a look at:
http://www.php.net/manual/en/function.xslt-process.php
Example 3 Using the xslt_process() to transform a variable containing XML
data and a variable containing XSL data into a variable containing the
resulting XML data



> I'm looking forward to your replies :)
>
>
> Yours
> --
> Lasse Laursen <[EMAIL PROTECTED]> - Systems Developer
> NetGroup A/S, St. Kongensgade 40H, DK-1264 København K, Denmark
> Phone: +45 3370 1526 - Fax: +45 3313 0066 - Web: www.netgroup.dk

Peter Clarke


-- 
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] Re: Execing problems

2002-02-08 Thread Peter Clarke

Make sure that exec() will not get any kind of response from the script if
you want it in the background.
This works for me:

$command = "funky script stuff here";
exec ("$command >/dev/null 2>&1 &");

Peter Clarke

"Jason Rennie" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all,
>
> I have a seperate perl script that I need to start running from a php
> script. The script does a fork into the backgroup and exits.
>
> when i do an
>
> exec("funky script stuff here");
>
> The page just hangs trying to load again, apparently after I call the
> exec.
>
> I've also tried
>
> exec("script stuff &")
>
> but it does the same thing.
>
> Any ideas anybody ?
>
> Jason
>
> --
> Hofstadter's Law : "It always takes longer than you expect, even when you
> take Hofstadter's Law into account."
>


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




[PHP] fsockopen timeout

2002-02-15 Thread Peter Clarke

According to the manual;
http://www.php.net/manual/en/function.fsockopen.php
Depending on the environment, optional connect timeout may not be available.

Does anyone know what environment is needed for it to be available?
I have Redhat Linux 7.1 - and the timeout doen't seem to work.

Any ideas?

Peter


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




[PHP] Re: fsockopen timeout

2002-02-15 Thread Peter Clarke

OK I've found it...
The time out value is a FLOAT. So a timeout of 1 second is 1.0.
Strange since the examples in the manual are integers.

Anyway this works:
$socket = fsockopen($urlArray["host"], $urlArray["port"], &$errnum,
&$errstr, 1.0);

"Peter Clarke" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> According to the manual;
> http://www.php.net/manual/en/function.fsockopen.php
> Depending on the environment, optional connect timeout may not be
available.
>
> Does anyone know what environment is needed for it to be available?
> I have Redhat Linux 7.1 - and the timeout doen't seem to work.
>
> Any ideas?
>
> Peter
>


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




[PHP] Re: sms to web

2002-05-30 Thread Peter Clarke

Basically you'll need to have a mobile number set up with an SMSC who will
extract the data from the message and send it on to the url that you provide
them with.

Peter

"Deniz" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> can anybody advice me some source about how to channel sms messages to a
> webserver and parse it with php?
>
> thanks
> -d
>
>


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




[PHP] Re: file upload problem (files > 7.5mb)

2002-03-05 Thread Peter Clarke

"Stefan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED].;
> i wrote a php uploadscript and it works fine till the file is not larger
> then 7.5mb.
> is set the max upload file size in the upladfrom as well as in php.ini to
> 100mb. but it still doesn't work!
> system is linux red hat and php 4.0.6 (with mysql)
> is there anyone who had the samestefa problem and knows a solution?
>
> stefan
>

I suspect the killer is 'post_max_size'
Adjust settings for:

max_execution_time
memory_limit
post_max_size

Also you really should upgrade to php 4.1.2 since this fixes a security hole
in file uploads.

Peter


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




[PHP] Re: register_globals and E_ALL error reporting

2002-03-13 Thread Peter Clarke


"Richard Ellerbrock" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> The following code generates a warning when register_globals=off and
> error reporting is set to E_ALL. How do I define the constant in another
> way not to generate a warning? This is with php 4.1.1. I use defines
> extensively throughout my code and it is making my debugging difficult
> through the transition to register_global=off code.
>
> 
> define(DBF_HOST, "localhost");
>
> echo DBF_HOST;
>
> ?>
>
> Warning: Use of undefined constant DBF_HOST - assumed 'DBF_HOST' in
> var/www/html/iptrackdev/test.php on line 3 localhost

if (defined("DBF_HOST")) {
echo DBF_HOST;
} else {
echo "DBF_HOST not defined";
}


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




[PHP] how to close an http connection BUT carry on processing

2002-03-27 Thread Peter Clarke

I'm looking for a way to close the connection with the browser yet have the
script carry on doing some processing.
Any ideas?

Peter



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




[PHP] Re: PHP and DOM XML

2002-04-05 Thread Peter Clarke


"Rarmin" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have one question about operations that can be done with XML.
> What I need to do is build a web site which stores some data in XML
> files and retrieve that data. It's basically the system that allows
> users to register, login and upload and download some files. It needs to
>   use XML.
>
> The question is:
> If there are simultaneos approaches to register or upload (registration
> and upload data are all stored in the single XML file), using DOM will
> make me problems. DOM loads the whole document into memory, and writes
> it whole to disk. The question is how to avoid this? Since if, for
> example, two users register at the same time, they both get their copy
> of document, and the later that writes itself to the file will overwrite
> the changes made by the first one. How to avoid this and still use DOM?
> I am using PHP 4.1.2 and libxml 2.4.19.
>
> Any advice is wellcome.
> Tnx in advance.
>
> Armin
>

You could lock the xml file while a user registers:
http://www.php.net/manual/en/function.flock.php

if ($fp = fopen($file, "r")) {
if (flock ($fp, LOCK_EX + LOCK_NB )) {
// process registration here
flock ($fp,LOCK_UN);
fclose($fp);
}
}

however only one user will be able to register at a time.

It would be better to store this in a database because then you can have
multiple simultaneous registrations. Then when whatever application needs to
see the info as xml, have php generate the xml from the data in the
database.

Peter



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




[PHP] Re: HELP XML XML XML HELP

2001-12-06 Thread Peter Clarke

yes, echo the xml but send a header telling the browser it's xml:

header("Content-Type: text/xml");



"Olivier Masudi" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
>
> http://www.test.com/test.php?orderid=xyz
>
>
> test.php has to make a request to DB mysql and return a xml page like this
:
>
> 
>  amount="1234"
> currency="BEF">
>
> How can I do that ?
>  Should I just use echo  ?
>
>
> Help
>
>
>
>


-- 
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] Re: URGENT: IIS doesn't like GET or POST

2001-12-06 Thread Peter Clarke

Check 'register_globals' in php.ini
It sounds like it's off which is much more secure

Instead of getting:
$var
you'll have:
$HTTP_GET_VARS['var']

It stops people sending any variables in the script.

Peter

"Ron Newman" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
> When I pass form variables to PHP using either GET or POST it works under
> PWS running on "localhost", but when I run the same script remotely on a
> Win2K Advanced Server and IIS machine, I get "Warning, not defined" errors
> for all the variables passed.
>
> Is there some configuration problem with IIS, or am I overlooking
something
> else?
>
> Ron
>
>


-- 
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] Re: Xml Parse Extended Chars

2001-12-06 Thread Peter Clarke

The only predefine entities in XML are < > &
all others need to be defined in the dtd.
Best thing to do is leave the charatef as is in the xml and only run
htmlentites on the contents when sending the contents to an html web
browser.
The xml will happily hold the character as it is.

If you're using the XML Parser functions, you can choose the "target"
character encoding:
  ISO-8859-1 (default)
  US-ASCII
  UTF-8



"Chris Noble" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Ive ran into a stumbling block trying to parse an xml document. I control
> the parsing and the creation of the xml document so I can do any changes
> from either side of it. Problem I have run into is my xml document has a é
> in it. Ive ran htmlentities on it and it converts it to é but
> everytime I try and run xml parse on that I get the error code of
"undefined
> entity at line 108". Has anyone ran into this problem before or know a
> solution to handle these issues?
>
> Chris Noble
>
>


-- 
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] Re: arrays

2001-12-24 Thread Peter Clarke

The best thing for converting XML to HTML is XSLT (that's what it was made
for). PHP can do the convertion using the XSLT functions (which require
Sablotron):
http://www.php.net/manual/ref.xslt.php

Peter

"Php Dood" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm trying to figure out how to parse an xml document, and convert it into
> html...
> i know how to parse in simple xml stuff for example
> easy is pretty easy to parse in, and i know how to code that,
> but when you start adding flags that i'm going to need variables for,
> example easy is not so easy.
>
> ***
> paste sample xml
> ***
> 
>
>
>   date="060801" high_temp="24.78" low_temp="14.51" sky_desc="3"
> precip_desc="*" temp_desc="8" air_desc="*" uv_index="7"
> wind_speed="18.51" wind_dir="270" humidity="48" dew_point="12.01"
> comfort="25.28" rainfall="*" snowfall="*" precip_prob="0" icon="2" />
>   date="060901" high_temp="20.34" low_temp="13.68" sky_desc="1"
> precip_desc="*" temp_desc="7" air_desc="20" uv_index="7"
> wind_speed="18.51" wind_dir="270" humidity="57" dew_point="9.23"
> comfort="19.23" rainfall="*" snowfall="*" precip_prob="2" icon="1" />
>   date="061001" high_temp="20.35" low_temp="12.01" sky_desc="3"
> precip_desc="*" temp_desc="7" air_desc="*" uv_index="7"
> wind_speed="*" wind_dir="*" humidity="56" dew_point="9.80"
> comfort="*" rainfall="*" snowfall="*" precip_prob="1" icon="2" />
>   date="061101" high_temp="20.34" low_temp="12.02" sky_desc="3"
> precip_desc="*" temp_desc="7" air_desc="*" uv_index="7"
> wind_speed="*" wind_dir="*" humidity="57" dew_point="10.34"
> comfort="*" rainfall="*" snowfall="*" precip_prob="1" icon="2" />
>   date="061201" high_temp="22.01" low_temp="13.12" sky_desc="3"
> precip_desc="*" temp_desc="7" air_desc="*" uv_index="7"
> wind_speed="*" wind_dir="*" humidity="55" dew_point="11.45"
> comfort="*" rainfall="*" snowfall="*" precip_prob="1" icon="2" />
>   date="061301" high_temp="23.12" low_temp="13.12" sky_desc="7"
> precip_desc="*" temp_desc="7" air_desc="*" uv_index="7"
> wind_speed="*" wind_dir="*" humidity="46" dew_point="9.79"
> comfort="*" rainfall="*" snowfall="*" precip_prob="2" icon="2" />
>   date="061401" high_temp="23.12" low_temp="13.68" sky_desc="7"
> precip_desc="*" temp_desc="7" air_desc="*" uv_index="7"
> wind_speed="*" wind_dir="*" humidity="49" dew_point="10.34"
> comfort="*" rainfall="*" snowfall="*" precip_prob="3" icon="2" />
>
>
>


-- 
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] Re: Can i get the full HTTP-Header without patching PHP?

2001-07-12 Thread Peter Clarke


"Rainer Kohnen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> is there a way to get the full HTTP Header
> without patching PHP?
>
> I use a debugger coded in PHP a lot. Now i need
> to debug some intershop enfinity pages. However,
> enfinity uses a lot of fields with the same names.
> So my debugger overwrites the variables and i get
> only the last one. As i cant change the code
> (wouldn't work anymore then) i cant debug without
> having access to the full http header.
> (i can make arrays for duplicate variables for
>  myself then)
>
> Same problem with some kind of e-cash system.
> It validates itself by putting a signature into
> the header. However, PHP cant validate the header
> as i have no chance to get the original header.
> (And i cant rebuild the original header of course)
>
> If there is no way without patching to
> get these informations are there any plans to
> integrate a function for getting the header
> in future versions of php?
>
> thanks
>

Have you tried:
http://www.php.net/manual/en/function.getallheaders.php
$headers = getallheaders();
while (list ($header, $value) = each ($headers)) {
echo "$header: $value\n";
}

Peter


-- 
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] Re: php/apache question(probably stupid)

2001-07-13 Thread Peter Clarke


"Conor McTernan" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> hey all,
>
> I've been using apache, php and mysql on win32 for a while now, and I have
> recently decided to move over to linux *yay*, so i got myself a copy of
> Suse 7.1 personal edition.
>
> i now have linux up and running, but for the life of me I cannot get php
> and apache to work.
>
> i downloaded the sources of both from their respective sites, and I have
> managed to compile apache and get it running, and I have also managed to
> compile php(i think) but i cannot get apache to parse any of my code.
>
> i followed the instructions on installing php as a static object, here is
> a brief outline of what i have done
>
> i initially install apache, and get it running, i cannot remember what i
> configured it with, but i dont think i configured it with anything
> actually. one apache was installed i managed to get the httpd up and
> running, *note* I have installed apache in /usr/local/apache, i assumed
> that this was the norm.
>
> i got apache running using the apachectl command, and managed to stop it
> as well.
>
> i now unpacked the php4.0.6 sources, these are the most recent available
> from php.net, i unpacked this into a temp dir in my root folder (i dont
> know if this is a good or a bad thing?)
>
> i then followed the instructions in the php install file i configure php
> with what i want, e.g. --with-mysql
> --with-apache-prefix=/usr/loocal/apache (is this correct, or should it
> point to where my apache source code is, in which case it should point to
> /root/temp/apache1.3.6/src)
>
> before i run the make and make install for php i then run the ./configure
> on apache again this time enabling the php4 module, i run the ./configure
> then i run the make, i now have a httpd binary in my apache1.3.6/src
> dir(once again, i'm not really sure if it was here before) so i copy this
> to the /usr/local/apache/bin dir, shutting down apache first of course.
>
> once this is done i compile and install php
>
> i now copy my php.ini-dist to my /usr/lib dir(i think) and edit my
> httpd.conf file
>
> i now restart apache and fire up a test php page i name my page test.php4,
> when i load it in my browser(either konqueror or netscape6) all i get is
> my source spat back out at me.
>
>
> i'm guessing that it is just a problem with my httpd.conf, but i have made
> the changes that are outlined in the install file. other than that i've no
> idea as to what the problem could be.
>
> any help would be much appreciated. sorry about the length of this mail.
>
> conor

Do you have the following in httpd.conf:

# And for PHP 4.x, use:
#
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

NB .php NOT .php4

Otherwise consider have php as a DSO then you can rebuild PHP without
rebuilding Apache.

Peter


-- 
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] Re: postgres and php

2001-07-13 Thread Peter Clarke


"Derek" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> anyone know how I force a case insensitive search through a postgres
> database.
>
> I've got a search looking for 'something like '%something%' but this won't
> find 'SOMETHING'...if you know what I mean!?
>
> Thanks in advance for any help
>
> Derek
>
>

What's the actual SQL query you trying to use? Because _ like '%something%'
_ is correct.

Peter


-- 
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] Re: More upload Problems

2001-07-19 Thread Peter Clarke


"Jason Rennie" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all,
>
> It appears when i try to upload a file in a form, and pass it to php, it
> never arrives.
>
> I'm doing a POST from a  form, and i all but copied the example straight
> from the php manual on file uploading.
>
> But the $HTTP_POST_FILES[] array is never set, and is_uploaded_file always
> returns false.
>
> Has anybopdy else had a problem like this ???
>
> I really am stumped here.
>
> Could i have perhaps compiled php incorrectly ? Turning off a needed
> switch perhaps ?
>
> Jason
>


Check your php.ini file to see if "file_uploads = on" - it is often turned
off for security.

Peter


-- 
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] Re: More upload Problems

2001-07-19 Thread Peter Clarke


"Jason Rennie" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Check your php.ini file to see if "file_uploads = on" - it is often
turned
> > off for security.
>
> Yep it is turned on.
>
> And php.ini is in /usr/local/php/lib/php.ini
>
> Any other ideas ?
>
> Jason
>

need to see some code...

Peter


-- 
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] Re: More upload Problems

2001-07-20 Thread Peter Clarke


"Jason Rennie" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

>
> Here is the total chunk of code to date.
>
> It does currently work, except for the file submission complaining about
> the no file uploaded.
>
> the current fragment of code to do with file submission is simply my
> efforts to get the script to say that a file is being successfulyl
> uploaded.
>
> Jason
>
>
> 
>
> if(is_uploaded_file($userfile))
> {
> move_uploaded_file($userfile,"/tmp");
> }
> else
> {
> echo "No file Uploaded";
>
> }
>
>
> // now to provide an assignment submission box
> print "";
> print "\n";
> print "\n";
> print "Submit A File ";
> print "\n";
> print "\n";
> print "";
>
>
>
> ?>
>


Try a simple script that tests just file uploads, without all the other
stuff getting in the way. For your ACTION in the form just point it to:
 $HTTP_SERVER_VARS['PHP_SELF']
You seem to have a GET request in the ACTION and a POST in the form, not
sure if that'll be a problem.

Peter




-- 
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] Re: More upload Problems

2001-07-20 Thread Peter Clarke


"Peter Clarke" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> "Jason Rennie" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> >
> > Here is the total chunk of code to date.
> >
> > It does currently work, except for the file submission complaining about
> > the no file uploaded.
> >
> > the current fragment of code to do with file submission is simply my
> > efforts to get the script to say that a file is being successfulyl
> > uploaded.
> >
> > Jason
> >
> >
> >  >
> >
> > if(is_uploaded_file($userfile))
> > {
> > move_uploaded_file($userfile,"/tmp");
> > }
> > else
> > {
> > echo "No file Uploaded";
> >
> > }
> >
> >
> > // now to provide an assignment submission box
> > print "";
> > print " ACTION=\"$param&upload=true\" METHOD=\"post\" >\n";
> > print " VALUE=\"1048576\">\n";
> > print "Submit A File ";
> > print "\n";
> > print "\n";
> > print "";
> >
> >
> >
> > ?>
> >
>
>
> Try a simple script that tests just file uploads, without all the other
> stuff getting in the way. For your ACTION in the form just point it to:
>  $HTTP_SERVER_VARS['PHP_SELF']
> You seem to have a GET request in the ACTION and a POST in the form, not
> sure if that'll be a problem.
>
> Peter
>
>
>

Just seen you've got it fixed.

Peter


-- 
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] Re: xsl:include doesn't work from php, it works with sabcmd

2001-08-07 Thread Peter Clarke


"Marius Andreiana" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi
>
> I try to keep some common xsl templates in separate files and
> use 
>
> It works fine if I process them from cmd line with sabcmd,
> but the same files don't work in php, I get
> Fatal error: msgtype: error in ...
> when I add the line xsl:include (if I remove it it's ok)
>
> What's the problem? (I'm using sablotron 0.52)
>
> Thanks!
> Marius Andreiana
> --

Have you tried Sablotron 0.60?

Peter


-- 
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] Re: security check - virtual host and mod php setup

2001-08-20 Thread Peter Clarke


"Dave" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> please hack apart this solution and point out the error/insecure nature of
the
> setup.
>
> goal, provide php access to name based virtual hosts on FreeBSD boxes
>
> problem, security of PHP access to base system and other user scripts
>
> solution,
>
> apache compiled with suexec
> # set user and group to unique
> chown USERID:USERID /path/to/user/html/directory
>
> # no public access to any files under here that
> # you don't want public reading, like scripts
> # with database login information in them
> chmod -R 0750 /path/to/user/html/directory
>
> # set group sticky execution...  we will run
> # apache as this unique group so may not be needed
> chmod g+s /path/to/user/html/directory
>
> >in apache's httpd.conf
> # set each virtual host to run any accesses
> # as the group USERID giving them only access
> # to this directory...  defeats PHP directory
> # and shell scripts as long as no public read bits
> # are set
> 
> ServerName whatever.com
> Group USERID
> 
>
>
> Sufficient?
>
> you end up with http://test1.com and http://test2.com being unable to
create PHP
> scripts or do listings of any other virtual user directory since they are
not of
> the same group, but accesses to the site are made by invoking apache as
that
> group for that session.
>
> directory tree
> drwxr-s---  2 user1   user1  512  Aug 19 18:23 vtest1
> drwxr-s---  2 user2   user2  512  Aug 19 18:26 vtest2
>
> with directory groups set in the httpd.conf for user1 in vtest1 and user2
in
> vtest2, neither user should be able to use PHP filesystem functions to
browse
> the other directories as long as no public bits are set, and apache server
> requests still server the documents from the directories since each users
> directory has an Group user1 (or user2) set for his directory in the
directory
> or virtual container, thus executing the apache requsts as the appropriate
user
> and not the generic www user.
>
>
> Please feel free to point out any errors in my logic...  it appears pretty
solid
> from here.
>
> Dave
>


Have you looked at "open_basedir" in php.ini ?
Here's what I do:
in php.ini
 open_basedir = /dev/null

in httpd.conf

ServerName whatever.com
php_admin_value open_basedir /path/to/website



Peter


-- 
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] Re: Whacky WGET issue...

2001-08-31 Thread Peter Clarke


"Sondra Russell" <[EMAIL PROTECTED]> wrote in message
news:p05100303b7b4263f844e@[212.43.200.227]...
> Hello everyone!
>
> Crazy question:
>
> I've created a little script that reads in .txt files and, with the
> help of phplib templates, matches them up with a collection of
> templates and spits out the beautiful html page.
>
> In order to avoid sending variables through the URL I've stolen this
> bizarre workaround where, when you call
> http://www.mysite.com/somepage.html for example, the apache
> configuration realizes it's a 404 and redirects all 404s through my
> cms script.  Then my script looks for
> http://www.mysite.com/somepage.txt and does the rest.
>
> This works beautifully, and my plan was to have a "dev" environment
> that runs against the little CMS system and then wget the whole site
> periodically for the live server (so, the live site actually *is* a
> collection of flat pages).
>
> Beautiful plan, but it turns out that WGET doesn't see the apache
> configuration change that runs all 404s through my CMS script.  It
> sees a 404 and tells me its a 404 and then goes back to its coffee
> break, you know?
>
> Anyone else tried this workaround before with similar results?
> Anyone else have a better workaround?  Bueller?
>
> Anyway, best,
> Sondra


Make sure to change the header. The page returned will have all the content
but the header still says "404" this needs to be changed to "200" so that
wget doesn't go off on a coffee break.
Try using:

header ("status: 200 OK");

Peter



-- 
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] Re: [PHP-INST] PHP4 and Apache 1.3.20 DSO mode not working?

2001-09-03 Thread Peter Clarke

>
> My question is simple. Have you downloaded, compiled, and integrated
> the most recent versions of Apache and PHP and made them work? Not
> previous versions. I've seen several people have problems with doing
> this in the newsgroups dating from late 2000. Someone please wipe
> out your apache/php installation and attempt to reinstall the most
> recent versions according to the instructions. I'm starting to think
> nobody has actually tested this...

I've recently installed:
Red Hat Linux release 7.1 (Seawolf), PHP 4.0.6 Apache, 1.3.20 DSO from
scratch with no problems.
also:
Red Hat Linux release 6.1 (Cartman), PHP 4.0.6 Apache, 1.3.20 DSO from
scratch with no problems.

Just so you know it can work.

Peter


-- 
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] avi to wmv convert

2004-08-20 Thread Peter Clarke
John Nichel wrote:
Jay Blanchard wrote:
[snip]
In what manual?
[/snip]
TFM!
I'm sorry, I didn't quite catch that.  Could you hold my hand, and point 
it out to me?  If you were a real pal, you would write the code for me 
too. ;)

The only manual I know of is at www.php.net
It provides a tool for searching the online documentation.
Searching for 'avi' produces just one result of:
http://www.php.net/function.getimagesize
in which a user posts about finding dimensions etc from media files.
I cannot find anywhere that mentions converting avi files to wmv files.
So, yes could you hold my hand and give me a url to the manual page.
Don't worry about the code, just the link will do.
Thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] avi to wmv convert

2004-08-21 Thread Peter Clarke
John Nichel wrote:
Peter Clarke wrote:
John Nichel wrote:
Jay Blanchard wrote:
[snip]
In what manual?
[/snip]
TFM!
I'm sorry, I didn't quite catch that.  Could you hold my hand, and 
point it out to me?  If you were a real pal, you would write the code 
for me too. ;)

The only manual I know of is at www.php.net
It provides a tool for searching the online documentation.
Searching for 'avi' produces just one result of:
http://www.php.net/function.getimagesize
in which a user posts about finding dimensions etc from media files.
I cannot find anywhere that mentions converting avi files to wmv files.

The point of the razzing is to get one to do some research.  If you 
don't see it in the manual, chances are PHP cannot do it on it's own. 
Without seeing any 'video' functions listed in 'THE MANUAL', I would 
hazard a guess that converting between two different video formats is a 
bit beyond the scope of PHP.  Not to say that this cannot be done, as 
I'm sure there is an API out there that PHP can interact with, but 
someplace like Google would be a better place to start a search like there.

Agreed, my issue is with the pure unhelpfulness of the responses to the 
question. The response was:
"There are a few listed in the manual."
which is totally wrong.

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


[PHP] Re: crazy readdir bug

2004-06-18 Thread Peter Clarke
Matt Richards wrote:
Imagine the following:
362>class someClass {
363>  function someFunction() {
364>if($rDirectory = opendir("/templates")) {
365>  while(false != ($strFile = readdir($srDirectory))) {
366>print $strFile."";
367> }
368>   }
369>  }
370>}
line 364 $rDirectory
line 365 $srDirectory
so $srDirectory does not exist.
-Peter

The class is constructed successfully, the function is called 
successfuly, the if($rDirectory = opendir("/templates")) statement 
returns true, and the directory most certainly exists, but as soon as an 
attempt to read the contents of the directory occurs, the once valid 
resource ($rDirectory) becomes invalid:

Warning: readdir(): 36 is not a valid Directory resource in 
D:\inetpub\wwwroot\phpSLearningDev\root\components\installer\inc\installer.php 
on line 365

if the code is removed from both the class and function, it executes fine.
I am currently working on a Windows 2003 server (not my choice) and an 
internal (non network (SMB)) HDD.

I can't imagine that simply being inside a class could cause this.
Am I missing something!?!?!?  I regard myself as a fairly proficient PHP 
developer, but this one has got a whole dev team stumped.

Any thoughts appreciated.
Matt Richards
matt_DOT_richards_AT_NOSPAM_safetymedia_DOT_co_DOT_uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Worried about PECL

2004-07-08 Thread Peter Clarke
Currently the online manual for php is great.
My concern is that the documentation for PECL extensions is almost 
non-existent. Since some php extensions are being moved/replaced by PECL 
extensions are we going to get non-existent documentation?

For example:
www.php.net/mime-magic
"This extension has been deprecated as the PECL extension fileinfo 
provides the same functionality (and more) in a much cleaner way."
http://pecl.php.net/package/Fileinfo provides no documentation so what 
these extra functions are, I have no idea. Worse, I now have no idea how 
to do mime_content_type().

www.php.net/mcal
"Note: This extension has been removed as of PHP 5 and moved to the PECL 
repository."
There is no mention of mcal on the pecl website.

I appreciate that PECL will more relevant to PHP5, but PHP5 is close is 
the documentation close too?

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


[PHP] Re: Copyrighting PHP, MySql, Apache,perl etc...

2004-01-29 Thread Peter Clarke
Ryan A wrote:
Which brings up a little question, any idea of whats ZEND's (or anybody else
that matters) opinion
of using PHP in a domain name?
eg: my-lovely-php-and-apache-website.com
Have a look at http://www.php.net/license/
"We cannot really stop you from using PHP in the name of your project 
unless you include any code from the PHP distribution, in which case you 
would be violating the license. But we would really prefer if people 
would come up with their own names independent of the PHP name.

Why you ask? You are only trying to contribute to the PHP community. 
That may be true, but by using the PHP name you are explicitly linking 
your efforts to those of the entire PHP development community and the 
years of work that has gone into the PHP project. Every time a flaw is 
found in one of the thousands of applications out there that call 
themselves "PHP-Something" the negative karma that generates reflects 
unfairly on the entire PHP project. We had nothing to do with PHP-Nuke, 
for example, and every bugtraq posting on that says "PHP" in it. Your 
particular project may in fact be the greatest thing ever, but we have 
to be consistent in how we handle these requests and we honestly have no 
way of knowing whether your project is actually the greatest thing ever."

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