[PHP] Re: New to mac and trying to define a php.ini file.

2012-01-04 Thread Phil Dobbin
On 4/1/12 14:09, Richard Quadling rquadl...@gmail.com wrote:

 Where do I put my php.ini file for a MacBook Air? I've only had it 2
 days and having trouble with the date.timezone setting.
 
 I've also had to install xampp (recommended - no idea about it) for
 Apache with PHP.
 
 Different versions of PHP now installed.
 
 Default from command line is PHP 5.3.6 with Suhosin-Patch (cli)
 (built: Sep  8 2011 19:34:00)
 
 The one that XAMPP installed is 5.3.1 and I've found the ini file for
 this is in /Applications/XAMPP/xamppfiles/etc/php.ini

If you want to use the php installed by xampp, you have to adjust the PATH
to php in your .bashrc/.bash_profile to suit.

There are about a million examples of how to achieve this on Google.

Cheers,

Phil...

-- 
Nothing to see here... move along, move along


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



Re: [PHP] PHP syntax - novice question

2011-10-29 Thread Phil Dobbin
On 30/10/11 at 01:18, si...@welsh.co.nz (Simon J Welsh) wrote:

 It seems as though your editor has changed the normal quotes around pre 
 into pretty 
 quotes. Change the ‘s and ’s back to '.

Hi, Simon.

Thanks for that. Couldn’t see for looking...

Cheers,

Phil.
--
Please consider the environment before reading this email...


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



[PHP] Need help debugging random httpd segfault

2011-03-09 Thread Phil
Hello list,

We've been experiencing random crashes on httpd, error_log shows a
bunch of [notice] child pid 12984 exit signal Segmentation fault (11)

PHP 5.2.17:

./configure --with-apxs2=/var/www/bin/apxs --with-gd
--with-jpeg-dir=/usr/local --with-pgsql --with-pdo-pgsql
--with-png-dir=/usr/local --with-zlib-dir=/usr/local --with-mssql
--enable-wddx --with-mysqli --with-freetype-dir=/usr/local
--enable-zend-multibyte --with-mcrypt --with-mysql --with-pdo-mysql
--enable-mbstring --with-pdo-dblib --with-sybase=/usr/local/freetds
--enable-soap --with-openssl --with-curl --with-imap --with-kerberos
--with-imap-ssl --enable-ftp --enable-debug

I've been looking at coredumps; here's what I got:

(gdb) bt
#0  zend_mm_remove_from_free_list (heap=0x85043f0, mm_block=0x8512420)
at /root/download/php/php-5.2.17/Zend/zend_alloc.c:837
#1  0x01042561 in _zend_mm_free_int (heap=0x85043f0, p=value
optimized out) at
/root/download/php/php-5.2.17/Zend/zend_alloc.c:1979
#2  0x0104f9c0 in _zval_dtor () at
/root/download/php/php-5.2.17/Zend/zend_variables.h:35
#3  _zval_ptr_dtor (zval_ptr=0x887af7c) at
/root/download/php/php-5.2.17/Zend/zend_execute_API.c:414
#4  0x0106682e in zend_hash_destroy (ht=0x86b43c8) at
/root/download/php/php-5.2.17/Zend/zend_hash.c:526
#5  0x01053a5d in destroy_zend_class (pce=0x8736aec) at
/root/download/php/php-5.2.17/Zend/zend_opcode.c:185
#6  0x0106682e in zend_hash_destroy (ht=0x85046b8) at
/root/download/php/php-5.2.17/Zend/zend_hash.c:526
#7  0x0105cc78 in zend_shutdown () at
/root/download/php/php-5.2.17/Zend/zend.c:736
#8  0x01019ba5 in php_module_shutdown () at
/root/download/php/php-5.2.17/main/main.c:1918
#9  0x01019c4b in php_module_shutdown_wrapper (sapi_globals=0x13724a0)
at /root/download/php/php-5.2.17/main/main.c:1889
#10 0x010c89e3 in php_apache_child_shutdown (tmp=0x0) at
/root/download/php/php-5.2.17/sapi/apache2handler/sapi_apache2.c:369
#11 0x009d3b69 in run_cleanups () at memory/unix/apr_pools.c:2306
#12 apr_pool_destroy (pool=0x867a1b0) at memory/unix/apr_pools.c:774
#13 0x080cbd54 in clean_child_exit (code=0) at prefork.c:196
#14 0x080cc49d in just_die (sig=15) at prefork.c:328
#15 signal handler called
#16 0x0052d424 in __kernel_vsyscall ()
#17 0x0028670b in poll () from /lib/libc.so.6
#18 0x009dda94 in apr_wait_for_io_or_timeout (f=0x0, s=0x867c1f8,
for_read=0) at support/unix/waitio.c:51
#19 0x009d7ada in apr_socket_sendv (sock=0x867c1f8, vec=0xbfe85340,
nvec=1, len=0xbfe85248) at network_io/unix/sendrecv.c:212
#20 0x0807b8a6 in writev_it_all (s=0x867c1f8, vec=0xbfe85338, nvec=2,
len=20851, nbytes=0xbfe853dc) at core_filters.c:321
#21 0x0807c42e in ap_core_output_filter (f=0x867c850, b=0x8686538) at
core_filters.c:868
#22 0x080afa28 in ap_http_header_filter (f=0x871ee70, b=0x8691a98) at
http_filters.c:1306
#23 0x08071f0e in ap_content_length_filter (f=0x871ee58, b=0x8691a98)
at protocol.c:1338
#24 0x080b1228 in ap_byterange_filter (f=0x871ee40, bb=0x8691a98) at
byterange_filter.c:169
#25 0x08092d42 in deflate_out_filter (f=0x8691a60, bb=0x8691a98) at
mod_deflate.c:512
#26 0x08092d42 in deflate_out_filter (f=0x8695050, bb=0x8691a98) at
mod_deflate.c:512
#27 0x00116edd in apr_brigade_write (b=0x8691a98, flush=0x8087640
ap_filter_flush, ctx=0x8695050,
str=0x875e3bc !DOCTYPE html PUBLIC \-//W3C//DTD XHTML 1.0
Strict//EN\ \http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\;\r\nhtml
xmlns=\http://www.w3.org/1999/xhtml\; xml:lang=\fr\
lang=\fr\\r\nhead\r\nmeta name=\..., nbyte=20520) at
buckets/apr_brigade.c:429
#28 0x0806fe26 in buffer_output (r=0x8694278,
str=0x875e3bc !DOCTYPE html PUBLIC \-//W3C//DTD XHTML 1.0
Strict//EN\ \http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\;\r\nhtml
xmlns=\http://www.w3.org/1999/xhtml\; xml:lang=\fr\
lang=\fr\\r\nhead\r\nmeta name=\..., len=20520) at
protocol.c:1453
#29 0x0806ffcc in ap_rwrite (buf=0x875e3bc, nbyte=20520, r=0x8694278)
at protocol.c:1488
#30 0x010c90a5 in php_apache_sapi_ub_write (
str=0x875e3bc !DOCTYPE html PUBLIC \-//W3C//DTD XHTML 1.0
Strict//EN\ \http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\;\r\nhtml
xmlns=\http://www.w3.org/1999/xhtml\; xml:lang=\fr\
lang=\fr\\r\nhead\r\nmeta name=\..., str_length=20520)
at /root/download/php/php-5.2.17/sapi/apache2handler/sapi_apache2.c:78
#31 0x0102ada3 in php_ub_body_write_no_header (
str=0x875e3bc !DOCTYPE html PUBLIC \-//W3C//DTD XHTML 1.0
Strict//EN\ \http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\;\r\nhtml
xmlns=\http://www.w3.org/1999/xhtml\; xml:lang=\fr\
lang=\fr\\r\nhead\r\nmeta name=\..., str_length=20520) at
/root/download/php/php-5.2.17/main/output.c:684
#32 0x0102b377 in php_end_ob_buffer (send_buffer=1 '\001',
just_flush=0 '\0') at /root/download/php/php-5.2.17/main/output.c:294
#33 0x0102ba38 in zif_ob_end_flush (ht=0, return_value=0x86a4084,
return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
at /root/download/php/php-5.2.17/main/output.c:810
#34 0x0109162a in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfe85990) at

Re: [PHP] Change styling depending on var value

2009-11-23 Thread Phil Matt

Mari Masuda wrote:


This may be a dumb question, but did you actually fetch the db query's results 
and put them in $row before trying to use $row?  In MySQL you could do 
something like:

$query = select * from my_table;
$result = mysql_query($query);
$row = mysql_fetch_array($result);  //this statement would need to be inside of 
a loop if there is more than one result

Thanks, Mari. That was it: I usually declare the variables first, then 
on with the rest of the code. I had inserted the $row conditional values 
right after the vars, before the rest of the query...just plain dumb.


Cheers --- Phil

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



[PHP] CSS and variables

2009-11-20 Thread Phil Matt

De-lurking here.

I'm trying, with no success, to use some CSS styling on my PHP output.

Here's the code I want to style:

echo 'trtd class=spacer'.$row[0].'/tdtd'.$row[1].'/td

I want to use a CSS style for the second td cell, picking up the style 
from the value of a variable. I tried this:


$newcolor = color: red;

td style= ? echo($newcolor): ?'.$row[1].'/td

But it doesn't work. No problem with th spacer class, works fine. I 
just can't get the syntax for pulling a CSS style from a PHP var.


TIA for your help!

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



Re: [PHP] Change styling depending on var value

2009-11-20 Thread Phil Matt

Ashley Sheridan wrote:


Copying back the phplist *again*!

Sorry. I'll remember to copy in...


what does your code currently look like now, with the right == in?


$entree=meat;
$beverage=coffee;
if ($row[3] == $entree)
{
   $newcolor=color:red;
}
elseif ($row[3] == $beverage)
{
   $newcolor=color:red;
}
else
{
   $newcolor=color:green;


The result is that all of the text in the styled cell is green.

td style='.$newcolor.''.$row[3].'/td

I know the script is running through the conditional statement, because 
if I change the ELSE value of $newcolor, all of the styled cells change 
to whatever color I specify there.


I went back and browsed the db table to see to make sure I had the right 
row and that the entries matched my references - no probs there.


Cheers --- Phil

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



Re: [PHP] Change styling depending on var value

2009-11-20 Thread Phil Matt

Dan McCullough wrote:
To add to what Ashley said about $row[3],  remember that when you are 
returning from the db the counter for fields will start at 0 not 1, so 
if its the 3rd field that will be $row[2].  You might also want to do 
switch rather then elseif but thats always a good debate.




Thanks, Dan. I had checked that a while ago.

I also tried the same script on a different row, changing the strings in 
the variables to match the data in the fields - same result, always 
defaults to the ELSE color.


Cheers --- Phil

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



Re: RES: [PHP] CSS and variables

2009-11-20 Thread Phil Matt

Jônatas Zechim wrote:

Try:

echo 'td style=' . $newcolor .'' . $row[1] . '/td';




Thanks, Jônatas. This was the solution.

Cheers --- Phil

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



Re: [PHP] Change styling depending on var value

2009-11-20 Thread Phil Matt

Ashley Sheridan wrote:


copy the results of this:

vardump($row);


Sirloin Steak  freshAcmemeat
Chicken Breast frozen   Acmemeat
Decaf Columbianpantry   Giant   coffee
Ice Cream  frozen   Giant   dessert 

All looks as expected.
NB: This is just test data until I get the formatting right.

Cheers --- Phil

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



Re: [PHP] Change styling depending on var value

2009-11-20 Thread Phil Matt

Ashley Sheridan wrote:

That's not a vardump, a vardump would contain the type of variable. I 
wanted to see the whole thing.


I played with this for a while and checked the PHP manual; not sure how 
to use this.



Cheers --- Phil

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



Re: [PHP] Change styling depending on var value

2009-11-20 Thread Phil Matt

Ashley Sheridan wrote:


As Mike pointed out, I meant var_dump(), sorry!



Is the idea to put the variable in question within the parentheses?

I tried the statement,

var_dump($row[3];

And I got in the output:

NULL

Also tried

var_dump();

And I got in the output:

Warning: Wrong parameter count for var_dump() in...

I reread the PHP manual for var_dump. I still don't see where it goes in 
the PHP script or how to implement it.


Cheers --- Phil

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



Re: [PHP] Change styling depending on var value

2009-11-20 Thread Phil Matt

Ashley Sheridan wrote:


put

var_dump($row);

I inserted this line in the script at the end of the html table, still 
inside the PHP echo statement.


This yields:

bool(false)

Cheers --- Phil

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



[PHP] preg_match_all question

2009-01-16 Thread Phil Ewington - iModel Ltd.

Hi All,

Having an issue with regular expressions, never been my strong point!

The following pattern only picks up one instance per line, if more than 
one instance exists all text from first {{ to last }} is included, can 
anyone point out where I am going wrong?


preg_match_all(/\{\{lang:(.*)\}\}/, $str, $tags);

Here is an example of what needs to be processed

ullispan{{lang:PA1Feature1}}/span/lilispan{{lang:PA1Feature2}}/span/li/ul
ullispan{{lang:PA2Feature1}}/span/lilispan{{lang:PA2Feature2}}/span/li/ul

TIA

Phil.

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



Re: [PHP] preg_match_all question

2009-01-16 Thread Phil Ewington - iModel Ltd.

Robert Cummings wrote:

On Fri, 2009-01-16 at 09:42 +, Phil Ewington - iModel Ltd. wrote:
  

Hi All,

Having an issue with regular expressions, never been my strong point!

The following pattern only picks up one instance per line, if more than 
one instance exists all text from first {{ to last }} is included, can 
anyone point out where I am going wrong?


preg_match_all(/\{\{lang:(.*)\}\}/, $str, $tags);



You need the ungreedy modifier:

preg_match_all(/\{\{lang:(.*)\}\}/U, $str, $tags);

Cheers,
Rob.
  

Rob you're a star, thanks mate.

- Phil

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



[PHP] PECL JSON package

2008-12-11 Thread Phil Ewington - iModel

Hi All,

I have just installed the PECL JSON package, or at least think I have!! 
But how do I use it?? I was expecting /usr/share/pear/Services/JSON.php 
to be found on my system for include but not so. My system tells me I 
have 1.2.1 successfully installed but I cannot find any docs that tell 
me how to make use of it. I am running PHP 5.1.6 at present.


TIA

Phil.

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



Re: [PHP] PECL JSON package

2008-12-11 Thread Phil Ewington - iModel

Phil Ewington - iModel wrote:

Hi All,

I have just installed the PECL JSON package, or at least think I 
have!! But how do I use it?? I was expecting 
/usr/share/pear/Services/JSON.php to be found on my system for include 
but not so. My system tells me I have 1.2.1 successfully installed but 
I cannot find any docs that tell me how to make use of it. I am 
running PHP 5.1.6 at present.


TIA

Phil.

OK, seems I am confusing PECL and PEAR. Have now configured extension 
using phpize and enabled in php.ini.


- Phil.

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



Re: [PHP] PECL JSON package

2008-12-11 Thread Phil Ewington - iModel

Eric Butera wrote:

On Thu, Dec 11, 2008 at 5:43 AM, Phil Ewington - iModel
phil.ewing...@i-model.co.uk wrote:
  

Phil Ewington - iModel wrote:


Hi All,

I have just installed the PECL JSON package, or at least think I have!!
But how do I use it?? I was expecting /usr/share/pear/Services/JSON.php to
be found on my system for include but not so. My system tells me I have
1.2.1 successfully installed but I cannot find any docs that tell me how to
make use of it. I am running PHP 5.1.6 at present.

TIA

Phil.

  

OK, seems I am confusing PECL and PEAR. Have now configured extension using
phpize and enabled in php.ini.

- Phil.

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





If you're using the pecl version, it is json_encode().

If you're using the pear version you say
require_once 'Services/JSON.php';
$json = new Services_JSON();
$output = $json-encode($value);

If you're using php5, you should have json in the build unless it was
disabled for some reason.  If you're going to be using it a lot,
you're really going to want the speed of the c version.

  
Yeah thanks. I am using the PECL version and have it compiled as an 
extension now working fine, just got confused with installing PEAR 
scripts. I have PHP 5.1.6, JSON only available in build from 5.2.0 I 
believe.


- Phil.


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



[PHP] I know this is not easy and I'm not stupid but...

2007-08-09 Thread Phil Curry
how can this be? This is not the first time I've run into a situation  
like this. What am I missing?


line 102echo  ($userValues['afterDark']); // outputs 1

line 103if ( $userValues['afterDark'] == 0 ) {// passes


Thanks.
-Phil

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



Re: [PHP] I know this is not easy and I'm not stupid but...

2007-08-09 Thread Phil Curry

Please include the list when replying.

Phil Curry wrote:

Phil Curry wrote:
how can this be? This is not the first time I've run into a  
situation like this. What am I missing?
line 102echo  ($userValues['afterDark']); //  
outputs 1

line 103if ( $userValues['afterDark'] == 0 ) {// passes


Add a line at 102.5...

var_dump($userValues['afterDark']);

What type is that variable?

Don't have to do a dump, I know its a tinyint(1), not null, default 0


That would be the type in the database, not the type of that  
variable at that time.


-Stut

--
http://stut.net/


Absolutely right. didn't think of that.

var_dump($userValues['afterDark']);  == string(1) 1

but then I'm comparing a string to an int and the result always seems  
to pass. So does that mean any string compared to any int will be true?
By casting (int)$userValues['afterDark'] the test still passes and  
var_dump shows the (int)$userValues['afterDark'] as an int(1) but  
does give a value like the previous example.
ie. string(1)1 but only int(1) Not sure if the expression has a  
value of 1 now that its been cast.


Then finally  if ( (int)$userValues['afterDark'] === 0 ) {//  
passes


So:
if ( $userValues['afterDark'] == 0 ) {  // passes
if ( (int)$userValues['afterDark'] == 0 ) {   // passes
if ( (int)$userValues['afterDark'] === 0 ) { // passes

And the value of afterdark in the mysql table is tinyint(1) 1.
And echo( 1+(int)$userValues['afterDark']);// outputs 2

Now I'm confused!
-Phil

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



[PHP] magic quotes

2007-07-17 Thread Phil Princely

Hi all,

I've been having a problem with a setting on a test server and
production server. My test server has magic_quotes_gpc off, but the
production server has it turned on. I've no access to the php.ini for
the production server and don't want to change the setting on my test
server.

Searching on the internet, I found some ways to deal with this kind of thing:

use a .htaccess file to turn magic_quotes off by saving a text file
with the line:

magic_quotes_gpc off

Or making a function to strip slashes like this:

if (magic_quote_gpc()) {
stripslashes_array($_GET);
stripslashes_array($_POST);
stripslashes_array($_REQUEST);
stripslashes_array($_COOKIE);
}

What do people on this list usually do with this kind of problem. To
me, the .htaccess seems the easiest solution, since I don't have to
change any scripts.

cheers

Phil P.

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



[PHP] ftp_get() problem

2007-06-22 Thread Phil Curry
New to php and this list. Googled a lot and scoured newsgroups to no  
avail. So now I'm here looking for an answer. Here's my offending line:


 $gotFile = ftp_get( $connection, $destination, $source,  
FTP_BINARY );


Just prior to execution all parameters have valid values. The  
following error is reported:


 Warning: ftp_get() [function.ftp-get]: Error opening  
iPhoneRingTone.mp3 in /Users/b1ueskyz/Sites/pmcRoutines.php on line 91


Using the same parameters I am able to successfully ftp_put(),  
ftp_rename(), and ftp_delete()the file. I just can't 'get' it.



Any help or direction is greatly appreciated.
-Phil Curry

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



[PHP] ftp_get() Pt2

2007-06-22 Thread Phil Curry

Oops. Forgot to mention

If I use an ftp client of ftp from the command line, I can 'get' the  
file.  This is why I thought it was my code.


Thanks.
-Phil

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



[PHP] strtotime returns 00:00 for 7am

2007-06-20 Thread Phil Princely

Hi all
I'm new to this list. I hope this hasn't been discussed already.

using this code:

function test_time($time_string) {
   echo strftime(%X %A, %b %e\n, strtotime($time_string));
}

test_time('now');
test_time('4pm + 2 Hours');
test_time('now + 2 fortnights');
test_time('last Monday');
test_time('tomorrow');
test_time('5am tomorrow');
test_time('7am 12 days ago');

gives this output:

21:46:18 Wednesday, Jun 20

18:00:00 Wednesday, Jun 20

21:46:18 Wednesday, Jul 18

00:00:00 Monday, Jun 18

00:00:00 Thursday, Jun 21

00:00:00 Thursday, Jun 21

07:00:00 Friday, Jun  8


I'm wondering why the 2nd and 3rd last both give 00:00 as the
time. Especially why 5am tomorrow doesn't work. Using PHP5.


Thanks


Phil P.


Re: [PHP] Monitoring Remote Server Services using php !

2006-05-30 Thread Phil Martin

I did the following, I've followed your advice and wrote my own, that is
listed below. It's a function that has 3 entry arguments, IP, Port and
Protocol. It returns if the Service is UP or DOWN. Take a Look, and see if
we can enhance it's speed.


function servstatus($remote_ip, $remote_ip_port, $remote_ip_proto) {

if ($remote_ip_proto == tcp) {
   $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);

   // Turning off Warning Messages
   $i_error_old=error_reporting();
   error_reporting($i_error_old  ~ (E_WARNING));

   if ($connect = socket_connect($socket, $remote_ip,  .
$remote_ip_port . )) {
   return true;
   socket_set_block($socket);
   socket_close($socket);
   unset($connect);
   } else {
   return false;
   socket_set_nonblock($socket);
   socket_close($socket);
   unset($connect);}

} else {

   // Turning off Warning Messages
   $i_error_old=error_reporting();
   error_reporting($i_error_old  ~ (E_WARNING));

   $socket = fsockopen(udp://$remote_ip, $remote_ip_port, $errno,
$errstr, 2);
   $timeout = 1;

   if (!$socket) {
   return true;
   }

   socket_set_timeout ($socket, $timeout);
   $write = fwrite($socket,\x00);
   if (!$write) {
   return true;
   }

   $startTime = time();
   $header = fread($socket, 1);
   $endTime = time();
   $timeDiff = $endTime - $startTime;

   if ($timeDiff = $timeout) {
   fclose($socket);
   return true;
   } else {
   fclose($socket);
   return false;
   }
   }
}


On 5/25/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:




On Thu, 25 May 2006, Phil Martin wrote:

 Hi everybody,

 I'm new to the list and also new to php, I hope I can learn many
 things from here.
 My first doubt is the following: I'm trying to create a small
monitor
 system, just to suit my needs in monitoring some services in my
application.
 I've found some functions that return to me the service by port, name
and so
 on (getservbyport, getservbyname). What I need is to monitor remote
server
 services, I mean, lets suppose I have a server 192.168.0.2 with a ssh
server
 running. I'd like to see the status (up/down) of that server from
another
 machine, like 192.168.0.1. I don't want to use some monitoring softwares
out
 there in the web, i know they exist and in fact I use many of them like
 nagios, cacti and so on, but I'm planning to do my own small solution.
What I need is some function that asks me a remote IP, port and
 protocol as input data and results TRUE/FALSE (any boolean value), just
to
 see if the service is up. I did that making a function using nmap, but i
 don't want to hold that solution to linux, I'd like to use it at other
OS.
 My function's syntax is like this

 ?php
 $ssh_status=service_status (192.168.0.2, 22, tcp);
 if ($ssh_status==TRUE); {
 echo Service UP;
 } else {
 echo Service DOWN;
}
 ?


  Does anyone know if there is a similar function in PHP ? I'd be very
 happy if somebody knows about a function like that.

 Thanks in advance

 att.
 Felipe Martins



Why not use php and curl and write your own. Good way to start learning
php. Or you can do like we do and use php and curl to make sure you can
actually get results from the server and use a shell script or php script
on each remote server running from cron every 10/.. minutes that checks
the processes you want monitored and sends an email to a pager if it
detects a problem. That would allow you to not only monitor if a service
is running but also server load, file systems filing up, etc.



[PHP] Executing functions or scripts in parallel

2006-05-30 Thread Phil Martin

Hi everyone,

 I've made a very basic and small function to suit my needs in
monitoring some hosts services. I've noticed that the script is a little bit
slow because of the number of hosts and services to monitor. Is there a way
to execute my function servstatus();  in parallel with every hosts to
increase the speed ?
 Thanks in advance.

[]'s
Felipe Martins


[PHP] Executing functions or scripts in parallel

2006-05-30 Thread Phil Martin

Hi everyone,

 I've made a very basic and small function to suit my needs in
monitoring some hosts services. I've noticed that the script is a little bit
slow because of the number of hosts and services to monitor. Is there a way
to execute my function servstatus();  in parallel with every hosts to
increase the speed ?
 Thanks in advance.

[]'s
Felipe Martins


Re: [PHP] Executing functions or scripts in parallel

2006-05-30 Thread Phil Martin

Sure, sorry about that. I have a function that tells me if the host is DOWN
or UP. I want to run this function in parallel for each host I monitor. The
function is the following:

function servstatus($remote_ip, $remote_ip_port, $remote_ip_proto) {

if ($remote_ip_proto == tcp) {
   $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);

   // Turning Off Warning Messages
   $i_error_old=error_reporting();
   error_reporting($i_error_old  ~ (E_WARNING));

   if ($connect = socket_connect($socket, $remote_ip,  .
$remote_ip_port . )) {
   return true;
   socket_set_block($socket);
   socket_close($socket);
   unset($connect);
   } else {
   return false;
   socket_set_nonblock($socket);
   socket_close($socket);
   unset($connect);}

} else {

   // Turning off Warning Messages
   $i_error_old=error_reporting();
   error_reporting($i_error_old  ~ (E_WARNING));

   $socket = fsockopen(udp://$remote_ip, $remote_ip_port, $errno,
$errstr, 2);
   $timeout = 1;

   if (!$socket) {
   return true;
   }

   socket_set_timeout ($socket, $timeout);
   $write = fwrite($socket,\x00);
   if (!$write) {
   return true;
   }

   $startTime = time();
   $header = fread($socket, 1);
   $endTime = time();
   $timeDiff = $endTime - $startTime;

   if ($timeDiff = $timeout) {
   fclose($socket);
   return true;
   } else {
   fclose($socket);
   return false;
   }
   }
}


Thanks in advance

Felipe Martins

On 5/30/06, Dave Goodchild [EMAIL PROTECTED] wrote:




On 30/05/06, Phil Martin [EMAIL PROTECTED] wrote:

 Hi everyone,

   I've made a very basic and small function to suit my needs in
 monitoring some hosts services. I've noticed that the script is a little
 bit
 slow because of the number of hosts and services to monitor. Is there a
 way
 to execute my function servstatus();  in parallel with every hosts to
 increase the speed ?
   Thanks in advance.

 []'s
 Felipe Martins


Can you show us the function?

--
http://www.web-buddha.co.uk

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!



Re: [PHP] Executing functions or scripts in parallel

2006-05-30 Thread Phil Martin

Many parts of this script were found at the following site:
http://www.sitepoint.com/article/udp-portscanning-php

This script isn't totally mine. I've just adapted it to my needs and it is
working quite well, telling me when a service is up or down ... read the
article for further details.

Anyway, my question was about concurrent script running. My script is
working the way I needed it to and all I need now is a way to fasten it. I
still think it's a little bit slow by many aspects, maybe because I'm not a
programmer and I've written a code that is not so good or fast, or there is
no way to have all my servers services checked in parallel.


Thanks in advance.

Felipe Martins

On 5/30/06, Jochem Maas [EMAIL PROTECTED] wrote:


Phil Martin wrote:
 Sure, sorry about that. I have a function that tells me if the host is
DOWN
 or UP. I want to run this function in parallel for each host I monitor.
The
 function is the following:

 function servstatus($remote_ip, $remote_ip_port, $remote_ip_proto) {

 if ($remote_ip_proto == tcp) {
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);

// Turning Off Warning Messages
$i_error_old=error_reporting();
error_reporting($i_error_old  ~ (E_WARNING));

if ($connect = socket_connect($socket, $remote_ip,  .
 $remote_ip_port . )) {
return true;

the following 3 statements will never be run.

socket_set_block($socket);
socket_close($socket);
unset($connect);
} else {
return false;

the following 3 statements will never be run.

socket_set_nonblock($socket);
socket_close($socket);
unset($connect);}

my guess is you know even less about sockets, especially
blocking/non-blocking
than I do!


 } else {

why are you making the distinction between udp and tcp in this way?


// Turning off Warning Messages
$i_error_old=error_reporting();
error_reporting($i_error_old  ~ (E_WARNING));

$socket = fsockopen(udp://$remote_ip, $remote_ip_port,
$errno,
 $errstr, 2);
$timeout = 1;

if (!$socket) {

if you don't get the socket why does that mean the service is up?

return true;
}

socket_set_timeout ($socket, $timeout);
$write = fwrite($socket,\x00);
if (!$write) {

again if you can't write why does that mean the service is up?

return true;
}

$startTime = time();
$header = fread($socket, 1);
$endTime = time();
$timeDiff = $endTime - $startTime;

if ($timeDiff = $timeout) {

why does a time measurement mean the service is up?

fclose($socket);
return true;
} else {
fclose($socket);
return false;
}
}
 }


 Thanks in advance

 Felipe Martins

 On 5/30/06, Dave Goodchild [EMAIL PROTECTED] wrote:




 On 30/05/06, Phil Martin [EMAIL PROTECTED] wrote:
 
  Hi everyone,
 
I've made a very basic and small function to suit my needs in
  monitoring some hosts services. I've noticed that the script is a
 little
  bit
  slow because of the number of hosts and services to monitor. Is there
a
  way
  to execute my function servstatus();  in parallel with every hosts to
  increase the speed ?
Thanks in advance.
 
  []'s
  Felipe Martins
 
 
 Can you show us the function?

 --
 http://www.web-buddha.co.uk

 dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml,
css)

 look out for project karma, our new venture, coming soon!






[PHP] Monitoring Remote Server Services using php !!!

2006-05-25 Thread Phil Martin

Hi everybody,

 I'm new to the list and also new to php, I hope I can learn many
things from here.
 My first doubt is the following: I'm trying to create a small monitor
system, just to suit my needs in monitoring some services in my application.
I've found some functions that return to me the service by port, name and so
on (getservbyport, getservbyname). What I need is to monitor remote server
services, I mean, lets suppose I have a server 192.168.0.2 with a ssh server
running. I'd like to see the status (up/down) of that server from another
machine, like 192.168.0.1. I don't want to use some monitoring softwares out
there in the web, i know they exist and in fact I use many of them like
nagios, cacti and so on, but I'm planning to do my own small solution.
What I need is some function that asks me a remote IP, port and
protocol as input data and results TRUE/FALSE (any boolean value), just to
see if the service is up. I did that making a function using nmap, but i
don't want to hold that solution to linux, I'd like to use it at other OS.
My function's syntax is like this

?php
$ssh_status=service_status (192.168.0.2, 22, tcp);
if ($ssh_status==TRUE); {
echo Service UP;
} else {
echo Service DOWN;
}
?


  Does anyone know if there is a similar function in PHP ? I'd be very
happy if somebody knows about a function like that.

Thanks in advance

att.
Felipe Martins


[PHP] xslt_process() error

2005-05-04 Thread Phil Ewington - 43 Plc
Hi Guys,

I am trying to replicate a ColdFusion custom tag I wrote for transforming an
XML doc with XSLT and having major problems. When I use xslt_process() I get
the following error:

Warning: Sablotron error on line 1: XML parser error 4: not well-formed
(invalid token) in

The XML  XSL files all display correctly in browsers and it all works with
CF, what can the problem be? I have read articles about a bug in the
Sablotron libraries so the XSL file must not have any headers, this makes no
difference. Can anyone help?

Thanks in advance,


---
Phil Ewington

43 Plc - Ashdale House
35 Broad Street, Wokingham
Berkshire RG40 1AU

T: +44 (0)1189 789 500
F: +44 (0)1189 784 994
E: mailto:[EMAIL PROTECTED]
W: www.soyouthink.com



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.2 - Release Date: 02/05/2005

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



[PHP] FW: xslt_process() error

2005-05-04 Thread Phil Ewington - 43 Plc
Hi All,

I am trying to replicate a ColdFusion custom tag I wrote for transforming an
XML doc with XSLT and having major problems. When I use xslt_process() I get
the following error:

Warning: Sablotron error on line 1: XML parser error 4: not well-formed
(invalid token) in

The XML  XSL files all display correctly in browsers and it all works with
CF, what can the problem be? I have read articles about a bug in the
Sablotron libraries so the XSL file must not have any headers, this makes no
difference. Can anyone help?

Thanks in advance,


---
Phil Ewington

43 Plc - Ashdale House
35 Broad Street, Wokingham
Berkshire RG40 1AU

T: +44 (0)1189 789 500
F: +44 (0)1189 784 994
E: mailto:[EMAIL PROTECTED]
W: www.soyouthink.com


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.3 - Release Date: 03/05/2005

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



[PHP] Best Server OS

2005-03-28 Thread Phil Neeb
I'm lookin for some opinions on this one ...
What do you think the best OS is for running a server with PHP and 
MySQL?  If you're going to say Linux, please, which Linux OS, there are 
so many.

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


[PHP] Remove rows from a MySQL table?

2005-03-24 Thread Phil Neeb
Is it possible to remove a row(s) from a MySQL table? I looked through 
the PHP manual and didn't see anything about it.

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


Re: [PHP] Remove rows from a MySQL table?

2005-03-24 Thread Phil Neeb
John Nichel wrote:
Phil Neeb wrote:
Is it possible to remove a row(s) from a MySQL table? I looked through 
the PHP manual and didn't see anything about it.

Call me crazy, but the MySQL manual _might_ have something about it.
Oh c'mon, you expect me to go look at a second website? That'd require 
effort! Thanks though.

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


[PHP] PHP Classes

2005-03-16 Thread Phil Neeb
Greets,
I've gone through the PHP Manual a few times now, reading about classes, 
but really, what's written there doesn't make a whole lot of sense to 
me.  I know a lot, if not the vast majority, of PHP programmers use 
classes, so I was wondering if some of you could explain them to me. 
What are the benefits of using classes? What's the format of a class? 
I'd like to know things like that and anything else you folks would like 
to teach me. Thanks

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


[PHP] PHP file as homepage?

2005-03-15 Thread Phil Neeb
I've noticed that PHP.net uses index.php as its homepage and well, I'm 
curious as to how that's possible.  Is it the server setup that allows 
them to load a php file as their homepage or something else?

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


[PHP] Array Help

2005-03-14 Thread Phil Neeb
Greets,
I'm running into the problem of not having a server that gives me database 
access or ability to use files to store my data ... Yeah, I know, it sucks. 
Anyway ... My page has a number of profiles about people involved with my 
organization and all the profiles load into a set appearance.  I have all 
the information about each person stored in individual arrays (if there's an 
easier way to do this w/o database or files, I'd love to hear it) ... 
anyway, I pass a variable through the URL which causes the array info to 
load, but I use an if statement for EVERYONE which makes my work way too 
tedious ... The variable I pass is the same value as the name each person's 
array (the variable is stored in the link) so, I'm curious if there's a way 
I can use the variable as the array name and cut out those tons of if 
statements. 

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



RE: [PHP] reading/writing files outside of web root

2005-02-17 Thread Phil Ewington - 43 Plc
 Jason Wong wrote:
  On Wednesday 09 February 2005 02:31, Richard Lynch wrote:
  Phil Ewington - 43 Plc wrote:
   For some reason user_prefs will not open
   for read/write even when I tested it under apache.apache and chmod'd
   to 755,
   perhaps because /home is owned by root?
 
  Something went wrong with this test.
 
  You SHOULD have been able to read/write that file in PHP, assuming
  'apache' is the user PHP runs as.  Use http://php.net/phpinfo to
  confirm that it really *IS* 'apache' user that's running apache/php.
 
  It *will* fail if apache has no access to $HOME!

 I stand corrected.

 In addition to read/write access to the file itself, Apache must have at
 least eXecute (directory listing) permission to the directory containing
 that file.

 /home being owned by root is not the issue -- But if it's not something
 the apahce user can 'ls /home' and get the contents of, then you've got a
 problem.

Thanks for all the input guys. The cron job suggestion is a great idea and I
will go with this over using sudo. Thanks again.

- Phil Ewington.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.8 - Release Date: 14/02/2005

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



[PHP] reading/writing files outside of web root

2005-02-08 Thread Phil Ewington - 43 Plc
Hi All,

I am revisiting a previous question posted here as after lots of
investigation and code testing I cannot get what I want.

I want to use PHP to read/write files that are outside of the web root and
not owned by apache. To be specific...

$HOME/.procmailrc
$HOME/.spamassassin/user_prefs

.procmailrc must be owned by root.root and chmod'd to 600 or is does not
work, user_prefs can be owned by anyone, it does not seem to care who or
what the permissions are. The first problem is .procmailrc, someone on this
list suggested to use chown/chmod in PHP to change the file so it can be
read/written to by PHP, this I soon realized was not an option as the file
owned by root cannot be changed. For some reason user_prefs will not open
for read/write even when I tested it under apache.apache and chmod'd to 755,
perhaps because /home is owned by root?

So my question is can I easily/safely edit files outside of the web root
using PHP or is there a 3rd party command line tool to do this?


TIA


---
Phil Ewington

43 Plc - Ashdale House
35 Broad Street, Wokingham
Berkshire RG40 1AU

T: +44 (0)1189 789 500
F: +44 (0)1189 784 994
E: mailto:[EMAIL PROTECTED]
W: www.soyouthink.com



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.6 - Release Date: 07/02/2005

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



[PHP] Permissions

2004-11-19 Thread Phil Ewington - 43 Plc
Hi All,

I have a need for a PHP application to read/write Linux system files that
have root.root ownership. At present reading not a problem but writing
obviously is denied. I know there are probably some serious security issues
here, but what should I be doing to allow this behaviour. I am running PHP
4.3.8 on Linux Redhat Fedora 1 installed as an Apache module.

TIA

---
Phil Ewington

43 Plc - Ashdale House
35 Broad Street, Wokingham
Berkshire RG40 1AU

T: +44 (0)1189 789 500
F: +44 (0)1189 784 994
E: mailto:[EMAIL PROTECTED]
W: www.soyouthink.com



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.797 / Virus Database: 541 - Release Date: 15/11/2004

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



[PHP] WDDX functions not working!!

2004-10-08 Thread Phil Ewington - 43 Plc
Hi All,

I have been running 4.3.4 on a Cobalt RaQ 4 for some months and have been
using the WDDX functions with great effect. I have recently moved all our
sites to a new server (Linux RedHat ES 3 running PHP 4.3.6) and found that
the WDDX functions do not work! No errors just nothing happens. I checked
the phpinfo and it clearly shows that wddx is enabled (as I would expect
with the --enable-wddx configure option). I have found this to be the case
for 4.3.6, 4.3.8  4.3.9. What's going on??

$wddx_string = wddx_deserialize($wddx_packet);

This should generate an array but does not! Has anyone else found this? What
version does it work on? Installing PHP 5 is not an option at the moment as
all our classes would need re-writing to conform to the new standards.


TIA

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

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



[PHP] SOLVED Re: [PHP] Strange PHP problem with mod_perl and MySQL

2004-08-06 Thread Phil Stracchino
On Fri, Aug 06, 2004 at 02:33:28PM -0400, Justin Hannus wrote:
 Please include the list when replying to posts...

Sorry.  You replied to me off-list, so I did the same.

Reinstalling DBD::mysql did indeed solve the problem.  I now know that
whenever I update MySQL, I need to also reinstall both PHP and
DBD::mysql.

Thanks for the pointer.

 
 -Justin
 
 - Original Message -
 From: Phil Stracchino [EMAIL PROTECTED]
 To: Justin Hannus [EMAIL PROTECTED]
 Sent: Friday, August 06, 2004 2:23 PM
 Subject: Re: [PHP] Strange PHP problem with mod_perl and MySQL
 
 
  On Fri, Aug 06, 2004 at 10:06:31AM -0400, Justin Hannus wrote:
   Make sure that your php and DBD::MySQL were compiled against the *same
   exact* library. Apache loads in mod_php and mod_perl on startup and if
 they
   in turn both load two separate libmysqlclient libs then you will get
   multiple defined symbols--which Apache cannot resolve.
 
  Hmm.  DBD::MySQL was updated recently enough that they SHOULD have been
  compiled against the same version.  Just in case, I will try
  re-installing DBD::MySQL right now and see if that has an effect.
 
 
  --
== Fight Back!  It may not be just YOUR life at risk. ==
[EMAIL PROTECTED] : [EMAIL PROTECTED] : [EMAIL PROTECTED]
 phil stracchino : unix ronin : renaissance man : mystic zen biker geek
   2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)
 Linux Now!  ...Friends don't let friends use Microsoft.
 
 

-- 
  == Fight Back!  It may not be just YOUR life at risk. ==
  [EMAIL PROTECTED] : [EMAIL PROTECTED] : [EMAIL PROTECTED]
   phil stracchino : unix ronin : renaissance man : mystic zen biker geek
 2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)
   Linux Now!  ...Friends don't let friends use Microsoft.

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



[PHP] Strange PHP problem with mod_perl and MySQL

2004-08-05 Thread Phil Stracchino
I have a strange PHP problem.


I'm running Apache-1.3.28, with mod_perl-1.29, mod_ssl-2.8.15, and PHP4,
on a Slackware-based custom Linux installation.  Up until today, I was
running php-4.3.3, configured as follows:

./configure --with-mysql=/opt/mysql
--with-db4=/usr/local/BerkeleyDB.4.1/ --with-apxs=/usr/sbin/apxs
--with-gnu-ld --with-bz2 --with-zlib --with-readline
--with-jpeg-dir=/usr --with-png-dir=/usr --with-tiff=/usr
--with-xpm-dir=/usr/X11R6 --enable-sockets --enable-bcmath

I also have a number of mod_perl registry-object CGIs which use
DBD::MySQL to access a number of different local databases.  Up until
today, these CGIs were all working perfectly.


Today, I installed a PHP application which requires GD support.  I
therefore needed to recompile and reinstall PHP adding --with-gd to the
above.  So long as I was recompiling PHP anyway, I figured I should
update to the latest version, so I downloaded php-4.3.8 and configured
it as follows:

./configure --with-mysql=/opt/mysql
--with-db4=/usr/local/BerkeleyDB.4.1/ --with-apxs=/usr/sbin/apxs
--with-gnu-ld --with-bz2 --with-zlib --with-readline --with-gd
--with-jpeg-dir=/usr --with-png-dir=/usr --with-tiff=/usr
--with-xpm-dir=/usr/X11R6 --enable-sockets --enable-bcmath

Note that the only change is the addition of --with-gd.  After
installing php-4.3.8 and restarting Apache, all of the mod_perl registry
CGIs are dying at various points with SEGVs.  Each one dies in a
consistent way at a consistent point every time, but I can find nothing
in common with how or where they die.  If I disable mod_php4 and restart
Apache, they work perfectly again.  None of the affected CGIs uses any
PHP code.

I have tried recompiling 4.3.8 without GD support to see if the problem
is related to that, but has no effect.  I have also tried reinstalling
4.3.3, both with and without GD support.  The behavior does not change
in the slightest.  However PHP4 is compiled, if mod_php4 is not loaded,
the registry CGIs all work; if it is loaded, they all die.



Can anyone shed any light on this, and ideally tell me how I can make
mod_perl and mod_php4 work together again, as they were up until today?



-- 
  == Fight Back!  It may not be just YOUR life at risk. ==
  [EMAIL PROTECTED] : [EMAIL PROTECTED] : [EMAIL PROTECTED]
   phil stracchino : unix ronin : renaissance man : mystic zen biker geek
 2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)
   Linux Now!  ...Friends don't let friends use Microsoft.

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



Re: [PHP] Strange PHP problem with mod_perl and MySQL

2004-08-05 Thread Phil Stracchino
On Fri, Aug 06, 2004 at 12:32:19AM -0400, Phil Stracchino wrote:
 Note that the only change is the addition of --with-gd.  After
 installing php-4.3.8 and restarting Apache, all of the mod_perl registry
 CGIs are dying at various points with SEGVs.  Each one dies in a
 consistent way at a consistent point every time, but I can find nothing
 in common with how or where they die.  If I disable mod_php4 and restart
 Apache, they work perfectly again.  None of the affected CGIs uses any
 PHP code.


Oh, one minor addition to this: There is one registry CGI that does not
crash with mod_php4 enabled.  It is much simpler than the others, and
unlike the others, does not use DBD::MySQL.  Another standalone CGI that
I have not yet converted to a mod_perl registry object, which *does* use
DBD::MySQL and which is much more complex than any of the other CGIs,
works just fine.


-- 
  == Fight Back!  It may not be just YOUR life at risk. ==
  [EMAIL PROTECTED] : [EMAIL PROTECTED] : [EMAIL PROTECTED]
   phil stracchino : unix ronin : renaissance man : mystic zen biker geek
 2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)
   Linux Now!  ...Friends don't let friends use Microsoft.

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



[PHP] PHP Bespoke Email Solutions

2004-07-20 Thread Phil Ewington - 43 Plc
Hi All,

I have been using a Windows platform for generating and sending bespoke
emails from .csv format lists but have had to swap to a Linux solution. We
are using Postfix instead of Visnetic as our mail server but need a
replacement for our email generation software (WorldMerge).

Does anyone know of any PHP scripts that will generate emails from a
database of email addresses and an HTML template with bespoke content I.E
greetings, unsubscribe email address links, etc... and send to an SMTP
server?

TIA

Phil Ewington.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.725 / Virus Database: 480 - Release Date: 19/07/2004

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



[PHP] Got a problem with Slashes on my CMS

2004-07-09 Thread Phil Mellor
Hello world!

Please help! I have a CMS built which I have a problem with and I don't know
if it's a coding error or a bug, but any suggestions would be welcome!

My CMS pulls information from MySQL database with slashes. On one particular
content module I have a problem! I'm trying to 'require' a module stored on
disk, sometimes it works and othertimes it produces the following error:

Parse error: parse error, expecting `','' or `';'' in
/home/sites/site8/web/cmp/generatePage.php(565) : eval()'d code on line 45

If I echo the statement which is supposed to be eval'ed and compare it to
when it works, the only difference is that the working one includes slashes
(this makes sense as I'm stripping slashes from the DB result to make it
work!).

Anyone got any idea how I work around this issue? I can't add or
stripslashes from the file on disk, because then it fails because of the
same intermittant error!

Thanks in advance,
Phil Mellor

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



[PHP] Scheduling a PHP script

2004-06-14 Thread Phil Ewington - 43 Plc
Hi All,

I have a PHP script that I need to call from both web browsers  from a
crontab but whichever route I choose I hit a problem. Here are the options I
have tried along with problems encountered...


PHP
-
/usr/bin/php /home/sites/home/web/schedules/index.php arg1 arg2 arg3

After resolving include path issues using ini_set() I get... Call to
undefined function:  mysql_connect().
I assume that all mysql functions are unavailable??

curl
-
/usr/bin/curl -u username:password
http://www.domain.com/script.php?arg1=aarg2=barg3=c

This gives me a PHP error... Undefined index: arg2
Only the first argument is available

wget
-
/usr/bin/wget --http-user=username --http-passwd=password
http://www.domain.com/script.php?arg1=aarg2=barg3=c

This does not give an error but gives a message...
`index.php?fuseaction=NewMembers.1' saved [557]
Again it looks like query string is ignored. The database changes and email
report that are supposed to occur on successful execution are unavailable!

lynx
-
/usr/bin/lynx -dump -auth=username:password
http://www.domain.com/script.php?arg1=aarg2=barg3=c

This gives me a PHP error... Undefined index: arg2
Only the first argument is available again!

Any ideas anyone?

TIA

- Phil.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.705 / Virus Database: 461 - Release Date: 12/06/2004

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



RE: [PHP] Scheduling a PHP script

2004-06-14 Thread Phil Ewington - 43 Plc
 On Mon, 14 Jun 2004 12:10:30 +0100
 Phil Ewington - 43 Plc [EMAIL PROTECTED] wrote:
 
  PHP
  -
  /usr/bin/php /home/sites/home/web/schedules/index.php arg1 arg2 arg3
 
  After resolving include path issues using ini_set() I get... Call to
  undefined function:  mysql_connect().
  I assume that all mysql functions are unavailable??
 
 Is your commandline php executable compiled --with-mysql ?

My PHP installation (4.3.6) was configured with: with-mysql=shared

 
  curl
  -
  /usr/bin/curl -u username:password
  http://www.domain.com/script.php?arg1=aarg2=barg3=c
 
 When issuing commands through bash (or alike) you need to 
 surround the string
 with double-quotes (), because  is a bash-operator, meaning put into
 background. With the command above you will execute /usr/bin/curl -u
 username:password http://www.domain.com/script.php?arg1=a; in the 
 background,
 arg2=b in the background, and arg3=c in the foreground ;)

That worked a treat! Thanks.

 
 The correct command is:
 /usr/bin/curl -u username:password
 http://www.domain.com/script.php?arg1=aarg2=barg3=c;
 
 This also applies to wget, lynx and all other commandline tools 
 you can imagine
 ;-)
 
 -- 
 Dennis Freise [EMAIL PROTECTED]
 GnuPG key: 2DE8 CCEF 6E20 11D4 3B27  21EC B0BA 1749 D2C8 38ED
 Available at: http://www.final-frontier.ath.cx/?key-plain
 
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.705 / Virus Database: 461 - Release Date: 12/06/2004

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



[PHP] Changing the directory that PHP runs from (CLI)

2004-06-11 Thread Phil Ewington - 43 Plc
Hi All,

I have read the manual page for 'Using PHP from the command line' thoroughly
and cannot find the answer to my problem. I have a script that needs to be
accessed from both the command line and from web browsers. I tested the
script from the command line and all worked well. As soon as I set the
script to run from the crontab, all my includes fail because of paths. I
believe the manual tries to cover forcing PHP to run from an alternative
location but makes no sense to me. Can anyone tell me what changes I need to
make to the following crontab entry...

0 23 * * * /usr/bin/php /path/to/my/script.php arg1 arg2 arg3  /dev/null

TIA

- Phil.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

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



RE: [PHP] Re: Changing the directory that PHP runs from (CLI)

2004-06-11 Thread Phil Ewington - 43 Plc
Justin,

I think I will go for the ini_set() option, seems to be the best bet to not
affect anything else. Thanks.

- Phil.

 -Original Message-
 From: Justin Patrin [mailto:[EMAIL PROTECTED]
 Sent: 11 June 2004 15:42
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Changing the directory that PHP runs from (CLI)


 Phil Ewington - 43 Plc wrote:

  Hi All,
 
  I have read the manual page for 'Using PHP from the command
 line' thoroughly
  and cannot find the answer to my problem. I have a script that
 needs to be
  accessed from both the command line and from web browsers. I tested the
  script from the command line and all worked well. As soon as I set the
  script to run from the crontab, all my includes fail because of paths. I
  believe the manual tries to cover forcing PHP to run from an alternative
  location but makes no sense to me. Can anyone tell me what
 changes I need to
  make to the following crontab entry...
 
  0 23 * * * /usr/bin/php /path/to/my/script.php arg1 arg2 arg3 
 /dev/null
 
  TIA
 
  - Phil.
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

 Well, you could put your includes in a central location and set the
 include_path correctly in your php.ini. If that won't work for you, you
 can use chdir(dirname(realpath(__FILE))) to change to the script's
 directory. You could also use ini_set to add whatever directory you need
 ot the script's include_path.

 --
 paperCrane Justin Patrin

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

 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

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



[PHP] Passing args to a PHP script from the command line

2004-06-10 Thread Phil Ewington - 43 Plc
Hi All,

Can anyone tell me how to pass arguments to a PHP script from the command
line? I know I need to use the -args option but how exactly, I have tried
the following...

/usr/bin/php myscript.php -args key=value

but this does not work, the script executes but key is not available as
$_GET[key] in my script. Any pointers will be much appreciated.

TIA

Phil.

---
Phil Ewington - Technical Director

43 Plc - Ashdale House
35 Broad Street, Wokingham
Berkshire RG40 1AU

T: +44 (0)1189 789 500
F: +44 (0)1189 784 994
E: mailto:[EMAIL PROTECTED]
W: www.soyouthink.com

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

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



RE: [PHP] Passing args to a PHP script from the command line

2004-06-10 Thread Phil Ewington - 43 Plc
 Phil Ewington - 43 Plc wrote on donderdag 10 juni 2004 12:58:

  Hi All,
 
  Can anyone tell me how to pass arguments to a PHP script from the
  command line? I know I need to use the -args option but how exactly,
  I have tried the following...
 
  /usr/bin/php myscript.php -args key=value

 You don't have to call the -args argument. just run the script
 from command line like this:

 php myscript.php value

 Where value is the argument you want to use in the script.
 These arguments are stored in an arrray ($argv).

 Do a print_r($argv) and you can see the content.

OK, but if no param name is passed in, I assume that the order they are
passed in as must be correct or the script will not know what values belong
to which parameters? This seems a little odd, I assume that $argv only
exists when accessed from the command line? My script needs to be excuted
from both command line and from web browsers.


 
  but this does not work, the script executes but key is not available
  as $_GET[key] in my script. Any pointers will be much appreciated.
 
  TIA
 
  Phil.
 
  ---
  Phil Ewington - Technical Director
 
  43 Plc - Ashdale House
  35 Broad Street, Wokingham
  Berkshire RG40 1AU
 
  T: +44 (0)1189 789 500
  F: +44 (0)1189 784 994
  E: mailto:[EMAIL PROTECTED]
  W: www.soyouthink.com
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

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



RE: [PHP] Passing args to a PHP script from the command line

2004-06-10 Thread Phil Ewington - 43 Plc
 Phil Ewington - 43 Plc wrote on donderdag 10 juni 2004 14:27:

  Phil Ewington - 43 Plc wrote on donderdag 10 juni 2004 12:58:
 
  Hi All,
 
  Can anyone tell me how to pass arguments to a PHP script from the
  command line? I know I need to use the -args option but how
  exactly, I have tried the following...
 
  /usr/bin/php myscript.php -args key=value
 
  You don't have to call the -args argument. just run the script from
  command line like this:
 
  php myscript.php value
 
  Where value is the argument you want to use in the script.
  These arguments are stored in an arrray ($argv).
 
  Do a print_r($argv) and you can see the content.
 
  OK, but if no param name is passed in, I assume that the order they
  are passed in as must be correct or the script will not know what
  values belong to which parameters? This seems a little odd, I assume
  that $argv only exists when accessed from the command line? My script
  needs to be excuted from both command line and from web browsers.
 

 How do you mean the order must be correct. Use some code like this to
 give it an index value.
 for ($counter=0; $counter  $argc; $counter++) {
list($key, $value) = each($argv);
echo (key . $key . has value :  . $value . \n);
 }

Your example was...

php myscript.php value

That is just a value, no parameter name as with a query string, take this
example...

php myscript.php a b

Let's say that this was requested from a browser like myscript.php?1=a2=b

PHP uses 1  2 to refer to the values, but the values would get mixed up if
I was to use...

$argv[0]  $argv[1]

and the order of a and b were different when the script was called. Does
that make sense? I find it odd that I need to write more code to 1) check
$_GET and 2) check $argv, also simple error checking will fail for command
line stuff when checking that all the required params are present.


 From what i understand the argv  argc are only avaliable when the
 script is run from commandline. Just do a check on this and if not
 there get some $_POST or $_GET variables.

 
 
  but this does not work, the script executes but key is not available
  as $_GET[key] in my script. Any pointers will be much appreciated.
 
  TIA
 
  Phil.
 
  ---
  Phil Ewington - Technical Director
 
  43 Plc - Ashdale House
  35 Broad Street, Wokingham
  Berkshire RG40 1AU
 
  T: +44 (0)1189 789 500
  F: +44 (0)1189 784 994
  E: mailto:[EMAIL PROTECTED]
  W: www.soyouthink.com
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004
 
  ---
  Incoming mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

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



RE: [PHP] Passing args to a PHP script from the command line

2004-06-10 Thread Phil Ewington - 43 Plc
 Phil Ewington - 43 Plc wrote on donderdag 10 juni 2004 15:11:

  Phil Ewington - 43 Plc wrote on donderdag 10 juni 2004 14:27:
 
  Phil Ewington - 43 Plc wrote on donderdag 10 juni 2004 12:58:
 
  Hi All,
 
  Can anyone tell me how to pass arguments to a PHP script from the
  command line? I know I need to use the -args option but how
  exactly, I have tried the following...
 
  /usr/bin/php myscript.php -args key=value
 
  You don't have to call the -args argument. just run the script
  from command line like this:
 
  php myscript.php value
 
  Where value is the argument you want to use in the script.
  These arguments are stored in an arrray ($argv).
 
  Do a print_r($argv) and you can see the content.
 
  OK, but if no param name is passed in, I assume that the order they
  are passed in as must be correct or the script will not know what
  values belong to which parameters? This seems a little odd, I assume
  that $argv only exists when accessed from the command line? My
  script needs to be excuted from both command line and from web
  browsers.
 
 
  How do you mean the order must be correct. Use some code like this
  to give it an index value. for ($counter=0; $counter  $argc;
 $counter++) { list($key, $value) = each($argv);
 echo (key . $key . has value :  . $value . \n);
  }
 
  Your example was...
 
  php myscript.php value
 
  That is just a value, no parameter name as with a query string, take
  this example...
 
  php myscript.php a b
 
  Let's say that this was requested from a browser like
  myscript.php?1=a2=b
 
  PHP uses 1  2 to refer to the values, but the values would get mixed
  up if I was to use...
 
  $argv[0]  $argv[1]
 
  and the order of a and b were different when the script was called.
  Does that make sense? I find it odd that I need to write more code to
  1) check $_GET and 2) check $argv, also simple error checking will
  fail for command line stuff when checking that all the required
  params are present.
 
 

 ic now i understand what you mean :)
 Why not just pass the arguments on commandline like this:

 php myscript.php 1=a 2=b

 and then just split on '=' to get key  value.

That will do for me! Still more coding than I would like and not how I think
it should be implemented, but hey we don't actually live in an ideal world
do we ;o)

Thanks for your help, it is much appreciated.

- Phil.

  From what i understand the argv  argc are only avaliable when the
  script is run from commandline. Just do a check on this and if not
  there get some $_POST or $_GET variables.
 
 
 
  but this does not work, the script executes but key is not
  available as $_GET[key] in my script. Any pointers will be much
  appreciated.
 
  TIA
 
  Phil.
 
  ---
  Phil Ewington - Technical Director
 
  43 Plc - Ashdale House
  35 Broad Street, Wokingham
  Berkshire RG40 1AU
 
  T: +44 (0)1189 789 500
  F: +44 (0)1189 784 994
  E: mailto:[EMAIL PROTECTED]
  W: www.soyouthink.com
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004
 
  ---
  Incoming mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004
 
  ---
  Incoming mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004
 
  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.701 / Virus Database: 458 - Release Date: 07/06/2004

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



[PHP] How to verify that data is in a blob?

2004-05-31 Thread phil
I want to verify that there is data (doesn't matter whether it's valid data or 
not) inside a MySQL blob using a PHP function.  How do I do this?

Thanks!!

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



[PHP] fsockopen() throwing errors

2004-05-28 Thread Phil Ewington - 43 Plc
Hi All,

How can I stop fsockopen() throwing an error and killing my script when it
cannot connect?

I have tried the following:

$this-_Socket = fsockopen($s_server, $this-_Port, $i_errno, $s_errstr,
$this-_Timeout);
if (!$this-_Socket)
{
... code to handle connection failure
}

and ...

if (!$this-_Socket = fsockopen($s_server, $this-_Port, $i_errno,
$s_errstr, $this-_Timeout))
{
... code to handle connection failure
}

I have also tried prefixing fsockopen() with @ but when it fails to connect
it kills my script by throwing an error. Any advise here will be much
appreciated as this code is mission critical.

TIA

- Phil.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004

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



[PHP] Parse XML

2004-05-25 Thread Phil Dowson
Hi,

I am having a couple of difficulties with a script to parse XML. This may
well be because my 16 month kid was up all night, but I'm banging my head
against a wall right now.

The script quite easily extracts one of the entries listed under DATA_2
but doesnt list the other. This is my first look into parsing XML, so I am
not sure of the terminology :-). How can I have both entries in this XML
file parsed to an array that I can use to build a table. (I just really need
the array, I can take it from there).

Thanks !

Phil

Here's my code (please let me know if I'm missing anything really simple):


== PHP CODE

?
 $data = file_get_contents('db_list.xml');
 $ret = array();
 $hash_stack = array();

 $parser = xml_parser_create();
 xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
 xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
 xml_parse_into_struct($parser,$data,$values,$tags);
 xml_parser_free($parser);


 foreach ($values as $key = $val) {

   if($val['type'] == open) {
 array_push($hash_stack, $val['tag']);
 }
   elseif($val['type'] == close) {
 array_pop($hash_stack);
 }
   elseif($val['type'] == complete) {
 array_push($hash_stack, $val['tag']);
 eval(\$ret[ . implode($hash_stack, ][) . ] =
'{$val[value]}';);
 array_pop($hash_stack);
 }

  }
print_r($ret);
?


== XML CODE


?xml version=1.0?
DATA_DB
  LIST_2
DATA_2
  DB_KEY09011234/DB_KEY
  LIST_1
G_1
  NAMEBLOGGS, JOE/NAME
   LIST_15
DATA_15
  ADDRESS15 MAIN STREET/ADDRESS
  CITY_STATEMAINLAND  WS/CITY_STATE
  ZIP9/ZIP
/DATA_15
  /LIST_15
/G_1
  /LIST_1
/DATA_2
DATA_2
  DB_KEY09011235/DB_KEY
  LIST_1
G_1
  NAMEBROOK, CURTIS/NAME
  LIST_15
DATA_15
  ADDRESS16 MAIN STREET/ADDRESS
  CITY_STATEMAINLAND  WS/CITY_STATE
  ZIP9/ZIP
/DATA_15
  /LIST_15
/G_1
  /LIST_1
/DATA_2
  /LIST_2
/DATA_DB

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



[PHP] Problem with header

2004-03-24 Thread Phil Matt
Hello to all - just joined this list to see if I can enhance my pretty slim knowledge 
of PHP.

I have a little script I cobbled together than I modified to use as a guestbook for a 
client's site. I am trying to get the script to call a success page if the mail in 
fact gets 
sent. I plan to also add a failure page if the validation routine (haven't added 
this yet) 
doesn't work.

I have been experimenting with the statement

header(Location:thanks.shtml);

But no matter where I place it in the PHP file, I get the error message that says 
Headers already sent...

To wit:
? 
include (/file with passwords and user id's in it); 
//a bunch of stuff to pull email recipient's address and id out of MySQL db
//works fine
//$enjoy, $visit, $test vars pulled from form that follows the script, no probs there
$recipient=$to_name;
$message=$enjoy.$visit.$text;
$params['sendmail_path'] = '/usr/sbin/sendmail';
if ($submit){
mail($recipient, $subject, $message, From:\$from_name\$from_email\r\n .
Reply-to: $from_email\r\n .   
X-Mailer: PHP/ . phpversion());
   }
?

So where in the world does the

header(Location:thanks.shtml);

statement go? And if I do an if/else thing on submit, where does the other statement 
go? 

header(Location:error.shtml);

TIA for any advice you can offer. I must be really missing the point here.

Cheers --- Phil Matt

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



[PHP] Re: Apache directive to expand unqualified host names?

2004-03-16 Thread Phil Frisbie, Jr.
Matt wrote:

Hello,

I am looking for an Apache directive to automatically expand an
unqualified host name in a web browser client.  Here's an example of
what I mean by this:
User, in web browser, enters (these are all hypothetical examples):

http://automobiles/trucks/

automobiles actually fully qualifies to
automobiles.transportation.com.  I want the Apache server to convert
the text entered above to the following once the browser loads the web
page:
http://automobiles.transportation.com/trucks/

I understand that one can configure an Apache server to do this,
probably with an Apache directive?  If so, which one?
Is this on an Intranet where you would resolve 'automobiles' to an IP address?

Thanks for any help,
-Matt
--
Remove the obvious text (including the dash) to email me.
--
Phil Frisbie, Jr.
Hawk Software
http://www.hawksoft.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Re: fsockopen() errors.

2004-03-09 Thread Phil Ewington - 43 Plc
Tom,

Thought about that one or simply trying to catch the error in my site wide
error handler, will give it a try, thanks.


-- Phil.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: 08 March 2004 15:53
 To: PHP
 Subject: [PHP] Re: fsockopen() errors.


 On 8 Mar 2004 Phil Ewington - 43 Plc wrote:

  Can anyone tell me the best way to avoid errors using
 fsockopen(). I have
  tried wrapping the function call in a conditional statement,
 and have also
  tried calling the function and then testing the return.

 Here's an approach I have used to avoid any error messages at all --
 presumably you could also set a flag in the error handler to indicate
 what happened, if you need that.

   .

   $olderr = error_reporting(0);
   set_error_handler(ignoreerrhandler);
   $fp = fsockopen(.)
   restore_error_handler();
   error_reporting($olderr);
   if ($fp) {
   [worked]
   } else {
   [failed]
   }
   .

   function ignoreerrhandler($errno, $errstr, $errfile, $errline) {
   return;
   }

 --
 Tom

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



[PHP] fsockopen() errors.

2004-03-08 Thread Phil Ewington - 43 Plc
Hi All,

Can anyone tell me the best way to avoid errors using fsockopen(). I have
tried wrapping the function call in a conditional statement, and have also
tried calling the function and then testing the return.

Example 1:
$sckHandle = fsockopen($server, 25, $errNo, $errString);
if ($sckHandle)
{
code here...
}


Example 2:
if ($sckHandle = fsockopen($server, 25, $errNo, $errString))
{
code here...
}

both give this error on failing to connect to a given server:

fsockopen(): unable to connect to mx3.hotmail.com:25

I was under the impression that example 2 would not trigger an error if
fsockopen() failed. Any help will be greatly appreciated.

Phil.

---
Phil Ewington - Technical Director

43 Plc - Ashdale House
35 Broad Street, Wokingham
Berkshire RG40 1AU

T: +44 (0)1189 789 500
F: +44 (0)1189 784 994
E: mailto:[EMAIL PROTECTED]
W: www.soyouthink.com

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



RE: [PHP] fsockopen() errors.

2004-03-08 Thread Phil Ewington - 43 Plc
Hi Miguel,

I am giving it a test at the moment, thanks.

-- Phil.


 -Original Message-
 From: Miguel J. Jiménez [mailto:[EMAIL PROTECTED]
 Sent: 08 March 2004 12:29
 To: Phil Ewington - 43 Plc
 Cc: PHP
 Subject: Re: [PHP] fsockopen() errors.


 Is it an error or a warning? If it is a warning you can try use @
 before fsockopen() to avoid echoing warning messages [EMAIL PROTECTED](...)].

 --

 Miguel J. Jiménez
 ISOTROL, S.A. (Área de Internet)
 Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA)
 [EMAIL PROTECTED]
 TLFNO. 955036800 ext. 111

 --
 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] fsockopen() errors.

2004-03-08 Thread Phil Ewington - 43 Plc
Hmm, added @ to fsockopen() function, still happens, can anyone shed any
light on this?

TIA

Phil.



 -Original Message-
 From: Phil Ewington - 43 Plc [mailto:[EMAIL PROTECTED]
 Sent: 08 March 2004 12:57
 To: Miguel J. Jiménez
 Cc: PHP
 Subject: RE: [PHP] fsockopen() errors.


 Hi Miguel,

 I am giving it a test at the moment, thanks.

 -- Phil.


  -Original Message-
  From: Miguel J. Jiménez [mailto:[EMAIL PROTECTED]
  Sent: 08 March 2004 12:29
  To: Phil Ewington - 43 Plc
  Cc: PHP
  Subject: Re: [PHP] fsockopen() errors.
 
 
  Is it an error or a warning? If it is a warning you can try use @
  before fsockopen() to avoid echoing warning messages [EMAIL PROTECTED](...)].
 
  --
 
  Miguel J. Jiménez
  ISOTROL, S.A. (Área de Internet)
  Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA)
  [EMAIL PROTECTED]
  TLFNO. 955036800 ext. 111
 
  --
  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


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



[PHP] OTP: Programming

2004-03-07 Thread Phil Dowson
Hi,

I have been working with PHP for a few years now, and I feel very 
comfortable with it. I am considering branching out into windows 
application development, and I was wondering what language people would 
recommend for someone comfortable with PHP.

I have heard that PHP can be used in this capacity, would PHP work for 
me to create applications with a GUI?

I am sorry if this really is an off topic post!

Thanks

Phil Dowson

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


Re: [PHP] syntax error

2004-01-26 Thread Phil Driscoll
On Monday 26 January 2004 07:37, John Taylor-Johnston wrote:
 Obviously, I'm screwing up my syntax trying to add 2003.php to the end. How
 should I express this line please :) ?

 ?php include
 (/home/users/q/qx04t9mu/www/glq2-test/calendars/+strtolower(date(F))+200
3.htm); ?
replace the + symbols with . and also date(F) should be date('F'). If you 
really want to add 2003.php to the end then you should add it and not 
2003.htm.
-- 
Phil Driscoll

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



[PHP] sorting multi-dimensional arrays

2003-12-22 Thread Phil Ewington - 43 Plc
Hi All,

I am trying to sort a multi-dimensional array using a value in the second
dimension. I have looked at the usort examples but don't fully understand
what usort is actually doing so am struggling. I have tried the following:

if (! getmxrr($this-_Domain, $as_hosts, $ai_weights))
{
return false;
}

for ($i = 0; $i  count($as_hosts); $i++)
{
$this-MXRecs[] = array($as_hosts[$i], $ai_weights[$i]);
}

function IsBestMX($a, $b)
{
if ($a[1] == $b[1])
{
return 0;
}
return ($a[1]  $b[1]) ? -1 : 1;
}

usort($this-MXRecs);

Can anyone point me in the right direction?

TIA

Phil.

---
Phil Ewington - Technical Director

43 Plc - Ashdale House
35 Broad Street, Wokingham
Berkshire RG40 1AU

T: +44 (0)1189 789 500
F: +44 (0)1189 784 994
E: mailto:[EMAIL PROTECTED]
W: www.soyouthink.com

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



RE: [PHP] sorting multi-dimensional arrays

2003-12-22 Thread Phil Ewington - 43 Plc
Ooops, forgot to specify the compare function with usort(); all working now.


Phil.

-Original Message-
From: Phil Ewington - 43 Plc [mailto:[EMAIL PROTECTED]
Sent: 22 December 2003 14:08
To: [EMAIL PROTECTED]
Subject: [PHP] sorting multi-dimensional arrays


Hi All,

I am trying to sort a multi-dimensional array using a value in the second
dimension. I have looked at the usort examples but don't fully understand
what usort is actually doing so am struggling. I have tried the following:

if (! getmxrr($this-_Domain, $as_hosts, $ai_weights))
{
return false;
}

for ($i = 0; $i  count($as_hosts); $i++)
{
$this-MXRecs[] = array($as_hosts[$i], $ai_weights[$i]);
}

function IsBestMX($a, $b)
{
if ($a[1] == $b[1])
{
return 0;
}
return ($a[1]  $b[1]) ? -1 : 1;
}

usort($this-MXRecs);

Can anyone point me in the right direction?

TIA

Phil.

---
Phil Ewington - Technical Director

43 Plc - Ashdale House
35 Broad Street, Wokingham
Berkshire RG40 1AU

T: +44 (0)1189 789 500
F: +44 (0)1189 784 994
E: mailto:[EMAIL PROTECTED]
W: www.soyouthink.com

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



[PHP] Re: PHP LDAP query - need to add Exchange fields

2003-12-22 Thread Phil Dowson
Ben,

I was trying the same thing, but I am not sure you are using the same 
setup as me. My office runs a windows 2000 domain with a Exchange server 
2000 box. All profile information is stored in the windows 2000 domain 
controller, and the exchange server accesses the information from there. 
So it doesnt use its own LDAP. And to make it all the more interesting, 
this script is running on our Intranet, on a FreeBSD 5 box with the 
OpenLDAP client.

The following script will bring back all the fields available in LDAP, 
as long as they are filled out. In this script you need to have a valid 
DOMAIN_USER and a valid DOMAIN_PASS. There are ways to do this 
anonymously, you just need to change the $ldap_bind line to remove the 
$ldaprdn and $ldappass.

To change the search criteria, you can change the $filter variable, at 
the moment it filters on the domain user's userid, or samaccountname.

At the bottom of this post, I have included search results based on my 
user, I have removed everything except the fields you might want.

?
$ldapuser = DOMAIN_USER;
$ldappass = DOMAIN_PASS;
$ldaprdn  = 'DOMAIN\\'.$ldapuser;
$ldapconn = @ldap_connect(dns.domain.com, 3268);
@ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
if ($ldapconn) {
$ldapbind = @ldap_bind($ldapconn, $ldaprdn, $ldappass);
}
$base_dn = DC=dns,DC=domain,DC=com;
$filter=samaccountname=$ldapuser;
$read = ldap_search($ldapconn, $base_dn, $filter);
$info = ldap_get_entries($ldapconn, $read);
$ii=0;
for ($i=0; $ii$info[$i][count]; $ii++){
$data = $info[$i][$ii];
echo $data.:nbsp;nbsp;.$info[$i][$data][0].br;
}
?
Hope it helps

Phil Dowson

Ben Crothers wrote:
Hoping this is an easy question to answer, apologise upfront if this is so
basic, but just been put in charge of a PHP app with LDAP interface to M$
Exchange, and trying to figure out how it works.
At the moment it works fine and extracts fields like first- and surname,
title, department, etc. I need to add the 'office' field, and added it at
the end of this filter line:
---
 $filter =
(|(sn=$search[$i]*)(givenname=$search[$i]*)(title=$search[$i]*)(department=
$search[$i]*)(office=$search[$i]*));

...but so far it's not working. I *know* there's data in the 'office'
field -- any ideas as to what I'm missing?
Thanks a lot in advance,

Ben

---Field List---

homemdb:
manager:
memberof:
altrecipientbl:
publicdelegatesbl:
streetaddress:
info:
cn:
company:
c:
department:
description:
displayname:
mail:
facsimiletelephonenumber:
givenname:
initials:
instancetype:
legacyexchangedn:
l:
distinguishedname:
objectcategory:
objectclass:
objectguid:
objectsid:
homephone:
mobile:
pager:
physicaldeliveryofficename:
postofficebox:
postalcode:
primarygroupid:
proxyaddresses:
name:
samaccountname:
samaccounttype:
showinaddressbook:
st:
sn:
telephonenumber:
co:
textencodedoraddress:
title:
useraccountcontrol:
userprincipalname:
usnchanged:
usncreated:
whenchanged:
whencreated:
wwwhomepage:
mailnickname:
msexchuseraccountcontrol:
deliverandredirect:
homemta:
msexchhomeservername:
msexchmailboxguid:
msexchmailboxsecuritydescriptor:
mdbusedefaults:
protocolsettings:

---Field List---

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


[PHP] Slow LDAP Queries

2003-12-16 Thread Phil Dowson
Hi,

I am using ldap_bind to connect to an Active Directory server to
authenticate users on a website. Although the script is running,
occasionally, and at random, the process to authenticate the user will take
almost exactly 75 seconds (within 100ths of a second). Other times the
authentication process will take less than a second.

Is there any way to see what is causing the delay, does anyone know which
logs I should be looking at. The webserver is a FreeBSD box, and the Domain
controller is a Windows 2000 box.

PHP Version: 4.3.4
Apache Version: 1.3.29
FreeBSD: 5.1
Open LDAP: openldap-client-2.0.27

My code is below.

?
$ldapuser = username;
$ldappass = password;

//Script Time Debug -- START
   $mtime = microtime();
   $mtime = explode( ,$mtime);
   $mtime = $mtime[1] + $mtime[0];
   $starttime = $mtime;
//Script Time Debug -- START

$ldaprdn  = 'DOMAINNAME\\'.$ldapuser;
$ldapconn = @ldap_connect(dns.domain.com, 3268);
@ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);

if ($ldapconn) {
 $ldapbind = @ldap_bind($ldapconn, $ldaprdn, $ldappass);
 if ($ldapbind) {echo you are logged in;}
 else {echo you are not logged in;}
 ldap_close($ldapconn);
 }

//Script Time Debug -- END
   $mtime = microtime();
   $mtime = explode( ,$mtime);
   $mtime = $mtime[1] + $mtime[0];
   $endtime = $mtime;
   $totaltime = ($endtime - $starttime);
   echo (script type='text/javascript'alert('$totaltime')/script);
//Script Time Debug -- END
?

Thanks

Phil Dowson

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



[PHP] ldap_modify(): Modify: Server is unwilling to perform

2003-12-11 Thread Phil Dowson
Hi,

I am trying to write a script that will allow users within the Windows 2000
Active Directory to be able to change thier personal details on an intranet
website. I have included the script I am using below.

The first part of the script commented as Search Script works flawlessly,
even though $base_dn is not set. The problem I am having is with the Modify
Script, when I try and modify a field it returns with the error:

Warning: ldap_modify(): Modify: Server is unwilling to perform in change.php
on line xx

Is there something in AD that stops ldap_modify? Is my problem with the
unset $base_dn? I had left the $base_dn blank, as I had no idea what it
should be. I would appreciate any help, comments or suggestions.

Thanks!

Phil Dowson

\/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ Script Below \/ \/ \/
\/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/

?
$base_dn = '';
$ldappass = 'mypassword';
$ldaprdn  = 'AD\\'.$ldapuser;
$ldapconn = @ldap_connect(ad.domain.com, 3268);

//Search Script Start

@ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);

if ($ldapconn) {
$ldapbind = @ldap_bind($ldapconn, $ldaprdn, $ldappass);
}

$filter=samaccountname=$ldapuser;
$justthese = array(samaccountname,  info);
$read = ldap_search($ldapconn, $base_dn, $filter, $justthese);
$info = ldap_get_entries($ldapconn, $read);

//Search Script End


//Modify Script Start

$info = $_POST[info];

@ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);

if ($ldapconn) {
$ldapbind = @ldap_bind($ldapconn, $ldaprdn, $ldappass);
}

$newinfo[notes][0]=$notes;
ldap_modify($ldapconn, $base_dn, $newinfo);

//Modify Script End
?

/\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ Script Above /\ /\ /\
/\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\

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



Re: [PHP] installing php onto xitami, HELP!

2003-10-29 Thread Phil Driscoll
On Tuesday 28 October 2003 17:59, Paul Vinten wrote:
 when trying to access a php file, I just get a 'cannot find server' message
 from my browser.

I don't have Windows or Xitami so I'm far from being an expert, but it sounds 
like Xitami is not actually running or you have a DNS lookup failure.

If you are requesting the web page in the form http://127.0.0.1/myphpfile.php 
then I guess it must be the former. Can you access a plain html non-php file 
on the server?
-- 
Phil Driscoll

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



[PHP] PHP Sessions

2003-10-25 Thread Phil King
Hi All,

I have a login page that which verifies he username  password against a
MySql database and then passes the username to another page as a session.
I created this on my PC,  which is running PHP version 4.3.2, and it works
with no problem.

My host has the following set  on the server which is running PHP Version
4.3.3:
1. register_globals set to off,
2. Session.bug_compa4_42 set to on
3. Session.bug.Compat-Warn set to on.

When I submit the form I get a warning about :

Warning: Unknown(): Your script possibly relies on a session side-effect
which existed until PHP 4.2.3.
 Please be advised that the session extension does not consider global
variables as a source of data, unless register_globals is enabled. You can
disable this functionality and this warning by setting session.bug_compat_42
or session.bug_compat_warn to off, respectively. in Unknown on line 0

I have tried using :
ini_set (session.bug_compat_42, 0) and ini_set
(session.bug_compat_warn, 0), to override the PHP.ini on the server but
now when I submit the form on the Login page the server just hangs and then
the services on that server stop.

Can anyone shed any light on why a simple login page could crash a server.?

Thanks for any advice so that I can pass information to my host to rectify
what maybe a configuration error.

Thanks again.

Phil.

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



RE: [PHP] ftp_connect() issues

2003-10-13 Thread Phil Ewington - 43 Plc
I can still connect to the ftp server from my client machine using any
number of FTP apps, I also created an ftp test tool, on the same server as I
am currently having problems, that lets you enter an ftp host, username 
password to see if it can connect and login.

I can login to other ftp servers just not the one I want to. Strangely I
managed to get a connection to the suspect ftp server a couple of times then
nothing again. Seems to be an intermittent problem, but it would be nice to
know whether it was a connection that was being dropped by the remote server
or whether there were network issues that stopped the request reaching the
target server.


Phil.

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]
Sent: 10 October 2003 17:51
To: [EMAIL PROTECTED]
Subject: Re: [PHP] ftp_connect() issues


On Saturday 11 October 2003 00:01, Phil Ewington - 43 Plc wrote:

 A script that has been running successfully for over 18 months has
suddenly
 stopped working due to ftp_connect() failing. I have been assured that
 nothing has changed on the ftp server so now need to try and find out why
 this is happening.

And have you verified that you can still connect to the ftp server via other
means?

And have you verified that the script can connect to other ftp servers?

--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
It is more rational to sacrifice one life than six.
-- Spock, The Galileo Seven, stardate 2822.3
*/

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



[PHP] ftp_connect() issues

2003-10-10 Thread Phil Ewington - 43 Plc
Hi All,

A script that has been running successfully for over 18 months has suddenly
stopped working due to ftp_connect() failing. I have been assured that
nothing has changed on the ftp server so now need to try and find out why
this is happening. ftp_connect seems to only return true or false, no
specific RFC error codes :o( Can anyone suggest where I can start looking
for a resolution to this matter?

Running PHP 4.2.3 on a Cobalt RAQ4.

TIA

Phil.

Phil Ewington - Technical Director
--
43 Plc
35 Broad Street, Wokingham
Berkshire RG40 1AU
T: +44 (0)118 978 9500
F: +44 (0)118 978 4994
E: mailto:[EMAIL PROTECTED]
W: http://www.43plc.com

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



[PHP] fsockopen()

2003-09-30 Thread Phil Ewington - 43 Plc
Hi All,

I am having problems with fsockopen() and wondered if anyone else has
encountered this behaviour. My problem is that when connecting to an invalid
domain I cannot trap the errors.

I have tried setting a variable then testing the value, which prints a
warning to the screen...

$sck_handle = fsockopen($hostname, $port, $errno, $errstr, $timeout);
if (!$sck_handle)
{
// socket could not be opened.
$http_statuscode = Error: . $errno . - . $errstr;
}
else
{
...
}

How can I get $errno  $errstr, are these for read/write errors rather than
socket initialisation? I need to know why the socket could not be opened so
I can give an appropriate error message.

TIA


Phil Ewington - Technical Director
--
43 Plc
35 Broad Street, Wokingham
Berkshire RG40 1AU
T: +44 (0)118 978 9500
F: +44 (0)118 978 4994
E: mailto:[EMAIL PROTECTED]
W: http://www.43plc.com

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



RE: [PHP] fsockopen()

2003-09-30 Thread Phil Ewington - 43 Plc
Positive, I am deliberately using invalid domains to test how to catch
errors when users misspell their domain.



-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]
Sent: 30 September 2003 12:01
To: [EMAIL PROTECTED]
Subject: Re: [PHP] fsockopen()


On Tuesday 30 September 2003 18:46, Phil Ewington - 43 Plc wrote:

 I am having problems with fsockopen() and wondered if anyone else has
 encountered this behaviour. My problem is that when connecting to an
 invalid domain I cannot trap the errors.

Have you checked that it is really an invalid domain and not simply been
hijacked by Versign:

  http://www.techweb.com/tech/network/20030926_network

--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
H. L. Mencken's Law:
Those who can -- do.
Those who can't -- teach.

Martin's Extension:
Those who cannot teach -- administrate.
*/

--
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] fsockopen()

2003-09-30 Thread Phil Ewington - 43 Plc
Sorry Jason, I did read the article but must have been away with the fairies
for a moment. I was testing domains that are complete rubbish but they were
all .com and .net so yes you were right and I am a complete fool ;o). Now
getting an error message 'No such file or directory' when testing on another
TLD, strange message for 'domain cannot be found', but hey life would be
boring if everyone thought along the same lines :o)


-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]
Sent: 30 September 2003 15:51
To: [EMAIL PROTECTED]
Subject: Re: [PHP] fsockopen()


On Tuesday 30 September 2003 20:39, Phil Ewington - 43 Plc wrote:
 Positive, I am deliberately using invalid domains to test how to catch
 errors when users misspell their domain.

Did you read that article (or are you aware of what it is about)?

And what invalid domains have you tried?

--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Life is the childhood of our immortality.
-- Goethe
*/

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



[PHP] How many Mondays in a month?

2003-09-29 Thread Phil Dowson
Hi,

I have posted a similar question in php.db, but I was wondering if someone
could help out with a non-db issue. I am trying to display statistics of
visitors to my web site, and what I would like to do is show the average
number of visitors that have visited the site in a given month for a certain
day e.g..:

Stats for www.mysite.com for 09/2003

Monday - 15 average - 65 total
Tuesday - 16 average - 66 total
Wednesday - 14 average - 65 total
Thursday - 13 average - 63 total
Friday - 15 average - 65 total
Saturday - 5 average - 25 total
Sunday - 6 average - 28 total

I have tried a number of ways to do this, but I cannot work out a way to
show the number for example Mondays that will be in a given month, which I
need to work out the average. I can work out the total easy enough, just not
the average.

TIA

Phil Dowson

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



Re: [PHP] How many Mondays in a month?

2003-09-29 Thread Phil Dowson
Greg,

That worked brilliantly... I bow down to your sheer excellence!!! Thankyou
Thankyou Thankyou



Greg Wiley [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Funny you should ask this because I've been meaning to share some code that
I wrote a few months ago that does exactly this for any day of the week.

Please feel free to use this and make changes. I'd appreciate any
changes/bug fixes being sent back to me though.

?php
/*
 * num_days
 *
 * A function that takes a day, a month and a year and returns the number of
 * occurrences of that day in the given month and year.
 *
 * Arguments:
 * day - the day required
 * month - which month are we talking about
 * year - which year are we talking about
 *
 * Returns:
 * occ - the number of times the day occurs in the month.
 * or NULL if there are invalid parameters.
 */
function num_days ($day, $month, $year)
{
$day_array = array(Mon = Monday,
   Tue = Tuesday,
   Wed = Wednesday,
   Thu = Thursday,
   Fri = Friday,
   Sat = Saturday,
   Sun = Sunday);

$month_array = array(1 = Jan, Feb, Mar, Apr, May, Jun,
 Jul, Aug, Sep, Oct, Nov, Dec);

/*
* Check our arguments are valid.
*/

/*
* $day must be either a full day string or the 3 letter
abbreviation.
*/
if (!(in_array($day, $day_array) ||
array_key_exists($day, $day_array))) {
echo num_days: invalid argument. \$day must be day name or
three letter abbreviation;
return;
}

/*
* $month must be either a full month name or its 3 letter
abrreviation
*/
if (($mth = array_search(substr($month,0,3), $month_array)) = 0) {
echo num_days: invalid argument. \$month must be month name
or three letter abbreviation;
return;
}

/*
* Now fetch the previous $day of $month+1 in $year;
* this will give us the last $day of $month.
*/

/*
* Calculate the timestamp of the 01/$mth+1/$year.
*/
$time = mktime(0,0,0,$mth+1,1,$year);

$str = strtotime(last $day, $time);

/*
* Return nth day of month.
*/
$date = date(j, $str);

/*
* If the difference between $date1 and $date2 is 28 then
* there are 5 occurences of $day in $month/$year, otherwise
* there are just 4.
*/
if ($date = 28) {
return 4;
} else {
return 5;
}
}

?

The other function I have does this:

/*
 * nth_day
 *
 * A function that takes a number and a day and returns the date of
 * nth occurrence of that day in the given month and year.
 *
 * Arguments:
 * nth - the nth occurence required
 * day - the day required
 * month - which month are we talking about
 * year - which year are we talking about
 *
 * Returns:
 * date - the date on which the nth day occurs in month and year.
 * or NULL for errors.
 */

Give me a shout if anyone wants this one.

Cheers, Greg.


 -Original Message-
 From: Phil Dowson [mailto:[EMAIL PROTECTED]
 Sent: 29 September, 2003 16:22
 To: [EMAIL PROTECTED]
 Subject: [PHP] How many Mondays in a month?


 Hi,

 I have posted a similar question in php.db, but I was
 wondering if someone could help out with a non-db issue. I am
 trying to display statistics of visitors to my web site, and
 what I would like to do is show the average number of
 visitors that have visited the site in a given month for a
 certain day e.g..:

 Stats for www.mysite.com for 09/2003

 Monday - 15 average - 65 total
 Tuesday - 16 average - 66 total
 Wednesday - 14 average - 65 total
 Thursday - 13 average - 63 total
 Friday - 15 average - 65 total
 Saturday - 5 average - 25 total
 Sunday - 6 average - 28 total

 I have tried a number of ways to do this, but I cannot work
 out a way to show the number for example Mondays that will be
 in a given month, which I need to work out the average. I can
 work out the total easy enough, just not the average.

 TIA

 Phil Dowson

 -- 
 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] Displaying Blobs by a newbie

2003-09-14 Thread Phil King
Hi Curt,

Thanks for the tip.

I created the two scripts . The image tag on the main page calls the image
from the other script with an incremented id parameter.

Thanks for your help.

Phil.
Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 * Thus wrote Phil King ([EMAIL PROTECTED]):
  Hi All,
 
  I have some images in a mysql database. I wish to display all these
images
  on a PHP Page.
 
  I have created a query to retrieve all the images from the database but
all
  that is displayed is characters.
  I have the Content-Type as image/jpeg in the header of the page to
display
  the images.

 Basically you need two scripts:

 script1:
 generate html that has img tags that point to script2.

 script2:
 read one image from the database and send that image with the
 appropriate content-type


 
  Can anyone advise me or point me in the right direction to rectify this.

 This has been discussed may times on the list, you can search the
 archives to find out more detailed discussions on this.


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

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



Re: [PHP] Displaying Blobs by a newbie

2003-09-13 Thread Phil King
Hi Warren,

Thanks for your reply.

I imported the blobs into mysql database. They were in jpeg format.

Phil.


Warren Vail [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 You didn't say how the images were placed in the db but you did indicate
they were jpeg format.

 I'd try;

 fetching the db column in to a string variable;

 then;

 $im = imagecreatefromstring($imagestring);
 header (Content-type: image/jpeg);
 imagejpeg($im);
 imagedestroy($im);

 good luck,

 Warren Vail

 -Original Message-
 From: Phil King [mailto:[EMAIL PROTECTED]
 Sent: Friday, September 12, 2003 11:54 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Displaying Blobs by a newbie


 Hi All,

 I have some images in a mysql database. I wish to display all these images
 on a PHP Page.

 I have created a query to retrieve all the images from the database but
all
 that is displayed is characters.
 I have the Content-Type as image/jpeg in the header of the page to display
 the images.

 Can anyone advise me or point me in the right direction to rectify this.

 Thanks very much.

 Phil.

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



[PHP] Displaying Blobs by a newbie

2003-09-12 Thread Phil King
Hi All,

I have some images in a mysql database. I wish to display all these images
on a PHP Page.

I have created a query to retrieve all the images from the database but all
that is displayed is characters.
I have the Content-Type as image/jpeg in the header of the page to display
the images.

Can anyone advise me or point me in the right direction to rectify this.

Thanks very much.

Phil.

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



Re: [PHP] Newbie Question

2003-08-22 Thread Phil King
Hi Everyone,

Thanks a lot for all your advice, I really appreciate it.

PHP / mysql is new to me so excuse my ignorance of the subject..

I will go get phpMyAdmin and give it a whirl.

Thanks again.

Phil.



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



[PHP] Newbie Question

2003-08-21 Thread Phil King
Hi,

I 'm in the process of modify one of my sites to use PHP/mysql instead of
ASP/Ms Access.

The Access database has 200 records in it.

I have PWS, mysql and PHP running on my local PC.

I have used Navicat from mysqlstudio.com to import the access database into
mysql and then exported the data back out as an sql script.
The script consists of multiple sql statements like :

INSERT INTO mydatabase
  (id, Description, Department, RetailPrice, PrefSupPartNo, PrefSupplier)
VALUES
  (1, Bunting Plastic Union Jack 4m, Flags  Bunting, 2.5, JFB,
Smiths);

Is there a way of including the sql script file into a PHP page or do I
have to copy and paste the statements into a PHP page with a mysql_query
statement after each sql statement, to load these records to my ISP's remote
server.

p.s My ISP has no GUI interface into mysql so all manipulation is done via
PHP.

Thanks very much for any guidence.

Phil.




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



Re: [PHP] Newbie Question

2003-08-21 Thread Phil King
Hi Robbert,

I beleive my ISP does not allow any GUI interface into mysql databases on
the server.
They have advised me that ALL functions, table creation, modification,
loading data etc has to be done from PHP.

It appears I have to use SQL statements within a PHP page to load the data.

Phil.

Van Andel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Sorry, I did mean phpMyAdmin (no such thing as phpMySQL).  Brain fart.
 Won't happen again.

 Robbert van Andel



 -Original Message-
 From: Dan Van Derveer [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 9:25 AM
 To: '[EMAIL PROTECTED]'
 Subject: RE: [PHP] Newbie Question


 On the same note I recommend phpMyAdmin(www.phpmyadmin.net). Its interface
 is quite useful especially when you have multiple DB's to manage on the
same
 server.

 Dan

 -Original Message-
 From: Van Andel, Robbert [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 12:24 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Newbie Question

 You can download PHPMySQL and locate it in a secure portion of your site.
 It's an excellent gui interface into mySQL.  This tool will allow you to
 upload the script file and insert the data.  I'm sorry, but I don't know
the
 URL where to get it.  Check sourceforge.

 Robbert van Andel


 -Original Message-
 From: Phil King [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 21, 2003 7:40 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Newbie Question


 Hi,

 I 'm in the process of modify one of my sites to use PHP/mysql instead of
 ASP/Ms Access.

 The Access database has 200 records in it.

 I have PWS, mysql and PHP running on my local PC.

 I have used Navicat from mysqlstudio.com to import the access database
into
 mysql and then exported the data back out as an sql script.
 The script consists of multiple sql statements like :

 INSERT INTO mydatabase
   (id, Description, Department, RetailPrice, PrefSupPartNo, PrefSupplier)
 VALUES
   (1, Bunting Plastic Union Jack 4m, Flags  Bunting, 2.5, JFB,
 Smiths);

 Is there a way of including the sql script file into a PHP page or do I
 have to copy and paste the statements into a PHP page with a mysql_query
 statement after each sql statement, to load these records to my ISP's
remote
 server.

 p.s My ISP has no GUI interface into mysql so all manipulation is done via
 PHP.

 Thanks very much for any guidence.

 Phil.




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

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



[PHP] I need a PHP alternative to Windows Scheduled Tasks

2003-07-23 Thread Phil Powell
I have concluded that Bill Gates is Satan!

Ok, I'm late, but... I have had 26 scheduled tasks that run every hour on the hour 
every day for eternity to go and run a series of Java files I wrote that connect 
remotely to a remote server to do remote cleanup of stray XML files, etc.; things I 
cannot do on the remote machine box itself because it's remote and I don't have 
permissions were I physically on the box anyway.

However, on 7/18 all 26 of my scheduled tasks stopped running; one of which 
continuously ran for 4 days straight w/o stopping (nor could I manually stop it).  I 
deleted the runaway process and recreated it; now not a single one of my 26 scheduled 
Win2000 tasks I created using MS-DOS AT commands work (which were working since 7/2).

I am now looking into programmatic alternatives.  I really could use some ideas that 
are practical given my situation.  I'm thinking PHP since I am very comfortable with 
it, were it possible within my bizarre Win2000 environment, but I need something that 
will clean those XML files remotely on a regular basis, it's important for website 
maintenance.  Any help appreciated.

Thanx
Phil


Re: [PHP] What did I do wrong to cause a parse error?

2003-07-11 Thread Phil Powell
Thanx I got it to work, however, I have no idea why it works now considering
I did nothing different:

$singleProfileHTML .= !--\n;
 foreach ($profileArray[$i][attributes] as $key = $val) {
  $singleProfileHTML .= strtolower($key) . '=' . str_replace(',
'#039;', str_replace('', 'quot;', stripslashes($val))) . \\n;
 }
 $singleProfileHTML .= --\n;

Beats the heck out of me!

Phil
- Original Message -
From: David Otton [EMAIL PROTECTED]
To: Phil Powell [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, July 11, 2003 2:48 AM
Subject: Re: [PHP] What did I do wrong to cause a parse error?


 On Fri, 11 Jul 2003 00:53:32 -0400, you wrote:

 foreach ($profileArray[$i][attributes] as $key = $val) {
  $singleProfileHTML .= $key . =\ . str_replace(', '#039;',
str_replace('', 'quot;', $val)) . \\n;
 }
 
 The parsing error occurs in the $singleProfileHTML.. line.  I'm
completely don't get it; I see absolutely nothing wrong with this, what did
I miss?

 Line 1 - attributes should have a $ in front of it, or be a string
literal.

 BTW, that's a really nasty line. Maybe it would be easier to read as :

 foreach ($profileArray[$i][$attributes] as $key = $val) {
 $val = str_replace('', 'quot;', $val);
 $val = str_replace(', '#039;', $val);
 $singleProfileHTML .= $key=\$val\\n;
 }



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



[PHP] Mind exploded on this one!

2003-07-11 Thread Phil Powell
$booleanNonFormVars = array('hasSelectedLetter', 'hasEnteredProfile', 
'hasSelectedProfile',
 'hasEditedProfile', 'hasDeletedProfile', 
'willDeleteProfile',
 'willDeletePic');
 $booleanVars = array('profileID', 'showemail', 'showbirthday', 'season', 
'profilememberid');
 $profileVarArray = array('firstname', 'lastname', 'city', 'state', 'country', 
'favebands',
  'faveconcert', 'favescandinavia', 'faveviking', 'favemeat',
  'freetime', 'thingslove', 'thingshate', 'favebibleverse',
  'changeonething', 'maritalstatus', 'birthday', 'favemovie', 
  'faveplace', 'favetv', 'imgpath', 'imgext');
 $profileNonFormVarArray = array('profileName', 'letter', 'name');

 $arrayListArray = array('booleanNonFormVars', 'booleanVars', 'profileVarArray', 
'profileNonFormVarArray');

Bluntly put, I need to get: 
$hasSelectedLetter
$letter

Etc..

I have absolutely NO idea how to do this, help!

Phil


[PHP] What did I do wrong to cause a parse error?

2003-07-10 Thread Phil Powell
foreach ($profileArray[$i][attributes] as $key = $val) {
 $singleProfileHTML .= $key . =\ . str_replace(', '#039;', str_replace('', 
'quot;', $val)) . \\n;
}

The parsing error occurs in the $singleProfileHTML.. line.  I'm completely don't get 
it; I see absolutely nothing wrong with this, what did I miss?

Phil


Re: [PHP] mail()

2003-07-05 Thread Phil Dowson
Perfect solution. Thanks!!!


- Original Message - 
From: Dan Anderson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, July 05, 2003 4:30 am
Subject: Re: [PHP] mail()


   Could someone let me know if it is possible to pass a resultset of a
query
   to a single variable so it can be included as the message part of the
mail
   function?

 if I were you I would try something like...

 ?php

 $result = mysql_query($query);
 $email = NULL; // it's bad form to dot without clearing the variable
 while ($line = mysql_fetch_array($result,MYSQL_ASSOC))
 {
   $email = $email . Value 1: {$line['value_1']}\n;
   $email = $email . Value 2: {$line['value_2']}\n;
   $email = $email . Value 3: {$line['value_3']}\n;
   // ...
 }
 mail('[EMAIL PROTECTED]','subject',$email);
 ?


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



[PHP] mail()

2003-07-04 Thread Phil Dowson
Hi,

Could someone let me know if it is possible to pass a resultset of a query
to a single variable so it can be included as the message part of the mail
function?

Thanks!

Phil Dowson


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



[PHP] Finding the height of a JPG in pixels using PHP

2003-04-05 Thread Phil Schwarzmann
I have JPG files stored as binary in a MySQL database.  I am displaying the
JPGs on the screen and also want to know the height (in pixels) of the JPG.
Can PHP do this?

 

Thanks!



[PHP] Using PHP Credit Card orders

2003-04-01 Thread Phil Schwarzmann
Where can I find information on using PHP along with secure online Credit
Card orders?

 

Thanks!



[PHP] Storing a graphic file in a MySQL database

2003-03-29 Thread Phil Schwarzmann
Where can I find some information on storing a graphic file such as a JPG or
GIF into a MySQL database.  I'm assuming I have to convert it to a binary
format and store it that way.  Or maybe this isn't possible?

 

Thanks!



[PHP] Re: preg_replace question

2003-02-23 Thread Phil Roberts
[EMAIL PROTECTED] (Electroteque) wrote in
news:[EMAIL PROTECTED]: 

 yet another regex question how could i hange the value within the
 quotes with preg_replace
 
 php_value upload_max_filesize 5M
 
 

$str = preg_replace(#php_value upload_max_filesize\s?['\](.+?)[\']#i, 
php_value upload_max_filesize\\\1\, $str);

Should work.

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



[PHP] Re: OOP and object references, not copies - how to do?

2003-02-23 Thread Phil Roberts
[EMAIL PROTECTED] (Erik FranzéN) wrote in
news:[EMAIL PROTECTED]: 

 Say the you are going to create a simple forum and you want to have a
 number of classes:
 
 Class Sql - handles the DB interface
 Class User - handles users
 Class Messages - handles messages
 
 When you are writing the code, you first creates a new sql object in
 order to read or write data from or to the database.
 
 Secondly you create a user object in order to handle users, for an
 example, to authenticate the user which is going to write a new
 message in your forum.
 
 The user object have a method which reads user information from the
 database.
  Since you alread have created a sql object, this method should use
  the sql 
 object in order to fecth data from the database.
 
 I nice way to do this, would be to send the sql object as an reference
 to the user object constructor and store the object reference to the
 sql object in the user object.
 
 This is not working very well in PHP yet because PHP cannot treat
 objects as references. When you send the sql object to the user object
 constructor method, it will be a copy, not a reference!
 
 How do I get around this? There must be a way to handle this and
 create nice OOO PHP-code? I don't like using global variables as
 object handles. 
 

You need to use the  chracter when passing  assigning.

$obj = new Object;

function func($obj)
{

}

To return an object:

function func()
{
return $obj;
}

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



[PHP] Re: Tutorials on OOP

2003-02-23 Thread Phil Roberts
[EMAIL PROTECTED] (Davy Obdam) wrote in news:[EMAIL PROTECTED]:

 Hi people,.
 
 I have to build several classes for a project i am doing, but i am quite 
 new to OOP programming. I need to make a database abstraction layer 
 class and a user login class.. Does anyone know some good tutorials 
 about these things and OOP in general. Thanks in advance..
 

http://www.phppatterns.com/ is a good place to learn about OO PHP design.


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



[PHP] PHP connecting to MS Access

2003-02-05 Thread Phil Schwarzmann
If a MS Access database and a PHP server were on the same machine, could
they connect without having to use something like MS SQL Server?  




[PHP] Need an explanation as to what this line does...

2003-02-01 Thread Phil Powell
 $stuffArray[$i][value] = strtr($stuffArray[$i][value], 
array_flip(get_html_translation_table(HTML_ENTITIES)));

To be bluntly honest, I don't understand hardly any of it, and the PHP Manual isn't 
helping this time.. maybe I'm weekend-stupid or something.. *sigh*

Phil



[PHP] Problem with xml_parse_into_struct

2003-01-29 Thread Phil Powell
I have various XML files that might contain  tags inside the element body, for 
example:

news id=1 shortDescription=Stuff Happened TodayToday on b1/29/03/b, stuff 
happened/news

Because of this I can't use xml_parse_into_struct; when I do this happens:

array (
  ...
  [attributes] = array (
   [ID] = 1
   [SHORTDESCRIPTION] = Stuff Happened Today
   )
 [values]  = Today on
)

and it stops right there on the b tag.

What I need to do is this: Clean out ALL occurrences of tags that are NOT part of 
the original XML structure from the contents read from the XML file:

$fileID = fopen('/phil/xml/news.xml', 'r') or die('Could not open XML');
$stuff = fread($fileID, filesize('/phil/xml/news.xml'));
fclose($fileID);

$stuff contains the contents of news.xml, so I would have to do my cleanup in $stuff, 
BUT.. I can't use preg_replace for tags because then ALL of my tags would be altered 
and xml_parse_into_struct would fail altogether.

How then do I make sure to ONLY remove the trash tags from each XML row body and 
nowhere else???

Thanx
Phil



  1   2   3   4   5   >