php-general Digest 16 Jan 2005 22:48:32 -0000 Issue 3231

2005-01-16 Thread php-general-digest-help

php-general Digest 16 Jan 2005 22:48:32 - Issue 3231

Topics (messages 206465 through 206489):

PHP date returns wrong value ??
206465 by: Michael Gale
206479 by: Jason Wong

Re: Adding up query results
206466 by: Chris

which is best php editor?
206467 by: QT
206469 by: Ville Mattila
206471 by: Michelle Konzack
206472 by: trobi
206480 by: QT

Re: Protected Mail System
206468 by: allan.lodestone.co.za

Re: SMTP Server
206470 by: eriksson.php.net

printer_open() command in redhatlinux 9, php 4.3.9
206473 by: Muditha Fernando

Any idea when 4.3.11 will be released?
206474 by: Gal
206475 by: Jeffery Fernandez
206478 by: Gal
206485 by: DvDmanDT

Only variables can be passed by reference -  Preg_match Fatal error
206476 by: Chandana Bandara
206477 by: Adrian

Re: Comman line vs. phpinfo()
206481 by: Joseph E. Maxwell
206484 by: DvDmanDT
206487 by: Marek Kilimajer

Problem with foreatch()
206482 by: Ben Edwards (lists)
206483 by: DvDmanDT
206486 by: James Kaufman

Re: Persistent PHP web application?
206488 by: Zouari Fourat

socket_connect giving me weird error
206489 by: Adam Hubscher

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---
Hello,
	I have a web page that loads php code from another file using include, 
the second file calls a function from a third file after doing a include 
on it.

I am running php 4.3.7
Below is the snip of code that gets called to update the database. The 
problem is with the tentry_time value.

The part of the code:
$query .=  tentry_time = ' . date(H:j:s) . ',;
For some reason ... the value for seconds is always off, if I do a 
update, then another one right way, the value that gets stored in the 
database for the second entry will occure before the first according to 
the number of seconds.

Here is some data from the DB after a select statement, you can see that 
the times do not follow the auto-increment value (first field).
26 |15 | 2005-01-15  | 23:15:27| 1  | 90   | 
Testing updates|

27 |15 | 2005-01-15  | 23:15:33| 1  | 90   | 
Another update ... |

28 |15 | 2005-01-15  | 23:15:07| 1  | 90   | 
Testing a 4 entry

--snip--
if (($_POST) AND (isset($_POST['newentry']))) {
	$check=0;
	if ($_POST['ticket_id'] != $ticket) {
		$check=1;
		$status=li class=errorERROR -- YOU DO NOT HAVE ACCESS TO THIS 
TICKET !/li\n;
	}

	if ($check==0) {
		$query=INSERT INTO tentry_table SET ticket_id = ' . $ticket . ',;
		$query .=  tentry_date = ' . date(Y-m-d) . ',;
		$query .=  tentry_time = ' . date(H:j:s) . ',;
		$query .=  tentry_rep = ' . $_SESSION['userid'] . ',;
			if ((isset($_POST['tentry_ctime'])) AND $_POST['tentry_ctime']  5 
and $_POST['tentry_ctime']  90) {
$query .=  tentry_ctime = ' . 
mysql_real_escape_string($_POST['tentry_ctime']) . ',;
			} else {
$query .=  tentry_ctime = '90',;
}
			if ((isset($_POST['tentry_body'])) AND strlen($_POST['tentry_body']) 
 5) {
			$query .=  tentry_body = ' . 
mysql_real_escape_string($_POST['tentry_body']) . ';
			} else {
			 $status=li class=errorERROR with entry -- appears to be empty 
!/li\n;
			 $check=1;
			 }
--snip--

Anyone have any ideas ??
Michael.
---End Message---
---BeginMessage---
On Sunday 16 January 2005 15:22, Michael Gale wrote:

Not a direct answer to your problem ...

   $query=INSERT INTO tentry_table SET ticket_id = ' . $ticket . ',;
   $query .=  tentry_date = ' . date(Y-m-d) . ',;
   $query .=  tentry_time = ' . date(H:j:s) . ',;

1) When doing something involving date/time it is best practice to assign 
date/time *once* to a variable then work off of that variable. This ensures 
that your date/time is consistent withing that block of code.

2) If there is no particular reason why you are storing the date and the time 
separately why not just use a DATETIME field? Then you can just use the 
builtin db function NOW(). Or, if that datetime never changes once assigned, 
you could even use a TIMESTAMP field.

-- 
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
--
New Year Resolution: Ignore top posted posts
---End Message---
---BeginMessage---
You should be able to do this:
select sum(quantity*price) from sale 

[PHP] [ANN] Kwartz-php 0.3.2 - a template system for PHP, Ruby, and Java

2005-01-16 Thread Makoto Kuwata
Hi all,

I'm pleased to announce the release of Kwartz-php 0.3.2.
This is a bugfix release.
  http://www.kuwata-lab.com/kwartz-php


Changes from 0.3.0:
  * [bug:1099306] KwartzAnalyzer#analyze() now analyzes BEGIN and END macro.
  * [bug:1098862] KwartzParser#parse_block_stmt() fratten the block-statement 
which is returned by parse_load_stmt().
  * [enhance] new class KwartzErbTranslator added
  * [change] KwartzAnalyzeVisitor class now extends KwartzVisitor class

  see http://www.kuwata-lab.com/kwartz-php/ChangeLog.html for details.



What's that?

  Kwartz-php is a template system which is available with multi
  programming language (PHP, Ruby and Java).
  And it is the first template system that realized the concept of
  'Separation of Presentation Logic and Presentaion data' (SoPL/PD).
  
  It is available to separate the presentation layer from the
  main program with any template system. In addition, Kwartz-php
  enables you to separate the presentation logics (iteration and
  conditional branching) from the presentation data (HTML file).


Features:
  * Separates presentation logic from presentation data.
  * Runs very fast
  * Supports multiple programing languages (PHP/Ruby/Java)
  * Doesn't break HTML design at all
  * Handles any text file
  * Supports Auto-Sanitizing and Partial-Sanitizing


Example:

  * Presentation Data (example.html)
  - There is no iteration nor conditional branching
in the presentation data file.

table
  tr id=mark:values
td@{$var}@/td
  /tr
/table

  
  * Presentation Logic (example.plogic)
  - There is no HTML tags in the presentation logic file.

## Re-define an element
element values {  ## element
  foreach ($list as $var) {
@stag;## start tag
@cont;## content
@etag;## end tag
  }
}


  * Compile
  - Generate an output script from presentation data
and presentation logic.

$ kwartz-php   -p example.plogic example.html  example.php

$ kwartz-php -l eruby  -p example.plogic example.html  example.rhtml

$ kwartz-php -l jstl11 -p example.plogic example.html  example.jsp


  * Output Script
(PHP)

table
?php foreach ($list as $var) { ?
  tr
td?php echo $var; ?/td
  /tr
?php } ?
/table


(eRuby)

table
% for var in list do %
  tr
td%= var %/td
  /tr
% end %
/table


(JSTL)

%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %
table
c:forEach var=var items=${list}
  tr
tdc:out value=${var} escapeXml=false//td
  /tr
/c:forEach
/table


The above examples shows:
 * Presentation data (= HTML file) doesn't contain any logics.
 * Presentation logic file doesn't contain any data.
 * These are separated from the main program.
 
The command-line option '-e' escapes the HTML special chars
with 'htmlspecialchars()' in PHP, 'CGI::escapeHTML()' in eRuby,
and 'c:out/' tag without 'escapeXml=false' in JSTL.


Web Page:
  http://www.kuwata-lab.com/kwartz-php

Download:
  https://www.kuwata-lab.com/kwartz-php/download.html

Users Guide:
  http://www.kuwata-lab.com/kwartz-php/users-guide.en.html

Reference Manual:
  http://www.kuwata-lab.com/kwartz-php/reference.en.html

ChangeLog:
  http://www.kuwata-lab.com/kwartz-php/ChangeLog.html


I hope you'd like it.

--
regards,
kwatch

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



[PHP] Re: Protected Mail System

2005-01-16 Thread allan

Protected Mail System Test.


+++ Attachment: No Virus found
+++ MC-Afee AntiVirus - www.mcafee.com


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

[PHP] which is best php editor?

2005-01-16 Thread QT
dear Sirs,

I try to use a couple of php editor, but I am not satisfied with them.

Any suggestion for good php editor.

best regards

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



Re: [PHP] which is best php editor?

2005-01-16 Thread Ville Mattila
QT wrote:
Any suggestion for good php editor.
My favourite PHP editor is jEdit, one of the best applications ever 
created. =) http://www.jedit.org/

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

[PHP] Re: SMTP Server

2005-01-16 Thread eriksson

Protected message is attached.


+++ Attachment: No Virus found
+++ Kaspersky AntiVirus - www.kaspersky.com


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

[PHP] Re: which is best php editor?

2005-01-16 Thread Michelle Konzack
Am 2005-01-16 11:29:50, schrieb QT:
 dear Sirs,
 
 I try to use a couple of php editor, but I am not satisfied with them.
 
 Any suggestion for good php editor.

notepad.exe :-)

But I prefer mc/mcedit.

 best regards

Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/ 
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSM LinuxMichi
0033/3/8845235667100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


Re: [PHP] Search Engine Friendly URLs

2005-01-16 Thread Greg Donald
On Fri, 14 Jan 2005 13:46:54 -0500, Josh
[EMAIL PROTECTED] wrote:
 I am converting a site to use includes instead of a Dreamweaver template.  I
 want the URLs to look like this: www.my-site1234.com/contact instead of
 www.my-site1234.com/default.php?p=contact.
 
 I found some tutorials on editing the .htaccess file but where do I find it
 on the server?

The .htaccess file is created in the web directory where your .php
files are.  It affects all directories from there down.


Looks like you may want something like this:

RewriteEngine on
RewriteRule ^([A-Za-z].*) default.php?p=$1 [L,qsappend]


You might also want

RewriteRule ^$ default.php?p=index [L,qsappend]

for a catch-all bounce to the homepage.


http://httpd.apache.org/docs/mod/mod_rewrite.html


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

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



[PHP] PHP date returns wrong value ??

2005-01-16 Thread Michael Gale
Hello,
	I have a web page that loads php code from another file using include, 
the second file calls a function from a third file after doing a include 
on it.

I am running php 4.3.7
Below is the snip of code that gets called to update the database. The 
problem is with the tentry_time value.

The part of the code:
$query .=  tentry_time = ' . date(H:j:s) . ',;
For some reason ... the value for seconds is always off, if I do a 
update, then another one right way, the value that gets stored in the 
database for the second entry will occure before the first according to 
the number of seconds.

Here is some data from the DB after a select statement, you can see that 
the times do not follow the auto-increment value (first field).
26 |15 | 2005-01-15  | 23:15:27| 1  | 90   | 
Testing updates|

27 |15 | 2005-01-15  | 23:15:33| 1  | 90   | 
Another update ... |

28 |15 | 2005-01-15  | 23:15:07| 1  | 90   | 
Testing a 4 entry

--snip--
if (($_POST) AND (isset($_POST['newentry']))) {
	$check=0;
	if ($_POST['ticket_id'] != $ticket) {
		$check=1;
		$status=li class=errorERROR -- YOU DO NOT HAVE ACCESS TO THIS 
TICKET !/li\n;
	}

	if ($check==0) {
		$query=INSERT INTO tentry_table SET ticket_id = ' . $ticket . ',;
		$query .=  tentry_date = ' . date(Y-m-d) . ',;
		$query .=  tentry_time = ' . date(H:j:s) . ',;
		$query .=  tentry_rep = ' . $_SESSION['userid'] . ',;
			if ((isset($_POST['tentry_ctime'])) AND $_POST['tentry_ctime']  5 
and $_POST['tentry_ctime']  90) {
$query .=  tentry_ctime = ' . 
mysql_real_escape_string($_POST['tentry_ctime']) . ',;
			} else {
$query .=  tentry_ctime = '90',;
}
			if ((isset($_POST['tentry_body'])) AND strlen($_POST['tentry_body']) 
 5) {
			$query .=  tentry_body = ' . 
mysql_real_escape_string($_POST['tentry_body']) . ';
			} else {
			 $status=li class=errorERROR with entry -- appears to be empty 
!/li\n;
			 $check=1;
			 }
--snip--

Anyone have any ideas ??
Michael.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Adding up query results

2005-01-16 Thread Chris
You should be able to do this:
select sum(quantity*price) from sale where dvd_id=1
Chris
Nathan Mealey wrote:
I hope someone can help with this frustratingly simple (I assume!) 
question I have.

I run this mysql query: select sum(quantity)*price,price from sale 
where dvd_id=1 group by price;

I get this result:
sum(quantity)*price price
450.0015.00
 29.99 29.99
I want to display the sum of the values in the first column 
(450.00+29.99), but I cannot figure out how to do this! Can someone 
clue me in?

Thanks a million,
Nathan
--
Nathan Mealey
Website Manager  Administrative Director
Cycle-Smart, Inc.
P.O. Box 1482
Northampton, MA
01061-1482
[EMAIL PROTECTED]
(413) 210-7984
(512) 681-7043 Fax
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: which is best php editor?

2005-01-16 Thread trobi
Michelle Konzack  wrote / napsal (a):
Am 2005-01-16 11:29:50, schrieb QT:
 

dear Sirs,
I try to use a couple of php editor, but I am not satisfied with them.
Any suggestion for good php editor.
   

notepad.exe :-)
But I prefer mc/mcedit.
 

best regards
   

Greetings
Michelle
 

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


[PHP] printer_open() command in redhatlinux 9, php 4.3.9

2005-01-16 Thread Muditha Fernando
Hi,

Can printer_open() command be used in redhatlinux 9, php 4.3.9.
It works fine under win2000.

Pls help.

Regards
Muditha Fernando

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



[PHP] Any idea when 4.3.11 will be released?

2005-01-16 Thread Gal
Hello,
I'm Working in organization which also using php on the Windows platform.
Because of the security holes in the older version and a COM bug at PHP 
4.3.10 (http://bugs.php.net/bug.php?id=31159) we are using a problematic 
version.

Does anyone here knows - what is the status of the release of 4.3.11 ?
Regards,
Gal
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Any idea when 4.3.11 will be released?

2005-01-16 Thread Jeffery Fernandez
Gal wrote:
Hello,
I'm Working in organization which also using php on the Windows platform.
Because of the security holes in the older version and a COM bug at 
PHP 4.3.10 (http://bugs.php.net/bug.php?id=31159) we are using a 
problematic version.

Does anyone here knows - what is the status of the release of 4.3.11 ?
Regards,
Gal
*[23 Dec 2004 2:43am CET] [EMAIL PROTECTED]
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
cheers,
JefferyFernandez
http://melbourne.ug.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Only variables can be passed by reference - Preg_match Fatal error

2005-01-16 Thread Chandana Bandara
hi 

When i try to compile this code it gives following error.
bFatal error/b:  Only variables can be passed by reference in 
b/var/www/html/hello/test.php/b on line b16/bbr /

I have defined variable for to match some string patterns / symbols.
when i execute that code for   preg_match , gives this fatal error .

?php

$user=root;
$pass=pass;
$db=database;
$pattern=[ _  : ] ;
   
 $dblink = mysql_connect(localhost:3306, $user, $pass)or 
die(Could not connect to db);
 mysql_select_db($db) or die (can't select the db);

 $result = mysql_query (select ServiceNo,Reply from Acknowledgement 
order by ServiceNo) or die (Invalid query);
 while ( $rset= mysql_fetch_array($result)) {
/* Lets check the reply with the database*/
$chk_msg= $rset[Reply];
//echo checking $chk_msg in $msgbr;
if ( preg_match($pattern,/$chk_msg/,$msg, $match) ) {
// match found
$SQL=update ServiceStatus set Status = 'UP' where 
ServiceNo=.$rset[ServiceNo];
mysql_query ($SQL) or die (Invalid 2nd query);
}else{

}

}
mysql_close($dblink);

?

how can i prevent this problem ???


Thanx in advance
chandana

Re: [PHP] Only variables can be passed by reference - Preg_match Fatal error

2005-01-16 Thread Adrian
check your preg_match() call...

things like $pattern and $msg are the spawn of satan btw.
there is ABSOLUTELY NO REASON to put variables in quotation marks
except that php has to parse the string which is slower than php just
seeing the variable.
and when a functions expects a reference, $variable will cause a
fatal error like it happens in your script.

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



Re: [PHP] Any idea when 4.3.11 will be released?

2005-01-16 Thread Gal
Hi Jeffery,
Thanks for the info.
I'm happy to read that the problem has been fixed. but i don't intend to 
use a CVS version on a production machine.

This is the reason i asked for info on the official 4.3.11 release date.
Do you have any idea when it is planned ?
Thanks,
Gal
Jeffery Fernandez wrote:
Gal wrote:
Hello,
I'm Working in organization which also using php on the Windows platform.
Because of the security holes in the older version and a COM bug at 
PHP 4.3.10 (http://bugs.php.net/bug.php?id=31159) we are using a 
problematic version.

Does anyone here knows - what is the status of the release of 4.3.11 ?
Regards,
Gal
*[23 Dec 2004 2:43am CET] [EMAIL PROTECTED]
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
cheers,
JefferyFernandez
http://melbourne.ug.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP date returns wrong value ??

2005-01-16 Thread Jason Wong
On Sunday 16 January 2005 15:22, Michael Gale wrote:

Not a direct answer to your problem ...

   $query=INSERT INTO tentry_table SET ticket_id = ' . $ticket . ',;
   $query .=  tentry_date = ' . date(Y-m-d) . ',;
   $query .=  tentry_time = ' . date(H:j:s) . ',;

1) When doing something involving date/time it is best practice to assign 
date/time *once* to a variable then work off of that variable. This ensures 
that your date/time is consistent withing that block of code.

2) If there is no particular reason why you are storing the date and the time 
separately why not just use a DATETIME field? Then you can just use the 
builtin db function NOW(). Or, if that datetime never changes once assigned, 
you could even use a TIMESTAMP field.

-- 
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
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] which is best php editor?

2005-01-16 Thread QT
hi Ville,

I just download jedit to my windows 2000. Wth my experience, jar contents
are working slow on windows. Same jedit works much slower than editplus on
my computer.

Are you using jedit with windows? can I increase performance?

Best regards

Ville Mattila [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 QT wrote:
  Any suggestion for good php editor.

 My favourite PHP editor is jEdit, one of the best applications ever
 created. =) http://www.jedit.org/

 Ville


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



[PHP] Diff: Comman line vs. phpinfo()

2005-01-16 Thread Joseph E. Maxwell
Just upgraded to php 4.3.10
phpinfo() apparently stuck on
 PHP Version 4.3.5
System  FreeBSD xxx.com 4.9-STABLE FreeBSD 4.9-STABLE #0: Wed Nov 
i386
Build Date  Apr 11 2004 20:01:52

Command line  ==
  php -v
  PHP 4.3.10 (cli) (built: Jan 15 2005 12:54:11)
  Copyright (c) 1997-2004 The PHP Group
  Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
Is this a php or an Apache problem. I did do an Apache restart !
Thanks


[PHP] Problem with foreatch()

2005-01-16 Thread Ben Edwards (lists)
I have the following Code:

  foreatch( $_POST[mtype] as $akey = $avalue ) {
echo $akey, $avaluebr;
  }

When I run it I get:

  Parse error: parse error, unexpected T_AS   
  in /var/www/mb/mb_estab_update.php on line 58

58 is the line with the foreatch on it.  However if I replace it with:

  print_r( $_POST[mtype] );

I get:

  Array ( [1] = RESTAURANT [2] = BEVERAGEWINE [3] = MAIN )

so the array is populated, what am I doing Wrong?

Regards,
Ben
-- 
Ben Edwards - Poole, UK, England
If you have a problem sending me email use this link
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)



signature.asc
Description: This is a digitally signed message part


[PHP] Re: Problem with foreatch()

2005-01-16 Thread DvDmanDT
Well, it's spelled foreach, not foreatch, that's why you get the error..

-- 
// DvDmanDT
MSN: dvdmandt¤hotmail.com
Mail: dvdmandt¤telia.com
Ben Edwards [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]

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



[PHP] Re: Comman line vs. phpinfo()

2005-01-16 Thread DvDmanDT
My guess is that something went wrong when you upgraded your PHP
installation.. Maybe you didn't recompile Apache with the new PHP version or
something..

-- 
// DvDmanDT
MSN: dvdmandt¤hotmail.com
Mail: dvdmandt¤telia.com
Joseph E. Maxwell [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 Just upgraded to php 4.3.10
 phpinfo() apparently stuck on


   PHP Version 4.3.5


 System FreeBSD xxx.com 4.9-STABLE FreeBSD 4.9-STABLE #0: Wed Nov i386
 Build Date Apr 11 2004 20:01:52



 Command line  ==
php -v
PHP 4.3.10 (cli) (built: Jan 15 2005 12:54:11)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies


 Is this a php or an Apache problem. I did do an Apache restart !

 Thanks


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



Re: [PHP] Any idea when 4.3.11 will be released?

2005-01-16 Thread DvDmanDT
They aren't talking about it on internals.. Not much on QA neither.. So..
Don't expect a release tomorrow.. :p CVS version might be the best option if
that bug is a problem..:p

-- 
// DvDmanDT
MSN: dvdmandt¤hotmail.com
Mail: dvdmandt¤telia.com
Gal [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 Hi Jeffery,

 Thanks for the info.

 I'm happy to read that the problem has been fixed. but i don't intend to
 use a CVS version on a production machine.

 This is the reason i asked for info on the official 4.3.11 release date.
 Do you have any idea when it is planned ?

 Thanks,
 Gal


 Jeffery Fernandez wrote:
  Gal wrote:
 
  Hello,
 
  I'm Working in organization which also using php on the Windows
platform.
  Because of the security holes in the older version and a COM bug at
  PHP 4.3.10 (http://bugs.php.net/bug.php?id=31159) we are using a
  problematic version.
 
  Does anyone here knows - what is the status of the release of 4.3.11 ?
 
  Regards,
  Gal
 
  *[23 Dec 2004 2:43am CET] [EMAIL PROTECTED]
 
  This bug has been fixed in CVS.
 
  Snapshots of the sources are packaged every three hours; this change
  will be in the next snapshot. You can grab the snapshot at
  http://snaps.php.net/.
 
  cheers,
  JefferyFernandez
  http://melbourne.ug.php.net

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



Re: [PHP] Problem with foreatch()

2005-01-16 Thread James Kaufman
On Sun, Jan 16, 2005 at 03:20:26PM +, Ben Edwards (lists) wrote:
 I have the following Code:
 
   foreatch( $_POST[mtype] as $akey = $avalue ) {
 echo $akey, $avaluebr;
   }
 
 When I run it I get:
 
   Parse error: parse error, unexpected T_AS   
   in /var/www/mb/mb_estab_update.php on line 58
 
 58 is the line with the foreatch on it.  However if I replace it with:
 
   print_r( $_POST[mtype] );
 
 I get:
 
   Array ( [1] = RESTAURANT [2] = BEVERAGEWINE [3] = MAIN )
 
 so the array is populated, what am I doing Wrong?
 
 Regards,
 Ben

You could try:

foreach( $_POST[mtype] as $akey = $avalue ) {
echo $akey, $avaluebr;
}

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



Re: [PHP] Diff: Comman line vs. phpinfo()

2005-01-16 Thread Marek Kilimajer
Joseph E. Maxwell wrote:
Just upgraded to php 4.3.10
phpinfo() apparently stuck on
 PHP Version 4.3.5
System FreeBSD xxx.com 4.9-STABLE FreeBSD 4.9-STABLE #0: Wed Nov 
i386
Build Date Apr 11 2004 20:01:52


Command line  ==
  php -v
  PHP 4.3.10 (cli) (built: Jan 15 2005 12:54:11)
  Copyright (c) 1997-2004 The PHP Group
  Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
Is this a php or an Apache problem. I did do an Apache restart !
Thanks

Where is apache looking for the php module?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Persistent PHP web application?

2005-01-16 Thread Zouari Fourat
but u dont need to reinitialise your variables every time the script
loads, u need just to init them once and u get what you want wherever
you want in your files


On Sun, 16 Jan 2005 11:38:48 +0800, Xuefer Tinys [EMAIL PROTECTED] wrote:
 $_SESSION is same as it use serialize/unserialize, alghough there're
 some difference
 
 
 On Sat, 15 Jan 2005 10:06:58 +0100, Zouari Fourat [EMAIL PROTECTED] wrote:
  what about using $_SESSION arrays ?
 
 
  On Fri, 14 Jan 2005 19:28:24 -0500, Al [EMAIL PROTECTED] wrote:
   George Schlossnagle addresses exactly your requirement in his book 
   Advanced PHP
   Programming.
  
   Josh Whiting wrote:
Dear list,
   
My web application (an online classifieds server) requires a set of
fairly large global arrays which contain vital information that most all
the page scripts rely upon for information such as the category list,
which fields belong to each category, and so on. Additionally, there are
a large number of function definitions (more than 13,000 lines of code
in all just for these global definitions).
   
These global arrays and functions never change between requests.
However, the PHP engine destroys and recreates them every time. After
having spent some serious time doing benchmarking (using Apache Bench),
I have found that this code takes at least 7ms to parse per request on
my dual Xeon 2.4ghz server (Zend Accelerator in use*). This seriously
cuts into my server's peak capacity, reducing it by more than half.
   
My question is: is there a way to define a global set of variables and
functions ONCE per Apache process, allowing each incoming hit to run a
handler function that runs within a persistent namespace? OR, is it
possible to create some form of shared variable and function namespace
that each script can tap?
   
AFAIK, mod_python, mod_perl, Java, etc. all allow you to create a
persistent, long-running application with hooks/handlers for individual
Apache requests. I'm surprised I haven't found a similar solution for
PHP.
   
In fact, according to my work in the past few days, if an application
has a large set of global functions and variable definitions, mod_python
FAR exceeds the performance of mod_php, even though Python code runs
significantly slower than PHP code (because in mod_python you can put
all these definitions in a module that is loaded only once per Apache
process).
   
The most promising prospect I've come across is FastCGI, which for Perl
and other languages, allows you to run a while loop that sits and
receives incoming requests (e.g. while(FCGI::accept() = 0) {..}).
However, the PHP/FastCGI modality seems to basically compare to mod_php:
every request still creates and destroys the entire application
(although the PHP interpreter itself does persist).
   
Essentially I want to go beyond a persistent PHP *interpreter* (mod_php,
PHP/FastCGI) and create a persistent PHP *application*... any
suggestions?
   
Thanks in advance for any help!
Regards,
J. Whiting
   
* - Please note that I am using the Zend Accelerator (on Redhat
Enterprise with Apache 1.3) to cache the intermediate compiled PHP code.
My benchmarks (7ms+) are after the dramatic speedup provided by the
accelerator. I wouldn't even bother benchmarking this without the
compiler cache, but it is clear that a compiler cache does not prevent
PHP from still having to run the (ableit precompiled) array and function
definition code itself.
  
   --
   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] socket_connect giving me weird error

2005-01-16 Thread Adam Hubscher
Warning: socket_connect() expects parameter 3 to be long, string given 
in testing.php on line 21
Couldn't Create Socket: Success

It actually spits that across for every socket I'm trying to connect.
I'm doing an online status for multiple servers, which I have tested to 
work when I simply do a socket_connect($sock,$url,$port); on the port 
numbers of the various servers. The servers all reside on the same IP 
address.

The script actually works manually, ie if i put the actual port in to 
the socket_connect function call. However, as soon as I put the variable 
in - it wont work.

The code looks like so:
foreach ($servers as $key = $value){
	$currport = $servers[$key]['Port']; // was attempting this to see if it 
would work - it did not either. Normally tried $servers[$key]['Port'] 
directly.
	if(!socket_connect($sock, 'rmoff.ath.cx', $currport)){
		print(Couldn't Create Socket:  . 
socket_strerror(socket_last_error()). \n); // Debugging purposes
		$output .= Server Name:  . $Servers[$key]['Name'].  ~~ Offline br /;
	}
	else{
		$output .= Server Name:  . $Servers[$key]['Name'].  ~~ Online br /;
	}
}

I cant quite find anything that is... actually wrong with the code. I 
dont understand the error all that much either, as it says Success in 
it. Needless to say - I'm thoroughly confused!

Anyone help me out?
Thanks!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Socket_Connect returning unusual error

2005-01-16 Thread Adam Hubscher
Warning: socket_connect() expects parameter 3 to be long, string given 
in testing.php on line 21
Couldn't Create Socket: Success

It actually spits that across for every socket I'm trying to connect.
I'm doing an online status for multiple servers, which I have tested to 
work when I simply do a socket_connect($sock,$url,$port); on the port 
numbers of the various servers. The servers all reside on the same IP 
address.

The script actually works manually, ie if i put the actual port in to 
the socket_connect function call. However, as soon as I put the variable 
in - it wont work.

The code looks like so:
foreach ($servers as $key = $value){
$currport = $servers[$key]['Port']; // was attempting this to see 
if it would work - it did not either. Normally tried 
$servers[$key]['Port'] directly.
if(!socket_connect($sock, $ip, $currport)){
print(Couldn't Create Socket:  . 
socket_strerror(socket_last_error()). \n); // Debugging purposes
$output .= Server Name:  . $Servers[$key]['Name'].  ~~ 
Offline br /;
}
else{
$output .= Server Name:  . $Servers[$key]['Name'].  ~~ 
Online br /;
}
}

I cant quite find anything that is... actually wrong with the code. I 
dont understand the error all that much either, as it says Success in 
it. Needless to say - I'm thoroughly confused!

Anyone help me out?
Thanks!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] cron job style php...

2005-01-16 Thread Russell P Jones
I have written a simple script that when a date in an array matches todays
date, it sends an email (notifies me when bills are due). Any ideas on how
to make this run once a day? Can you do a cron job on a PHP prog?

Russ Jones

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



[PHP] Phonetic speller function

2005-01-16 Thread Dotan Cohen
Hi all,
I am creating an app that will take any word and return an array with all the 
possible ways of spelling it. I wrote a function that replaces letter(s) with 
other letter(s) with similar sounds. For instance, 'pink' returns:

Array
(
[0] = pink
[1] = pinc
[2] = pynk
[3] = pync
[4] = peenk
[5] = peenc
)

The code looks like this:

?php
printpre\n;

if (!$band) { $band=Pink Floyd; }
$band=strtolower($band);
$misspells = array($band);

function mispel ($was,$willbe) {
  global $misspells;
  global $newarr;
  $newarr = array();
  foreach ($misspells as $mis) {
$newarr[] = str_replace($was, $willbe, $mis);
  }
  foreach ($newarr as $new) {
$misspells[] = $new;
  }
  $misspells = array_unique ($misspells);
}

mispel('c','k');
mispel('c','s');
mispel('k','c');
mispel('s','c');
mispel('l','ll');
mispel('t','tt');
mispel('i','y');
mispel('i','ee');
mispel('f','ph');

$misspells = array_unique ($misspells);
print_r($misspells);

print/pre;
? 

I don't know how obvious it is from my code, but I'm fairly new to php and 
programming in general (I certainly don't make my living this way!). My big 
obstacle now is replacing letters that appear twice in the word, such as 
kayak. Focusing only on the 'k's I get this array: kayak, cayac. But I need 
kayak, kayac, cayak, cayac.

I have just spent the last four hours of my life getting all exited about 
exploding and imploding and str*** and replacing needles in haystacks with 
the php manual (and the comments!!!). But it proves far beyond my ability to 
command my little compter to give me four possible spellings of kayak.

So I now turn to the popular php community for advise. What functions could be 
reccommended to complete the task? Is there a better way of doing this? Was I 
better off trying to do it with explode/implode or is the replace method 
better? Neither of them worked for me... Maybe a completely different 
approach? And ideas would be great, links to tutorials, code snippets, 
sggestions as to aproaches, cups of coffee...

Thanks guys.

Dotan Cohen

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



Re: [PHP] cron job style php...

2005-01-16 Thread Randy Johnson
Russel,
Yes you can run a cron job on php
You may have to add a line like this at the top, it has been awhile since I 
have done it]

#! /usr/local/php/sapi/cli/php
this line would be different for your system
-Randy
- Original Message - 
From: Russell P Jones [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Sunday, January 16, 2005 6:00 PM
Subject: [PHP] cron job style php...


I have written a simple script that when a date in an array matches todays
date, it sends an email (notifies me when bills are due). Any ideas on how
to make this run once a day? Can you do a cron job on a PHP prog?
Russ Jones
--
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] cron job style php...

2005-01-16 Thread Hans Zaunere

 I have written a simple script that when a date in an array matches todays
 date, it sends an email (notifies me when bills are due). Any ideas on how
 to make this run once a day? Can you do a cron job on a PHP prog?

It can, and run basically like any other shell script.

The first line needs to be the dash-bang that point to your PHP binary.

#!/usr/local/php/bin/php
?php

Note that the opening tag is required.  No closing tag is required.
 
Note that you can/should compile PHP to contain the CLI binary (new releases
do).  You can check what kind of PHP binary you have using -v:

Shell /usr/local/php/bin/php -v

To keep track of scripts that I run under Apache, versus those that run on
the command line, I use the .psh extension on those that run on the command
line.


---
Hans Zaunere
President, Founder
New York PHP
http://www.nyphp.org

Gmail: The 1gb spam catcher 

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



Re: [PHP] cron job style php...

2005-01-16 Thread Bret Hughes
On Sun, 2005-01-16 at 17:00, Russell P Jones wrote:
 I have written a simple script that when a date in an array matches todays
 date, it sends an email (notifies me when bills are due). Any ideas on how
 to make this run once a day? Can you do a cron job on a PHP prog?
 
 Russ Jones


Never tried it but on linux (RHL or Fedora) I would add a file to
/etc/cron.daily with something like this in it

/usr/bin/php /usr/local/bin/myjob.php

where myjob.php  is the php script.  if it runs from the command link
now it should work.  This will run as root of course and if you wnated
it to be run as someone else you could probably add the line:

0 2 * * * username /usr/bin/php /usr/local/bin/myjob.php

to /etc/crontab  or the users crontab without the username field.

hth

Bret

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



Re: [PHP] Phonetic speller function

2005-01-16 Thread Greg Donald
On Mon, 17 Jan 2005 01:07:12 +0200, Dotan Cohen
[EMAIL PROTECTED] wrote:
 I am creating an app that will take any word and return an array with all the
 possible ways of spelling it.

PHP has soundex, which may greatly assist in what you are doing:

php.net/soundex

Lots of good examples in the user comments.


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

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



Re: [PHP] use php to determine user OS

2005-01-16 Thread Greg Donald
On Sat, 15 Jan 2005 18:30:02 -0800, Graham Anderson [EMAIL PROTECTED] wrote:
 is there a php function out there that can get the operating system of
 the user...Mac/PC/Linux

$_SERVER[ 'HTTP_USER_AGENT' ]


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

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



Re: [PHP] imagejpeg() output

2005-01-16 Thread Greg Donald
On Sat, 15 Jan 2005 08:39:16 -0800, Steven Simmons [EMAIL PROTECTED] wrote:
 I'm trying to write an object oriented system for saving my uploaded
 files to a blog.
 
 I am using php to resize the original photos and save a thumbnail .
 
 When I get all done, I want to do something like this:
 
$tempImageData = imagejpeg( $imageResource, '', 75 );
$outputHandler - save ( $tempImageData );
 
 Where the $outputHandler is an object that knows how/where to save the file.
 However, I've noticed that imagejpeg() only returns a number 1.
 
 This worked on my previous server, but I'm guessing my new server has a
 newer version of php.
 
 What am I doing wrong? How can i pass the raw jpeg data to a function?

To resize the image you have to create a new image handler to write
the new jpeg data to.  You can create that image handler with
imagecreatetruecolor() for example.

imagejpeg() is for outputting the data to the browser.


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

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



[PHP] cancel 20050116225111.60153.qmail@lists.php.net

2005-01-16 Thread webmaster
This message was cancelled from within Mozilla.

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



[PHP] Encoding problems using phpMyAdmin

2005-01-16 Thread Lars B. Jensen
I seem to have problems getting phpMyAdmin showing shift_jis properly, after 
upgrading to PHP5 on my FreeBSD box. mySQL is running version 4.1.8.

My application works excellent, the problem only exist in phpmyadmin.

Anyone ran into this problem before ? I've tried to google for it, but didnt 
really find anything on it ?

I did as a test update the phpmyadmin sourcecode to force shift_jis charset 
rather than UTF8 which it seems to prefer, to no apparent difference.

-- 
Lars B. Jensen, Internet Architect

CareerCross Japan
Japan's premier online career resource for english speaking professionals

http://www.careercross.com

Re: [PHP] Phonetic speller function

2005-01-16 Thread Richard Lynch
Dotan Cohen wrote:

 kayak. Focusing only on the 'k's I get this array: kayak, cayac. But I
 need
 kayak, kayac, cayak, cayac.

You may (or may not) be able to get something going with that extra
optional last argument to str_replace which tells how many characters to
replace.

str_replace('k', 'c', 'kayak', 1) == cayak

You probably should step back and use soundex, or one of the other sound
like modules in PHP as Greg suggested though, as a word with THREE k's in
it will maybe be too much hassle...

-- 
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] socket_connect errors

2005-01-16 Thread Adam Hubscher
Ok, I had made a post earlier but bout 5min later I figured out the 
problem (I had spaces and returns that were in the array beside the ports).

The code looks like this:
if(($sock = socket_create(AF_INET,SOCK_STREAM,SOL_TCP))  0){
	print(Couldn't Create Socket:  . 
socket_strerror(socket_last_error()). \n);
}
socket_set_option($sock, SOL_SOCKET,SO_RCVTIMEO, array('sec' = 1, 
'usec' = 0));
$output = '';
for($i = 0; $i  count($file); $i++){
	$servernum = $file[$i];
	$i++;
	$servername = $file[$i];
	$serverport = $file2[$i];
	$serverport = preg_replace('/\s/','',$serverport);
	
	// Test if server online - if not, output offline. If yes, output Online.
	if(!socket_connect($sock, $ip, $mapport)){
		print(Couldn't Create Socket:  . 
socket_strerror(socket_last_error()). \n); // Debug
		$output .= Server Name:  . $servername.  ~~ Offline br /;
		continue;
	}
	else{
		$output .= Server Name:  . $servername.  ~~ Online br /;
	}
}

My problem now is that as it runs through the loop - it has a connection 
error. Warning: socket_connect() [function.socket-connect]: unable to 
connect [106]: Transport endpoint is already connected in status.php on 
line 17

Even looking at examples, I cannot figure out why this error is being 
produced. I cannot close the socket at the end of the loop, as it would 
make any further attempts for online status impossible.

The socket_close($sock) is directly after the loop.
Thanks for any help!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Socket_Connect returning unusual error

2005-01-16 Thread Richard Lynch
Adam Hubscher wrote:
 Warning: socket_connect() expects parameter 3 to be long, string given
 in testing.php on line 21
 Couldn't Create Socket: Success

PHP usually auto-converts data -- However it's possible that this
EXPERIMENTAL function (?) doesn't have the magic code down in the guts of
PHP.

So, try type-casting your third parameter to an (int):


  $currport = $servers[$key]['Port']; // was attempting this to see

$currport = (int) $servers[$key]['Port'];

echo currport is: '$currport'br /\n;


If this fixes it, file a bug report at http://bugs.php.net -- search for
the same issue first.  It should get fixed pretty quick-like (relatively
speaking) if that's all it is.

It's also possible that your 'Port' is empty or something...  That's why I
included the 'echo' -- Always hand-check the data you are sending when
weird things happen.

One line of debugging output can save hours of time and fistfuls of hair.

-- 
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] Only variables can be passed by reference - Preg_match Fatal error

2005-01-16 Thread Richard Lynch
Adrian wrote:
 check your preg_match() call...

 things like $pattern and $msg are the spawn of satan btw.
 there is ABSOLUTELY NO REASON to put variables in quotation marks
 except that php has to parse the string which is slower than php just
 seeing the variable.

You'd be hard-pressed to measure a difference, I suspect.

It *IS* a bad thing stylsticly.

 and when a functions expects a reference, $variable will cause a
 fatal error like it happens in your script.

Ouch.

-- 
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] Socket_Connect returning unusual error

2005-01-16 Thread Adam Hubscher
Richard Lynch wrote:
Adam Hubscher wrote:
Warning: socket_connect() expects parameter 3 to be long, string given
in testing.php on line 21
Couldn't Create Socket: Success

PHP usually auto-converts data -- However it's possible that this
EXPERIMENTAL function (?) doesn't have the magic code down in the guts of
PHP.
So, try type-casting your third parameter to an (int):

$currport = $servers[$key]['Port']; // was attempting this to see

$currport = (int) $servers[$key]['Port'];
echo currport is: '$currport'br /\n;
If this fixes it, file a bug report at http://bugs.php.net -- search for
the same issue first.  It should get fixed pretty quick-like (relatively
speaking) if that's all it is.
It's also possible that your 'Port' is empty or something...  That's why I
included the 'echo' -- Always hand-check the data you are sending when
weird things happen.
One line of debugging output can save hours of time and fistfuls of hair.
I actually fixed it by using a simple preg_replace to remove any 
returns/spaces. It was actually imported from a text file and I forgot 
to clean up any excess characters taht could still exist.

However,now I get the error: Couldn't Create Socket: Transport endpoint 
is already connected after it successfully connects once already.

The new code is found in my other post (socket_connect errors), but for 
reference:

if(($sock = socket_create(AF_INET,SOCK_STREAM,SOL_TCP))  0){
print(Couldn't Create Socket:  . 
socket_strerror(socket_last_error()). \n);
}
socket_set_option($sock, SOL_SOCKET,SO_RCVTIMEO, array('sec' = 1, 
'usec' = 0));
$output = '';
for($i = 0; $i  count($file); $i++){
$servernum = $file[$i];
$i++;
$servername = $file[$i];
$serverport = $file2[$i];
$serverport = preg_replace('/\s/','',$serverport);

// Test if server online - if not, output offline. If yes, output 
Online.
if(!socket_connect($sock, $ip, $mapport)){
print(Couldn't Create Socket:  . 
socket_strerror(socket_last_error()). \n); // Debug
$output .= Server Name:  . $servername.  ~~ Offline br /;
continue;
}
else{
$output .= Server Name:  . $servername.  ~~ Online br /;
}
}

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


Re: [PHP] Diff: Comman line vs. phpinfo()

2005-01-16 Thread Richard Lynch
Joseph E. Maxwell wrote:
 Just upgraded to php 4.3.10
 phpinfo() apparently stuck on


   PHP Version 4.3.5


 SystemFreeBSD xxx.com 4.9-STABLE FreeBSD 4.9-STABLE #0: Wed Nov 
 i386
 Build DateApr 11 2004 20:01:52



 Command line  ==
php -v
PHP 4.3.10 (cli) (built: Jan 15 2005 12:54:11)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies


 Is this a php or an Apache problem. I did do an Apache restart !

To make 100% sure your Apache restart actually happened, check the
run-times for your 'httpd' processes or use mod_status (?)
http://127.0.0.1/server-status (http://127.0.0.1/server_status?) which
will print Apache uptime (and other fun stuff)

If you didn't install mod_status, ps auxwww | grep httpd might show it, or
top.

Some Apache restart scripts don't report errors well, so when you THINK
you re-started, you didn't.

Also check the module path in httpd.conf as suggestd, and re-do PHP's
make install paying particular attention to where it puts things...

You may be putting the php*.so in the wrong directory.

-- 
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] imagejpeg() output

2005-01-16 Thread Richard Lynch
Steven Simmons wrote:
 When I get all done, I want to do something like this:

 $tempImageData = imagejpeg( $imageResource, '', 75 );
 $outputHandler - save ( $tempImageData );

 Where the $outputHandler is an object that knows how/where to save the
 file.
 However, I've noticed that imagejpeg() only returns a number 1.

With a blank filename, I think imagejpeg() dumps your JPEG to the browser
and returns true/false for success/failure.  http://php.net/imagejpeg

You'd need to use http://php.net/ob_start and friends to do what you're
trying to do.

-- 
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] control REMOTE_ADDR header

2005-01-16 Thread Richard Lynch
Alawi Albaity wrote:
 how can I can send http request with my chosen REMOTE_ADDR is there a
 class
 to do that or method in php ?

I'm not 100% certain, but I think REMOTE_ADDR comes from data embedded in
the TCP/IP info...

So, basically, you'd have to seriously hack things to forge your return IP
address...  And then the data would go to somebody else.  *WHY* do you
think you need this?...

-- 
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] Encoding problems using phpMyAdmin

2005-01-16 Thread Lars B. Jensen
Just a quick note, this seems to be a bug in phpMyAdmin since 2.5.7-pl1 - I 
submitted a bug report on the sourceforge website and awaits them to handle 
it.

/ Lars 

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


Re: [PHP] Encoding problems using phpMyAdmin

2005-01-16 Thread Randy Johnson
I am just curious why you do not upgrade to the latest stable 2.6.0-pl3?
Randy
- Original Message - 
From: Lars B. Jensen [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Sunday, January 16, 2005 11:40 PM
Subject: Re: [PHP] Encoding problems using phpMyAdmin


Just a quick note, this seems to be a bug in phpMyAdmin since 2.5.7-pl1 - 
I submitted a bug report on the sourceforge website and awaits them to 
handle it.

/ Lars
--
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: Any idea when 4.3.11 will be released?

2005-01-16 Thread Manuel Lemos
Hello,
on 01/16/2005 10:17 AM Gal said the following:
I'm Working in organization which also using php on the Windows platform.
Because of the security holes in the older version and a COM bug at PHP 
4.3.10 (http://bugs.php.net/bug.php?id=31159) we are using a problematic 
version.

Does anyone here knows - what is the status of the release of 4.3.11 ?
There hasn't been even a release candidate, so do not expect a release soon.
Meanwhile, if you can build PHP from the source, you may want to try PHP 
4.3.9 with the Hardened PHP patches that fix the security bugs .

http://www.hardened-php.net/
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Encoding problems using phpMyAdmin

2005-01-16 Thread Lars B. Jensen
I am just curious why you do not upgrade to the latest stable 2.6.0-pl3?
Because, any version in any patch level since 2.5.7-pl1 doesnt display 
shift-jis (japanese) properly - or anyway on my system. They seem to have 
broken the support for it, since that specific version.

/ Lars 

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


Re: [PHP] cron job style php...

2005-01-16 Thread Ligaya Turmelle
Check out here - http://www.htmlcenter.com/tutorials/tutorials.cfm/155/php/
and here -
http://www.phpfreaks.com/tutorials/28/0.php
and if you want to read about my learning with cron try here -
http://www.khankennels.com/blog/index.php?p=103
Hope it all helps.
Respectfully,
Ligaya Turmelle
Russell P Jones wrote:
I have written a simple script that when a date in an array matches todays
date, it sends an email (notifies me when bills are due). Any ideas on how
to make this run once a day? Can you do a cron job on a PHP prog?
Russ Jones

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

[PHP] Persistance objects + importing

2005-01-16 Thread daniel
Hi list, I am needing some advise on the best way of importing classes and
persistance, I am goingto supply some code, and would like to know if sessions 
or share memory is
the best way for it.It currently serializes and unserializes the class from a 
session , i
parse the directory and classusing pear naming standards, i can also send args 
to it. Let me know if
there is a better way ofdoing this, as from the talk serializing is also slow. 
I wonder if this
bit of code could ever becomea php extension ?? That would rock.

import 'PACKAGE_Classname'; or even import PACKAGE_Classname heh :)

becomes require_once('PACKAGE/Classname.php');

new PACKAGE_Classname(); //persist here dont reinclude per page.



function import($class_name,$serialize = null,$parse_dir = true,$args = null)
{
$parse_dir ? $filename = 
preg_replace(/_/,/,$class_name) : $filename =
$class_name;
if ($serialize) {
require_once($filename..php);
if (!isset($_SESSION[''.$class_name.''])) {
if (!$args) {
$class = new $class_name;
} else {
$num_args = func_num_args();
$params = func_get_args();
$class= 
$this-_format_args($class_name,$num_args,$params);
}
$_SESSION[''.$class_name.''] = 
serialize($class);
}
return 
unserialize($_SESSION[''.$class_name.'']);
} else {
require_once($filename..php);
if (!$args) {
return new $class_name;
} else {
$num_args = func_num_args();
$params = func_get_args();
return 
$this-_format_args($class_name,$num_args,$params);
}
}

}


function _format_args($class_name,$num_args,$params)
{
$code = return new {$class_name}(;
if ($num_args = 4) {
$args = array();
for($i=3;$i$num_args;$i++) {
$args[] = '$params[' . $i . ']';
}

$code .= implode(',',$args);
}
$code .= ');';
return eval($code);
}

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



Re: [PHP] Any idea when 4.3.11 will be released?

2005-01-16 Thread Rasmus Lerdorf
On Sun, 16 Jan 2005, Gal wrote:
 I'm Working in organization which also using php on the Windows platform.
 Because of the security holes in the older version and a COM bug at PHP
 4.3.10 (http://bugs.php.net/bug.php?id=31159) we are using a problematic
 version.

I'd just roll back to 4.3.9 and do proper input filtering.  As long as you
don't pass raw user data to unserialize or do something like include
$user_data/foo while allowing $user_data to be huge, you are fine.

-Rasmus

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



Re: [PHP] imagejpeg() output

2005-01-16 Thread Rasmus Lerdorf
On Sat, 15 Jan 2005, Steven Simmons wrote:

 I'm trying to write an object oriented system for saving my uploaded
 files to a blog.

 I am using php to resize the original photos and save a thumbnail .

 When I get all done, I want to do something like this:

 $tempImageData = imagejpeg( $imageResource, '', 75 );
 $outputHandler - save ( $tempImageData );

 Where the $outputHandler is an object that knows how/where to save the file.
 However, I've noticed that imagejpeg() only returns a number 1.

 This worked on my previous server, but I'm guessing my new server has a
 newer version of php.

 What am I doing wrong? How can i pass the raw jpeg data to a function?

What worked on your previous server?  ImageJpeg has never returned the
image data.  It has always either written it to the file you specify, or
if you don't specify one it will output it directly at that point.  If you
want to capture it in a variable you will need to use output buffering.
See php.net/ob_start

-Rasmus

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