Re: [PHP] adding code and beginning and end without includes

2006-03-16 Thread Claudio Corlatti

search in google
php +prepend +htaccess

http://www.codingforums.com/showthread.php?t=78287

bye bye

Claudio

blackwater dev wrote:

Is there a way to intercept and add code at the beginning and end of every
http request - WITHOUT having to put an include at the top and bottom of
every page?

This is something we need to be app specific so don't really want to do it
globally like chanse the php.ini or something.

Thanks!

  


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



Re: [PHP] Parse Error

2006-02-21 Thread Claudio Corlatti

Hi,
you need to finish every line with ;
$host=localhost ;
$user=ray ;
$password=* ;

Bye


Ray Cantwell wrote:

Hi all,
I am a noob and super confused right now. I have some really simple 
code and i am getting an error that reads:
*Parse error*: syntax error, unexpected T_VARIABLE in 
*/var/www/mysql_up.php* on line


here is the code:

html
headtitleTest MySQL/title/head
body
!-- mysql_up.php --
?php
$host=localhost ;
$user=ray ;
$password=* ;

mysql_connect($host,$user,$password) ;
$sql=show status;
$result = mysql_query($sql);
if ($result == 0)
  echo bError  . mysql_errno() . : 
. mysql_error() . /b;
else
{
?
!-- Table That Displays the results --
table border=1
 trtdbVariable_name/b/tdtdbValue/b
 /td/tr
 ?php
   for ($i = 0; $i  mysql_num_rows($result); $i++) {
 echo TR;
 $row_array = mysql_fetch_row($result);
 for ($j = 0; $j  mysql_num_fields(result); $j++)
 {/
   echo TD . $row_array[$j] . /td;
 }
 echo /tr;
  }
?
/table
?php } ?
/body/html

I am really confused because i cannot see any obvious errors.
any help would be appreciated.

Ray.








[PHP] LDAP Paged Search

2005-10-31 Thread Claudio
Hi Folks!
This is my first email to php-general, and first of all I wish to thank
the developers for their GREAT work! :-)

Well, I don't mean to waste your time, so here follow my question.

I've stared using PHP some months ago, and my last application is an LDAP
Administration Tool for IBM ITDS server. It run on AIX and Linux, and I'm
trying to extend it to manage Active Directory too.

The problem is that A.D. only support Paged search: it gives back the
first N results (N=1000 in my case) each time. There is a particular way
to perform searches that handles this kind of replies, it is usually based
on a cookie that's exchanged between client and server so that the client
can obtain a cursor of where the search is arrived, and continue it
until the results are completed.

I've tried to Google-search  to see if someone else already had this
problem and I found that, while PERL resolve it, PHP does not provide a
solution. So I decided to subscribe this list, maybe someone here knows
how to resolve this problem?

  Thanks in advance!
  Claudio

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



[PHP] include file to global scope

2005-10-12 Thread Claudio
Hi,

I'm using PHP 5. I have a class operation that includes php files.
Is there a way to include this files to global scope? So that difined vars 
and functions are global accesseble?

I saw that some PHP functions have a context parameter, is something like 
this in eval or include possible?

Thanks,

Claudio 

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



Re: [PHP] include file to global scope

2005-10-12 Thread Claudio
 first off I would recommend that you 'pollute' your global scope as
 little as possible.
I agree at all! Thats my opinion, and i don't use global variables at all. 
The problem is, other people do. And if I need to use their code I must 
include it.

 that said the solution will probably involve the use of the 'global' 
 keyword.
Yes, see example files 1 and 2. This files are very simple, but shows the 
problem. Naturly the decision what file to include an when is complexer than 
that.
The file2.php represents a large standalone old php file. Doesn't maintend 
by me. It works fine.
The file1.php5 represents a newer application. File2 will not work, because 
$abc is not a global var.
Ok, I could search for all declared vars and add a global to it. Thats not 
realy a nice solution.

Do anyone have a better Idea?

Claudio

file1.php5:
-
?php
class testInc {
public static function incFile($x) {
return include_once($x);
}
}
testInc::incFile('file2.php');
?
-
file2.php:
-
?php
$abc = true;
function anotherOne() {
global $abc;
if ($abc) {
echo 'it works';
} else {
echo 'failure';
}
}
anotherOne();
?
-

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



[PHP] pear.php.net

2005-10-12 Thread Claudio
is http://pear.php.net offline?

snip
Warning: Invalid argument supplied for foreach() in 
/usr/local/www/pearweb/include/pear-format-html.php on line 360

Warning: Invalid argument supplied for foreach() in 
/usr/local/www/pearweb/include/pear-format-html.php on line 360

Warning: Invalid argument supplied for foreach() in 
/usr/local/www/pearweb/include/pear-format-html.php on line 360

Warning: Invalid argument supplied for foreach() in 
/usr/local/www/pearweb/include/pear-format-html.php on line 360

Fatal error: Call to undefined function: init_auth_user() in 
/usr/local/www/pearweb/include/pear-format-html.php on line 112
/snip 

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



Re: [PHP] include file to global scope

2005-10-12 Thread Claudio
Is it possible to process the file in second php instance?
An only get its output?

Claudio 

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



[PHP] DOMDocument and html doctype

2005-05-14 Thread Claudio
Hi,
I've used loadHTML() to read a HTML file to DOM. This file starts with a 
string like
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN

Do someone know how I can access this string? By reading the doctype back 
from DOMDocument I only found the name (HTML) but nothing more...

Thanks,

Claudio 

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



[PHP] buffering headers before send

2005-05-07 Thread Claudio
Hi,

is there a way to buffering headers before sending like ob_start() ?

Thanks,

Claudio 

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



[PHP] Re: buffering headers before send

2005-05-07 Thread Claudio
M. Sokolewicz [EMAIL PROTECTED] schrieb im Newsbeitrag
 ob_start buffers both `normal` output AND headers.

Humm, now it works...
Is there something else that must be set, so that ob_start() works or not?
Something like an php.ini entry?

Here is the listing of ob_start.php5

?php
ob_start();
echo hallo firstBR;
$x = ob_get_clean();
ob_start();
header(X-Sample-Test: foo);
$h[0] = headers_sent();
$h[1] = headers_list();
echo hallo secondBR;
echo $x;
$x = ob_get_clean();
ob_start();
echo hallo thirdBR;
echo $x;
header(X-Sample-Test: foo2);
$h[2] = headers_sent();
$h[3] = headers_list();
ob_end_flush();
echo PRE;
var_dump($h);
echo /PRE;
? 

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



Re: [PHP] SimpleXML add a node

2005-03-13 Thread Claudio
@richard
 I dunno about that whole try/catch thing, but if you're not going to USE
 it to catch the errors, then you might as well be old school and check the
 return values of all these functions.

that sounds good, but , so far I know, if the API says that a function _can_ 
throw an exception, I _must_ catch it. In this case 'importNode', 
'appendChild', and 'createElement'. If I'm wrong please correct me.

 Since it works once and not the second time, I'd be looking to see if
 the XML produced on the first go-around is actually VALID, since, if it's
 not, that would cause this problem, I think.

The first time 'dom_import_simplexml' returns a DOMElement, the second a 
DOMDocument. I don't know why.
The string version of the first SimpleXML is: (that produces a DOMElement)
?xml version=1.0?config/
The string version of the second SimpleXML is: (that produce a DOMDocument)
?xml version=1.0?configactive/config/

@jason
I'm alredy using the 'dom_import_simplexml' function (line 5, code anexed)

@jochem
'instanceof' used now, thanks for reminding. Also if in this case it wasn't 
the prpblem.


last of all, a probalbly readable version of the code:
---
// check if there is a valid simplexml document
if (!($this-configXML instanceof SimpleXMLElement)) 
$this-createConfigXML();
   $dom = new DOMDocument('1.0');
   // create a DOMElement from SimpleXML
   $domElem = dom_import_simplexml($this-configXML);
   if ( $domElem === false ) return false;
  echo \n\r.'1:';var_dump($domElem);echo BR\n\r;
try {
 // import DOMElement(simplexml) to empty DOMDocument
 $domNode = $dom-importNode($domElem,true);
 if ( $domNode === false ) return false;
  // append the imported node to the DOMDocument
 $domNode = $dom-appendChild($domNode);
  // create new DOMElement
  $domElem = $dom-createElement(($mode? 'softactive':'active'));
 // add new Element to DOMElement(simplexml)
  $domNode-appendChild( $domElem );
} catch(Exception $e) {
  echo 'EXCEPTION: '.$e-getMessage().'BR/';
  return false;
}
   // redefine old simplexml
   $simplexml = simplexml_import_dom($dom);
   if ($simplexml === false) return false;
   $this-configXML = $simplexml;
  echo '2:';echo $this-configXML-asXML();echo BR\n\r;
}
return true;

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



[PHP] SimpleXML add a node

2005-03-11 Thread Claudio
Hi,

I probably have a stupid question... how can I add a node into an existing 
simplexml object.
I create the object by
$xml = simplexml_load_file('test.xml');

the xml file shows like this:
?xml version='1.0'?
config
/config


Thanks for help... 

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



Re: [PHP] SimpleXML add a node

2005-03-11 Thread Claudio
 php.net/dom

??

Like this?

---

try {

$dom = new DOMDocument();

$config = 
$dom-appendChild($dom-importNode(dom_import_simplexml($this-configXML),true));

$config-appendChild( $dom-createElement(($mode? 'softactive':'active')) );

$this-configXML = simplexml_import_dom($config);

} catch(Exception $e) {}



It ist strange... It runs one time, the second time I receive the following 
error.

Warning: DOMDocument::importNode() [function.importNode]: Cannot import: 
Node Type Not Supported in ...

Warning: appendChild() expects parameter 1 to be DOMNode, boolean given in 
...

Fatal error: Call to a member function appendChild() on a non-object in ...

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



[PHP] CLI CGI

2005-02-04 Thread Claudio
Can I use the CGI executable at the command-line?
In other words, what is the diference between the CLI and CGI Version?

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



[PHP] Premature end of script headers: php

2005-02-03 Thread Claudio
Hi,
Im trying to use PHP4 and PHP5 at the same time. PHP4 as CGI and PHP5 as
module.
PHP5 ist actually not present and not installed
PHP4 runs find as module, when I try to use it as CGI I receive the error
message:
Premature end of script headers: php

Can someone help me?


Here my used configurations:

Testfile: ?php phpinfo(); ?

Webserver: Apache 2.0.50 (Linux/Suse) installed as RPM

PHP4 version 4.3.10 self compiled from downloaded tar
   ./configure \
--with-apxs2=/usr/sbin/apxs2-prefork \
--prefix=/usr/local/php-4.3.10 \
--with-mysql --with-ldap

httpd.conf:
#
# If PHP4 is loaded as module
#
#IfModule sapi_apache2.c
IfModule mod_php4.c
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php
DirectoryIndex index.php3
DirectoryIndex index.php4
/IfModule

#
# To load PHP4 as CGI
#
IfDefine PHP4_CGI
ScriptAlias /php4/ /usr/local/php-4.3.10/bin/
Directory /usr/local/php-4.3.10/bin/
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from 192.168.11
/Directory
AddType application/x-httpd-php4 .php
AddType application/x-httpd-php4 .php3
AddType application/x-httpd-php4 .php4
AddType application/x-httpd-php-source .phps

Action application/x-httpd-php4 /php4/php

DirectoryIndex index.php
DirectoryIndex index.php3
DirectoryIndex index.php4
/IfDefine

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



Re: [PHP] Premature end of script headers: php

2005-02-03 Thread Claudio
Maybe... What is the diference?

In /usr/local/php-4.3.10/ I have 5 files after make install

(pear php php-config phpextdist phpsize)

What should I do? How can I make the cgi-executable?

Marek Kilimajer wrote:
 My guess cli binary is executed instead of cgi.

 Claudio wrote:
 Hi,
 Im trying to use PHP4 and PHP5 at the same time. PHP4 as CGI and PHP5 as
 module.
 PHP5 ist actually not present and not installed
 PHP4 runs find as module, when I try to use it as CGI I receive the error
 message:
 Premature end of script headers: php

 Can someone help me?


 Here my used configurations:

 Testfile: ?php phpinfo(); ?

 Webserver: Apache 2.0.50 (Linux/Suse) installed as RPM

 PHP4 version 4.3.10 self compiled from downloaded tar
./configure \
 --with-apxs2=/usr/sbin/apxs2-prefork \
 --prefix=/usr/local/php-4.3.10 \
 --with-mysql --with-ldap

 httpd.conf:
 #
 # If PHP4 is loaded as module
 #
 #IfModule sapi_apache2.c
 IfModule mod_php4.c
 AddType application/x-httpd-php .php
 AddType application/x-httpd-php .php3
 AddType application/x-httpd-php .php4
 AddType application/x-httpd-php-source .phps
 DirectoryIndex index.php
 DirectoryIndex index.php3
 DirectoryIndex index.php4
 /IfModule

 #
 # To load PHP4 as CGI
 #
 IfDefine PHP4_CGI
 ScriptAlias /php4/ /usr/local/php-4.3.10/bin/
 Directory /usr/local/php-4.3.10/bin/
 AllowOverride None
 Options +ExecCGI -Includes
 Order allow,deny
 Allow from 192.168.11
 /Directory
 AddType application/x-httpd-php4 .php
 AddType application/x-httpd-php4 .php3
 AddType application/x-httpd-php4 .php4
 AddType application/x-httpd-php-source .phps

 Action application/x-httpd-php4 /php4/php

 DirectoryIndex index.php
 DirectoryIndex index.php3
 DirectoryIndex index.php4
 /IfDefine
 

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



Re: [PHP] Premature end of script headers: php

2005-02-03 Thread Claudio
gw:/usr/local/php-4.3.10/bin # ./php -v
PHP 4.3.10 (cli) (built: Feb  3 2005 17:58:19)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

Your guess was correct...

after a new configure without axp2s...

gw:/usr/local/php-4.3.10/bin # ./php -v
PHP 4.3.10 (cgi) (built: Feb  3 2005 22:59:02)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

now it runs... PHP4 as CGI and PHP5 as module
Thanks!!

Marek Kilimajer [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
 Claudio wrote:
 Maybe... What is the diference?

 In /usr/local/php-4.3.10/ I have 5 files after make install

 (pear php php-config phpextdist phpsize)

 What should I do? How can I make the cgi-executable?

 Marek Kilimajer wrote:

My guess cli binary is executed instead of cgi.

 Try

 $ /usr/local/php-4.3.10/php -v

 If the output is

 PHP 4.3.10 (cli) (built: .
 ^^^

 it's CLI and CGI version was installed somewhere else. Try to locate it, 
 or check the output of make install. cgi version is installed by default 
 unless you include --disable-cgi in ./configure arguments 

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



[PHP] Installation de PHP 4.2.1 with Apache and extension Frontpage 2002

2002-07-03 Thread Claudio Valgoi

Hello,

I've recently installed Mandrake v 8.1 on my computer and then successfully
compiled and installed PostgreSQL and Apache 1.3.24 and PHP 4.2.1... All
that works well...

When I installed Frontpage 2002 extensions on the same computer, PhP didn't
work any more.
I then tried to compile again php with make clean; but same result PhP
isn't working

I then tried to make a 
/configure --with-apxs=/usr/local/apache/bin/apxs
--with-pgsql=/usr/local/pgsql dans php and the following error appeared :

Sorry, I was not able to successfully run
APXS



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




[PHP] Installation de PHP 4.2.1 avec Apache et extension frontpage 2002

2002-07-02 Thread Claudio Valgoi

Bonjour,

Sur mon poste qui tourne avec une distribution Mandrake 8.1 j'ai compiler et
installé PostgreSQL ainsi que apache 1.3.24 et php 4.2.1 tous ça fonctionne
très bien.

Lorsque j'ai installé les extension FrontPage 2002 sur mon serveur Apache,
PHP ne tourne plus.

j'ai essaier de recompiler php en faisaint un make clean;make mais cela ne
marche pas. 

j'ai essayé de refaire un ./configure --with-apxs=/usr/local/apache/bin/apxs
--with-pgsql=/usr/local/pgsql dans php

mais l'erreur suivante apparaît

Sorry, I was not able to successfully run
APXS

merci de votre aide



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




[PHP] uploading files problem

2002-03-29 Thread Claudio Fedel

hi there,

I'm trying to upload a file using php on an apache server running on
linux.

The code of the form I'm using is as follow:

form  enctype=\multipart/form-data\ method=POST
action=$PHP_SELF?action=doupload 
pFile to upload:br
input type=file name=file size=30
input type=text name=zio size=30
pbutton name=submit type=submit
Upload
/button
/form


when I press the submit button after selecting the file, nothing
happens. 
I tried to print the filename passed by the form but it is empty.
If I run the same page on my win2k server, everything works fine.
It seems as that the form doesn't pass post variables. I also tried to
delete the enctype parameter and in this case the variables are printed
on screen.

Is there any particular setting on linux for this page to work?

thanks