[PHP] Server Client Architecture, best parctice

2005-11-17 Thread Yaswanth Narvaneni
Hi!

I would like to know what does the community think of the best
architecture for server client communication and why? That is, if
there is a server in C++ (say a game server) and the PHP has to 'read'
data 'from' the server then what is the best form of communication?

a) Shared Memory : Server opens the shared memory in write and the PHP
scripts open it in read and gets the data
b) TMPFS (just like shared memory): Server opens a file in tmpfs in
write and PHP in read
c) Databases: Server Updates a table in the DB and client reads from the table
d) Files: Same as TMPFS

Regards,
Yaswanth

--
In theory there is no difference between theory and practice.
In practice there is. -- Fortune Cookie

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



[PHP] Re: Server Client Architecture, best parctice

2005-11-17 Thread gOLeM
my friend here forgot to add that it will be a pretty busy website
with lots of requests.
And i would also like to know if there are any other forms of
communication other than the 4 that my friend here specified. Anything
that you people think will be efficient.

On 11/17/05, Yaswanth Narvaneni [EMAIL PROTECTED] wrote:
 Hi!

 I would like to know what does the community think of the best
 architecture for server client communication and why? That is, if
 there is a server in C++ (say a game server) and the PHP has to 'read'
 data 'from' the server then what is the best form of communication?

 a) Shared Memory : Server opens the shared memory in write and the PHP
 scripts open it in read and gets the data
 b) TMPFS (just like shared memory): Server opens a file in tmpfs in
 write and PHP in read
 c) Databases: Server Updates a table in the DB and client reads from the table
 d) Files: Same as TMPFS

 Regards,
 Yaswanth

 --
 In theory there is no difference between theory and practice.
 In practice there is. -- Fortune Cookie



--
Quitters never win and Winners never quit   -- Napolean Hill
In any moment of decision, the best thing you can do is the right
thing, the next best thing is the wrong thing, and the worst thing you
can do is nothing. --Teddy Roosevelt

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



Re: [PHP] Shared Memory Problem

2005-11-17 Thread Jochem Maas

Yaswanth Narvaneni wrote:

Hi!

I found the solution to my prob. SELinux was enabled in the server
which needs disabling. After disabling SELinux it was working great.
Thanks for your help guys.

Another small query though, is there anyway to enable SELinux and as
well use shared memory between PHP and C++? I know using Zend engine


the zend engine is free.. I think you mean 'Zend Some Product Name' instead 
:-)


would solve the prob, but we need to buy zend which is very costly for
me, any other solution is welcome.


I have no idea if it either possible or efficient enough for your
needs but you may be able to use pipes?

http://php.net/proc_open




Regards,
Yaswanth

On 11/16/05, Curt Zirzow [EMAIL PROTECTED] wrote:


On Wed, Nov 16, 2005 at 03:33:22AM +0530, Yaswanth Narvaneni wrote:


Hi!

I have a server written in C++ and my webpages are in PHP. The PHP has
to communicate with the server using shared memory. This was working
fine on the server running FC-1 with php-4.3.8. We recently migrated
to CentOS 4.1 (Equivalent to RHEL 4.1) running php-4.3.9. The error it
displays is as follows:

shmop_open(): unable to attach or create shared memory segment in
/var/www/html/sharedmem.php on line 2

The server opens the shm in 666 (originally was 644) even then it was
not working. I can see the shared mem open using 'ipcs' command.

...
$shm_id = shmop_open($shm_key, a,0,0) or die(FATAL ERROR:: Unable
to Access Shared Memory);


You might want to try to open it within the same mode that the
server created it in:

1)
 $shm_id = shmop_open($shm_key, a,0666,0);

2)
 are you 100% sure the key is valid? the error message you are
 getting seems to point in this direction since the shmop_open is
 failing on the C call to shmget(), wich usually fails when either
 you dont have enough memory to create it (which you arn't doing),
 some other creation problems, or that the key supplied wasn't
 found.


Curt.
--

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






--
In theory there is no difference between theory and practice.
In practice there is. -- Fortune Cookie



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



[PHP] plese help

2005-11-17 Thread Aftab Alam
Hello,

I want to create a trigger in PostgresSQL ,

In trigger, Before inserting the record i  want to check that data is
available or not, if data is  not there then the  insert script execute
otherwise trigget check the next insert script.

Please reply.




Regards,
  _

Aftab Alam




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Monday, October 17, 2005 4:06 PM
To: php-general@lists.php.net
Subject: php-general Digest 17 Oct 2005 10:35:46 - Issue 3742



php-general Digest 17 Oct 2005 10:35:46 - Issue 3742

Topics (messages 224207 through 224218):

Funky array question
224207 by: Brian Dunning
224209 by: Minuk Choi
224210 by: Jordan Miller
224211 by: Jordan Miller
224212 by: Jordan Miller

Re: editor
224208 by: yangshiqi1089

a couple of problems with PHP form
224213 by: Bruce Gilbert
224218 by: Mark Rees

Re: OPTIMIZING - The fastest way to open and show a file
224214 by: Ruben Rubio Rey
224215 by: Ruben Rubio Rey
224216 by: ac

can't get IIS to run php if the script is not directly under wwwroot
224217 by: tony yau

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


--

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



Re: [PHP] SOAP and PHP

2005-11-17 Thread Angelo Zanetti


Angelo Zanetti wrote:

Hi guys.

I've googled but found so many pages that I'm not sure what to use.

I want to use PHP to make use of SOAP.

I've found:
-nuSoap
-libxml(2)
-php-soap
-and others which seemed less important.

Can you recommend which one to use? and which one is the most supported.
Also if I've missed some that you feel I should know about please let me 
know.

Thanks in advance.

Angelo


 HI guys.

I've found nuSOAP. it seems to work well. Im not using PHP5 so couldnt 
use the suggestions but thanks anyway...


http://dietrich.ganx4.com/nusoap/

regards

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



[PHP] Re: SOAP and PHP

2005-11-17 Thread James Benson



Petr Smith wrote:

Torgny Bjers wrote:


Angelo Zanetti wrote:



Hi guys.

I've googled but found so many pages that I'm not sure what to use.

I want to use PHP to make use of SOAP.

I've found:
-nuSoap
-libxml(2)
-php-soap
-and others which seemed less important.

Can you recommend which one to use? and which one is the most supported.
Also if I've missed some that you feel I should know about please let
me know.
Thanks in advance.

Angelo





Not sure, but there's already a couple of relevant classes in PEAR:
http://pear.php.net/search.php?q=soapin=packagesx=0y=0

A hot tip is to always search in the packages there. :)
http://pear.php.net/packages.php

Warm Regards,
Torgny



Who uses PEAR? Mess of old unsupported and undocumented libraries which 
only their authors (maybe) can use?





LOL, what does your code look like huh?

I use pear when documentation is available or API docs are easily 
understood.


DB, Mime_Mail, HTTP_REQUEST are a few Ive used and still do, your 
obviously not experienced enough to read and reuse others code




I would recommend PHP5 SOAP extension, based on libxml2. It works 
without problems and without messing with PEAR.


You can start with this tutorial: 
http://www-128.ibm.com/developerworks/library/os-phpws/?ca=dgr-lnxw06PHP5soap 



Petr


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



[PHP] Re: Server Client Architecture, best parctice

2005-11-17 Thread James Benson

Are both servers on the same machine?




Yaswanth Narvaneni wrote:

Hi!

I would like to know what does the community think of the best
architecture for server client communication and why? That is, if
there is a server in C++ (say a game server) and the PHP has to 'read'
data 'from' the server then what is the best form of communication?

a) Shared Memory : Server opens the shared memory in write and the PHP
scripts open it in read and gets the data
b) TMPFS (just like shared memory): Server opens a file in tmpfs in
write and PHP in read
c) Databases: Server Updates a table in the DB and client reads from the table
d) Files: Same as TMPFS

Regards,
Yaswanth

--
In theory there is no difference between theory and practice.
In practice there is. -- Fortune Cookie


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



[PHP] Re: unsubscribing

2005-11-17 Thread James Benson
Read the instructions on php.net, their are two different ways to 
unsuscribe, either email or use the web interface,



http://php.net/mailing-lists.php



wayne wrote:

I tried to unsubscribe on several occasion without
success. I followed the instruction at the bottom 
of the email. Can someone take me off the list.

Thank You.


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



[PHP] Wierd error

2005-11-17 Thread Chris Boget

I'm seeing the following line showing up in my logs:

08:08:30  [warning] [Unknown][0]: Unknown(): Unable to call () - function 
does not exist


and I've narrowed it down to this line of code:

settype( $dbObject, null );

When I comment out the above line, the error goes away.  When
I uncomment it out, the error comes back.  I've used both single
and double quotes, I've tried using different types, I've tried passing
the object both by value and by reference but nothing seems to help.

What's going on?

thnx,
Chris

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



[PHP] Re: Server Client Architecture, best parctice

2005-11-17 Thread James Benson
Each has its own benefits, if on a shared server then a database would 
be the most secure I think, if its a dedicated server then tmpfs or just 
plain old files will probably be the best, it also depends on various 
other factors like, server hardware and bandwith, only you can select 
the best option for your particular setup.



James





Yaswanth Narvaneni wrote:

Hi!

I would like to know what does the community think of the best
architecture for server client communication and why? That is, if
there is a server in C++ (say a game server) and the PHP has to 'read'
data 'from' the server then what is the best form of communication?

a) Shared Memory : Server opens the shared memory in write and the PHP
scripts open it in read and gets the data
b) TMPFS (just like shared memory): Server opens a file in tmpfs in
write and PHP in read
c) Databases: Server Updates a table in the DB and client reads from the table
d) Files: Same as TMPFS

Regards,
Yaswanth

--
In theory there is no difference between theory and practice.
In practice there is. -- Fortune Cookie


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



Re: [PHP] Wierd error

2005-11-17 Thread Chris Boget

I'm seeing the following line showing up in my logs:

08:08:30  [warning] [Unknown][0]: Unknown(): Unable to call () - function 
does not exist


and I've narrowed it down to this line of code:


Update, it turns out it's not the settype().  Here's a larger context of the 
offending

area of code:

   $query = 'my query';

   $queryResult = $DBAccess-db-query( $query );

   if( !( DB::isError( $queryResult ))) {
 $tmpArray = array();
 while( $queryResult-fetchInto( $tmpArray )) {
   $dbObject = new IPI_OfficeDetailsInterface();
   $dbObject-_populateMemberVariables( $tmpArray );
   $retval[] = $dbObject;

   $tmpArray = array();
   settype( $dbObject, null );

 }
   }

The line to concentrate on is this one:

$dbObject = new IPI_OfficeDetailsInterface();

If I leave it as above, no error occurs.  But I instead instantiate 
$dbObject

as follows (which is what I was doing originally)

$dbObject = new IPI_OfficeDetailsInterface();

then the error shows up in the log again.  The error only goes away if I 
either

remove the settype() function call or I remove the '' in the instantiation.

Why?

thnx,
Chris 


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



[PHP] Re: Server Client Architecture, best parctice

2005-11-17 Thread Mariano Guadagnini
Reading this, a question arose me: is it possible to read a shared 
memory area with php, supposing than both programs are in the same 
machine? does php support ipc? that would be greatly useful.



Mariano.



James Benson wrote:

Each has its own benefits, if on a shared server then a database would 
be the most secure I think, if its a dedicated server then tmpfs or 
just plain old files will probably be the best, it also depends on 
various other factors like, server hardware and bandwith, only you can 
select the best option for your particular setup.



James





Yaswanth Narvaneni wrote:


Hi!

I would like to know what does the community think of the best
architecture for server client communication and why? That is, if
there is a server in C++ (say a game server) and the PHP has to 'read'
data 'from' the server then what is the best form of communication?

a) Shared Memory : Server opens the shared memory in write and the PHP
scripts open it in read and gets the data
b) TMPFS (just like shared memory): Server opens a file in tmpfs in
write and PHP in read
c) Databases: Server Updates a table in the DB and client reads from 
the table

d) Files: Same as TMPFS

Regards,
Yaswanth

--
In theory there is no difference between theory and practice.
In practice there is. -- Fortune Cookie







--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.3/173 - Release Date: 16/11/2005

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



Re: [PHP] plese help

2005-11-17 Thread Angelo Zanetti
yes Im sure everyone is going to answer seeing that this is a postgres 
list... oh wait its a PHP list.


Sorry buddy, think you're goin to get flamed.


Aftab Alam wrote:

Hello,

I want to create a trigger in PostgresSQL ,

In trigger, Before inserting the record i  want to check that data is
available or not, if data is  not there then the  insert script execute
otherwise trigget check the next insert script.

Please reply.




Regards,
  _

Aftab Alam




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Monday, October 17, 2005 4:06 PM
To: php-general@lists.php.net
Subject: php-general Digest 17 Oct 2005 10:35:46 - Issue 3742



php-general Digest 17 Oct 2005 10:35:46 - Issue 3742

Topics (messages 224207 through 224218):

Funky array question
224207 by: Brian Dunning
224209 by: Minuk Choi
224210 by: Jordan Miller
224211 by: Jordan Miller
224212 by: Jordan Miller

Re: editor
224208 by: yangshiqi1089

a couple of problems with PHP form
224213 by: Bruce Gilbert
224218 by: Mark Rees

Re: OPTIMIZING - The fastest way to open and show a file
224214 by: Ruben Rubio Rey
224215 by: Ruben Rubio Rey
224216 by: ac

can't get IIS to run php if the script is not directly under wwwroot
224217 by: tony yau

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


--



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



[PHP] Re: Wierd error

2005-11-17 Thread James Benson
There is nothing weird when this function takes a variable as the 
argument and your using an object, read the manual



http://php.net/settype



You could try:-

$dbObject = (null) $dbObject;


Ive not tested that but think it should work!



James




Chris Boget wrote:

I'm seeing the following line showing up in my logs:

08:08:30  [warning] [Unknown][0]: Unknown(): Unable to call () - 
function does not exist


and I've narrowed it down to this line of code:

settype( $dbObject, null );

When I comment out the above line, the error goes away.  When
I uncomment it out, the error comes back.  I've used both single
and double quotes, I've tried using different types, I've tried passing
the object both by value and by reference but nothing seems to help.

What's going on?

thnx,
Chris


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



[PHP] Re: plese help

2005-11-17 Thread James Benson





Aftab Alam wrote:

Hello,

I want to create a trigger in PostgresSQL ,

In trigger, Before inserting the record i  want to check that data is
available or not, if data is  not there then the  insert script execute
otherwise trigget check the next insert script.

Please reply.





What, and you expect someone to code this for you?

What was your question?





Regards,
  _

Aftab Alam




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Monday, October 17, 2005 4:06 PM
To: php-general@lists.php.net
Subject: php-general Digest 17 Oct 2005 10:35:46 - Issue 3742



php-general Digest 17 Oct 2005 10:35:46 - Issue 3742

Topics (messages 224207 through 224218):

Funky array question
224207 by: Brian Dunning
224209 by: Minuk Choi
224210 by: Jordan Miller
224211 by: Jordan Miller
224212 by: Jordan Miller

Re: editor
224208 by: yangshiqi1089

a couple of problems with PHP form
224213 by: Bruce Gilbert
224218 by: Mark Rees

Re: OPTIMIZING - The fastest way to open and show a file
224214 by: Ruben Rubio Rey
224215 by: Ruben Rubio Rey
224216 by: ac

can't get IIS to run php if the script is not directly under wwwroot
224217 by: tony yau

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


--


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



[PHP] Suppressing Notices from imap_headerinfo()?

2005-11-17 Thread Mike Walsh
I am using imap_headerinfo() to query articles from an NNTP server.

I have encountered a situation where I can't suppress some notices from 
imap_headerinfo() and I can't figure out why.  It appears that 
imap_headerinfo() doesn't like the e-mail address in the article (which is 
SPAM blocked) and spits out the following:

Notice: (null)(): Unterminated mailbox: [EMAIL PROTECTED] 
(errflg=3) in Unknown on line 0

Notice: (null)(): Must use comma to separate addresses: 
lancaster(DOT.)ac(DOT.)uk (errflg=3) in Unknown on line 0

I have tried calling ob_start() and ob_clean() around my calls to 
imap_headerinfo() as well as adding the '@' character to the call to 
imap_headerinfo().

ob_start() ;
$header = @imap_headerinfo($nntp, $i) ;

$ob = ob_get_contents() ;
ob_clean() ;

Oddly the $ob variable doesn't contain anything which implies that 
imap_headerinfo() is dumping it's notices directly.

Any suggestions on how to suppress these notices?  I don't even use the 
email field in my application.

Thanks,

Mike

--

Mike Walsh -- mike underscore walsh at mindspring dot com 

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



[PHP] Re: How to build a XML DTD on the fly?

2005-11-17 Thread James Benson

Learn DTD and how it works first then you will know :-)


A DTD is contained in an external file and not in XML, so you would 
create a DTD file then link it from the XML like so,



!DOCTYPE document SYSTEM document.dtd





Erik Franzén wrote:
The code below lacks the part where the folling DTD attribute is 
created: !ATTLIST document id ID #IMPLIED


How can I create the above DTD attribute in the code below?

?php
// Creates an instance of the DOMImplementation class
$oDomImp = new DOMImplementation;

// Creates a DOMDocumentType instance
$oDomDtd = $oDomImp-createDocumentType('document', null, null);

// Creates a DOMDocument instance
$oDom = $oDomImp-createDocument(, , $oDomDtd);

// Set other properties
$oDom-encoding = 'iso-8859-1';
$oDom-standalone = true;

// Create an empty element
$oElement = $oDom-createElement('document', 'test');
$oElement-setAttribute('id', '123');
// Append the element
$oDom-appendChild($oElement);

// Retrieve and print the document
echo $oDom-saveXML() . \n;

echo TagName:  . $oDom-getElementById('123')-tagName;
?

Now the code produces the following result:

?xml version=1.0 encoding=iso-8859-1 standalone=yes?
!DOCTYPE document
document id=123test/document

TagName:


Thanks
/Erik


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



[PHP] OS Detection

2005-11-17 Thread Rahul S. Johari

Ave,

I'm working on a Guestbook for a site and I'm trying to identify Browser 
Operating System of the user and eventually I'll display the Icon matching
the Browser/OS in the entry.

I'm able to identify and use an If Conditional statement for the Browser,
but I can't seem to identify the OS.

This is what I'm using to identify the Browser:


function browser_detection( $which_test ) {

// initialize the variables
$browser = '';
$dom_browser = '';

// set to lower case to avoid errors, check to see if http_user_agent is set
$navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ?
strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';

// run through the main browser possibilities, assign them to the main
$browser variable
if (stristr($navigator_user_agent, opera))
{
$browser = 'opera';
$dom_browser = true;
}

elseif (stristr($navigator_user_agent, msie 4))
{
$browser = 'msie4';
$dom_browser = false;
}

elseif (stristr($navigator_user_agent, msie))
{
$browser = 'msie'; 
$dom_browser = true;
}

elseif ((stristr($navigator_user_agent, konqueror)) ||
(stristr($navigator_user_agent, safari)))
{
$browser = 'safari';
$dom_browser = true;
}

elseif (stristr($navigator_user_agent, gecko))
{
$browser = 'mozilla';
$dom_browser = true;
}

elseif (stristr($navigator_user_agent, mozilla/4))
{
$browser = 'ns4';
$dom_browser = false;
}

else 
{
$dom_browser = false;
$browser = false;
}

// return the test result you want
if ( $which_test == 'browser' )
{
return $browser;
}
elseif ( $which_test == 'dom' )
{
return $dom_browser;
//  note: $dom_browser is a boolean value, true/false, so you can just test
if
// it's true or not.
}
}

$user_browser = browser_detection('browser');

echo $user_browser;

if ( $user_browser == 'opera' )
{
echo OPERA;
}
else {
echo SOMETHING ELSE;
}

?

Any suggestions on getting the OS ?

Thanks,

Rahul S. Johari
Coordinator, Internet  Administration
Informed Marketing Services Inc.
251 River Street
Troy, NY 12180

Tel: (518) 266-0909 x154
Fax: (518) 266-0909
Email: [EMAIL PROTECTED]
http://www.informed-sources.com



Re: [PHP] Re: Wierd error

2005-11-17 Thread Chris Boget
There is nothing weird when this function takes a variable as the 
argument and your using an object, read the manual

http://php.net/settype


I'm not sure what you mean here.  Nowhere on the doc page for 
settype() (at least, not that I saw) does it say you can't pass an

object as the first argument.  Or, if you do, there is odd results.
Additionally, we are using settype() to null out/unset objects else
where in our code and that causes no error to show up in the log.

thnx,
Chris

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



[PHP] Re: better way to mix html and php code?

2005-11-17 Thread James Benson
None, their all messy and terribly hard to read, I would use CSS instead 
of tables, that way their would be not much need to change any HTML code 
incase you wanted to re-design your webpage with another style or make 
slight alterations etc, HTML coders should be able to understand CSS so 
would be able to identify the bits of HTML within your PHP code if it 
needed changing, your code would be a lot easier to read using CSS, 
easier to alter and take up roughly 25% less space.



James

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



[PHP] Cookies

2005-11-17 Thread Ben Miller
Is there a way to test if a user has cookies turned on or not so that I can
use cookies if the user allows them and use the URL if the user does not
allow them?

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



Re: [PHP] Cookies

2005-11-17 Thread Dan McCullough
Tried and true is to set a cookie and then attempt to read it, if you
cant read it then cookies are not on.

On 11/17/05, Ben Miller [EMAIL PROTECTED] wrote:
 Is there a way to test if a user has cookies turned on or not so that I can
 use cookies if the user allows them and use the URL if the user does not
 allow them?

 --
 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] Wierd error

2005-11-17 Thread Jochem Maas

Chris Boget wrote:

I'm seeing the following line showing up in my logs:

08:08:30  [warning] [Unknown][0]: Unknown(): Unable to call () - 
function does not exist


and I've narrowed it down to this line of code:



Update, it turns out it's not the settype().  Here's a larger context of 
the offending

area of code:

   $query = 'my query';

   $queryResult = $DBAccess-db-query( $query );

   if( !( DB::isError( $queryResult ))) {
 $tmpArray = array();
 while( $queryResult-fetchInto( $tmpArray )) {
   $dbObject = new IPI_OfficeDetailsInterface();
   $dbObject-_populateMemberVariables( $tmpArray );
   $retval[] = $dbObject;

   $tmpArray = array();
   settype( $dbObject, null );


why not just do:

unset($dbObject);

?



 }
   }

The line to concentrate on is this one:

$dbObject = new IPI_OfficeDetailsInterface();

If I leave it as above, no error occurs.  But I instead instantiate 
$dbObject

as follows (which is what I was doing originally)

$dbObject = new IPI_OfficeDetailsInterface();


so you want to do a bitwise AND on a non-existant variable and a newly creately 
object??
maybe you meant to do:

$dbObject = new IPI_OfficeDetailsInterface();



then the error shows up in the log again.  The error only goes away if I 
either
remove the settype() function call or I remove the '' in the 
instantiation.


Why?

thnx,
Chris


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



Re: [PHP] Cookies

2005-11-17 Thread Richard Davey
Hi Ben,

Thursday, November 17, 2005, 3:26:04 PM, you wrote:

 Is there a way to test if a user has cookies turned on or not so
 that I can use cookies if the user allows them and use the URL if
 the user does not allow them?

Set one? :)

Then check if it exists or not.

This of course will not catch those sneaky buggers who disable cookies
part way through your site just to see what effect it will have.

Cheers,

Rich
-- 
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk

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



Re: [PHP] Cookies

2005-11-17 Thread Robert Cummings
On Thu, 2005-11-17 at 10:33, Richard Davey wrote:
 Hi Ben,
 
 Thursday, November 17, 2005, 3:26:04 PM, you wrote:
 
  Is there a way to test if a user has cookies turned on or not so
  that I can use cookies if the user allows them and use the URL if
  the user does not allow them?
 
 Set one? :)
 
 Then check if it exists or not.
 
 This of course will not catch those sneaky buggers who disable cookies
 part way through your site just to see what effect it will have.

*lol* I do that sometimes... with Javascript too.

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



Re: [PHP] Wierd error

2005-11-17 Thread Chris Boget

why not just do:
unset($dbObject);


We were using unset() for the longest time but found it doesn't
seem to free up the memory.


$dbObject = new IPI_OfficeDetailsInterface();
so you want to do a bitwise AND on a non-existant variable and a newly 
creately object??

maybe you meant to do:
$dbObject = new IPI_OfficeDetailsInterface();


You are right.  My original email contained a typo.  It should have
been '=' as that is what is in our code.

thnx,
Chris

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



Re[2]: [PHP] Cookies

2005-11-17 Thread Richard Davey
Hi Robert,

Thursday, November 17, 2005, 3:39:43 PM, you wrote:

 *lol* I do that sometimes... with Javascript too.

:) it's amazing what you can break by doing that!

Cheers,

Rich
-- 
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk

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



Re: [PHP] Sending arrays from page to page

2005-11-17 Thread Lowell Allen

On Nov 15, 2005, at 12:07 PM, Ben Miller wrote:

I am trying to learn how to work with arrays, and have the basic 
concept
down for working within a single page, but I am having trouble sending 
an
array from one page to another.  For example, I can send a variable 
from
page to page using either the URL, such as www.domain.com/?foo=bar, or 
using
a form, but can I send an array from one page to another using a form 
so

that all the values in the array will be sent?


[snip]

If you don't want to use session variables (as already suggested), you 
can serialize the array, then send as a hidden form value:


http://us2.php.net/manual/en/function.serialize.php

You may need to also encode the serialized value:

http://us2.php.net/manual/en/function.base64-encode.php

HTH

--
Lowell Allen

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



Re: [PHP] OS Detection

2005-11-17 Thread Rahul S. Johari
Ave,

Interesting.
I did get this JavaScript code for OS detection:

// This script sets OSName variable as follows:
// Windowsfor all versions of Windows
// MacOS  for all versions of Macintosh OS
// Linux  for all versions of Linux
// UNIX   for all other UNIX flavors
// Unknown OS indicates failure to detect the OS

var OSName=Unknown OS;
if (navigator.appVersion.indexOf(Win)!=-1) OSName=Windows;
if (navigator.appVersion.indexOf(Mac)!=-1) OSName=MacOS;
if (navigator.appVersion.indexOf(X11)!=-1) OSName=UNIX;
if (navigator.appVersion.indexOf(Linux)!=-1) OSName=Linux;

document.write('Your OS: '+OSName);

Which does serve my purpose. I guess I'll work something with this out.

Thanks.


On 11/17/05 10:21 AM, George Pitcher [EMAIL PROTECTED] wrote:

 Rahul,
 
 The Client OS is a 'client' object, so isn't necessarily passed by the
 Browser. Try javascript.
 
 George
 
 -Original Message-
 From: Rahul S. Johari [mailto:[EMAIL PROTECTED]
 Sent: 17 November 2005 3:10 pm
 To: PHP
 Subject: [PHP] OS Detection
 
 
 
 Ave,
 
 I'm working on a Guestbook for a site and I'm trying to identify Browser 
 Operating System of the user and eventually I'll display the Icon matching
 the Browser/OS in the entry.
 
 I'm able to identify and use an If Conditional statement for the Browser,
 but I can't seem to identify the OS.
 
 This is what I'm using to identify the Browser:
 
 
 function browser_detection( $which_test ) {
 
 // initialize the variables
 $browser = '';
 $dom_browser = '';
 
 // set to lower case to avoid errors, check to see if
 http_user_agent is set
 $navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ?
 strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
 
 // run through the main browser possibilities, assign them to the main
 $browser variable
 if (stristr($navigator_user_agent, opera))
 {
 $browser = 'opera';
 $dom_browser = true;
 }
 
 elseif (stristr($navigator_user_agent, msie 4))
 {
 $browser = 'msie4';
 $dom_browser = false;
 }
 
 elseif (stristr($navigator_user_agent, msie))
 {
 $browser = 'msie';
 $dom_browser = true;
 }
 
 elseif ((stristr($navigator_user_agent, konqueror)) ||
 (stristr($navigator_user_agent, safari)))
 {
 $browser = 'safari';
 $dom_browser = true;
 }
 
 elseif (stristr($navigator_user_agent, gecko))
 {
 $browser = 'mozilla';
 $dom_browser = true;
 }
 
 elseif (stristr($navigator_user_agent, mozilla/4))
 {
 $browser = 'ns4';
 $dom_browser = false;
 }
 
 else
 {
 $dom_browser = false;
 $browser = false;
 }
 
 // return the test result you want
 if ( $which_test == 'browser' )
 {
 return $browser;
 }
 elseif ( $which_test == 'dom' )
 {
 return $dom_browser;
 //  note: $dom_browser is a boolean value, true/false, so you can
 just test
 if
 // it's true or not.
 }
 }
 
 $user_browser = browser_detection('browser');
 
 echo $user_browser;
 
 if ( $user_browser == 'opera' )
 {
 echo OPERA;
 }
 else {
 echo SOMETHING ELSE;
 }
 
 ?
 
 Any suggestions on getting the OS ?
 
 Thanks,
 
 Rahul S. Johari
 Coordinator, Internet  Administration
 Informed Marketing Services Inc.
 251 River Street
 Troy, NY 12180
 
 Tel: (518) 266-0909 x154
 Fax: (518) 266-0909
 Email: [EMAIL PROTECTED]
 http://www.informed-sources.com
 
 
 

Rahul S. Johari
Coordinator, Internet  Administration
Informed Marketing Services Inc.
251 River Street
Troy, NY 12180

Tel: (518) 266-0909 x154
Fax: (518) 266-0909
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



Re: [PHP] Wierd error

2005-11-17 Thread Jochem Maas

Chris Boget wrote:

why not just do:
unset($dbObject);



We were using unset() for the longest time but found it doesn't
seem to free up the memory.


interesting - you are suggesting that settype does free the memory
directly? I have seen a number of posts to internals regarding to
being able to free up memory in long-running/heavy cli scripts...
none of the devs mentioned settype() ... maybe you know something
nobody else does :-)




$dbObject = new IPI_OfficeDetailsInterface();


so you want to do a bitwise AND on a non-existant variable and a newly 
creately object??

maybe you meant to do:
$dbObject = new IPI_OfficeDetailsInterface();



You are right.  My original email contained a typo.  It should have
been '=' as that is what is in our code.


darn, no easy fix then.

why didn't you paste the code verbatim? - typing it over by hand
(or approximating) is a waste of (other) peoples time. (i.e. they are
trying to help you fix code that doesn't really exist)



thnx,
Chris



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



Re: [PHP] Cookies

2005-11-17 Thread Dan McCullough
You can check on every page load, but I'm sure thats over kill for
most public facing sites to catch some Yahoos who have too much time
on their hands.

On 11/17/05, Richard Davey [EMAIL PROTECTED] wrote:
 Hi Ben,

 Thursday, November 17, 2005, 3:26:04 PM, you wrote:

  Is there a way to test if a user has cookies turned on or not so
  that I can use cookies if the user allows them and use the URL if
  the user does not allow them?

 Set one? :)

 Then check if it exists or not.

 This of course will not catch those sneaky buggers who disable cookies
 part way through your site just to see what effect it will have.

 Cheers,

 Rich
 --
 Zend Certified Engineer
 PHP Development Services
 http://www.corephp.co.uk

 --
 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] Wierd error

2005-11-17 Thread Ford, Mike
On 17 November 2005 14:31, Chris Boget wrote:

  I'm seeing the following line showing up in my logs:
  
  08:08:30  [warning] [Unknown][0]: Unknown(): Unable to call () -
  function does not exist 
  
 
 The line to concentrate on is this one:
 
 $dbObject = new IPI_OfficeDetailsInterface();
 
 If I leave it as above, no error occurs.  But I instead instantiate
 $dbObject as follows (which is what I was doing originally)
 
 $dbObject = new IPI_OfficeDetailsInterface();

Should be = -- = is trying to do a bitwise and operation, which isn't 
terribly meaningful when an object is involved!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re[2]: [PHP] Cookies

2005-11-17 Thread Richard Davey
Hi Dan,

Thursday, November 17, 2005, 3:56:43 PM, you wrote:

 You can check on every page load, but I'm sure thats over kill for
 most public facing sites to catch some Yahoos who have too much time
 on their hands.

Is that a new technical term for 'hacker' ? :)

Cheers,

Rich
-- 
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk

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



Re: Re[2]: [PHP] Cookies

2005-11-17 Thread Dan McCullough
:) why of course

On 11/17/05, Richard Davey [EMAIL PROTECTED] wrote:
 Hi Dan,

 Thursday, November 17, 2005, 3:56:43 PM, you wrote:

  You can check on every page load, but I'm sure thats over kill for
  most public facing sites to catch some Yahoos who have too much time
  on their hands.

 Is that a new technical term for 'hacker' ? :)

 Cheers,

 Rich
 --
 Zend Certified Engineer
 PHP Development Services
 http://www.corephp.co.uk

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

2005-11-17 Thread Ben Miller
Hi Ben,

Thursday, November 17, 2005, 3:26:04 PM, you wrote:

 Is there a way to test if a user has cookies turned on or not so
 that I can use cookies if the user allows them and use the URL if
 the user does not allow them?

Set one? :)

Then check if it exists or not.

This of course will not catch those sneaky buggers who disable cookies
part way through your site just to see what effect it will have.

Cheers,

Rich
--
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk

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

In order to set one and then check if it exists or not, I have to set it on
one page, and then test it on the next page load - In this case, I don't
figure out how I need to send information from page to page until they have
already gone to another page, at which point, the test is no longer needed.
I was hoping there might be a browser variable or something like that that
would tell right away if cookies are turned on or not.  If there is not,
perhaps this is something we should lobby the browsers to get?

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



Re: [PHP] Wierd error

2005-11-17 Thread Chris Boget

We were using unset() for the longest time but found it doesn't
seem to free up the memory.

interesting - you are suggesting that settype does free the memory
directly? 


Yes.  Moreso than unset(), at least according to my observations and
tests.

I have seen a number of posts to internals regarding to being able to 
free up memory in long-running/heavy cli scripts... none of the devs 
mentioned settype() ... maybe you know something nobody else does :-)


We have a very process intensive script that creates (and destroys) a
large number of objects.  As this script gets run again and again, we 
would see that the memory load would go through the roof and eventually

cause Apache to crash (among other things; btw - this is running on
a windoze box).  We changed all the unset() to settype() and the
memory usage over the same amount of time dropped dramatically -
significantly, in fact.

thnx,
Chris

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



Re: [PHP] Re: Wierd error

2005-11-17 Thread Chris Boget
There is nothing weird when this function takes a variable as the 
argument and your using an object, read the manual


Are you suggesting that settype() can't be used for objects?  The
documentation doesn't seem to indicate that...


You could try:-
$dbObject = (null) $dbObject;
Ive not tested that but think it should work!


Nope.

Parse error: parse error, unexpected T_VARIABLE in 


thnx,
Chris

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



Re[2]: [PHP] Cookies

2005-11-17 Thread Richard Davey
Hi Ben,

Thursday, November 17, 2005, 4:24:11 PM, you wrote:

 In order to set one and then check if it exists or not, I have to
 set it on one page, and then test it on the next page load - In this
 case, I don't figure out how I need to send information from page to
 page until they have already gone to another page, at which point,
 the test is no longer needed.

You don't have to set / test one on a *PAGE* at all, just from a PHP
script (these are not always the same thing).

Cheers,

Rich
-- 
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk

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



Re: [PHP] OS Detection

2005-11-17 Thread Lowell Allen

On Nov 17, 2005, at 10:09 AM, Rahul S. Johari wrote:

I'm working on a Guestbook for a site and I'm trying to identify 
Browser 
Operating System of the user and eventually I'll display the Icon 
matching

the Browser/OS in the entry.

I'm able to identify and use an If Conditional statement for the 
Browser,

but I can't seem to identify the OS.

This is what I'm using to identify the Browser:


function browser_detection( $which_test ) {

// initialize the variables
$browser = '';
$dom_browser = '';

// set to lower case to avoid errors, check to see if http_user_agent 
is set

$navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ?
strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';

// run through the main browser possibilities, assign them to the main
$browser variable
if (stristr($navigator_user_agent, opera))
{
$browser = 'opera';
$dom_browser = true;
}


[snip]


Any suggestions on getting the OS ?


If you're using the above to match parts of the 
$_SERVER[HTTP_USER_AGENT] string, why not also use stristr() to look 
for windows, mac, etc.?


--
Lowell Allen

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



[PHP] Re: Formatting of a number

2005-11-17 Thread Dan Baker
Scott Parks [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi-

 I have a number that I am trying to format.  It is data coming from a 
 main frame and
 has 8 characters assigned to it (6 and two decimal places).  I have 
 zerofill set up in
 MySQL on this field and am working on the best way to display the  number.

 Currently I have this:

 $sOutput = number_format(rtrim($sValue,'0') /100,2);

 What I am running into is this, I have a number in this field as:
 3145900, using the above I will get:  314.59, which is wrong, it
 needs to be 3,145.90.

 Yet, if I have a number of:  749450, I get the result I am looking for
 of 749.45.

 I did not see a way to tell trim I only want one 0 cut?

Just convert the string into a number, and work with it as a number:

// first, convert the string into a number (assuming 3 decimals, as your 
example shows)
$nValue = floatval($sValue) / 1000;
// then, format it
$sOutput = number_format($nNumber, 2);

DanB

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



[PHP] checkng if string is a number

2005-11-17 Thread blackwater dev
How can I check to see if a string var holds a number?  Is regex the
only way to do this?  For example I have code where the var could hold
10 or ten.  If the string is a number, do one thing, if it isn't
do something else. is_int doesn't work, intval converts ten to a
number so that doesn't work

Thanks!

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



[PHP] Re: better way to mix html and php code?

2005-11-17 Thread Dan Baker
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 Hi to all,
 always wondered what's better way to mix html and php code. Here are three 
 ways of the same code. Which one you prefer? (And why, of caurse :))
(snip)
 I think third solution would be the best solution?

IF you are doing a complex site, then the third option is almost mandatory. 
You typically do not know what code will be in the header, until you have 
processed some of the page.  Building the page as-you-go, allows for easy 
alteration of previously built HTML code.  Complex sites are extremely 
difficult to create using the template approach, because of the variety of 
output.

I would highly agree with James Benson about CSS.

DanB 

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



[PHP] Re: checkng if string is a number

2005-11-17 Thread Ben

blackwater dev said the following on 11/17/2005 11:37 AM:

How can I check to see if a string var holds a number?  Is regex the
only way to do this?  For example I have code where the var could hold
10 or ten.  If the string is a number, do one thing, if it isn't
do something else. is_int doesn't work, intval converts ten to a
number so that doesn't work


is_numeric

http://ca.php.net/is_numeric

- Ben

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



Re: [PHP] checkng if string is a number

2005-11-17 Thread Curt Zirzow
On Thu, Nov 17, 2005 at 02:37:49PM -0500, blackwater dev wrote:
 How can I check to see if a string var holds a number?  Is regex the
 only way to do this?  For example I have code where the var could hold
 10 or ten.  If the string is a number, do one thing, if it isn't
 do something else. is_int doesn't work, intval converts ten to a
 number so that doesn't work

http://php.net/ctype_digit

Curt.
-- 

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



Re: [PHP] checkng if string is a number

2005-11-17 Thread Max Belushkin
  Which version of PHP are you using? On php 4.4.0 (SuSE 10.0 default RPM, not 
custom build, so perhaps I'm missing some extras you're using?) the following 
script works fine:
?php
  if (10==intval(ten)) echo boo\n; else echo no boo\n;
?

  I get no boo. intval doesn't convert my ten to a number. Moreover, the 
output of the following:

?php
  echo intval(ten);
?

  produces an expected (by me) 0.

On Thursday 17 November 2005 20:37, blackwater dev wrote:
 do something else. is_int doesn't work, intval converts ten to a
 number so that doesn't work

 Thanks!

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



Re: [PHP] Re: better way to mix html and php code?

2005-11-17 Thread Robert Cummings
On Thu, 2005-11-17 at 14:34, Dan Baker wrote:
 [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
  Hi to all,
  always wondered what's better way to mix html and php code. Here are three 
  ways of the same code. Which one you prefer? (And why, of caurse :))
 (snip)
  I think third solution would be the best solution?
 
 IF you are doing a complex site, then the third option is almost mandatory. 
 You typically do not know what code will be in the header, until you have 
 processed some of the page.  Building the page as-you-go, allows for easy 
 alteration of previously built HTML code.  Complex sites are extremely 
 difficult to create using the template approach, because of the variety of 
 output.

Ummm... bullturds :)

Here is an example of a layout template:

-
jinn:prepend/
html

head
  titlejinn:pageTitle//title

  style type=text/css
  !--
jinn:template path=css/main.template/
  --
  /style

  jinn:accumulatorFlush name=javaScriptTags/
  jinn:accumulatorFlush name=javaScriptTags dynamic=true/

  script type=text/javascript language=javascript
  !-- //

  jinn:accumulatorFlush name=javaScript/
  jinn:accumulatorFlush name=javaScript dynamic=true/

  function onLoadRoutines()
  {
jinn:accumulatorFlush name=javaScriptOnLoad/
jinn:accumulatorFlush name=javaScriptOnLoad dynamic=true/
  }

  // --
  /script

/head

body onLoad=javascript:onLoadRoutines() bgcolor=#ff
marginheight=5 marginwidth=10 topmargin=0 l
-

Now anywhere in the modules (which incidentally get loaded before the
content), or anywhere else in a sub-template content can be accumulated
in any of the above accumulator names. I have worked on plenty of
complex sites, and my JavaScript and other content always goes EXACTLY
where it's supposed to be, regardless of where the logic exists that
determines it's need to exist. For instance to include on load
javascript from any module:
-

$sAcc = $this-getServiceRef( 'accManager' );
$acc = $sAcc-getAccumulatorRef( 'javaScriptOnLoad' );

$acc-append( alert( 'F!' );\n );

 I would highly agree with James Benson about CSS.

I agree CSS is great, but it's not everything. Custom tags allow one to
embed macro and meta semantics into a page without the cumbersome nature
of PHP function calls. For instance I find this meta tag handy in many
sites I create:

project:searchable
Some content that the site's search feature can search upon.
/project:searchable

Another one that my designer friends REALLY like:

project:restrict access=admin, manager
Some content that only admin and management can view.
/project:restrict

So templates aren't just about making pretty tables, though they can do
that quite well too.

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



Re: [PHP] checkng if string is a number

2005-11-17 Thread Max Belushkin
  If I misunderstood the intval part of your post, than the [proposed already] 
is_numeric solutions are the way to go. is_numeric will, however, unlike the 
conversion functions, return false if there's anything but a number in the 
string, so, i.e., is_numeric (10a1) will return false, but intval (10a1) 
will give 10.

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



Re: [PHP] Re: PHP 4.4.1 on Apache 2.0.x issue

2005-11-17 Thread Max Belushkin
   Hi list,

  Does anyone have any information/updates on this issue perhaps? The thread 
on http://lists.freebsd.org/pipermail/freebsd-ports/2005-November/027056.html 
hasn't had anything new (since Nov 6), and on 
http://bugs.php.net/bug.php?id=35059 it's been stated as fixed ever since 
(Nov 2).

  The FreeBSD php port doesn't seem to have moved past 4.1.1_1, which, as the 
thread implies, still has the problem, and since the PHP CVS commit was made 
4 days before that, I'm [wildly] guessing that fix was already consumed...

  On a side note, has anyone had an issue with PHP and mod_rewrite of the same 
nature on a non-FreeBSD install?

  Thanks!
  Max.

On Tuesday 08 November 2005 21:07, Geert Booster wrote:
 I've seen this problem on a FreeBSD 5.3 machine with Apache2 and PHP
 4.4.1_1. The problem looks to be a problem with mod_rewrite and PHP,
 because the different scripts (MovebleType, Gallery2, Dokuwiki)
 are rewriting and getting the same errors.

 Maybe the following [1] thread on the FreeBSD ports lists does help you.
 I (and the other sysops/users of this machine) are waiting for a patch
 for this problem
 (By PHP developers or maybe the FreeBSD porters, it could be a FreeBSD
 issue) because we don't want to go back to 4.4.0 when it's not needed
 (critically fixes in 4.4.1..)

 You're not the only one :-)

 [1]
 http://lists.freebsd.org/pipermail/freebsd-ports/2005-November/027038.html


 Yours sincerely,

 Geert Booster

 --
 Geert Booster
 [EMAIL PROTECTED]

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



[PHP] Re: Re: better way to mix html and php code?

2005-11-17 Thread Dan Baker
Robert Cummings [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 On Thu, 2005-11-17 at 14:34, Dan Baker wrote:
 [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
  Hi to all,
  always wondered what's better way to mix html and php code. Here are 
  three
  ways of the same code. Which one you prefer? (And why, of caurse :))
 (snip)
  I think third solution would be the best solution?

 IF you are doing a complex site, then the third option is almost 
 mandatory.
 You typically do not know what code will be in the header, until you have
 processed some of the page.  Building the page as-you-go, allows for easy
 alteration of previously built HTML code.  Complex sites are extremely
 difficult to create using the template approach, because of the variety 
 of
 output.

 Ummm... bullturds :)

(snip)

 Now anywhere in the modules (which incidentally get loaded before the
 content), or anywhere else in a sub-template content can be accumulated
 in any of the above accumulator names. I have worked on plenty of
 complex sites, and my JavaScript and other content always goes EXACTLY
 where it's supposed to be, regardless of where the logic exists that
 determines it's need to exist. For instance to include on load
 javascript from any module:

Looks very good.  I rescind my previous post.  I haven't worked with 
templates of this magnitude before.

DanB

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



[PHP] php related segmentation fault with Apache 2.0.55

2005-11-17 Thread kristina clair
Hello,

I am seeing Apache segmentation faults with some processes which turn
out to be php related.  This is a newly upgraded Apache from Apache
2.0.54 to Apache 2.0.55.  The scripts that are failing with the new
Apache work with no problems with the old Apache.

Traceback from Apache is below.

Let me know if I should provide any more info.  php version is 4.3.10,
and linux distro is fedora core 3 - php and apache are both compiled
from source, not installed from rpm.

Thanks,
Kristina

#0  zend_hash_index_update_or_next_insert (ht=0xb7d247a0, h=4, pData=0xbfffec70,
nDataSize=12, pDest=0x0, flag=1) at
/usr/local/src/php-4.3.10/Zend/zend_hash.c:392
nIndex = 4
p = (Bucket *) 0x7068702e
#1  0xb7c6bf23 in zend_list_insert (ptr=0x9b57ba4, type=162888612)
at /usr/local/src/php-4.3.10/Zend/zend_list.c:45
index = 4
le = {ptr = 0xda1a0c4, type = 2, refcount = 1}
#2  0xb7c6c05e in zend_register_resource (rsrc_result=0x0,
rsrc_pointer=0xda1a0c4,
rsrc_type=2) at /usr/local/src/php-4.3.10/Zend/zend_list.c:98
rsrc_id = 162888612
#3  0xb7c452f8 in _php_stream_alloc (ops=0x9b57ba4, abstract=0x9b57ba4,
persistent_id=0x0, mode=0xb762f895 rb)
at /usr/local/src/php-4.3.10/main/streams.c:281
le = {ptr = 0x24, type = 1126289980, refcount = 797960056}
ret = (php_stream *) 0xda1a0c4
#4  0xb7c46b06 in _php_stream_fopen_from_fd (fd=16, mode=0xb762f895 rb,
persistent_id=0x0) at /usr/local/src/php-4.3.10/main/streams.c:2067
self = (php_stdio_stream_data *) 0x9c0871c
stream = (php_stream *) 0x9c08730
sb = {st_dev = 16, __pad1 = 0, st_ino = 3230021650, st_mode = 33188,
  st_nlink = 1, st_uid = 42807, st_gid = 100, st_rdev = 0, __pad2 = 0,
  st_size = 1179, st_blksize = 32768, st_blocks = 8, st_atim = {tv_sec
= 1124473602,
tv_nsec = 315743024}, st_mtim = {tv_sec = 1126289980, tv_nsec = 797960056},
  st_ctim = {tv_sec = 1126289980, tv_nsec = 799959752}, __unused4 = 0,
__unused5 = 0}
#5  0xb7c46c9d in _php_stream_fopen (
filename=0xda143d8 /home/serve/STJOSEPHGC/eventsdb.php,
mode=0xb762f895 rb,
opened_path=0xb1a8, options=165)
at /usr/local/src/php-4.3.10/main/streams.c:1999
realpath = 0xd993454 /mnt/nfs/STJOSEPHGC/eventsdb.php
st = {st_dev = 16, __pad1 = 0, st_ino = 3230021650, st_mode = 33188,
  st_nlink = 1, st_uid = 42807, st_gid = 100, st_rdev = 0, __pad2 = 0,
  st_size = 1179, st_blksize = 32768, st_blocks = 8, st_atim = {tv_sec
= 1124473602,
tv_nsec = 315743024}, st_mtim = {tv_sec = 1126289980, tv_nsec = 797960056},
  st_ctim = {tv_sec = 1126289980, tv_nsec = 799959752}, __unused4 = 0,
__unused5 = 0}
open_flags = 0
fd = 16
ret = (php_stream *) 0x0
persistent = 16
persistent_id = 0x0
#6  0xb7c47fb5 in php_plain_files_stream_opener (wrapper=0xb7cf3dc4,
path=0xda143d8 /home/serve/STJOSEPHGC/eventsdb.php, mode=0xb762f895 rb,
options=165, opened_path=0xb1a8, context=0x0)
at /usr/local/src/php-4.3.10/main/streams.c:2463
No locals.
#7  0xb7c485dc in _php_stream_open_wrapper_ex (
path=0xda143d8 /home/serve/STJOSEPHGC/eventsdb.php, mode=0xb762f895 rb,
options=173, opened_path=0xa5, context=0x0)
at /usr/local/src/php-4.3.10/main/streams.c:2660
stream = (php_stream *) 0x0
wrapper = (php_stream_wrapper *) 0xb7cf3dc4
path_to_open = 0xda143d8 /home/serve/STJOSEPHGC/eventsdb.php
#8  0xb75d84ce in ?? ()
   from /home/sys/Zend/lib/Optimizer-2.5.7/php-4.3.x/ZendOptimizer.so
No symbol table info available.
#9  0x0da143d8 in ?? ()
No symbol table info available.
#10 0xb762f895 in ?? ()
   from /home/sys/Zend/lib/Optimizer-2.5.7/php-4.3.x/ZendOptimizer.so
No symbol table info available.
---Type return to continue, or q return to quit---
#11 0x00ad in ?? ()
No symbol table info available.
#12 0xb1a8 in ?? ()
No symbol table info available.
#13 0x in ?? ()
No symbol table info available.

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



[PHP] Does anyone here use the pecl extension APC?

2005-11-17 Thread Jochem Maas

and possibly with heavy (php5) OO code?

I'm getting intermittent segfaults with 5.0.4, 5.0.5
when using apc_fetch() and apc_store() - caching of all opcodes
[by setting the ini setting 'apc.enabled' to 1] works fine.

I just tried with php5.1RC5 and it just segfaults on every request,
with or without the use of apc_fetch()/apc_store()

I was wondering whether any one has any tips or a clue as
to starting to debug (and hopefully) fix this?

rgds,
jochem

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



Re: [PHP] php related segmentation fault with Apache 2.0.55

2005-11-17 Thread Max Belushkin
  I have had various problems with upgrading one or the other, until I took it 
as a rule to recompile both upon an upgrade. On the machine I do things 
completely manually on [which has it's drawbacks], I generally also upgrade 
to the current version of PHP together with any Apache update, and 
vice-versa. The current 4.x version is 4.4.1 [although on a FreeBSD install I 
had some issues and downgraded to 4.4.0, but this behaviour hasn't been 
confirmed outside of FreeBSD until now] - perhaps try recompiling PHP to the 
current 4.x version (or if you feel up to it, upgrade to the 5.x versions?), 
and see if it helps? Resolved a lot of my problems in the past...

On Thursday 17 November 2005 22:31, kristina clair wrote:
 2.0.54 to Apache 2.0.55.  The scripts that are failing with the new
 Apache work with no problems with the old Apache.

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



[PHP] php + cURL issue

2005-11-17 Thread Nate Nielsen
I'm having an issue with cURL.  I have installed it on two different boxes, one 
is working properly, and another isn't.

The script auto login's a user to a site.  One server it works as expected and 
logs the user in, the other it does not.  It appears the cookie data that is 
being saved is different on the two machines from the login.

The code itself is identical.   The result on the two servers is different.   
I've fiddled with this thing for a couple weeks, and now its too late to mess 
with it anymore as I have a launch target I need to hit.

What I'd like is a php / IIS guru to help me fix this.  I will give you remote 
desktop access to the server and you can take it away from there.  I just need 
you to get the script running on the server the same as the other.  The script 
is already there, its very simplistic, only about 50 lines or so, no database 
interaction, nothing fancy at all.  I'm not a strong PHP guy, so its very 
simplistic.  (again though, it works on other server, so its not a code issue)

In return, I'll give you free hosting on one of my dedicated servers for 6 
months.  This is not your average shared hosting, I dont host sites for a 
living, I only host clients I code for - so there is only a handful of people 
on each server.  In fact, the server you will be on, you will be the only 
person on it at this time.  You'll have access to PHP (obviously), ColdFusion 
MX 7 (the latest, greatest version), MSSQL 2k and/or mySQL (different server), 
and if you need additional services, we can work that out.

Please email me if you are interested in helping or if you have any ideas 
please!!   

Thanks in advance!

- Nate Nielsen
[EMAIL PROTECTED]

Re: [PHP] checkng if string is a number

2005-11-17 Thread Max Belushkin
  Curt,

  yes, technically, 0 is a number - it's a bit late here, and I believe I
mis-understood the original question, which is why I re-posted in the thread.

  I guess my mind got a bit confused by the combination of is_int doesn't
work, intval returns a number and '10' vs 'ten' example.

  That's probably due to the fact I normally rely on intval() to do the job
for integers, which also helps remove some user mis-types at the end of
number fields, which is useful in situations when
A) you're ok with the user typing 11l when they mean 111
B) you don't want to accept a value of 0

  In principle, that's the only problem with intval - a 0 will evaluate
 as false in a logical statement. Unless one wants to make sure it's a full
 number from start to end, of course...

  Max.

On Thursday 17 November 2005 23:05, you wrote:
 On Thu, Nov 17, 2005 at 08:47:30PM +0100, Max Belushkin wrote:
extras you're using?) the following script works fine:
 
  ?php
if (10==intval(ten)) echo boo\n; else echo no boo\n;
  ?
 
I get no boo. intval doesn't convert my ten to a number.
Moreover, the output of the following:

 Yes it does.

   echo intval('a'); // 0
   echo intval('0'); // 0
   echo intval(0);   // 0
   echo intval(0.1); // 0

   $v = intval('ten');
   var_dump($v); // int(0)

   $v = intval('10');
   var_dump($v); // int(10)

 Curt.

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



Re: [PHP] php related segmentation fault with Apache 2.0.55

2005-11-17 Thread kristina clair
I actually did that before emailing about php 4.3.10.  With php 4.4.1,
the traceback is different:

Reading symbols from /home/sys/Zend/lib/ZendExtensionManager.so...done.
Loaded symbols for /home/sys/Zend/lib/ZendExtensionManager.so
Error while reading shared library symbols:
.//home/sys/Zend/etc/pfpro.so: No such file or directory.
Reading symbols from /home/sys/verisign/lib/libpfpro.so...done.
Loaded symbols for /usr/local/verisign//lib/libpfpro.so
#0  0xb7ca0c15 in php_handler (r=0xda05f90)
at /home/sys/src/php-4.4.1/sapi/apache2handler/sapi_apache2.c:538538
 if (parent_req  strcmp(parent_req-handler,
PHP_MAGIC_TYPE)  strcmp(parent_req-handler, PHP_SOURCE_MAGIC_TYPE)
 strcmp(parent_req-handler, PHP_SCRIPT)) {
warning: not using untrusted file .gdbinit

(gdb) bt full
#0  0xb7ca0c15 in php_handler (r=0xda05f90)
at /home/sys/src/php-4.4.1/sapi/apache2handler/sapi_apache2.c:538
orig_bailout = {{__jmpbuf = {0, 0, 0, 0, 0, 0}, __mask_was_saved = 0,
 __saved_mask = {__val = {0 repeats 32 times
ctx = (php_struct *) 0xd9e9a80
conf = Variable conf is not available.
(gdb)

On 11/17/05, Max Belushkin [EMAIL PROTECTED] wrote:
   I have had various problems with upgrading one or the other, until I took it
 as a rule to recompile both upon an upgrade. On the machine I do things
 completely manually on [which has it's drawbacks], I generally also upgrade
 to the current version of PHP together with any Apache update, and
 vice-versa. The current 4.x version is 4.4.1 [although on a FreeBSD install I
 had some issues and downgraded to 4.4.0, but this behaviour hasn't been
 confirmed outside of FreeBSD until now] - perhaps try recompiling PHP to the
 current 4.x version (or if you feel up to it, upgrade to the 5.x versions?),
 and see if it helps? Resolved a lot of my problems in the past...

 On Thursday 17 November 2005 22:31, kristina clair wrote:
  2.0.54 to Apache 2.0.55.  The scripts that are failing with the new
  Apache work with no problems with the old Apache.

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




--
In most cases, people, even wicked people, are far more naive and
simple-hearted than one generally assumes.  And so are we.
/* last line, 1st ch., The Brothers Karamazov */

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



Re: [PHP] php + cURL issue

2005-11-17 Thread Nate Nielsen
also, as another note - the php version and cURL version is identical on the 
two machines - the main difference between them being that one is windows 2k 
server and the other one is windows 2k3 server (std ed)


any ideas ?

thanks

- Original Message - 
From: Nate Nielsen [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, November 17, 2005 4:00 PM
Subject: [PHP] php + cURL issue


I'm having an issue with cURL.  I have installed it on two different boxes, 
one is working properly, and another isn't.


The script auto login's a user to a site.  One server it works as expected 
and logs the user in, the other it does not.  It appears the cookie data 
that is being saved is different on the two machines from the login.


The code itself is identical.   The result on the two servers is different. 
I've fiddled with this thing for a couple weeks, and now its too late to 
mess with it anymore as I have a launch target I need to hit.


What I'd like is a php / IIS guru to help me fix this.  I will give you 
remote desktop access to the server and you can take it away from there.  I 
just need you to get the script running on the server the same as the other. 
The script is already there, its very simplistic, only about 50 lines or so, 
no database interaction, nothing fancy at all.  I'm not a strong PHP guy, so 
its very simplistic.  (again though, it works on other server, so its not a 
code issue)


In return, I'll give you free hosting on one of my dedicated servers for 6 
months.  This is not your average shared hosting, I dont host sites for a 
living, I only host clients I code for - so there is only a handful of 
people on each server.  In fact, the server you will be on, you will be the 
only person on it at this time.  You'll have access to PHP (obviously), 
ColdFusion MX 7 (the latest, greatest version), MSSQL 2k and/or mySQL 
(different server), and if you need additional services, we can work that 
out.


Please email me if you are interested in helping or if you have any ideas 
please!!


Thanks in advance!

- Nate Nielsen
[EMAIL PROTECTED] 


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



[PHP] Re: php + cURL issue

2005-11-17 Thread Manuel Lemos

Hello,

on 11/17/2005 08:00 PM Nate Nielsen said the following:

I'm having an issue with cURL.  I have installed it on two different
boxes, one is working properly, and another isn't.

The script auto login's a user to a site.  One server it works as
expected and logs the user in, the other it does not.  It appears the
cookie data that is being saved is different on the two machines from
the login.

The code itself is identical.   The result on the two servers is
different.   I've fiddled with this thing for a couple weeks, and now
its too late to mess with it anymore as I have a launch target I need
to hit.


This sounds like bugs in different curl library versions.

I cannot help you with CURL itself because I do not use it except for 
circumstances where SSL is needed and OpenSSl is not available.


Anyway, I use this HTTP client class that uses either fsockopen 
connections or curl depending what is available. When SSL is not 
necessary, the Curl library is not used at all.


The class takes care of collecting and send back any site cookies, 
handles redirection, complex HTTP authentication methods, etc.. You may 
want to take a look at it here:


http://www.phpclasses.org/httpclient


--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] Mail Injection- Which Mail function Parameters

2005-11-17 Thread Chris Drozdowski

Hello,

When using the mail() function to send a simple mail message, which  
specific parameters of the function need to cleaned to prevent mail  
injection?


First of all I am already validating the $to parameter to be a valid  
email address.


After reading http://securephp.damonkohler.com/index.php/ 
Email_Injection, I gather the parameters that need to be cleaned to  
prevent mail injection are the $headers and the $additional_parameters.


Is this correct?

Do I also need to clean the $subject parameter to prevent mail  
injection?


What about the $message parameter?

Thanks,

C Drozdowski

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



[PHP] Mail Injection- Which Mail function Parameters CORRECTED

2005-11-17 Thread Chris Drozdowski

Hello,

When using the mail() function to send a simple mail message, which  
specific parameters of the function need to cleaned to prevent mail  
injection?


First of all I am already validating the $to parameter to be a valid  
email address.


After reading http://securephp.damonkohler.com/index.php/ 
Email_Injection, I gather the parameters that need to be cleaned to  
prevent mail injection are the $headers and the $additional_headers.


Is this correct?

Do I also need to clean the $subject parameter to prevent mail  
injection?


What about the $message parameter?

Thanks,

C Drozdowski

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



[PHP] php error message

2005-11-17 Thread Edward Martin
I am new to working with php and I am having trouble trying to figure
out this following error message that is displayed when I access a php
file. Can you tell me what this error message means (in plain English)
and what steps I might take to correct it?

Warning: Cannot modify header information - headers already sent by
(output started at
/usr/home/ecmartin/public_html/ethics06/calendarlogin.php:8) in
/usr/home/ecmartin/public_html/ethics06/sas.php on line 34


The page that displays this error has a small php log-in script on in.
(Depending on where I place the script in the page code, the error
message moves to a different location on the page). The page originally
was an html page that contained typical stylesheet data, javascript
scripts (for headers and menus) and a flash-based menu. ALL of these
features still work when the page is displayed (as well as the php
log-in script), however, I cannot get rid of the error message.

Thanks 

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



[PHP] Re: php error message

2005-11-17 Thread Ben

Edward Martin said the following on 11/17/2005 04:27 PM:


Warning: Cannot modify header information - headers already sent by
(output started at
/usr/home/ecmartin/public_html/ethics06/calendarlogin.php:8) in
/usr/home/ecmartin/public_html/ethics06/sas.php on line 34


It means you are trying to change the page's headers after they have 
already been sent to the user's browser. You are probably trying to use 
the header() function after HTML/Javascript/what have you has already 
been sent to the browser.  If you need to use header() you should write 
any earlier output to a variable and only output it to the browser after 
any header() function use.


- Ben

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



[PHP] replicate a live stream from one server to another with php and wget [slightly ot]

2005-11-17 Thread Graham Anderson


has anyone here used wget or similar command  to redirect/reflect  a  
live stream data  from one server to another server ?
I wanted to use each server's upload bandwidth to transfer a live  
stream to a new server


that way, my hope is that I can balance the bandwidth load a bit  
between servers for users in different areas.
Would it just be a question of duplicating the headers of the  
incoming file and redirecting it to another server?


I am 'fishing' a bit so any help from those who use php with live  
streaming is appreciated.




Server side:
live stream  is encoded and sent to
streaming server 1 in Los Angeles  which sends the data to
streaming server 2 in Chicago which sends the data to
streaming server 3 in Mexico City


Client Side:
The below is pretty simple to do :)
When the user tries to access the live broadcast stream, a php script  
determines the nearest non-overloaded server.
In this case, the user is directed to the live stream on server two  
in Chicago


many thanks

g

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



[PHP] Re: php error message

2005-11-17 Thread Chuck Anderson

Ben wrote:


Edward Martin said the following on 11/17/2005 04:27 PM:

 


Warning: Cannot modify header information - headers already sent by
(output started at
/usr/home/ecmartin/public_html/ethics06/calendarlogin.php:8) in
/usr/home/ecmartin/public_html/ethics06/sas.php on line 34
   



It means you are trying to change the page's headers after they have 
already been sent to the user's browser. You are probably trying to use 
the header() function after HTML/Javascript/what have you has already 
been sent to the browser.  If you need to use header() you should write 
any earlier output to a variable and only output it to the browser after 
any header() function use.


- Ben
 

Most likely that is exactly what's happening. To be even more clear - 
the solution is to use the header function before any HTML (before *any* 
output). I learned this when I had an include file that was all Php 
causing this problem. The end of the included file had a carriage return 
after the closing tag ?. That was a nasty one to locate. Now I always 
make sure there is no white space after the closing tag in files I might 
include somewhere else.


--
*
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*

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



Re: [PHP] Re: php error message

2005-11-17 Thread Jasper Bryant-Greene

Chuck Anderson wrote:

Ben wrote:


Edward Martin said the following on 11/17/2005 04:27 PM:


Warning: Cannot modify header information - headers already sent by
(output started at
/usr/home/ecmartin/public_html/ethics06/calendarlogin.php:8) in
/usr/home/ecmartin/public_html/ethics06/sas.php on line 34
  


It means you are trying to change the page's headers after they have 
already been sent to the user's browser. You are probably trying to 
use the header() function after HTML/Javascript/what have you has 
already been sent to the browser.  If you need to use header() you 
should write any earlier output to a variable and only output it to 
the browser after any header() function use.


- Ben
 
Most likely that is exactly what's happening. To be even more clear - 
the solution is to use the header function before any HTML (before *any* 
output). I learned this when I had an include file that was all Php 
causing this problem. The end of the included file had a carriage return 
after the closing tag ?. That was a nasty one to locate. Now I always 
make sure there is no white space after the closing tag in files I might 
include somewhere else.


An alternative solution is to just turn on output buffering, which will 
make sure no output gets sent until after all PHP has stopped processing 
(unless you specifically tell it to get sent earlier).


Jasper

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



Re: [PHP] php + cURL issue

2005-11-17 Thread Curt Zirzow
On Thu, Nov 17, 2005 at 04:00:21PM -0600, Nate Nielsen wrote:
 I'm having an issue with cURL.  I have installed it on two different boxes, 
 one is working properly, and another isn't.
 
 The script auto login's a user to a site.  One server it works as expected 
 and logs the user in, the other it does not.  It appears the cookie data that 
 is being saved is different on the two machines from the login.
 

what are the differences in the cookies?

have you tried curl_setopt() with:
  curl_setopt($ch, CURLOPT_VERBOSE);
  curl_setopt($ch, CURLOPT_STDERR, $filehandle); // where to log

have you looked at the output on the login request to ensure that
the content is being returned as expected.

What does the code look like?


Curt.
-- 

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



Re: [PHP] Mail Injection- Which Mail function Parameters CORRECTED

2005-11-17 Thread Curt Zirzow
On Thu, Nov 17, 2005 at 07:10:06PM -0500, Chris Drozdowski wrote:
 Hello,
 
 When using the mail() function to send a simple mail message, which  
 specific parameters of the function need to cleaned to prevent mail  
 injection?

This is a good topic.  I'm in the process of writing an article on
it as well.

Consider:
mail ($to, $subject, $message, $additional_headers, $additional_parameters);

$to - yes (should clean)
--
As we've seen validating emails tends to be a long discussion on to
properly accomplish the validation.  Things to consider:

  - Are you going to allow them to send to multiple emails.
  - Do you want them to allow them to include the name of the
person the email is to: Joe Something [EMAIL PROTECTED]

based on what ever validation you choose and what you want to
allow, the key things to watch out for are the comma (,),
semicolon (;), line feed/carriage return (\r and/or \n)

  
$subject - yes
--
You want ensure that the \r and/or \n or properly removed (or
escaped)

$message - yes
---
This usually can go without any special escaping, unless you have
certain headers (the Boundary: header) or allow an injection into
the $additional_headers field.  If this is the case a malicious
user could attach a virus to be sent anonymously.

$additional_headers - yes
-
As with $to, $subject you need to make sure \r and/or \n are
removed or escaped properly.  The most common used header is the
From header:
  
  From: $fromname $fromemail

As noted in the $message section, if you have dont take care in
ensuring this paramater isn't done correctly you could potentially
allow the user to setup their own Boundary: header, which then
would allow them to freely make what ever attachments they like.

Also this is where the open (well psudo open) relay occurs, if you
dont filter things properly, you can open up the CC: and BCC:
headers, allowing the person to anonymously send emails.

additional_parameters - very much yes
-
The most common value passed here is usually something like:

  -f $fromemail

if you consider what this actually does, send parameters to the
sendmail binary directly you could open your self to exploits
unlreated to php itself.  Caution should really be used when
allowing outside data to be used here.

 
 After reading http://securephp.damonkohler.com/index.php/ 
 Email_Injection, I gather the parameters that need to be cleaned to  
 prevent mail injection are the $headers and the $additional_headers.

This is a nice article it rather makes me wonder if my article will
be as good as this one.

Curt.
-- 

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



[PHP] SESSION expiry time setting

2005-11-17 Thread Angelo Zanetti

Hi guys.

I've been searching for where the time is set for a session to expire 
but had little luck.


in the PHP.ini file I found:

session.cache_expire

which specifies the time in minutes but is this what sets the session to 
timeout once the setting time has been surpassed?


Or am I looking in the totally wrong direction??

thanks in advance.

Angelo

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



Re: [PHP] Regex for Amateur Radio Callsigns

2005-11-17 Thread Greg Beaver

Leonard Burton wrote:

HI,



Tuesday, November 15, 2005, 8:39:19 PM, you wrote:


Here are how they look
W1W
W1AW
WA1W
AD4HZ
N9URK
WB6NOA
4N1UBG


Let's do it this way... What are the rules for a valid callsign?



Basicly, you see an example of each different type of callsign.  Other
than the patterns you  see above there are no real rules.  A letter in
the example above means that there can only be a letter in the spot
and a number in a spot means there can only be a number in that spot. 
There are 7 different formats and you see the one above.


Did you see the regex I had in a previous post?


/^([A-Z]{1,2}|[0-9][A-Z])([0-9])([A-Z]{1,3})$/

Using preg_match(), this will split a callsign like N8LAI into

array(
 0 = 'N8LAI',
 1 = 'N',
 2 = '8',
 3 = 'LAI'
)

and you can use the information however you like (i.e. this is a 
standard technician/general class call sign, located in region 8 
Michigan/Ohio/Kentucky, etc.)


_... .
Greg

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



Re: [PHP] Mail Injection- Which Mail function Parameters CORRECTED

2005-11-17 Thread Ligaya Turmelle



$message - yes
---
This usually can go without any special escaping, unless you have
certain headers (the Boundary: header) or allow an injection into
the $additional_headers field.  If this is the case a malicious
user could attach a virus to be sent anonymously.


Shouldn't you also worry about html script tags in the body of an HTML 
email?  Couldn't a person also use those to send you a nasty present?




$additional_headers - yes
-
As with $to, $subject you need to make sure \r and/or \n are
removed or escaped properly.  The most common used header is the

From header:
  
  From: $fromname $fromemail


As noted in the $message section, if you have dont take care in
ensuring this paramater isn't done correctly you could potentially
allow the user to setup their own Boundary: header, which then
would allow them to freely make what ever attachments they like.

Also this is where the open (well psudo open) relay occurs, if you
dont filter things properly, you can open up the CC: and BCC:
headers, allowing the person to anonymously send emails.


why would a person allow a user to input header information on a web 
form?  That sounds like a HUGE security hole or is there someway I just 
can't see?



--

life is a game... so have fun.

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

Re: [PHP] Does anyone here use the pecl extension APC?

2005-11-17 Thread Rasmus Lerdorf
Filing a bug against APC with a gdb backtrace from one of these crashes would 
be useful.  
See http://pecl.php.net/bugs/report.php?package=APC

-Rasmus

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