[suspicious - maybe spam] php-general Digest 21 Aug 2005 10:34:42 -0000 Issue 3637

2005-08-21 Thread php-general-digest-help

php-general Digest 21 Aug 2005 10:34:42 - Issue 3637

Topics (messages 221016 through 221036):

Re: preg_match
221016 by: Edin Kadibašić
221017 by: Edin Kadibašić

[suspicious - maybe spam] $BM_5aITK~$J1|MM$r%O%a%F8+$^$;$s$+(B
221018 by: info.g-muta.com

exec ping
221019 by: Juan Pablo Herrera
221020 by: Jasper Bryant-Greene
221021 by: Juan Pablo Herrera
221023 by: Jasper Bryant-Greene
221025 by: Juan Pablo Herrera

Re: apache sessions
221022 by: Chris Shiflett

SUPPORT FOR INTERACTION WITH A DATABASE
221024 by: Fernando Garza

PHP and Prolog database interaction
221026 by: Fernando Garza

PHP and Prolog
221027 by: Fernando Garza

support for database interaction
221028 by: Fernando Garza
221030 by: Jasper Bryant-Greene
221032 by: Robert Cummings

how to know when a php library is installed
221029 by: Lizet Pena de Sola
221031 by: Jasper Bryant-Greene
221034 by: Lizet Pena de Sola

VERY SORRY, explanation
221033 by: Fernando Garza

Problem between php4.4 and mysql
221035 by: Alex Scott
221036 by: Burhan Khalid

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
Richard Lynch wrote:
 But Perl isn't going to *SEE* \\s !!!
 
 PHP is going to *EAT* \\ and make \ out of it.
 
 That's why \ is an escape character in PHP.
 
 It's also an escape character in Perl/PCRE.
 
 Some days I think PHP's escape character should have been | or
 something, just so this topic wouldn't come up every damn month.

All true, except you would then end up having problems with regexs like
(this|or|that) :)

Edin
---End Message---
---BeginMessage---
Jasper Bryant-Greene wrote:
 John Nichel wrote:
 
 Personally, I have never used \\ in PCRE when looking for things like
 spaces (\s), word boundraries (\b), etc. and it's all worked out fine.
 
 
 It will work fine, but only because those (\s and \b) just happen to not
 be special characters in PHP *at this time*.
 
 It's sloppy programming because the backslash is known to be a special
 character, and \s or \b could conceivably become special characters at
 some time in the future. It's unlikely, but possible.
 
 Not only that, but it makes it more likely that you'll forget and put \n
 when you meant \\n, \r when you meant \\r, \t when you meant \\t, and so
 on...

Also people thinking that PHP's single-quoted strings don't have any
escape sequences run into trouble when they have backslash as the last
character of the string:

$path = 'c:\';

This will give you parse error because the parser would think that you
wanted literal ' character and looks in vain for the string end. The
correct line should be:

$path = 'c:\\';

Edin
---End Message---
---BeginMessage---
-
$B5U!o8r:](B $Bv5U!o8r:](B
-
[EMAIL PROTECTED],[EMAIL PROTECTED];~Be$O=*$j$^$7$?!#Ev%5%$%H$O5U!o4uK[EMAIL 
PROTECTED],[EMAIL PROTECTED]+M3$KA*$Y$k%7%9%F%`$r:NMQ$7$F$$$^$9!#(B

$B[EMAIL PROTECTED](B $B!D(B [EMAIL 
PROTECTED]D!Bh$G$O%(%C%A$$j(B+$B$*Ni$b$$j(B
$B[EMAIL PROTECTED](B $B!D(B [EMAIL PROTECTED]+M3$K8rD$7$F(BOK!!

[EMAIL PROTECTED]:$1$^$9$,![EMAIL 
PROTECTED]:$-$^$9!#$^$?!$4?75,EPO?$K4X$7$^$7$F$O?3::@)$H$J$C$F$*$j$^$9!#(B

http://awg.webchu.com/deai/?meet

$B!!~!!~!!~!!~!!~!!~!!~!!~!!~!!~!!~(B
[EMAIL PROTECTED]@-$X$N%5%]!%H!o$O$$/$^$G$bK\?M!Bh$G$9!#(B
[EMAIL PROTECTED]@-$X$N%5%]!%H$O+M38rD$G$*4j$$$7$^$9!#(B 
$B!!~!!~!!~!!~!!~!!~!!~!!~!!~!!~!!~(B

[EMAIL PROTECTED]6bA,[EMAIL PROTECTED](B 

$B$^$?![EMAIL PROTECTED][EMAIL 
PROTECTED],!$*Ajj$NG/Np!MF;Q$OJ]cCW$7$^$;$s!#(B
$B$G$bB:]$K7]G=4X78!2;[EMAIL PROTECTED]$j$^$9!#(B
$B$I$s$J?M$K=P0)$($k$+$O!B3$1$J$$$H$o$+$j$^$;$s$h$M!#(B
[EMAIL PROTECTED]%k%P%$%H463P$G$*;n$72$5$$!#(B  

http://awg.webchu.com/deai/?meet

$B!ZMxMQEPO?![(B
[EMAIL PROTECTED][EMAIL PROTECTED];YJ'$$(B
$B---(B
$B!Z%a%C%;!%88r49![(B
$B$[EMAIL PROTECTED];d=qH$r$4MxMQD:$1$^$9(B
$B!J%a!%k%%I%l%9!EEOCHV9f$N8r49$b+M3!K(B
$B---(B
$B!Z8rD![(B
$B6b3[!9g$2s?t!%W%l%$FbMF$J$I(B
$B---(B
$B!Z5U!o8r:]%9%?!%H![(B
[EMAIL PROTECTED]'[EMAIL PROTECTED]r7o$K9g$o$;$F8r:](B+$B%5%]!%H(B
[EMAIL PROTECTED]':GDc(BSEX$B$r%5%]!%H(B

$B-6=L#$r;}$?$l$?J}$OAaB.EPO?-(B  
 $B--(B
http://awg.webchu.com/deai/?meet
---End Message---
---BeginMessage---
Hi all!
I have following script:
$comando = system('ping 168.192.0.1', $nn);
echo $nn;
Well, i need that only show the first ten lines of the ping and kill
the process.
How can i make it?

Regards,
JP
---End Message---
---BeginMessage---

Juan Pablo Herrera wrote:

Hi all!
I have following script:
$comando = system('ping 168.192.0.1', $nn);
echo $nn;
Well, i need 

php-general Digest 21 Aug 2005 22:55:16 -0000 Issue 3638

2005-08-21 Thread php-general-digest-help

php-general Digest 21 Aug 2005 22:55:16 - Issue 3638

Topics (messages 221037 through 221052):

Re: how to know when a php library is installed
221037 by: Greg Donald

Looking for CMS advice
221038 by: Zachary Kessin
221045 by: Esteamedpw.aol.com

Re: support for database interaction
221039 by: Greg Donald

Re: Problem between php4.4 and mysql
221040 by: Alex Scott
221042 by: Alex Scott
221046 by: JamesBenson
221048 by: Alex Scott
221049 by: Jasper Bryant-Greene
221052 by: Jasper Bryant-Greene

Need help with for loop, pulling MySQL data, completely lost
221041 by: Dan Trainor
221043 by: Evan Priestley
221050 by: Dan Trainor

Re: PHP and Prolog
221044 by: Rory Browne
221047 by: Edin Kadibašić

Resizing thumbnails to the browser
221051 by: Murray . PlanetThoughtful

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
On 8/21/05, Lizet Pena de Sola [EMAIL PROTECTED] wrote:
 I need to test whether a library is installed with php or not.

extension_loaded();


-- 
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/
---End Message---
---BeginMessage---
I am about to start on a project that seems like it would be right for a 
CMS system. It will be about 80% rather boring stuff with about 20% 
custom database work. I have looked at XOOPS and a few others. However I 
can not seem to find one rather important thing about XOOPS. I 
understand how to use a module that someone else wrote, but I have not 
found any documentation on how to build my own blocks or application 
components.


I am not yet committed to XOOPS, so if there is different system that 
would be better that could work as well


--Zach
---End Message---
---BeginMessage---
I would check out Mambo:  _http://mamboserver.com_ (http://mamboserver.com)  
 
- Clint
---End Message---
---BeginMessage---
On 8/21/05, Fernando Garza [EMAIL PROTECTED] wrote:
 I am creating a 'Shell' in prolog language that interacts with a 'Visual
 Prolog' database format in 'Win32', I would like to interact with this
 database with 'PHP', just like the interaction with 'MySQL' database, can
 you give me some notion or the code that need to be executed to get this
 done? for example in:
 
 'mysql_connect'
 
 or
 
 'mysql_create_db'
 
 what code is executed behind this functions?
 
 I think the functions to make this done should be execute a program with
 some function, passes values and receive values from the 'shell'
 
 any idea?


http://pecl.php.net/support.php#tutorials


-- 
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/
---End Message---
---BeginMessage---


On 21 Aug 2005, at 12:08, Alex Scott wrote:


Thanks for reply,

But just briefly, why should it have been working for the past  
month o.k?


Kind regards,

Alex.


On 21 Aug 2005, at 11:34, Burhan Khalid wrote:



Alex Scott wrote:



Hi there,
I discovered that our website was not working properly today (To  
my  horror).

Hosted on redhat enterprise 4.
I think that there is a problem with php 4.4 talking to Apache  
mysql 4.1
as the php pages which do not talk to the DB are working but  
other  php pages are working.





This has been asked before, and answered (even by me).

You need http://php.net/mysqli or change your MySQL configuration  
so that it allows 'old style' passwords.


Google for the rest, or STFA :)

Regards,
Burhan





---End Message---
---BeginMessage---

Also I am using mysql 4.1.12 and mysql Is designed to work with 4.1.13?

Can anybody suggest to me how I might fix this problem please???

Alex.


On 21 Aug 2005, at 12:23, Alex Scott wrote:



On 21 Aug 2005, at 12:08, Alex Scott wrote:



Thanks for reply,

But just briefly, why should it have been working for the past  
month o.k?


Kind regards,

Alex.


On 21 Aug 2005, at 11:34, Burhan Khalid wrote:




Alex Scott wrote:




Hi there,
I discovered that our website was not working properly today (To  
my  horror).

Hosted on redhat enterprise 4.
I think that there is a problem with php 4.4 talking to Apache  
mysql 4.1
as the php pages which do not talk to the DB are working but  
other  php pages are working.






This has been asked before, and answered (even by me).

You need http://php.net/mysqli or change your MySQL configuration  
so that it allows 'old style' passwords.


Google for the rest, or STFA :)

Regards,
Burhan










---End Message---
---BeginMessage---
Sounds like you have a duplicate entry in your httpd.conf for the PHP 
module, 100% of the time ive seen that error is the above reason, so I 
suggest checking your LoadModule * sections, depending whether you have 
a shared libphp4.so 

[PHP] SUPPORT FOR INTERACTION WITH A DATABASE

2005-08-21 Thread Fernando Garza
Hi,

I am creating a Shell in prolog language that interacts with a Visual Prolog 
database format in Win32, I would like to interact with this database with 
PHP, just like the interaction with MySQL database, can you give me some 
notion or the code that need to be executed to get this done? for example 
in:

mysql_connect 

or 

mysql_create_db

what code is executed behind this functions?


I think the functions to make this done should be execute some function that 
run an .EXE, passes values and receive values from the shell


any idea?


Re: [PHP] exec ping

2005-08-21 Thread Juan Pablo Herrera
On 8/21/05, Jasper Bryant-Greene [EMAIL PROTECTED] wrote:
 Juan Pablo Herrera wrote:
  Thanks Jasper,
  well, i need make a explode of results of the ping. The idea is check
  a host and when the host don´ t response send a email.
  I don't explode the result of the ping.
 
 If it was me, I'd try opening a socket connection to the host instead,
 and check to see if you can connect or not. Whether or not that is
 suitable to your application I don't know...
 
 Jasper
 

Hi!
I did following script:

?php
// Exec a ping
exec('ping -c 5 192.168.236.3',$result);
// Take result from icmp seq = 2
$icmp = strpos($result[2], 'time=');

$icmp = $icmp + 5;

$fin = strpos($result[2], 'ms');
// This is my end
$fin = $fin - $icmp;
// I take only the ms time
$text = substr($result[2],$icmp,$fin);
// Strip whitespace
$ms = trim($text);

if (!is_numeric($ms)) {
  $a = '[EMAIL PROTECTED]';
  $asunto = Servidor Caido;
  $mensaje = Posible caida del servidor. No responde PING.;
  mail($a, $asunto, $mensaje);
}

?

It's very simple, but i think that is working. I will add other options.

JP

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



[PHP] PHP and Prolog database interaction

2005-08-21 Thread Fernando Garza
Hi,

I am creating a Shell in prolog language that interacts with a Visual Prolog 
database format in Win32, I would like to interact with this database with 
PHP, just like the interaction with MySQL database, can you give me some 
notion or the code that need to be executed to get this done? for example 
in:

mysql_connect 

or 

mysql_create_db

what code is executed behind this functions?


I think the functions to make this done should be execute some function that 
run an .EXE, passes values and receive values from the shell


any idea?


[PHP] PHP and Prolog

2005-08-21 Thread Fernando Garza
Hi,

I am creating a Shell in prolog language that interacts with a Visual Prolog 
database format in Win32, I would like to interact with this database with 
PHP, just like the interaction with MySQL database, can you give me some 
notion or the code that need to be executed to get this done? for example 
in:

mysql_connect 

or 

mysql_create_db

what code is executed behind this functions?


I think the functions to make this done should be execute a program with 
some function, passes values and receive values from the shell


any idea?


[PHP] support for database interaction

2005-08-21 Thread Fernando Garza
Hi,

I am creating a 'Shell' in prolog language that interacts with a 'Visual 
Prolog' database format in 'Win32', I would like to interact with this 
database with 'PHP', just like the interaction with 'MySQL' database, can 
you give me some notion or the code that need to be executed to get this 
done? for example in:

'mysql_connect' 

or 

'mysql_create_db'

what code is executed behind this functions?


I think the functions to make this done should be execute a program with 
some function, passes values and receive values from the 'shell'


any idea?


[PHP] how to know when a php library is installed

2005-08-21 Thread Lizet Pena de Sola
Hello all:
I need to test whether a library is installed with php or not. In this
case it's the tidy library I need for a project.
After getting a message from the hosting administrator that the tidy
library was installed and ready to use I ran a phpinfo() to find out
details:
There's nothing that looks like tidy in the Configure Command:

Configure Command'./configure' 'i386-redhat-linux'
'--prefix=/usr'
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin'
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include'
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var'
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--prefix=/usr'
'--cache-file=../config.cache' '--with-config-file-path=/etc'
'--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect'
'--disable-debug' '--enable-pic' '--disable-rpath'
'--enable-inline-optimization' '--with-bz2' '--with-db3' '--with-curl'
'--with-pear' '--with-dom=/usr' '--with-exec-dir=/usr/bin'
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd'
'--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext'
'--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr'
'--with-openssl' '--with-png' '--with-pspell' '--with-regex=system'
'--with-xml' '--with-expat-dir=/usr' '--with-pcre=/usr' '--with-zlib'
'--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp'
'--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets'
'--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path'
'--enable-track-vars' '--enable-trans-sid' '--enable-yp'
'--enable-wddx' '--without-oci8' '--with-pear=/usr/share/pear'
'--with-imap=shared' '--with-imap-ssl' '--with-kerberos'
'--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql'
'--with-snmp=shared,/usr' '--with-snmp=shared'
'--enable-ucd-snmp-hack' '--with-unixODBC=shared'
'--enable-memory-limit' '--enable-bcmath' '--enable-shmop'
'--enable-versioning' '--enable-calendar' '--enable-dbx'
'--enable-dio' '--enable-mcal' '--enable-mbstring'
'--enable-mbstr-enc-trans' '--enable-mbregex' '--enable-cgi'


However there is a section in the phpinfo output that shows:
tidy
Tidy supportenabled
libTidy Build Date  1 July 2005

Directive   Local Value Master Value
tidy.default_config no valueno value

Tidy Configuration DirectiveValue
indent-spaces   0



I've tried to run this php code to call tidy functions:
?

$html = '


html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en
headtitletitle/title/head
body
pparagraph bt /
text/p
/body/html
';
$tidy = new tidy;
$tidy-parseString($html);

$tidy-CleanRepair();

if ($tidy-errorBuffer) {
  echo The following errors were detected:\n;
  echo $tidy-errorBuffer;
}

?

And always get the error cannot instantiate nonexistent class.

Any input, comments are more than welcome,
Lizet


Re: [PHP] support for database interaction

2005-08-21 Thread Jasper Bryant-Greene

Fernando Garza wrote:

Hi,

I am creating a 'Shell' in prolog language that interacts with a 'Visual 
Prolog' database format in 'Win32', I would like to interact with this 
database with 'PHP', just like the interaction with 'MySQL' database, can 
you give me some notion or the code that need to be executed to get this 
done? for example in:


'mysql_connect' 

or 


'mysql_create_db'

what code is executed behind this functions?


Have a look at the PHP source code if you want to know what code is 
executed behind those functions.


And please refrain from spamming the list with 4 almost-identical messages.

Jasper

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



Re: [PHP] how to know when a php library is installed

2005-08-21 Thread Jasper Bryant-Greene

Lizet Pena de Sola wrote:

Hello all:
I need to test whether a library is installed with php or not. In this
case it's the tidy library I need for a project.


?php
if(function_exists('tidy_get_output')) {
// Tidy is installed
} else {
// Tidy is not installed, contact your host
}
?

Jasper

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



Re: [PHP] support for database interaction

2005-08-21 Thread Robert Cummings
On Sun, 2005-08-21 at 02:58, Fernando Garza wrote:
 Hi,
 
 I am creating a 'Shell' in prolog language that interacts with a 'Visual 
 Prolog' database format in 'Win32', I would like to interact with this 
 database with 'PHP', just like the interaction with 'MySQL' database, can 
 you give me some notion or the code that need to be executed to get this 
 done? for example in:
 
 'mysql_connect' 
 
 or 
 
 'mysql_create_db'
 
 what code is executed behind this functions?
 
 
 I think the functions to make this done should be execute a program with 
 some function, passes values and receive values from the 'shell'

Is there a reason you're spamming the list with multiple versions
(teency bit changed from one to the next) of the same question?

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] VERY SORRY, explanation

2005-08-21 Thread Fernando Garza
very sorry for the spam, I send the message many times because I received 
this message:*


Symantec Mail Security detected prohibited content in a message sent from 
your address 
(SYM:00367781894249647555)


*and I thinked that my message isn´t received, so I try to change the 
content


very thankful for the link

and sorry for the spamming


RE: [PHP] how to know when a php library is installed

2005-08-21 Thread Lizet Pena de Sola
Contacting host, thanks :)

-Original Message-
From: Jasper Bryant-Greene [mailto:[EMAIL PROTECTED] 
Sent: Sunday, August 21, 2005 1:20 AM
To: 'php'
Subject: Re: [PHP] how to know when a php library is installed

Lizet Pena de Sola wrote:
 Hello all:
 I need to test whether a library is installed with php or not. In this
 case it's the tidy library I need for a project.

?php
if(function_exists('tidy_get_output')) {
// Tidy is installed
} else {
// Tidy is not installed, contact your host
}
?

Jasper

-- 
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] Problem between php4.4 and mysql

2005-08-21 Thread Alex Scott

Hi there,

I discovered that our website was not working properly today (To my  
horror).

Hosted on redhat enterprise 4.

I think that there is a problem with php 4.4 talking to Apache mysql 4.1
as the php pages which do not talk to the DB are working but other  
php pages are working.


I restarted apache using the inetd script as well as mysql using the  
inetd script.
However the problem exists. I can enter mysql through the shell and  
tables seem intact.

I have no relevant errors in my log file.

One thing I noticed was that when I went to restart Apache it said 
( before restarting):
[Sun Aug 21 10:39:08 2005] [warn] module php4_module is already  
loaded, skipping


Should I try to be loading that module, somehow?

Any suggestions in how to get PHP working with mysql again would be  
much appreciated as it is a busy sight, so slightly stressed.


Thanks Alex.

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



Re: [PHP] Problem between php4.4 and mysql

2005-08-21 Thread Burhan Khalid

Alex Scott wrote:

Hi there,

I discovered that our website was not working properly today (To my  
horror).

Hosted on redhat enterprise 4.

I think that there is a problem with php 4.4 talking to Apache mysql 4.1
as the php pages which do not talk to the DB are working but other  php 
pages are working.


This has been asked before, and answered (even by me).

You need http://php.net/mysqli or change your MySQL configuration so 
that it allows 'old style' passwords.


Google for the rest, or STFA :)

Regards,
Burhan

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



Re: [PHP] how to know when a php library is installed

2005-08-21 Thread Greg Donald
On 8/21/05, Lizet Pena de Sola [EMAIL PROTECTED] wrote:
 I need to test whether a library is installed with php or not.

extension_loaded();


-- 
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

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



[PHP] Looking for CMS advice

2005-08-21 Thread Zachary Kessin
I am about to start on a project that seems like it would be right for a 
CMS system. It will be about 80% rather boring stuff with about 20% 
custom database work. I have looked at XOOPS and a few others. However I 
can not seem to find one rather important thing about XOOPS. I 
understand how to use a module that someone else wrote, but I have not 
found any documentation on how to build my own blocks or application 
components.


I am not yet committed to XOOPS, so if there is different system that 
would be better that could work as well


--Zach

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



Re: [PHP] support for database interaction

2005-08-21 Thread Greg Donald
On 8/21/05, Fernando Garza [EMAIL PROTECTED] wrote:
 I am creating a 'Shell' in prolog language that interacts with a 'Visual
 Prolog' database format in 'Win32', I would like to interact with this
 database with 'PHP', just like the interaction with 'MySQL' database, can
 you give me some notion or the code that need to be executed to get this
 done? for example in:
 
 'mysql_connect'
 
 or
 
 'mysql_create_db'
 
 what code is executed behind this functions?
 
 I think the functions to make this done should be execute a program with
 some function, passes values and receive values from the 'shell'
 
 any idea?


http://pecl.php.net/support.php#tutorials


-- 
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

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



Re: [PHP] Problem between php4.4 and mysql

2005-08-21 Thread Alex Scott


On 21 Aug 2005, at 12:08, Alex Scott wrote:


Thanks for reply,

But just briefly, why should it have been working for the past  
month o.k?


Kind regards,

Alex.


On 21 Aug 2005, at 11:34, Burhan Khalid wrote:



Alex Scott wrote:



Hi there,
I discovered that our website was not working properly today (To  
my  horror).

Hosted on redhat enterprise 4.
I think that there is a problem with php 4.4 talking to Apache  
mysql 4.1
as the php pages which do not talk to the DB are working but  
other  php pages are working.





This has been asked before, and answered (even by me).

You need http://php.net/mysqli or change your MySQL configuration  
so that it allows 'old style' passwords.


Google for the rest, or STFA :)

Regards,
Burhan







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



[PHP] Need help with for loop, pulling MySQL data, completely lost

2005-08-21 Thread Dan Trainor

Hello, all -

As a pet project of mine, I've decided to write a bit of code.  This is 
what I have, and it's not working as expected:


if ($action == prepareforupdate) {
@unlink(UPDATES/.$id./9.jpg);
$query0 = SELECT * FROM updates WHERE id=.$id.;
if (!$dbdata = mysql_query($query0)) {
echo Can't run query:  .mysql_error();
die;
};

for ($i = 9; $i = 0; $i--) {
$j = $i - 1;

echo Getting ready to rename UPDATES/$id/$j.jpg to
  UPDATES/$id/$i.jpg || nbsp;nbsp;nbsp;nbsp;br /;

@rename(UPDATES/$id/$j.jpg,UPDATES/$id/$i.jpg);

$returned = mysql_fetch_assoc($dbdata);

$query1 = UPDATE updates SET  . $i . d = '
  .$returned[$j.d]. ' WHERE id=' . $id . ';

if (!mysql_query($query1)) {
echo MySQL Error:  .mysql_error();
};

}
}


I have a database in the following format.  Let's say that d stands 
for date, and t stands for times, and I have ten days' worth of 
archives going on:


|id|1d|1t|2d|2t|3d|3t|...|8d|8t|9d|9t|

I'm trying to move the contents of the previous field to the logical 
next field, so the value of field 8d becomes 9d, the value of 7t 
becomes the value of 8t, and so on.


The problem that I'm having here is that only the first iteration of the 
for loop work properly.  Everything after that, is not being pulled up 
properly, I suspect.  This is what MySQL shows:


174 Query   SELECT * FROM updates WHERE id=5
174 Query   UPDATE updates SET 9d = '2005-08-21' WHERE id='5'
174 Query   UPDATE updates SET 8d = '' WHERE id='5'

174 Query   UPDATE updates SET 1d = '' WHERE id='5'
174 Query   UPDATE updates SET 0d = '' WHERE id='5'

So all in all, I think I might be a bit out of my league here, but I am 
eager to learn.  I think of this as more of a dynamic approach to a 
situation that I'm trying to adapt to.


As always, any feedback, or flames for that matter, would be greatly 
appreciated.


Thanks
-dant

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



Re: [PHP] Problem between php4.4 and mysql

2005-08-21 Thread Alex Scott

Also I am using mysql 4.1.12 and mysql Is designed to work with 4.1.13?

Can anybody suggest to me how I might fix this problem please???

Alex.


On 21 Aug 2005, at 12:23, Alex Scott wrote:



On 21 Aug 2005, at 12:08, Alex Scott wrote:



Thanks for reply,

But just briefly, why should it have been working for the past  
month o.k?


Kind regards,

Alex.


On 21 Aug 2005, at 11:34, Burhan Khalid wrote:




Alex Scott wrote:




Hi there,
I discovered that our website was not working properly today (To  
my  horror).

Hosted on redhat enterprise 4.
I think that there is a problem with php 4.4 talking to Apache  
mysql 4.1
as the php pages which do not talk to the DB are working but  
other  php pages are working.






This has been asked before, and answered (even by me).

You need http://php.net/mysqli or change your MySQL configuration  
so that it allows 'old style' passwords.


Google for the rest, or STFA :)

Regards,
Burhan












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



Re: [PHP] Need help with for loop, pulling MySQL data, completely lost

2005-08-21 Thread Evan Priestley

Dan,

When you run the second query ($query1), its results overwrite the  
results of your first query ($query0). `mysql_fetch_assoc()'  
returns results from the _most recent_ query, so after the first  
iteration, the call to `mysql_fetch_assoc()' is returning results  
from `query1', not from `query0'.


To solve this, retrieve all data from `query0' before iterating over  
it. Sample code in /painstakingly exact/ PHP which I have tested  
extensively:


?php

run query0

while( rows exist )
$rows[] = get next row

foreach $rows
for i = 0; i = 0; i-- {
   build query1
   run query1
   }
?

Excellent description of your problem, by the way; this one's tricky  
and definitely had me for a while when I first ran into it.


Evan

On Aug 21, 2005, at 7:24 AM, Dan Trainor wrote:


Hello, all -

As a pet project of mine, I've decided to write a bit of code.   
This is what I have, and it's not working as expected:


if ($action == prepareforupdate) {
@unlink(UPDATES/.$id./9.jpg);
$query0= SELECT * FROM updates WHERE id=.$id.;
if (!$dbdata = mysql_query($query0)) {
echo Can't run query:  .mysql_error();
die;
};

for ($i = 9; $i = 0; $i--) {
$j = $i - 1;

echo Getting ready to rename UPDATES/$id/$j.jpg to
  UPDATES/$id/$i.jpg || nbsp;nbsp;nbsp;nbsp;br /;

@rename(UPDATES/$id/$j.jpg,UPDATES/$id/$i.jpg);

$returned = mysql_fetch_assoc($dbdata);

$query1 = UPDATE updates SET  . $i . d = '
  .$returned[$j.d]. ' WHERE id=' . $id . ';

if (!mysql_query($query1)) {
echo MySQL Error:  .mysql_error();
};

}
}


I have a database in the following format.  Let's say that d  
stands for date, and t stands for times, and I have ten days'  
worth of archives going on:


|id|1d|1t|2d|2t|3d|3t|...|8d|8t|9d|9t|

I'm trying to move the contents of the previous field to the  
logical next field, so the value of field 8d becomes 9d, the  
value of 7t becomes the value of 8t, and so on.


The problem that I'm having here is that only the first iteration  
of the for loop work properly.  Everything after that, is not being  
pulled up properly, I suspect.  This is what MySQL shows:


174 Query   SELECT * FROM updates WHERE id=5
174 Query   UPDATE updates SET 9d = '2005-08-21' WHERE id='5'
174 Query   UPDATE updates SET 8d = '' WHERE id='5'

174 Query   UPDATE updates SET 1d = '' WHERE id='5'
174 Query   UPDATE updates SET 0d = '' WHERE id='5'

So all in all, I think I might be a bit out of my league here, but  
I am eager to learn.  I think of this as more of a dynamic approach  
to a situation that I'm trying to adapt to.


As always, any feedback, or flames for that matter, would be  
greatly appreciated.


Thanks
-dant

--
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] PHP and Prolog

2005-08-21 Thread Rory Browne
I've never really examined the code behind the PHP/MySQL API, but I
would assume, that it is mainly a wrapper for the C MySQL API.

Do you know how to interact with this database in any other language
such as C, Perl, Java etc?

I don't know much about prolog, but a look at www.swi-prolog.org
suggests that it has a two-way C interface. You'd exploit this, by
writing a php Extension in C(see PHP manual), that would interact with
 your prolog app, using the two-way C/C++ interface.

I don't know Prolog, nor anything about it, except that it seems to be
a functional programming language, so take these comments in that
reference frame.


On 8/21/05, Fernando Garza [EMAIL PROTECTED] wrote:
 Hi,
 
 I am creating a Shell in prolog language that interacts with a Visual Prolog
 database format in Win32, I would like to interact with this database with
 PHP, just like the interaction with MySQL database, can you give me some
 notion or the code that need to be executed to get this done? for example
 in:
 
 mysql_connect
 
 or
 
 mysql_create_db
 
 what code is executed behind this functions?
 
 
 I think the functions to make this done should be execute a program with
 some function, passes values and receive values from the shell
 
 
 any idea?
 


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



Re: [PHP] PHP and Prolog

2005-08-21 Thread Edin Kadibašić
Fernando Garza wrote:
 Hi,
 
 I am creating a Shell in prolog language that interacts with a Visual Prolog 
 database format in Win32, I would like to interact with this database with 
 PHP, just like the interaction with MySQL database, can you give me some 
 notion or the code that need to be executed to get this done? for example 
 in:
 
 mysql_connect 
 
 or 
 
 mysql_create_db
 
 what code is executed behind this functions?
 
 
 I think the functions to make this done should be execute a program with 
 some function, passes values and receive values from the shell

These are PHP functions implemented as wrappers around MySQL's C API.
There is no such extension for Prolog.

If your database has an ODBC driver then you can use odbc_* set of
functions.

Edin

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



Re: [PHP] Looking for CMS advice

2005-08-21 Thread Esteamedpw
I would check out Mambo:  _http://mamboserver.com_ (http://mamboserver.com)  
 
- Clint


[PHP] Re: Problem between php4.4 and mysql

2005-08-21 Thread JamesBenson
Sounds like you have a duplicate entry in your httpd.conf for the PHP 
module, 100% of the time ive seen that error is the above reason, so I 
suggest checking your LoadModule * sections, depending whether you have 
a shared libphp4.so module or built-in module there should or shouldnt 
be a LoadModule section present.



HTH



Alex Scott wrote:

Hi there,

I discovered that our website was not working properly today (To my  
horror).

Hosted on redhat enterprise 4.

I think that there is a problem with php 4.4 talking to Apache mysql 4.1
as the php pages which do not talk to the DB are working but other  php 
pages are working.


I restarted apache using the inetd script as well as mysql using the  
inetd script.
However the problem exists. I can enter mysql through the shell and  
tables seem intact.

I have no relevant errors in my log file.

One thing I noticed was that when I went to restart Apache it said ( 
before restarting):
[Sun Aug 21 10:39:08 2005] [warn] module php4_module is already  loaded, 
skipping


Should I try to be loading that module, somehow?

Any suggestions in how to get PHP working with mysql again would be  
much appreciated as it is a busy sight, so slightly stressed.


Thanks Alex.


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



Re: [PHP] Re: Problem between php4.4 and mysql

2005-08-21 Thread Alex Scott


On 21 Aug 2005, at 20:47, Alex Scott wrote:


Thanks,
Yes I found that it was also loading php.conf from conf.d , so  
moved that up a level restartedd apache and that error ceased.
However I am still finding that the database connected php pages  
are not loading.


I don't know why they just seemed to have stopped working, phpbb  
forum as well. When I loging I get a message about might have been  
hacked in the ssh window,

but I don't know if that was just someone trying to login?

Cheers for any more ideas,

Alex.


On 21 Aug 2005, at 19:39, JamesBenson wrote:


Sounds like you have a duplicate entry in your httpd.conf for the  
PHP module, 100% of the time ive seen that error is the above  
reason, so I suggest checking your LoadModule * sections,  
depending whether you have a shared libphp4.so module or built-in  
module there should or shouldnt be a LoadModule section present.



HTH



Alex Scott wrote:



Hi there,
I discovered that our website was not working properly today (To  
my  horror).

Hosted on redhat enterprise 4.
I think that there is a problem with php 4.4 talking to Apache  
mysql 4.1
as the php pages which do not talk to the DB are working but  
other  php pages are working.
I restarted apache using the inetd script as well as mysql using  
the  inetd script.
However the problem exists. I can enter mysql through the shell  
and  tables seem intact.

I have no relevant errors in my log file.
One thing I noticed was that when I went to restart Apache it  
said ( before restarting):
[Sun Aug 21 10:39:08 2005] [warn] module php4_module is already   
loaded, skipping

Should I try to be loading that module, somehow?
Any suggestions in how to get PHP working with mysql again would  
be  much appreciated as it is a busy sight, so slightly stressed.

Thanks Alex.




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








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



Re: [PHP] Re: Problem between php4.4 and mysql

2005-08-21 Thread Jasper Bryant-Greene

On 21 Aug 2005, at 21:24, Jasper Bryant-Greene wrote:


As far as your database problem goes... Have you recently installed
 MySQL 4.1 or has it previously been working with MySQL 4.1?



Alex Scott wrote:

I Installed it about a month ago (from RPM's) and  php 4.4 as well
the two were working together fine until this morning it would seem.
Do you have a theory?



Well, it's hard to say without a bit more detail. Are you able to give 
us the actual error that PHP is giving on the database connected pages?


I assume you are using the mysqli functions rather than the mysql 
functions to access your database?


Please remember to send replies to the list, there are other far more 
knowledgeable people out there who will be able to help too!


Jasper

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



Re: [PHP] Need help with for loop, pulling MySQL data, completely lost

2005-08-21 Thread Dan Trainor

Evan Priestley wrote:

Dan,

When you run the second query ($query1), its results overwrite the  
results of your first query ($query0). `mysql_fetch_assoc()'  returns 
results from the _most recent_ query, so after the first  iteration, the 
call to `mysql_fetch_assoc()' is returning results  from `query1', not 
from `query0'.


To solve this, retrieve all data from `query0' before iterating over  
it. Sample code in /painstakingly exact/ PHP which I have tested  
extensively:


?php

run query0

while( rows exist )
$rows[] = get next row

foreach $rows
for i = 0; i = 0; i-- {
   build query1
   run query1
   }
?

Excellent description of your problem, by the way; this one's tricky  
and definitely had me for a while when I first ran into it.


Evan

On Aug 21, 2005, at 7:24 AM, Dan Trainor wrote:


Hello, all -

As a pet project of mine, I've decided to write a bit of code.   This 
is what I have, and it's not working as expected:


if ($action == prepareforupdate) {
@unlink(UPDATES/.$id./9.jpg);
$query0= SELECT * FROM updates WHERE id=.$id.;
if (!$dbdata = mysql_query($query0)) {
echo Can't run query:  .mysql_error();
die;
};

for ($i = 9; $i = 0; $i--) {
$j = $i - 1;

echo Getting ready to rename UPDATES/$id/$j.jpg to
  UPDATES/$id/$i.jpg || nbsp;nbsp;nbsp;nbsp;br /;

@rename(UPDATES/$id/$j.jpg,UPDATES/$id/$i.jpg);

$returned = mysql_fetch_assoc($dbdata);

$query1 = UPDATE updates SET  . $i . d = '
  .$returned[$j.d]. ' WHERE id=' . $id . ';

if (!mysql_query($query1)) {
echo MySQL Error:  .mysql_error();
};

}
}


I have a database in the following format.  Let's say that d  stands 
for date, and t stands for times, and I have ten days'  worth of 
archives going on:


|id|1d|1t|2d|2t|3d|3t|...|8d|8t|9d|9t|

I'm trying to move the contents of the previous field to the  
logical next field, so the value of field 8d becomes 9d, the  
value of 7t becomes the value of 8t, and so on.


The problem that I'm having here is that only the first iteration  of 
the for loop work properly.  Everything after that, is not being  
pulled up properly, I suspect.  This is what MySQL shows:


174 Query   SELECT * FROM updates WHERE id=5
174 Query   UPDATE updates SET 9d = '2005-08-21' WHERE id='5'
174 Query   UPDATE updates SET 8d = '' WHERE id='5'

174 Query   UPDATE updates SET 1d = '' WHERE id='5'
174 Query   UPDATE updates SET 0d = '' WHERE id='5'

So all in all, I think I might be a bit out of my league here, but  I 
am eager to learn.  I think of this as more of a dynamic approach  to 
a situation that I'm trying to adapt to.


As always, any feedback, or flames for that matter, would be  greatly 
appreciated.


Thanks
-dant

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






Hello, Evan, and thanks for your reply -

I was under the impression that, since I specified $dbdata as the 
argument to mysql_fetch_assoc(), that this would work exclusively with 
query0.  I'm a bit confused as to how query0's return is getting 
overwritten, since I've tried to keep query0 and query1 seperate.


I'm going to drop this whole script, since I've found a much better way 
of keeping records of updates involving one big-ass database, but I'd at 
least like to know what I did wrong in this instance, so that I at least 
learn something.  Your explanation was very helpful, but please clarify, 
if you would be so kind.


Thanks
-dant

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



[PHP] Resizing thumbnails to the browser

2005-08-21 Thread Murray @ PlanetThoughtful
Hello All,

 

I have a series of thumbnails on my site of photos I've taken that are all
150px in width, but of variable height. I want to randomly display one of
the thumbnails each time the home page of my site is loaded in a column that
is 140px wide.

 

I'm wondering if anyone can point me at some code that would achieve this?
All of the thumbnails are in jpg format.

 

So, essentially, I'm trying to resize the thumbnails down to 140px wide
while maintaining the aspect ratio of the image's height.

 

I have GD enabled.

 

Any help appreciated!

 

Much warmth,

 

Murray

---

http://www.planetthoughtful.org

Building a thoughtful planet,

one quirky comment at a time.

 



Re: [PHP] Re: Problem between php4.4 and mysql

2005-08-21 Thread Jasper Bryant-Greene

M. Sokolewicz wrote:

Jasper Bryant-Greene wrote:


Well, it's hard to say without a bit more detail. Are you able to give 
us the actual error that PHP is giving on the database connected pages?


I assume you are using the mysqli functions rather than the mysql 
functions to access your database?


just in case you didn't know, mysqli wasn't available before PHP 5.0.0. 
The user states to be using PHP 4.4.x




Apologies, didn't read his email properly. In that case, do you have 
MySQL set up to accept old passwords? The password-hashing function 
changed with MySQL 4.1, and the mysql PHP function uses the old function.


Please remember to send replies to the list, there are other far more 
knowledgeable people out there who will be able to help too!


Again, *please* send replies to the list as well, not just me!

Jasper

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



Re: [PHP] php explained in sql

2005-08-21 Thread Jose Miguel
We should use:

if (!empty($mydata-email))

 in php, right?

On 8/19/05, Jasper Bryant-Greene [EMAIL PROTECTED] wrote:
 John Taylor-Johnston wrote:
  In php, if I wanted to know if $mydata-email contained something, I
  would do this, right?
  if ($mydata-email)
  {}
 
  How would I express this in SQL (MySQL)?
 
 That doesn't tell you if $mydata-email contains something. It tells you
 whether the value of $mydata-email, when cast to boolean, equals TRUE.
 If $mydata-email equaled zero or the string 0, it would still contain
 something, but that if statement would not get executed.
 
 In MySQL, it would depend on the datatype. You could do any of the
 following, depending on what you actually want to do:
 
 colname''
 colname0
 colname IS NOT NULL
 
 Or, if you're in MySQL = 5.0.2 and are using true boolean values:
 
 colname IS TRUE
 
 or, if you just want to check if it's TRUE or UNKNOWN:
 
 colname IS NOT FALSE
 
 
 Jasper
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Jose Arce
http://sinexion.com - http://josearce.com

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



Re: [PHP] Resizing thumbnails to the browser

2005-08-21 Thread Richard Lynch
On Sun, August 21, 2005 3:04 pm, Murray @ PlanetThoughtful wrote:
 I have a series of thumbnails on my site of photos I've taken that are
 all
 150px in width, but of variable height. I want to randomly display one
 of
 the thumbnails each time the home page of my site is loaded in a
 column that
 is 140px wide.

 I'm wondering if anyone can point me at some code that would achieve
 this?
 All of the thumbnails are in jpg format.

 So, essentially, I'm trying to resize the thumbnails down to 140px
 wide
 while maintaining the aspect ratio of the image's height.

The scaling is easy.

It's getting the damn browsers not to screw up that's hard :-)

Actually, a cheap and easy way would be to just use:
img src=/image150.jpg width=140

The penalties are:
1. The browser downloads a 150x??? image which is a TINY bit larger
than 140x???, but, really, this is negligible.

2. The browser has to scale the image, and that's slow if it's a
really really old slow computer.


But, to do it right server-side.

1. Edit a .htaccess file and add this to it:
Files thumbnail
  ForceType application/x-httpd-php
/Files

This informs Apache that your 'thumbnail' file is REALLY a PHP file,
even without the .php on the end.

2. Put this in 'thumbnail':

?php
//Untested...
  $path = /full/hard/drive/directory/path/to/your/images/;
  $image = imagecreatefromjpeg(filename($path . $_SERVER['PATH_INFO']));
  $width = imagesx($image);
  $height = imagesy($image);
  $new_width = 140;
  $new_height = round(140 * $height/$width);
  $new_image = imagecreatetruecolor($new_width, $new_height);
  // resource dst_image, resource src_image, int dst_x, int dst_y, int
src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h
  imagecopyresamples($new_image, $image, 0, 0, 0, 0, $new_width,
$new_height, $width, $height);
  ob_start();
  imagejpeg($new_image);
  $data = ob_get_contents();
  ob_end_clean();
  header(Content-type: image/jpeg);
  header(Content-length:  . strlen($data));
  echo $data;
?

Now, to use this script, make an IMG tag like:

img src=thumbnail/original150image.jpg width=140

The browser will never know the image is dynamic, nor that you are
using PHP, and that's the way you want it.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] support for database interaction

2005-08-21 Thread Richard Lynch
On Sat, August 20, 2005 11:58 pm, Fernando Garza wrote:
 I am creating a 'Shell' in prolog language that interacts with a
 'Visual
 Prolog' database format in 'Win32', I would like to interact with this
 database with 'PHP', just like the interaction with 'MySQL' database,
 can
 you give me some notion or the code that need to be executed to get
 this
 done? for example in:

 'mysql_connect'

 or

 'mysql_create_db'

 what code is executed behind this functions?

The code in question can be found at:

http://cvs.php.net/

Or you can use anonymous CVS to get the bleeding-edge version of PHP
and develop a new module for Prolog.

 I think the functions to make this done should be execute a program
 with
 some function, passes values and receive values from the 'shell'

That would not be anything like the way MySQL works.

Though if you find it easier to do it that way, and can afford the
performance penalty of a shell execution on each query, go for it.  It
would probably be fine for low-volume and maybe even moderate volume
sites.  It would almost-for-sure fail miserably on a high-volume
server.

But if you're more interested in making it work today on your box than
making it work for everybody a year (or 2) from now, then that's maybe
the way to go.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] apache sessions

2005-08-21 Thread Richard Lynch
On Sat, August 20, 2005 1:41 pm, Bawt T. Eggdrop wrote:
 im trying to change my session backend for apache from files to mysql.
 is there something php provides that allows a php script to execute
 before each page gets loaded in apache. if not i have to edit hundreds
 of php files...theres gotta be an easier way. thanks.

In an ideal world, the line of code did 'session_start();' would have
been designed in your code to be in ONE file that got included by
everything else.

In that case, you would only have one (1) file to edit, in which you
would do http://php.net/session_set_save_handler (or whatever it is)

Now, assuming you've got a zillion session_start() lines scattered
through your files, you should consider doing two things.

1. Fix it the Right Way (tm) and move all those into a 'globals.inc'
include file that all those files ?php include 'globals.inc';?

2. Quick hack use php.ini auto_prepend feature to force a file to be
executed at the top of every file in your site.  This may be a
short-term way to keep working while #1 is the long-term project... 
OTOH, a good sed script, or even just a real long vi session with :%sg
:wn can fix the session_start() problem the right way, so it's not
gonna take THAT long to do it right.

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: exec ping

2005-08-21 Thread mikespook
The PEAR package Net_Monitor and Net_Ping is useful for you. It`s esay way 
to detact the host~~

^_^

Juan Pablo Herrera [EMAIL PROTECTED] 
??:[EMAIL PROTECTED]
Hi all!
I have following script:
$comando = system('ping 168.192.0.1', $nn);
echo $nn;
Well, i need that only show the first ten lines of the ping and kill
the process.
How can i make it?

Regards,
JP 

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



Re: [PHP] __sleep, __wakeup and persistent connections

2005-08-21 Thread Richard Lynch
On Sat, August 20, 2005 6:33 am, Marcus Bointon wrote:
 I'm sorting out some code to handle session object storage,

I can't help with the OO stuff.

 given that the connection is persistent, and may thus be used by
 other scripts, is calling mysql_close a particularly bad idea? Should
 I just not bother closing the connection, letting PHP deal with it -
 the object will not attempt to re-use the stale connection because it
 will get a new instance courtesy of __wakeup when unserialized.

The persistence is all on the MySQL side -- From PHP's perspective,
it's more like a re-usable or a return for deposit connection :-)

When you close the persistent connection, MySQL still keeps around
the data structures to re-use it for the next script, which is what
persistent really means.

You don't have to close the connection -- PHP *is* going to close it
for you as the script ends.

When the same process (Apache child) asks for a connection with the
same username/password from MySQL, MySQL can re-use the existing data
structures to save the time of building them.  That time is actually
rather expensive, as it involves a lot of buffers, structures, and, I
believe, a fair amount of resource-locking to be sure the current
connection will not be in a race condition with other connections for
things like mysql_insert_id() and, if you use innoDB, transactions.

So saving this time for MySQL to build a connection from scratch
instead of using the parts laying around from the last one is the
persistent connection.

HTH

NOTE: Be sure you have a few *more* max_connections in /etc/my.cnf
than the number of Apache MaxChildren -- Otherwise your Apache
children can lock up all the MySQL persistent connections and leave
you with Apache children starved for MySQL connection, as well as NO
WAY for you to use mysqladmin or mysqldump since *ALL* the available
connections are taken up by your Apache server.  That's bad.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] preg_match

2005-08-21 Thread Richard Lynch
On Sat, August 20, 2005 5:00 am, John Nichel wrote:
 Personally, I have never used \\ in PCRE when looking for things like
 spaces (\s), word boundraries (\b), etc. and it's all worked out fine.

Personally, {
I
  } have
never {
used
proper
indenting
in
my
code } and
it's
all
worked
  out
fine;

:-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Hardware Detection

2005-08-21 Thread Richard Lynch
On Fri, August 19, 2005 9:55 pm, Saenal M wrote:
 Can we get information about hardware on client's PC. (e.g. hard disk,
 processor, keyboard, etc).? And How?
 anyone knows? please reply back.

Not only is it not possible, most of that information is NONE OF YOUR
DAMN BUSINESS!!! :-)

You can assume that if the browser is sending the headers to indicate
that I prefer French, then I probably have a keyboard that makes
French characters.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] php explained in sql

2005-08-21 Thread John Taylor-Johnston

varchar:
   colname''
Thanks,
John

Jasper Bryant-Greene wrote:


John Taylor-Johnston wrote:

In php, if I wanted to know if $mydata-email contained something, I 
would do this, right?

if ($mydata-email)
{}

How would I express this in SQL (MySQL)?



That doesn't tell you if $mydata-email contains something. It tells 
you whether the value of $mydata-email, when cast to boolean, equals 
TRUE. If $mydata-email equaled zero or the string 0, it would still 
contain something, but that if statement would not get executed.


In MySQL, it would depend on the datatype. You could do any of the 
following, depending on what you actually want to do:


colname''
colname0
colname IS NOT NULL

Or, if you're in MySQL = 5.0.2 and are using true boolean values:

colname IS TRUE

or, if you just want to check if it's TRUE or UNKNOWN:

colname IS NOT FALSE


Jasper


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