[PHP] Object Oriented Programming in PHP

2004-06-24 Thread Eric Marden
I'm interested in getting up to speed on OOP in PHP can anyone
recommend some good titles for me to pick up?

Thanks!

---
eric marden
http://xentek.net
---

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



Re: [PHP] Object Oriented Programming in PHP

2004-06-24 Thread Chris Shiflett
--- Eric Marden [EMAIL PROTECTED] wrote:
 I'm interested in getting up to speed on OOP in PHP can anyone
 recommend some good titles for me to pick up?

George Schlossnagle gave a good talk on this last night at NYPHP. His
slides aren't up yet, but they should appear here soon:

http://www.schlossnagle.org/~george/talks/

If you want to buy a book, his Advanced PHP Programming is a good title:

http://www.amazon.com/exec/obidos/ASIN/0672325616/ref%3Dnosim/chrisshiflett-20

Another good one is Upgrading to PHP 5 by Adam Trachtenberg, which should
be available in a few weeks and specifically explains OOP in terms of
what's different:

http://www.amazon.com/exec/obidos/ASIN/0596006365/ref%3Dnosim/chrisshiflett-20

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] SQL Case sensitivity

2004-06-24 Thread Evan Nemerson
http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html should do the trick, 
provided you're using MySQL.

On Wednesday 23 Jun 2004 20:14, Gabe wrote:
 I hope I don't get too chastised for a double post ( posted in .db first
 ), but I'm hoping someone can help me.

 I'm using PHP with ADOdb ( and an MS Access 2000 db ) to write a simple
 SQL statement but was running into some case sensitivity issues.  Here's
 my SQL currently:

 SELECT autoQuesID,fldQuesTitle,fldBody
 FROM tblFAQ_Question
 WHERE fldBody LIKE '%$strSearchFor%';

 All I'm trying to do is have the users search string searched for in the
 fldBody field.  However, I'm having problems trying to get it so that
 the search is case-insensitive.  For instance:

 If I search on Airline, I get 1 record.
 If I search on airline, I get 0 records.

 I make the value of $strSearchFor lower case ( using strtolower() ), but
 I don't know how to get it so that the contents of the fldBody field
 is lower case also.  I can't seem to find any functions or operators
 that remove the case-sensitivity.  However, I have tried this where
 clause to no avail:

 WHERE LCase(fldBody) LIKE '%$strSearchFor%'

 Any help would be much appreciated!

-- 
Evan Nemerson
[EMAIL PROTECTED]
http://coeusgroup.com/en

--
The greatest mistake is to imagine that the human being is an autonomous 
individual. The secret freedom which you can supposedly enjoy under a 
despotic government is nonsense, because your thoughts are never entirely 
your own. Philosophers, writers, artists, even scientists, not only need 
encouragement and an audience, they need constant stimulation from other 
people. It is almost impossible to think without talking. If Defoe had really 
lived on a desert island, he could not have written Robinson Crusoe, nor 
would he have wanted to. Take away freedom of speech, and the creative 
faculties dry up.

-George Orwell

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



Re: [PHP] Sort a text string by last word before separator

2004-06-24 Thread Evan Nemerson
If I were you I'd use preg_match_all() so you get the first and last name as 
separate elements, then use usort() to create a custom sorting function based 
on strnatcasecmp()

Be careful about middle names and the such.


On Thursday 24 Jun 2004 04:38, Andre Dubuc wrote:
 Given a text string:

 $OK = Joe Blow, William Howard Anser, Hannie Jansen, etc, etc,;

 $_SESSION['txt'] = $OK;
 session_write_close();
 $txt = $_SESSION['txt'];

 $sorted = explode(, , $txt);
 sort($sorted);
 print $sorted;

 results in a sort based on the first name:

 Hannie Jansen, Joe Blow, William Howard Anser, etc, etc


 I tried a another function (before_last)

 **

 function before ($this, $inthat)
 {
   return substr($inthat, 0, strpos($inthat, $this));
 }

 function strrevpos($instr, $needle)
 {
   $rev_pos = strpos (strrev($instr), strrev($needle));
   if ($rev_pos===false) return false;
   else return strlen($instr) - $rev_pos - strlen($needle);
 };

 function after_last ($this, $inthat)
 {
   if (!is_bool(strrevpos($inthat, $this)))
   return substr($inthat, strrevpos($inthat, $this)+strlen($this));
 };

 function before_last ($this, $inthat)
 {
   return substr($inthat, 0, strrevpos($inthat, $this));
 };

 

 to sort on last name, and it does work, but gives only the last item:

 $test2 = between_last(' ', ', ', $OK);
 print $test2;

 Jansen

 How would I get this 'before_last' function to iterate through the initial
 string, so I could build a sorted list with both first and last names,
 sorted by last name? I can't seem to get a proper 'foreach' statement to
 work, nor a 'while' statement.

 I'm really confused. I've read almost every entry on arrays/strings and
 searched code snippets. Almost all focus on one element arrays such apple,
 orange, peach rather than 2 or more elements such as  fancy cars, big
 trucks, fast dangerous motorcycles,

 Is it even possible to accomplish this type sort on a string?



 Any advice, pointers, or help will be greatly appreciated,
 Tia,
 Andre

-- 
Evan Nemerson
[EMAIL PROTECTED]
http://coeusgroup.com/en

--
If anyone can show me, and prove to me, that I am wrong in thought or deed, I 
will gladly change. I seek the truth, which never yet hurt anybody. It is 
only persistence in self-delusion and ignorance which does harm.

-Marcus Aurelius

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



Re: [PHP] issue with inheriting private property from abstract class in php5rc3

2004-06-24 Thread Marek Kilimajer
Curt Zirzow wrote --- napsal::
* Thus wrote Marek Kilimajer:
Chris wrote --- nap?sal::
if anyone can, would you please explain why the below code does what it 
does?  I would expect $this-test in TestInstance to refer to the 
inherited $test from Test.  Using php5RC3.  Thanks.

?php
abstract class Test {
  private $test;
  abstract public function addToTest($i);
}
class TestInstance extends Test {
  public function __construct() {
  $this-test = 0;
  }
...
The variable is private for Test, so TestInstance does not have access 
to it. By assigning 0 to $this-test in the constructor of TestInstance, 
you create a new property of TestInstance that is public (the default).

var_dump() shows it clearly:
object(TestInstance)#1 (2) {
 [test:private]= NULL    belongs to Test
 [test]= int(3)  belongs to TestInstance
}

I think one could argue that that test:private shouldn't even be
there. To me that test:private would imply that is TestIntance's
private variable.

Right, [Test::test:private] would be better
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Holding links in a database

2004-06-24 Thread Shaun
Hi,

I have created a site that is begining to accumulate a large number of
pages. I have been considering holding links to all pages in a database so
that the sub menus alter dynamically rather than being hand coded. Has
anyone else done this...

Many thanks for your thoughts/comments

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



Re: [PHP] TIFF display problem...

2004-06-24 Thread Richard Harb
Are you certain there are no other characters being sent (introduced
by the addition) in the 'body' beside the image?

Will you get any output (characters and all) if you request the image
file directly - without embedding it into a page using img src or
whatever?

While I have used only the supported by default images like jpg, png
and the like, that always turned out to be the problem for me ...

Richard

-Original Message-
Sent: Monday, June 21, 2004, 9:43:19 PM
 Hi All,

   I've run into a jam..  I have the follow PHP script:

 ?
   header(Content-type: image/tiff);

   $_GET['id'] = str_replace( ., , $_GET['id'] );
   $_GET['id'] = str_replace( /, , $_GET['id'] );

   $blah = /usr/local/apache/chm-images/ . $_GET['id'] . .A;

   readfile( $blah );
?

 This works just fine...

 When I add...

   session_start();

   if ( !$_SESSION['user_id'] )
   {
   exit();
   }

 ...to it, the image does not display.

 What I need to do is read in images from a secured directory and display it
 on the page.  I was using JPGs before and now need to display TIFF files.
 We have the plugins for IE all setup.  Could someone tell me how I could fix
 this?  I'm at a complete loss...

 -Dan Joseph

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



Re: [PHP] TIFF display problem...

2004-06-24 Thread Richard Harb
Argh, I see your problem was already solved (answers haven't been
listed as one thread, so I missed em). Oh well.

-Original Message-
Sent: Thursday, June 24, 2004, 11:58:15 AM
 Are you certain there are no other characters being sent (introduced
 by the addition) in the 'body' beside the image?

 Will you get any output (characters and all) if you request the image
 file directly - without embedding it into a page using img src or
 whatever?

 While I have used only the supported by default images like jpg, png
 and the like, that always turned out to be the problem for me ...

 Richard

 -Original Message-
 Sent: Monday, June 21, 2004, 9:43:19 PM
 Hi All,

  I've run into a jam..  I have the follow PHP script:

 ?
  header(Content-type: image/tiff);

  $_GET['id'] = str_replace( ., , $_GET['id'] );
  $_GET['id'] = str_replace( /, , $_GET['id'] );

  $blah = /usr/local/apache/chm-images/ . $_GET['id'] . .A;

  readfile( $blah );
?

 This works just fine...

 When I add...

  session_start();

  if ( !$_SESSION['user_id'] )
  {
  exit();
  }

 ...to it, the image does not display.

 What I need to do is read in images from a secured directory and display it
 on the page.  I was using JPGs before and now need to display TIFF files.
 We have the plugins for IE all setup.  Could someone tell me how I could fix
 this?  I'm at a complete loss...

 -Dan Joseph

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



[PHP] Site changes

2004-06-24 Thread Thies
attachment: vbpireiyph.bmp-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Optimize simple file XOR code

2004-06-24 Thread Marcus Johansson
Hi!

I'm using a very simple algorithm to encrypt files sent from the server
On Demand. The algorithm uses XOR for the encryption. My problem is
that the code is very slow, it can only process about 40 KB per second
on my system, so my question is, is there any more speed optimized way
to write this code?

Here is my function:

  function CryptFile($hash, $filename)
  {
// The current position in the key generated below
$key_pos = 0;

// The key used is generated using another function.
// Since this function is only called once it has
// nothing to do with the performance of this function
$key = GenerateKey($hash);

$handle=fopen($filename, r);
while (!feof($handle))
{
  // Set the time limit or the script will time out
  // on large files
  set_time_limit(30);

  $data = fread($handle,8192);
  for ($i=0; $istrlen($data); $i++)
  {
// Change the data read from the file by using
// XOR with the key
$data[$i] = $data[$i] ^ $key[$key_pos];

// Calculate the next position in the key
$key_pos=($key_pos+1) % count($key);
  }

  // Return the encrypted version to the browser
  echo $data;
}
  }

My guess is that if one should start optimizing the code anywhere, it
would be within the for-loop. Any ideas?

Thanks in advance!

Regards,
Marcus

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



[PHP] Multipart Email Problem

2004-06-24 Thread Matt MacLeod
I have a script that sends a multipart email from a php page.
The script appears to work fine on my mail client (Mail on Mac OSX) and 
on an online email reader (mail2web.com).

However a colleague using Outlook on Windows 2003 views the whole email 
(ie the raw code - both the text only and the HTML) and when I sent an 
email to his hotmail account, hotmail simply displayed a blank page.

My client is getting quite frantic about this so if anyone has any 
suggestions, I'd be very grateful.

This is the script I am using:
 $to=Matt MacLeod [EMAIL PROTECTED];
   $from=Vinciane Rycroft [EMAIL PROTECTED];
   $subject=London 21 Newsletter;
   $mime_boundary===Multipart_Boundary_x.md5(mt_rand()).x;
   $headers = From: $from\r\n .
  MIME-Version: 1.0\r\n .
  Content-Type:multipart/alternative;\n .
   boundary=\{$mime_boundary}\r\n\;
   $headers.= From: $from\r\n;
   $message = This is a multi-part message in MIME format.\n\n .
  --{$mime_boundary}\n .
  Content-Type: text/plain; charset=\iso-8859-1\\n .
  Content-Transfer-Encoding: 7bit\n\n .
  $nonhtml .\n .
  --{$mime_boundary}\n .
  Content-Type: text/html; charset=\iso-8859-1\\n .
  Content-Transfer-Encoding: 7bit\n\n .
  $htmlVersion;
   if (mail($to, $subject, $message, $headers))
  echo Message Sent!;
   else
  echo Failed to send message.;
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Multipart Email Problem

2004-06-24 Thread Alister Bulman
On Thu, 24 Jun 2004 12:27:17 +0100, Matt MacLeod [EMAIL PROTECTED] wrote:
 
 I have a script that sends a multipart email from a php page.
 
 The script appears to work fine on my mail client (Mail on Mac OSX) and
 on an online email reader (mail2web.com).
 
 However a colleague using Outlook on Windows 2003 views the whole email
 (ie the raw code - both the text only and the HTML) and when I sent an
 email to his hotmail account, hotmail simply displayed a blank page.

Sorting out the MIME headers is not easy.

So user http://pear.php.net/package/Mail_Mime to do the hard work.

Alister

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



Re: [PHP] Optimize simple file XOR code

2004-06-24 Thread Marcel Tschopp
Hi Marcus

Try this:

function CryptFile($hash, $filename)
{
// The key used is generated using another function.
// Since this function is only called once it has
// nothing to do with the performance of this function
$key = GenerateKey($hash);
$keylen = strlen($key = implode('', $key));

$handle = fopen($filename, 'r');
while (!feof($handle))
{
  // Set the time limit or the script will time out
  // on large files
  set_time_limit(30);

  $data = fread($handle, 8192);
  for ($i = 0; $i  strlen($data); $i = $i + $keylen)
  {
$data = substr_replace($data, substr($data, $i, $keylen) ^ $key, $i, $keylen);
  }

  // Return the encrypted version to the browser
  echo $data;
}
}

It should return the same results, but at my machine it is about 30
percent faster.

Cheers
Marcel


 Hi!
 
 I'm using a very simple algorithm to encrypt files sent from the server
 On Demand. The algorithm uses XOR for the encryption. My problem is
 that the code is very slow, it can only process about 40 KB per second
 on my system, so my question is, is there any more speed optimized way
 to write this code?
 
 Here is my function:
 
   function CryptFile($hash, $filename)
   {
 // The current position in the key generated below
 $key_pos = 0;
 
 // The key used is generated using another function.
 // Since this function is only called once it has
 // nothing to do with the performance of this function
 $key = GenerateKey($hash);
 
 $handle=fopen($filename, r);
 while (!feof($handle))
 {
   // Set the time limit or the script will time out
   // on large files
   set_time_limit(30);
 
   $data = fread($handle,8192);
   for ($i=0; $istrlen($data); $i++)
   {
 // Change the data read from the file by using
 // XOR with the key
 $data[$i] = $data[$i] ^ $key[$key_pos];
 
 // Calculate the next position in the key
 $key_pos=($key_pos+1) % count($key);
   }
 
   // Return the encrypted version to the browser
   echo $data;
 }
   }
 
 My guess is that if one should start optimizing the code anywhere, it
 would be within the for-loop. Any ideas?
 
 Thanks in advance!
 
 Regards,
 Marcus
 
 -- 
 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] ibill.com

2004-06-24 Thread Syed Ghouse
Hi All 
(B
(BAny body tell me how to use ibill.com payment site for my project

RE: [PHP] PHP+GD on FreeBSD 5.1

2004-06-24 Thread Jay Blanchard
[snip]
I have been having an extremely difficult getting PHP installed with GD
support on a FreeBSD 5.1 system.  While I can get the default GD package
installed, I can't seem to get it installed with JPEG support. Does
anyone know of any good tutorials or instructions for people with basic
general knowledge of FreeBSD?
[/snip]

Here is the configure line for PHP from one of our FreeBSD servers...

'./configure' '--enable-versioning' '--enable-memory-limit'
'--with-layout=GNU' '--with-zlib-dir=/usr' '--disable-all'
'--with-regex=php' '--with-pear' '--with-bz2=/usr' '--enable-calendar'
'--enable-ctype' '--with-curl=/usr/local' '--enable-dba' '--enable-ftp'
'--with-gd' '--enable-gd-native-ttf' '--enable-gd-jis-conv'
'--with-freetype-dir=/usr/local' '--with-jpeg-dir=/usr/local'
'--with-png-dir=/usr/local' '--with-xpm-dir=/usr/local'
'--with-gdbm=/usr/local' '--with-gettext=/usr/local'
'--with-mysql=/usr/local' '--enable-overload' '--with-pcre-regex=yes'
'--enable-posix' '--enable-session' '--enable-tokenizer'
'--with-expat-dir=/usr/local' '--enable-xml' '--with-zip=/usr/local'
'--with-zlib=yes' '--with-apxs=/usr/local/sbin/apxs'
'--prefix=/usr/local' 'i386-portbld-freebsd5.1' 

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



RE: [PHP] Holding links in a database

2004-06-24 Thread Jay Blanchard
[snip]
I have created a site that is begining to accumulate a large number of
pages. I have been considering holding links to all pages in a database
so that the sub menus alter dynamically rather than being hand coded.
Has anyone else done this...
[/snip]


Yes.

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



RE: [PHP] Holding links in a database

2004-06-24 Thread webmaster
Quoting Jay Blanchard [EMAIL PROTECTED]:

 [snip]
 I have created a site that is begining to accumulate a large number of
 pages. I have been considering holding links to all pages in a database
 so that the sub menus alter dynamically rather than being hand coded.
 Has anyone else done this...
 [/snip]


 Yes.

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




Me too!

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



RE: [PHP] Optimize simple file XOR code

2004-06-24 Thread Marcus Johansson
Wow! That REALLY did make a great difference!
Encoding a file of 2MB took 50 seconds before, now it is done in 1 (ONE)
second!

My Key is 8192 bytes long, is that the reason for why it so much faster
for me?
I don't really get how it works, but I guess I will figure it out.

Thank you very much!

-- Marcus

-Original Message-
From: Marcel Tschopp [mailto:[EMAIL PROTECTED] 
Sent: den 24 juni 2004 13:37
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Optimize simple file XOR code


Hi Marcus

Try this:

function CryptFile($hash, $filename)
{
// The key used is generated using another function.
// Since this function is only called once it has
// nothing to do with the performance of this function
$key = GenerateKey($hash);
$keylen = strlen($key = implode('', $key));

$handle = fopen($filename, 'r');
while (!feof($handle))
{
  // Set the time limit or the script will time out
  // on large files
  set_time_limit(30);

  $data = fread($handle, 8192);
  for ($i = 0; $i  strlen($data); $i = $i + $keylen)
  {
$data = substr_replace($data, substr($data, $i, $keylen) ^ $key,
$i, $keylen);
  }

  // Return the encrypted version to the browser
  echo $data;
}
}

It should return the same results, but at my machine it is about 30
percent faster.

Cheers
Marcel


 Hi!
 
 I'm using a very simple algorithm to encrypt files sent from the 
 server On Demand. The algorithm uses XOR for the encryption. My 
 problem is that the code is very slow, it can only process about 40 KB

 per second on my system, so my question is, is there any more speed 
 optimized way to write this code?
 
 Here is my function:
 
   function CryptFile($hash, $filename)
   {
 // The current position in the key generated below
 $key_pos = 0;
 
 // The key used is generated using another function.
 // Since this function is only called once it has
 // nothing to do with the performance of this function
 $key = GenerateKey($hash);
 
 $handle=fopen($filename, r);
 while (!feof($handle))
 {
   // Set the time limit or the script will time out
   // on large files
   set_time_limit(30);
 
   $data = fread($handle,8192);
   for ($i=0; $istrlen($data); $i++)
   {
 // Change the data read from the file by using
 // XOR with the key
 $data[$i] = $data[$i] ^ $key[$key_pos];
 
 // Calculate the next position in the key
 $key_pos=($key_pos+1) % count($key);
   }
 
   // Return the encrypted version to the browser
   echo $data;
 }
   }
 
 My guess is that if one should start optimizing the code anywhere, it 
 would be within the for-loop. Any ideas?
 
 Thanks in advance!
 
 Regards,
 Marcus
 
 --
 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



RE: [PHP] Holding links in a database

2004-06-24 Thread Jay Blanchard
[snip]
Quoting Jay Blanchard [EMAIL PROTECTED]:

 [snip]
 I have created a site that is begining to accumulate a large number of
 pages. I have been considering holding links to all pages in a
database
 so that the sub menus alter dynamically rather than being hand coded.
 Has anyone else done this...
 [/snip]


 Yes.


Me too!
[/snip]

We could start a club, others could join!

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



[PHP] max upload size

2004-06-24 Thread me2resh






hi there
i am trying to make a script to upload files to a specific directory on my server
i already made it but there is a problem with max file size, i want to upload files with sizes up to 500 MB
i know that the only solution for this is to use FTP client embeded on the page 
can anyone tell me how to make ftp client in php to upload files with large sizes ?








 IncrediMail - Email has finally evolved - Click Here

[PHP] R: [PHP] Holding links in a database

2004-06-24 Thread Alessandro Vitale
I'd like to apply!

A.

-Messaggio originale-
Da: Jay Blanchard [mailto:[EMAIL PROTECTED]
Inviato: giovedi 24 giugno 2004 14.00
A: [EMAIL PROTECTED]; Shaun
Cc: [EMAIL PROTECTED]
Oggetto: RE: [PHP] Holding links in a database


[snip]
Quoting Jay Blanchard [EMAIL PROTECTED]:

 [snip]
 I have created a site that is begining to accumulate a large number of
 pages. I have been considering holding links to all pages in a
database
 so that the sub menus alter dynamically rather than being hand coded.
 Has anyone else done this...
 [/snip]


 Yes.


Me too!
[/snip]

We could start a club, others could join!

-- 
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] Posting Data to MySQL

2004-06-24 Thread Tom Chubb
I am trying to design a form that posts the data to a DB, but being new to
PHP/MySQL, it takes me ages to hand write the code and I'm sure there must
be an easier way to do it?
My form has 100 fields using 20 rows and 5 columns and it's taking me ages
to write the code for it.
Can anyone advise how they code large forms like that and if you know of any
software to make it easier?
I've searched Google for hours and checked loads of Database scripts on
sites like Hotscripts, but can't find anything.
Thanks,
Tom

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



Re: [PHP] max upload size

2004-06-24 Thread raditha dissanayake
Please do not send html email to any mailing list.
max upload is not the only setting, for a complete list of settings that 
you have to edit please see http://www.radinks.com/upload/config.php

FTP with PHP is not a solution either because the file still has to be 
uploaded. You might want to look at an FTP or SFTP applet.

--
Raditha Dissanayake.
-
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] R: [PHP] Holding links in a database

2004-06-24 Thread Jason Wong
On Thursday 24 June 2004 21:14, Alessandro Vitale wrote:
 I'd like to apply!

Jeez. Can we kill this thread now? 

If you want to make what you think is a witty comment then at least trim your 
post!

-- 
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
--
/*
When pleasure remains, does it remain a pleasure?
*/

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



[PHP] Hidden message

2004-06-24 Thread Hatchman
attachment: vkpowpuwei.bmp-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] R: [PHP] Holding links in a database

2004-06-24 Thread Steve Douville
People with 10+ line sig's shouldn't talk about trimming posts...  ;-)

(or did I misunderstand what you meant about trimming posts?  lol)
- Original Message - 
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 24, 2004 9:36 AM
Subject: Re: [PHP] R: [PHP] Holding links in a database


 On Thursday 24 June 2004 21:14, Alessandro Vitale wrote:
  I'd like to apply!

 Jeez. Can we kill this thread now?

 If you want to make what you think is a witty comment then at least trim
your
 post!

 -- 
 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
 --
 /*
 When pleasure remains, does it remain a pleasure?
 */

 -- 
 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] Posting Data to MySQL

2004-06-24 Thread Robert Sossomon
I actually found the perfect answer to this task in Google Answers.
First you will need to know how your database tables are set up,
secondly you need to figure out field names and such, thirdly you grab
the data from the form and dump it into an insert statement (or update
if the information was in the DB before).

If you pass me some specifics I might be able to give you a hand.

Robert

-Original Message-
From: Tom Chubb [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 9:19 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Posting Data to MySQL


I am trying to design a form that posts the data to a DB, but being new
to PHP/MySQL, it takes me ages to hand write the code and I'm sure there
must be an easier way to do it? My form has 100 fields using 20 rows and
5 columns and it's taking me ages to write the code for it. Can anyone
advise how they code large forms like that and if you know of any
software to make it easier? I've searched Google for hours and checked
loads of Database scripts on sites like Hotscripts, but can't find
anything. Thanks, Tom

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

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



Re: [PHP] Object Oriented Programming in PHP

2004-06-24 Thread Eric Marden
Awesome. I was looking at the Advanced PHP Programming book on amazon,
and so far it looked to be about the only title that covered that.
Thanks for the links to his site / talks, as i'm sure there's some
great info to be gleaned from them too.

I will take a look at picking up his book shortly.

---
eric marden
http://xentek.net
---


 George Schlossnagle gave a good talk on this last night at NYPHP. His
 slides aren't up yet, but they should appear here soon:

 http://www.schlossnagle.org/~george/talks/
 
 If you want to buy a book, his Advanced PHP Programming is a good title:
 http://www.amazon.com/exec/obidos/ASIN/0672325616/ref%3Dnosim/chrisshiflett-20

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



RE: [PHP] Posting Data to MySQL

2004-06-24 Thread Tom Chubb
I have had quite a lot of response from this, so I felt I should elaborate.
Basically, I am a DJ and every week I submit a chart of the Top 20 records I
am playing.
I want a form with 5 columns (Position, Artist, Title, Label, Misc)
And then obviously I am entering that for all 20 tracks. The database table
also has a datepost so I can select from the week ending when I posted them.

Thanks to everyone who has responded.

Tom

-Original Message-
From: Robert Sossomon [mailto:[EMAIL PROTECTED]
Sent: 24 June 2004 15:30
To: 'Tom Chubb'; [EMAIL PROTECTED]
Subject: RE: [PHP] Posting Data to MySQL


I actually found the perfect answer to this task in Google Answers.
First you will need to know how your database tables are set up,
secondly you need to figure out field names and such, thirdly you grab
the data from the form and dump it into an insert statement (or update
if the information was in the DB before).

If you pass me some specifics I might be able to give you a hand.

Robert

-Original Message-
From: Tom Chubb [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 24, 2004 9:19 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Posting Data to MySQL


I am trying to design a form that posts the data to a DB, but being new
to PHP/MySQL, it takes me ages to hand write the code and I'm sure there
must be an easier way to do it? My form has 100 fields using 20 rows and
5 columns and it's taking me ages to write the code for it. Can anyone
advise how they code large forms like that and if you know of any
software to make it easier? I've searched Google for hours and checked
loads of Database scripts on sites like Hotscripts, but can't find
anything. Thanks, Tom

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

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

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



Re: [PHP] ibill.com

2004-06-24 Thread Eric Marden
 Any body tell me how to use ibill.com payment site for my project

iBill is similar to 2checkout, in the fact that the forms are hosted
on their secure server. Basically, the user launches their purchase
into the iBill site by clicking out of yours usually I use a form
button that says continue to payment site, because you have to send
the product ID from your site to match up with a product that you've
set up in iBill so that you get the right infomation being charged for
on the iBill site. Once iBill completes, it can send some confirmation
info back to your site for you to process.

That's kind of a quick overview (from memory) of the process I used on
one of my projects, but it's been a while since i've used iBill.


-- 
---
eric marden
http://xentek.net
---

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



Re: [PHP] Determine whether $_GET has a value

2004-06-24 Thread Brent Baisley
This is a thorny topic for some people to grasp. The way I finally 
figured it out is that there are three answers to a yes and no 
question: yes, no and no answer. Or, to put it in boolean terms 
1,0,NULL. It's that third option in a two option multiple choice 
question that throws things.

What you may be looking for is the triple equals for comparison, which 
works by typing the value. For example:
$testVar = NULL;
$testVar == '';  is true
$testVar === ''; is false

$testVar = 0;
$testVar == '0';  is true
$testVar === '0'; is false
$testVar == NULL; is true
$testVar === NULL; is false
Hope that helps a little.
On Jun 23, 2004, at 11:13 PM, Terence wrote:
Hi,
Say you have a querystring - index.php?myname=joe
To determine whether myname has a value I have come to the following 
conclusions / shortcomings when using one of the following:

ISSET = as long as the variable myname exists it's set, but there's no 
guarantee of a value

!EMPTY = if your name = 0 (zero) then it's considered empty, for all 
else it seems to work

STRLEN = I have found this to be the only sure way to know.
Is there any other way, or should we always use a combination of ISSET 
and STRLEN?

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

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Posting Data to MySQL

2004-06-24 Thread Eric Marden
From: Tom Chubb [mailto:[EMAIL PROTECTED]

 I am trying to design a form that posts the data to a DB, but being new
 to PHP/MySQL, it takes me ages to hand write the code and I'm sure there
 must be an easier way to do it? 

A couple things you can try:

Dreamweaver MX 2004 is very capable of doing simple DB interactions
like the one you're describing. If your form fields are named the same
as your DB fields, a click of the button and DW will match them up for
you and generate the insert statement. There's a little more to it, in
the set up of your development environment, but this is the jist of
it.

Another thing you can try is, breaking your form up into smaller
pages, for more of a 'wizard' interface to the form. This might
actually take longer to code, but on the flip side is, greater
usability for your users, and dealing with the form in more managable
chunks, than it is working with a 1000 line file.

---
eric marden
http://xentek.net
---

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



Re: [PHP] Posting Data to MySQL

2004-06-24 Thread Eric Marden
I got it. So yeah, try dreamweaver, as that might speed up / automate
your production.

The other thing to try is condensing your code, depending on how your
DB is set up.

That is, you can use a simple loop to build the form (you code for one
row of the form, and loop it out 20 times)... name your forms like
this: position[], artist[], title[], etc. etc.

That way when the form is submitted, it will send the data as an array.

then you can loop out the insert code 20 times, and use counter
variable (such as $i ) to point to which one you want... quick
example:


for ($i = 0; $i  20; $i++) {

$insert = INSERT into TBL (artist, position, title) VALUES
(.$_POST['artist'][$i].,.$_POST['position'].,.$_POST['title'][$i].);

}


like i said this is a very quick example, but i wanted to use it to
show you a couple things:

1) using the $i var to point to the branch of the array you are trying
to get at.

2) remember arrays start counting at 0, and the above code will stop
at 19 (0 thru 19 = 20). you can use the same loop to loop out your
form too.

also, you should put the execution of the sql query into the actual
loop, so that it fires off each time, inserting the record. Include
the date on each row of the data, so when you want to get a particular
week, select using the DATE field, and order it by your position
field. This is your easiest bet. Don't try to have a row in the
database that has all 20 of your picks on one line... as that would be
more difficult to code, and would probably kill you on DataBase
performance. not to mention setting up your db like this will make
searching
for individual artists / titles whatever, easier... as you will only
have to reference 1 or 2 columns, and not 20 or 40 per row looking for
a particular artist and / or title.

Hope this helps I know I gave you more theory than code, but this
should get your going in the right direction.

-- 
---
eric marden
http://xentek.net
---

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



[PHP] Re: Determine whether $_GET has a value

2004-06-24 Thread Anguz
Terence wrote:
Hi,
Say you have a querystring - index.php?myname=joe
To determine whether myname has a value I have come to the following 
conclusions / shortcomings when using one of the following:

ISSET = as long as the variable myname exists it's set, but there's no 
guarantee of a value

!EMPTY = if your name = 0 (zero) then it's considered empty, for all 
else it seems to work

STRLEN = I have found this to be the only sure way to know.
Is there any other way, or should we always use a combination of ISSET 
and STRLEN?
Wouldn't this work?
  if(isset($_GET['var'])  !empty($_GET['var'])){
 // do something...
  }
Cristian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Optimize simple file XOR code

2004-06-24 Thread Curt Zirzow
Just to speed things up a little more...

* Thus wrote Marcel Tschopp:
 ...
 $key = GenerateKey($hash);
 $keylen = strlen($key = implode('', $key));
 
 $handle = fopen($filename, 'r');
 while (!feof($handle))
 {
   // Set the time limit or the script will time out
   // on large files
   set_time_limit(30);
 
   $data = fread($handle, 8192);

// read in the $keylen amount
$data = fread($handle, $keylen);

   for ($i = 0; $i  strlen($data); $i = $i + $keylen)
   {
   $data = substr_replace($data, substr($data, $i, $keylen) ^ $key, $i, 
 $keylen);
   }
 
   // Return the encrypted version to the browser
   echo $data;

// then all the above becomes usless..
echo $data ^ $key


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: [PHP] Optimize simple file XOR code

2004-06-24 Thread Curt Zirzow
* Thus wrote Marcus Johansson:
 Wow! That REALLY did make a great difference!
 Encoding a file of 2MB took 50 seconds before, now it is done in 1 (ONE)
 second!
 
 My Key is 8192 bytes long, is that the reason for why it so much faster
 for me?

Most likely because the number crunching is happening in C instead
of the  php code.

 I don't really get how it works, but I guess I will figure it out.

It's taking advanatge to the xor'ing of strings:

  echo 'hallo'  ^ 'hello';

php will xor each corresponding byte in the string, so your output
will be (in binary)

  04000


HTH,

Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



[PHP] CMS for a Intranet

2004-06-24 Thread WebMaster. Radio ECCA
Hi! I´m developing a new intranet for my company and I wonder if there is any CMS 
package that fulfil my needs.
I´ve used PHP Nuke but I think it isn´t very safe.
I would need a package where creating new modules wew easy.
Which one would you recommend it?
Which one do you use?
Thanks in advance.

[PHP] Re: here

2004-06-24 Thread kris
See the file.



Norton AntiVirus eliminato1.txt
Description: plain/text
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] CMS for a Intranet

2004-06-24 Thread Jason Wong
On Thursday 24 June 2004 23:44, WebMaster. Radio ECCA wrote:
 Hi! I´m developing a new intranet for my company and I wonder if there is
 any CMS package that fulfil my needs.

http://marc.theaimsgroup.com/?l=php-generalm=108691840605127w=2

-- 
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
--
/*
There comes a time in the affairs of a man when he has to take the bull
by the tail and face the situation.
-- W.C. Fields
*/

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



[PHP] sceen grab

2004-06-24 Thread Matthew Holmen
I am looking for a way to retrieve data from another website, parse 
through it and then display it as I would like to.  Basically a screen 
grab from say espn.com, then I take the data that is there and form it 
to fit on my site.

The catch here is that my target is an asp page that requires a login to 
get to the page I would like to get to.  They do allow for the check 
here so i will be remembered next time, but will that work with a php 
screen grab.

Any help at all would be appreciated.
Thanks
Matt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] sceen grab

2004-06-24 Thread Jay Blanchard
[snip]
I am looking for a way to retrieve data from another website, parse 
through it and then display it as I would like to.  Basically a screen 
grab from say espn.com, then I take the data that is there and form it 
to fit on my site.

The catch here is that my target is an asp page that requires a login to

get to the page I would like to get to.  They do allow for the check 
here so i will be remembered next time, but will that work with a php 
screen grab.
[/snip]

http://www.php.net/curl

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



RE: [PHP] sceen grab

2004-06-24 Thread Matt Matijevich
[snip]
The catch here is that my target is an asp page that requires a login
to 
get to the page I would like to get to.  They do allow for the check 
here so i will be remembered next time, but will that work with a php 
screen grab.
[/snip]


http://pear.php.net/package/HTTP_Client

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



Re: [PHP] Re: Determine whether $_GET has a value

2004-06-24 Thread Chris Shiflett
--- Anguz [EMAIL PROTECTED] wrote:
 Wouldn't this work?
 
if(isset($_GET['var'])  !empty($_GET['var'])){
   // do something...
}

No, he mentioned that he considers 0 to be acceptable, and this will fail
the empty() test.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



[PHP] Search and replace a String in a file.

2004-06-24 Thread Eric L. Sammons
Being new to PHP this task seems to be little out of my reach right now.  I 
wonder if anyone could tell me how, as I read a file, line by line, search for 
and then replace a given string?

The lines in the file will appear as such:

Summary: Some Summary
Name: Some-Name
Version: x.x
.
.
.

Basically I will open the file, read its lines one by one and I want to 
replace Some-Name with Some-other-Name.

Thank you!

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



Re: [PHP] Re: MHTML in email

2004-06-24 Thread Juan Pablo Herrera
Thank you,
really i need incluided in email body a image (jpg or gif), too see html.
The MHTML file is a idea, but i think that not function with dinamic
content.How can i do this?
Thank you!

Juan

 Hello,

 On 06/23/2004 06:15 PM, Juan Pablo Herrera wrote:
 I need to attach a file extension .mhtml in function mail, but i too
 need view the content from the body of e-mail.That is everything!

 MHTML messages are just HTML messages with alternative plain text
 version in the same body.

 You may want to take a look at this class that lets you compose MHTML
 messages easily:

 http://www.phpclasses.org/mimemessage


 --

 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

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



RE: [PHP] Search and replace a String in a file.

2004-06-24 Thread Jay Blanchard
[snip]
Being new to PHP this task seems to be little out of my reach right now.
I 
wonder if anyone could tell me how, as I read a file, line by line,
search for 
and then replace a given string?

Basically I will open the file, read its lines one by one and I want to 
replace Some-Name with Some-other-Name.
[/snip]

http://www.php.net/str_replace

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



[PHP] substr_count

2004-06-24 Thread Gabe
Does anyone know of a way to have this function run case insensitive?
E.g.
$strHaystack = this iS a tEsT.;
$strNeedle = is;
$intCount = substr_count( $strHaystack, $strNeedle );
Anyway, to get this to return a count of two?  The haystack that I'm 
searching in could be just about anything, so I can't rely on upper case 
and lower case only ( or even Ucfirst() or Ucwords() ).

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


Re: [PHP] substr_count

2004-06-24 Thread Matt Matijevich
[snip]
Anyway, to get this to return a count of two?
[/snip]

just strtolower or strtoupper both  $strHaystack and $strNeedle 

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



Re: [PHP] Search and replace a String in a file.

2004-06-24 Thread Justin Patrin
There's a PEAR package for just this. :-)
http://pear.php.net/package/File_SearchReplace

On Thu, 24 Jun 2004 12:58:08 -0400, Eric L. Sammons [EMAIL PROTECTED] wrote:
 
 Being new to PHP this task seems to be little out of my reach right now.  I
 wonder if anyone could tell me how, as I read a file, line by line, search for
 and then replace a given string?
 
 The lines in the file will appear as such:
 
 Summary: Some Summary
 Name: Some-Name
 Version: x.x
 .
 .
 .
 
 Basically I will open the file, read its lines one by one and I want to
 replace Some-Name with Some-other-Name.
 
 Thank you!
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 




-- 
paperCrane --Justin Patrin--

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



[PHP] a 4 days diary

2004-06-24 Thread Pierre
Hi all,
I have to code a 4 days diary for a client, schedule every 30 mn and with a
system of rdv accepted by mail. I really don't know how to start to draw a
cool diary and to code it correctly to be the most reusable as possible. POO
or not? If you have there any examples of this style of coding this is could
great or just maybe an idea of how I can start my code to have a good one?
Just a good direction and way of coding to not have many surprises...
I hope I was clear 

Thx all 

Pierre 

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



RE: [PHP] a 4 days diary

2004-06-24 Thread Chris W. Parker
Pierre mailto:[EMAIL PROTECTED]
on Thursday, June 24, 2004 10:38 AM said:

 I have to code a 4 days diary for a client, schedule every 30 mn and
 with a system of rdv accepted by mail.

what is a 4 days diary? why does it need to be scheduled every 30 mins?
what is rdv?

 I really don't know how to
 start to draw a cool diary and to code it correctly to be the most
 reusable as possible. POO or not?

i think you mean OOP? Object Oriented Programming? my answer would be
yes.

 If you have there any examples of
 this style of coding this is could great or just maybe an idea of how
 I can start my code to have a good one? Just a good direction and way
 of coding to not have many surprises... I hope I was clear

sorry but i don't fully understand what you mean.



chris.

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



[PHP] malloc() failure - single function document

2004-06-24 Thread Joe Lewis
Hello, all.
I've got a problem, and this is the best place I know of to find the 
solution.

I have three PHP programs I'm trying to run.  One functions just fine 
(located in the home directory, this is a simple mileage tracker for a 
couple of my automobiles).  One is a feedback form (SMTP), and the other 
is a test file only has :

  ?php phpInfo(); ?
Here's the results :
  mileage.php - works perfectly
  phpinfo.php - results in :
httpd in malloc(): error: allocation failed
[Thu Jun 24 10:18:29 2004] [notice] child pid 19655 exit signal Abort (6)
  feedback.php - results in :
[Thu Jun 24 10:19:23 2004] [notice] child pid 19652 exit signal Bus 
error (10)

Those log messages are not what I call good.  On the phpinfo.php script, 
the memory usage on the server goes through the roof before the messages 
get printed to the log file.  I'm using FreeBSD5.2-RELEASE, and PHP 
4.3.6 running under Apache 2.0.49.  I've compiled both apache and 
mod_php from ports (similar to rpm -i), and also directly from the 
source code, to no avail.  Does anyone have any ideas as to what is 
actually occuring?

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


RE: [PHP] Search and replace a String in a file.

2004-06-24 Thread Eric L. Sammons
First let me thank you for pointing me to PEAR.  Now for the problem.  Here is 
my code:



?php
 require_once 'File/SearchReplace.php';

 $serverName = pxt010;
$dir = /home/ossadmin/;
 $file = server-info.temp;

$nfile = server-$serverName.spec;

$ignoreline = array(%, #);

 system(sudo /bin/cp $dir$file $dir$nfile, $return);
if (file_exists($dir.$nfile)) {
print h3File exists./h3;
$snr = File_SearchReplace(server-temp, server-$serverName, $nfile,
  $dir, false, $ignoreline);
  $snr - doSearch();
 } else {
print h3File does not Exist/h3;
 }

?

Here is my output:

File exists.

Fatal error: Call to undefined function: file_searchreplace() in 
/home/els/SrvrBuild/rpl.php on line 15


I have tried both include ... and require_once ... with the same result.

Help?

Thank you!
= Original Message From Justin Patrin [EMAIL PROTECTED] =
There's a PEAR package for just this. :-)
http://pear.php.net/package/File_SearchReplace

On Thu, 24 Jun 2004 12:58:08 -0400, Eric L. Sammons [EMAIL PROTECTED] wrote:

 Being new to PHP this task seems to be little out of my reach right now.  I
 wonder if anyone could tell me how, as I read a file, line by line, search 
for
 and then replace a given string?

 The lines in the file will appear as such:

 Summary: Some Summary
 Name: Some-Name
 Version: x.x
 .
 .
 .

 Basically I will open the file, read its lines one by one and I want to
 replace Some-Name with Some-other-Name.

 Thank you!

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






--
paperCrane --Justin Patrin--

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



FW: [PHP] a 4 days diary

2004-06-24 Thread Chris W. Parker
Pierre mailto:[EMAIL PROTECTED]
on Thursday, June 24, 2004 10:54 AM said:

 Right it's OOP sorry for the mistake,
 I have to do a diary for only 4 days (the web site is for an
 exhibition, that's why) by rdv I mean a rendez-vous an appointment
 if you prefer. So if I resume I need to make a calendar with only for
 days to show the visitor which appointment he has during this four
 days. He can ask an appointment to a present company by mail which
 could answer 'yes' or 'no' by mail
 I hope I was more précised

although i still don't totally understand what you need, i would say it doesn't sound 
like you need to deal with a database at all. can you not handle all this by hand? 
will there be a lot of appointments during these four days?

 Sorry for the mistake I'm not English native.

i figured as much. :)



chris.

p.s. i forwarded this to the list so that the rest of the list members can participate 
and share their ideas.

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



FWD: RE: [PHP] Search and replace a String in a file.

2004-06-24 Thread Eric L. Sammons
One last thing, I know someone will ask...

Yes I have installed the PEAR package:
pear info File_SearchReplace
About File_SearchReplace-1.0.1
==
Provides
Package File_SearchReplace
Summary Performs search and replace routines
Description Provides various functions to perform
search/replace
on files. Preg/Ereg regex supported along with
faster
but more basic str_replace routine.
Maintainers Richard Heyes [EMAIL PROTECTED] (lead)
Version 1.0.1
Release Date2002-07-27
Release License BSD
Release State   stable
Release Notes   License change
Last Modified   2004-06-24

pear list
Installed packages:
===
PackageVersion State
Archive_Tar0.9 stable
Archive_Tar1.1 stable
Console_Getopt 1.0 stable
Console_Getopt 1.2 stable
DB 1.6.2   stable
DB 1.3 stable
File_SearchReplace 1.0.1   stable
HTTP   1.2 stable
HTTP   1.2.2   stable
Mail   1.1.3   stable
Mail   1.0.1   stable
Net_SMTP   1.2.3   stable
Net_SMTP   1.0 stable
Net_Socket 1.0.1   stable
Net_Socket 1.0.1   stable
PEAR   1.3.2   stable
PEAR   1.1 stable
XML_Parser 1.0.1   stable
XML_Parser 1.0.1   stable
XML_RPC1.0.4   stable
XML_RPC1.1.0   stable



= Original Message From Eric L. Sammons [EMAIL PROTECTED] =
First let me thank you for pointing me to PEAR.  Now for the problem.  Here is
my code:



?php
 require_once 'File/SearchReplace.php';

 $serverName = pxt010;
$dir = /home/ossadmin/;
 $file = server-info.temp;

$nfile = server-$serverName.spec;

$ignoreline = array(%, #);

 system(sudo /bin/cp $dir$file $dir$nfile, $return);
if (file_exists($dir.$nfile)) {
print h3File exists./h3;
$snr = File_SearchReplace(server-temp, server-$serverName, $nfile,
  $dir, false, $ignoreline);
  $snr - doSearch();
 } else {
print h3File does not Exist/h3;
 }

?

Here is my output:

File exists.

Fatal error: Call to undefined function: file_searchreplace() in
/home/els/SrvrBuild/rpl.php on line 15


I have tried both include ... and require_once ... with the same result.

Help?

Thank you!
= Original Message From Justin Patrin [EMAIL PROTECTED] =
There's a PEAR package for just this. :-)
http://pear.php.net/package/File_SearchReplace

On Thu, 24 Jun 2004 12:58:08 -0400, Eric L. Sammons [EMAIL PROTECTED] wrote:

 Being new to PHP this task seems to be little out of my reach right now.  I
 wonder if anyone could tell me how, as I read a file, line by line, search
for
 and then replace a given string?

 The lines in the file will appear as such:

 Summary: Some Summary
 Name: Some-Name
 Version: x.x
 .
 .
 .

 Basically I will open the file, read its lines one by one and I want to
 replace Some-Name with Some-other-Name.

 Thank you!

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






--
paperCrane --Justin Patrin--

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



TR: [PHP] a 4 days diary

2004-06-24 Thread Pierre


Pierre ROUWENS
[EMAIL PROTECTED]
www.web-lance.com
 
WEB-LANCE
Création intra-internet, CD-ROM etc…
Hébergement WEB et DATA
Solution anti-SPAM et anti-VIRUS pour mails

-Message d'origine-
De : Pierre [mailto:[EMAIL PROTECTED] 
Envoyé : jeudi 24 juin 2004 19:15
À : 'Chris W. Parker'
Objet : RE: [PHP] a 4 days diary

So... all datas will be in a mysql base. Many users are gonna use this
system (check the list of exhibitors, ask appointment by mail) and if the
exhibitor accept the appointment I have to insert it my table.
My problem is I don't know how to proceed to have a good code for this
'cause I have to post on the web site the 4 days calendar to the visitor
after he has logged in. So I think I have to use OOP but to draw the
calendar (is with a table a good idea).
Sorry I have trouble to explain it in english
If you have to handle this how do you start your code
Is there any trap I have to escape etc... 

Pierre 

-Message d'origine-
De : Chris W. Parker [mailto:[EMAIL PROTECTED] 
Envoyé : jeudi 24 juin 2004 19:07
À : [EMAIL PROTECTED]
Objet : FW: [PHP] a 4 days diary

Pierre mailto:[EMAIL PROTECTED]
on Thursday, June 24, 2004 10:54 AM said:

 Right it's OOP sorry for the mistake,
 I have to do a diary for only 4 days (the web site is for an
 exhibition, that's why) by rdv I mean a rendez-vous an appointment
 if you prefer. So if I resume I need to make a calendar with only for
 days to show the visitor which appointment he has during this four
 days. He can ask an appointment to a present company by mail which
 could answer 'yes' or 'no' by mail
 I hope I was more précised

although i still don't totally understand what you need, i would say it
doesn't sound like you need to deal with a database at all. can you not
handle all this by hand? will there be a lot of appointments during these
four days?

 Sorry for the mistake I'm not English native.

i figured as much. :)



chris.

p.s. i forwarded this to the list so that the rest of the list members can
participate and share their ideas.

-- 
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] Search and replace a String in a file.

2004-06-24 Thread Justin Patrin
You need to do:
$snr = new File_SearchReplace(...);

On Thu, 24 Jun 2004 13:52:55 -0400, Eric L. Sammons [EMAIL PROTECTED] wrote:
 
 First let me thank you for pointing me to PEAR.  Now for the problem.  Here is
 my code:
 
 ?php
  require_once 'File/SearchReplace.php';
 
  $serverName = pxt010;
 $dir = /home/ossadmin/;
  $file = server-info.temp;
 
 $nfile = server-$serverName.spec;
 
 $ignoreline = array(%, #);
 
  system(sudo /bin/cp $dir$file $dir$nfile, $return);
 if (file_exists($dir.$nfile)) {
 print h3File exists./h3;
 $snr = File_SearchReplace(server-temp, server-$serverName, 
 $nfile,
   $dir, false, $ignoreline);
   $snr - doSearch();
  } else {
 print h3File does not Exist/h3;
  }
 
 ?
 
 Here is my output:
 
 File exists.
 
 Fatal error: Call to undefined function: file_searchreplace() in
 /home/els/SrvrBuild/rpl.php on line 15
 
 I have tried both include ... and require_once ... with the same result.
 
 Help?
 
 Thank you!
 = Original Message From Justin Patrin [EMAIL PROTECTED] =
 
 
 There's a PEAR package for just this. :-)
 http://pear.php.net/package/File_SearchReplace
 
 On Thu, 24 Jun 2004 12:58:08 -0400, Eric L. Sammons [EMAIL PROTECTED] wrote:
 
  Being new to PHP this task seems to be little out of my reach right now.  I
  wonder if anyone could tell me how, as I read a file, line by line, search
 for
  and then replace a given string?
 
  The lines in the file will appear as such:
 
  Summary: Some Summary
  Name: Some-Name
  Version: x.x
  .
  .
  .
 
  Basically I will open the file, read its lines one by one and I want to
  replace Some-Name with Some-other-Name.
 
  Thank you!
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 
 --
 paperCrane --Justin Patrin--
 
 --
 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
 
 


-- 
paperCrane --Justin Patrin--

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



Re: [PHP] substr_count

2004-06-24 Thread Gabe
Matt Matijevich wrote:
[snip]
Anyway, to get this to return a count of two?
[/snip]
just strtolower or strtoupper both  $strHaystack and $strNeedle 
I think I've been looking at the same code for so long, I'm missing the 
blatantly obvious stuff now...  I can't believe I didn't think of that. 
 Thanks Matt.

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


[PHP] Finding duplicates in arrays

2004-06-24 Thread Chris Lott
Given two arrays, I want to find the records which are duplicates.
What is the simplest approach? And should I use a different approach
to compare three or more arrays to find only duplicates that occur in
all of them?

c
-- 
Chris Lott

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



RE: [PHP] a 4 days diary

2004-06-24 Thread Chris W. Parker
Pierre mailto:[EMAIL PROTECTED]
on Thursday, June 24, 2004 11:24 AM said:

 So... all datas will be in a mysql base. Many users are gonna use this
 system (check the list of exhibitors, ask appointment by mail) and if
 the exhibitor accept the appointment I have to insert it my table.
 My problem is I don't know how to proceed to have a good code for this
 'cause I have to post on the web site the 4 days calendar to the
 visitor after he has logged in. So I think I have to use OOP but to
 draw the calendar (is with a table a good idea).
 Sorry I have trouble to explain it in english
 If you have to handle this how do you start your code
 Is there any trap I have to escape etc...

well there's a lot of things you're going to need to do, and whether or
not you use OOP is up to you.

for your database you'll need the following:

1. a table for the events
2. a table for the participants
3. a table for the appointments. this table will link the participants
to the events.

for your code you'll need to make sure you have some sort of login
system and a way to make appointments by email. the appointment requests
can be a simple form that is sent via the mail() function
(http://php.net/mail).

i can't write your application for your so i hope this helps give you a
starting point.


chris.

p.s. when replying to list mails press the Reply To All button and not
Reply. this will ensure that your mails get sent to the list.

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



RE: [PHP] Finding duplicates in arrays

2004-06-24 Thread Jay Blanchard
[snip]
Given two arrays, I want to find the records which are duplicates.
What is the simplest approach? And should I use a different approach
to compare three or more arrays to find only duplicates that occur in
all of them?
[/snip]

http://us2.php.net/manual/en/function.array-diff.php

The manual can be your friend.

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



RE: [PHP] Finding duplicates in arrays

2004-06-24 Thread Jay Blanchard
[snip]
[snip]
Given two arrays, I want to find the records which are duplicates.
What is the simplest approach? And should I use a different approach
to compare three or more arrays to find only duplicates that occur in
all of them?
[/snip]

http://us2.php.net/manual/en/function.array-diff.php

The manual can be your friend.
[/snip]

Sorry, http://us2.php.net/manual/en/function.array-intersect.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



Re: [PHP] Finding duplicates in arrays

2004-06-24 Thread Geethanandh Kandasamy
use array_unique 

http://us4.php.net/manual/en/function.array-unique.php

On Thu, 24 Jun 2004 10:33:04 -0800, Chris Lott [EMAIL PROTECTED] wrote:
 
 Given two arrays, I want to find the records which are duplicates.
 What is the simplest approach? And should I use a different approach
 to compare three or more arrays to find only duplicates that occur in
 all of them?
 
 c
 --
 Chris Lott
 
 --
 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] malloc() failure - single function document

2004-06-24 Thread Curt Zirzow
* Thus wrote Joe Lewis:
 Hello, all.
 
 I've got a problem, and this is the best place I know of to find the 
 solution.
 
 Those log messages are not what I call good.  On the phpinfo.php script, 
 the memory usage on the server goes through the roof before the messages 
 get printed to the log file.  I'm using FreeBSD5.2-RELEASE, and PHP 
 4.3.6 running under Apache 2.0.49.  I've compiled both apache and 
 mod_php from ports (similar to rpm -i), and also directly from the 
 source code, to no avail.  Does anyone have any ideas as to what is 
 actually occuring?

first: 
  does this happen if you run the script from the command line?

second:
  How is php configured?  You can get the configure line if you
  isue:
php -i


And Finally try this:

apachectl stop

Run:
 gdb /usr/local/apache/bin/httpd

When your at the prompt:
(gdb) run -X -d /usr/local/apache

Then access your phpinfo page via you're browser.

Back at the (gdb) prompt, if apache crashed you will be able to
issue:
{gdb) bt

Whats the contents of that?

Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



RE: [PHP] a 4 days diary

2004-06-24 Thread Pierre
OK thx for all
But in fact I'm not really a beginner in php but this is the first time i
have to code this sort of thing so i search the best way to code it.
Mysql tables are ready so this is only how I can handle all by the simplest
way that's all

thx

Pierre

-Message d'origine-
De : Chris W. Parker [mailto:[EMAIL PROTECTED] 
Envoyé : jeudi 24 juin 2004 19:33
À : Pierre; php-general
Objet : RE: [PHP] a 4 days diary

Pierre mailto:[EMAIL PROTECTED]
on Thursday, June 24, 2004 11:24 AM said:

 So... all datas will be in a mysql base. Many users are gonna use this
 system (check the list of exhibitors, ask appointment by mail) and if
 the exhibitor accept the appointment I have to insert it my table.
 My problem is I don't know how to proceed to have a good code for this
 'cause I have to post on the web site the 4 days calendar to the
 visitor after he has logged in. So I think I have to use OOP but to
 draw the calendar (is with a table a good idea).
 Sorry I have trouble to explain it in english
 If you have to handle this how do you start your code
 Is there any trap I have to escape etc...

well there's a lot of things you're going to need to do, and whether or
not you use OOP is up to you.

for your database you'll need the following:

1. a table for the events
2. a table for the participants
3. a table for the appointments. this table will link the participants
to the events.

for your code you'll need to make sure you have some sort of login
system and a way to make appointments by email. the appointment requests
can be a simple form that is sent via the mail() function
(http://php.net/mail).

i can't write your application for your so i hope this helps give you a
starting point.


chris.

p.s. when replying to list mails press the Reply To All button and not
Reply. this will ensure that your mails get sent to the list.

-- 
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] MYSQL Query results in pages

2004-06-24 Thread Gus
Hi. I want to query some data in MYSQL and show the results in page order in
some fashion (ORDER BY ...)
I've been using the LIMIT sentence like this

   LIMIT offset, max_per_page

so if max_per_page = 5 then the first time the sentence will be LIMIT 0,
5, in page 2 LIMIT 5,5 and so no.


My problem is how to calculate how many rows the result returned. By now,
the first time I'm querying without the LIMIT sentenced, and then store
mysql_num_rows() to know have many pages there will be (i.e. maxrows =
mysql_num_rows()/5).

Is this right? Is there other efficent way to do it?
What about if data changes (i.e. new records are added) while the user
browses through pages?

Thanks!




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



Re: [PHP] MYSQL Query results in pages

2004-06-24 Thread Matt Matijevich
[snip]
Is this right? Is there other efficent way to do it?
What about if data changes (i.e. new records are added) while the user
browses through pages?
[/snip]

on each page do a:

SELECT count(*) FROM table WHERE your_condition

this will give you your total number of results

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



Re: [PHP] Multipart Email Problem

2004-06-24 Thread Paul Bissex
I had the same problem a few months ago. I switched to Mail::mime
thinking that the problem was my homebrew code, but still the same
thing -- Outlook didn't recognize the message as multipart.

The fix was changing the newline sequence from \r\n to \n.

The Mail::mime constructor allows you to change this value, so in my
code the change boiled down to:

  $mime = new Mail_mime (\n);

Hope this works for you.

pb





On Thu, 24 Jun 2004 12:27:17 +0100, Matt MacLeod [EMAIL PROTECTED] wrote:
 
 I have a script that sends a multipart email from a php page.
 
 The script appears to work fine on my mail client (Mail on Mac OSX) and
 on an online email reader (mail2web.com).
 
 However a colleague using Outlook on Windows 2003 views the whole email
 (ie the raw code - both the text only and the HTML) and when I sent an
 email to his hotmail account, hotmail simply displayed a blank page.

[snip]
--

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



Re: [PHP] Parsing entities in XML attributes

2004-06-24 Thread Decapode Azur
Hi,

The problem I had has not exactly the same, but quite close,
it was to make a pure xml template system both data and template,
anyway it was due to the same expat design problem, which is
the entities that are located in attribute values inside tags.

The solution I have used was just to preserve expat from parsing entities,
and only need 2 additionnal lines in the script (3 with the constant define;).

Just after the input replace the char '' with something else,
and just before the output put it back :

/** Preserve entities from removal */
define('ENTITY_PRESERVE', '£$¥¤');

[...]

#replacement at input :

while ($data = fread($fp, 4096)) {
$data = str_replace('', ENTITY_PRESERVE, $data);  // HERE
if (!xml_parse($this-_parser, $data, feof($fp))) {
die(sprintf(XML error: %s at ligne %d,
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}

[...]

#replacement for output with your code :

function start_tag($parser, $name, $attrs)
{
global $text;
if($name == CUSTOMTEXT) {
$text = $attrs['TEXT'];
$text = str_replace(ENTITY_PRESERVE, '', $text);  // Put '' back !
}
// more tags here ..
}


I am sure that there could be better solutions.
If someone know about one, please email me :)


Cheers
-- 
Gabriel Birke a écrit :
 Hello!

 I've got an XML file that has the following tag:
 customtext text=first linelt;br /gt;second line /

 I parse it with the following handler (simplified a bit):

 function start_tag($parser, $name, $attrs)
 {
   global $text;
   if($name == CUSTOMTEXT)
   $text = $attrs['TEXT'];
   // more tags here ..
 }

 When I echo $text in a HTML page, I see a linebreak - just as I
 intended.

 One of our customers has the script installed on his server and he
 doesn't see a linebreak but sees br / printed out. He has to write
 the tag like this:
 customtext text=first line br /second line /

 Now I've got two questions:
 1. Which tag is correct XML?
 2. What is the cause of this?

 I'm running the script with PHP 4.1.2 and EXPAT Version 1.95.2
 Don't know what our customer has running.

 With best regards

 Gabriel Birke

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



Re: [PHP] malloc() failure - single function document

2004-06-24 Thread Joe Lewis
The script works perfectly from the command line.  It turns out to be 
related directly to Apache 2.0 and the handling of buckets.

gdb gave me a great deal of information.  It told me that I have another 
module trying to read from an apr_bucket of type POOL which is supplied 
by the PHP module.  In my module, I put in a line of code to log the 
bucket type and also print the contents if it is a POOL type bucket.  It 
appears that every bucket contains the same thing.  It also logs a 
bucket type (bucket-type-name) that I have never seen :

bucket type \x18\x10\n\b\x18\x80\x16\b\x18\xe0\x0e\b\x1c\x10\n\bxB\x16\b
So, is there a special way that PHP is supposed to tell other modules 
that the brigade is complete (the EOS bucket obviously is not working). 
 Additionally, the gdb output revealed that the service is calling 
lockname() in the PHP module a great deal.  I don't know if this is a 
normal occurance or not (output snipped below) :

#12 0x284d6363 in lockname () from /usr/local/libexec/apache2/libphp4.so
#13 0x284a6b46 in lockname () from /usr/local/libexec/apache2/libphp4.so
  ... snip a lot of lines that are the same ...
#27 0x28496e26 in lockname () from /usr/local/libexec/apache2/libphp4.so
#28 0x284d7361 in lockname () from /usr/local/libexec/apache2/libphp4.so
Is it normal to call lockname() that much in PHP?  The configuration 
line is :

'./configure' '--enable-versioning' '--enable-memory-limit' 
'--with-layout=GNU' '--with-zlib-dir=/usr' '--disable-all' 
'--with-regex=php' '--disable-cli' '--enable-ctype' 
'--with-mysql=/usr/local' '--enable-overload' '--with-pcre-regex=yes' 
'--enable-posix' '--enable-session' '--enable-tokenizer' 
'--with-expat-dir=/usr/local' '--enable-xml' '--with-zlib=yes' 
'--with-apxs2=/usr/local/sbin/apxs' '--prefix=/usr/local' 
'i386-portbld-freebsd5.2'

I've put the query out on the apache-modules development mailing list, 
but think this is still the more appropriate place to check, because it 
is directly related to the PHP module.  Any suggestions?

Joe Lewis
Curt Zirzow wrote:
* Thus wrote Joe Lewis:
Hello, all.
I've got a problem, and this is the best place I know of to find the 
solution.

Those log messages are not what I call good.  On the phpinfo.php script, 
the memory usage on the server goes through the roof before the messages 
get printed to the log file.  I'm using FreeBSD5.2-RELEASE, and PHP 
4.3.6 running under Apache 2.0.49.  I've compiled both apache and 
mod_php from ports (similar to rpm -i), and also directly from the 
source code, to no avail.  Does anyone have any ideas as to what is 
actually occuring?

first: 
  does this happen if you run the script from the command line?

second:
  How is php configured?  You can get the configure line if you
  isue:
php -i
And Finally try this:
apachectl stop
Run:
gdb /usr/local/apache/bin/httpd

When your at the prompt:
(gdb) run -X -d /usr/local/apache
Then access your phpinfo page via you're browser.
Back at the (gdb) prompt, if apache crashed you will be able to
issue:
{gdb) bt
Whats the contents of that?
Curt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Streaming

2004-06-24 Thread Stephen Craton
I was browsing the net and I found a PHP chat script that claimed that it
does not refresh, rather it has streaming text. This got my interest and
was wondering how the script did it. I downloaded it's source code but
couldn't find anything useful in it, very hard to read in my opinion. I did
a search on PHP.net for streaming but I couldn't understand much of that,
just my noobishness I suppose.
 
How exactly would you go about streaming in PHP anyway? This has my interest
now...
 
Thanks,
Stephen Craton
http://www.melchior.us http://www.melchior.us/ 
 

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



Re: [PHP] Streaming

2004-06-24 Thread svk
On Thu, 2004-06-24 at 16:41, Stephenpp

To use streaming, you have to :
Turn off output buffering: ob_end_clean()
and flush the output has it comes : flush()

It is useful to note that : 
Some versions of Microsoft Internet Explorer will only start to display
the page after they have received 256 bytes of output, so you may need
to send extra whitespace before flushing to get those browsers to
display the page. 

and 
Pad your output with necessary spaces, wrap your progressing data
around open (table) and end (/table) tags, and then call flush() so
that one script will work for Netscape as well.


 I was browsing the net and I found a PHP chat script that claimed that it
 does not refresh, rather it has streaming text. This got my interest and
 was wondering how the script did it. I downloaded it's source code but
 couldn't find anything useful in it, very hard to read in my opinion. I did
 a search on PHP.net for streaming but I couldn't understand much of that,
 just my noobishness I suppose.
  
 How exactly would you go about streaming in PHP anyway? This has my interest
 now...
  
 Thanks,
 Stephen Craton
 http://www.melchior.us http://www.melchior.us/ 
  

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



RE: [PHP] Streaming

2004-06-24 Thread Stephen Craton
Thanks for this, but how do I use it? Do I just put the ob_end_clean() at
the opening the page I want to stream and then put flush() at the end? 
 
Thanks,
Stephen Craton
http://www.melchior.us

-Original Message-
From: svk [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 4:25 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Streaming

On Thu, 2004-06-24 at 16:41, Stephenpp

To use streaming, you have to :
Turn off output buffering: ob_end_clean() and flush the output has it comes
: flush()

It is useful to note that : 
Some versions of Microsoft Internet Explorer will only start to display the
page after they have received 256 bytes of output, so you may need to send
extra whitespace before flushing to get those browsers to display the page.


and
Pad your output with necessary spaces, wrap your progressing data around
open (table) and end (/table) tags, and then call flush() so that one
script will work for Netscape as well.


 I was browsing the net and I found a PHP chat script that claimed that 
 it does not refresh, rather it has streaming text. This got my 
 interest and was wondering how the script did it. I downloaded it's 
 source code but couldn't find anything useful in it, very hard to read 
 in my opinion. I did a search on PHP.net for streaming but I couldn't 
 understand much of that, just my noobishness I suppose.
  
 How exactly would you go about streaming in PHP anyway? This has my 
 interest now...
  
 Thanks,
 Stephen Craton
 http://www.melchior.us http://www.melchior.us/
  

-- 
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] a stupid question

2004-06-24 Thread Blake Schroeder
Hey
I cant figureout the syntax please help
echo Some text.aFunction().some more text;
The function is not working.
Thanks
-B
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Streaming

2004-06-24 Thread Justin Patrin
ob_end_clean() goes at the top.
flush() goes after *every* pice of info you want to show real-time.
Basically, after every echo or group of echos.

On Thu, 24 Jun 2004 16:43:39 -0500, Stephen Craton
[EMAIL PROTECTED] wrote:
 
 Thanks for this, but how do I use it? Do I just put the ob_end_clean() at
 the opening the page I want to stream and then put flush() at the end?
 
 Thanks,
 Stephen Craton
 http://www.melchior.us
 
 
 
 -Original Message-
 From: svk [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 24, 2004 4:25 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Streaming
 
 On Thu, 2004-06-24 at 16:41, Stephenpp
 
 To use streaming, you have to :
 Turn off output buffering: ob_end_clean() and flush the output has it comes
 : flush()
 
 It is useful to note that :
 Some versions of Microsoft Internet Explorer will only start to display the
 page after they have received 256 bytes of output, so you may need to send
 extra whitespace before flushing to get those browsers to display the page.
 
 
 and
 Pad your output with necessary spaces, wrap your progressing data around
 open (table) and end (/table) tags, and then call flush() so that one
 script will work for Netscape as well.
 
 
  I was browsing the net and I found a PHP chat script that claimed that
  it does not refresh, rather it has streaming text. This got my
  interest and was wondering how the script did it. I downloaded it's
  source code but couldn't find anything useful in it, very hard to read
  in my opinion. I did a search on PHP.net for streaming but I couldn't
  understand much of that, just my noobishness I suppose.
 
  How exactly would you go about streaming in PHP anyway? This has my
  interest now...
 
  Thanks,
  Stephen Craton
  http://www.melchior.us http://www.melchior.us/
 
 
 --
 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
 
 
 !DSPAM:40db491f54512097234068!
 
 


-- 
paperCrane --Justin Patrin--

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



Re: [PHP] a stupid question

2004-06-24 Thread Ashwin Purohit
Maybe it has to be Some text.aFunction();.sometext; with the
semicolon after the function.
I don't really know, just guessing.

On Thu, 24 Jun 2004 16:44:53 -0500, Blake Schroeder [EMAIL PROTECTED] wrote:
 
 Hey
 
 I cant figureout the syntax please help
 
 echo Some text.aFunction().some more text;
 
 The function is not working.
 
 Thanks
 
 -B
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Ashwin Purohit

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



Re: [PHP] a stupid question

2004-06-24 Thread Matt Matijevich
[snip]
echo Some text.aFunction().some more text;
[/snip]

Have you checked to see if aFunction() is returning anything?

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



Re: [PHP] a stupid question

2004-06-24 Thread Blake Schroeder
The following code works:
echo Some text;
aFunction();
echo Some more text;
-B
Matt Matijevich wrote:
[snip]
echo Some text.aFunction().some more text;
[/snip]
Have you checked to see if aFunction() is returning anything?

.
 

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


Re: [PHP] a stupid question

2004-06-24 Thread David Goodlad
Perhaps using:

$ret = aFunction();
var_dump($ret);

Then you'll see if aFunction() is returning anything.

Dave

On Thu, 24 Jun 2004 16:48:18 -0500, Matt Matijevich
[EMAIL PROTECTED] wrote:
 
 [snip]
 echo Some text.aFunction().some more text;
 [/snip]
 
 Have you checked to see if aFunction() is returning anything?
 
 
 
 --
 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] Streaming

2004-06-24 Thread Stephen Craton
I just put it into my script, and it doesn't seem to be working. I put
ob_end_clean(); at the top of the script, but here's the while loop I have:

while($db-next_record()):
echo 'b'.$db-Record[user].':/bnbsp;nbsp;';
$sql = SELECT emote, image FROM c_emotes;
$result = mysql_query($sql, $db-linkid);
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { 
$emotes[] = $row['emote']; 
$images[] = img src='.$row['image'].'; 
}
if($db-Record['system'] != 1) {
$message = htmlentities($db-Record[text]);
} else {
$message = $db-Record[text];
}
$message = str_replace($emotes, $images, $message);
echo $message.br\n;
flush();
endwhile; 

It displays just fine if you refresh, but unless you refresh, you don't see
any new data. Any ideas?
 
Thanks,
Stephen Craton
http://www.melchior.us

-Original Message-
From: Justin Patrin [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 4:47 PM
To: Stephen Craton
Cc: PHP List
Subject: Re: [PHP] Streaming

ob_end_clean() goes at the top.
flush() goes after *every* pice of info you want to show real-time.
Basically, after every echo or group of echos.

On Thu, 24 Jun 2004 16:43:39 -0500, Stephen Craton [EMAIL PROTECTED]
wrote:
 
 Thanks for this, but how do I use it? Do I just put the ob_end_clean() 
 at the opening the page I want to stream and then put flush() at the end?
 
 Thanks,
 Stephen Craton
 http://www.melchior.us
 
 
 
 -Original Message-
 From: svk [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 24, 2004 4:25 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Streaming
 
 On Thu, 2004-06-24 at 16:41, Stephenpp
 
 To use streaming, you have to :
 Turn off output buffering: ob_end_clean() and flush the output has it 
 comes
 : flush()
 
 It is useful to note that :
 Some versions of Microsoft Internet Explorer will only start to 
 display the page after they have received 256 bytes of output, so you 
 may need to send extra whitespace before flushing to get those browsers to
display the page.
 
 
 and
 Pad your output with necessary spaces, wrap your progressing data 
 around open (table) and end (/table) tags, and then call flush() 
 so that one script will work for Netscape as well.
 
 
  I was browsing the net and I found a PHP chat script that claimed 
  that it does not refresh, rather it has streaming text. This got 
  my interest and was wondering how the script did it. I downloaded 
  it's source code but couldn't find anything useful in it, very hard 
  to read in my opinion. I did a search on PHP.net for streaming but I 
  couldn't understand much of that, just my noobishness I suppose.
 
  How exactly would you go about streaming in PHP anyway? This has my 
  interest now...
 
  Thanks,
  Stephen Craton
  http://www.melchior.us http://www.melchior.us/
 
 
 --
 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
 
 
 !DSPAM:40db491f54512097234068!
 
 


--
paperCrane --Justin Patrin--

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



Re: [PHP] a stupid question

2004-06-24 Thread Matt Matijevich
[snip]
echo Some text;
aFunction();
echo Some more text;
[/snip]

What is printed out?

if aFunction() is returning the string test then this code: echo
Some text.aFunction().some more text; should print out:

Some texttestsome more text

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



Re: [PHP] Streaming

2004-06-24 Thread Justin Patrin
Your script is ending, so the page ends. PHP (HTTP) isn't really
supposed to do streaming. If you want it to stream you have to
keep the script running. Add something like this:

while(true) {
   while($db-next_record()) {
   echo 'b'.$db-Record[user].':/bnbsp;nbsp;';
   $sql = SELECT emote, image FROM c_emotes;
   $result = mysql_query($sql, $db-linkid);
   while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
   $emotes[] = $row['emote'];
   $images[] = img src='.$row['image'].';
   }
   if($db-Record['system'] != 1) {
   $message = htmlentities($db-Record[text]);
   } else {
   $message = $db-Record[text];
   }
   $message = str_replace($emotes, $images, $message);
   echo $message.br\n;
   flush();
}
sleep(5);
set_time_limit(30);
} 

This will actually run *forever* and will loop through the records
again and again, probably giving yu the same content as before. You
would need some kind of way to know which records are new so you can
only display them in the loop. I would suggest adding a time 
$savedTime or some such to the loop.

Please note, though, that this is a *very large hack*. You're not
supposed to keep your scripts running forever. If you really want to
stream, write a Java/C/C++/C#/etc. app. Or, if you're feeling
adventurous, use JavaScript.

On Thu, 24 Jun 2004 16:54:57 -0500, Stephen Craton
[EMAIL PROTECTED] wrote:
 
 I just put it into my script, and it doesn't seem to be working. I put
 ob_end_clean(); at the top of the script, but here's the while loop I have:
 
 while($db-next_record()):
 echo 'b'.$db-Record[user].':/bnbsp;nbsp;';
 $sql = SELECT emote, image FROM c_emotes;
 $result = mysql_query($sql, $db-linkid);
 while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
 $emotes[] = $row['emote'];
 $images[] = img src='.$row['image'].';
 }
 if($db-Record['system'] != 1) {
 $message = htmlentities($db-Record[text]);
 } else {
 $message = $db-Record[text];
 }
 $message = str_replace($emotes, $images, $message);
 echo $message.br\n;
 flush();
 endwhile;
 
 It displays just fine if you refresh, but unless you refresh, you don't see
 any new data. Any ideas?
 
 Thanks,
 Stephen Craton
 http://www.melchior.us
 
 
 
 -Original Message-
 From: Justin Patrin [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 24, 2004 4:47 PM
 To: Stephen Craton
 Cc: PHP List
 Subject: Re: [PHP] Streaming
 
 ob_end_clean() goes at the top.
 flush() goes after *every* pice of info you want to show real-time.
 Basically, after every echo or group of echos.
 
 On Thu, 24 Jun 2004 16:43:39 -0500, Stephen Craton [EMAIL PROTECTED]
 wrote:
 
  Thanks for this, but how do I use it? Do I just put the ob_end_clean()
  at the opening the page I want to stream and then put flush() at the end?
 
  Thanks,
  Stephen Craton
  http://www.melchior.us
 
 
 
  -Original Message-
  From: svk [mailto:[EMAIL PROTECTED]
  Sent: Thursday, June 24, 2004 4:25 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] Streaming
 
  On Thu, 2004-06-24 at 16:41, Stephenpp
 
  To use streaming, you have to :
  Turn off output buffering: ob_end_clean() and flush the output has it
  comes
  : flush()
 
  It is useful to note that :
  Some versions of Microsoft Internet Explorer will only start to
  display the page after they have received 256 bytes of output, so you
  may need to send extra whitespace before flushing to get those browsers to
 display the page.
  
 
  and
  Pad your output with necessary spaces, wrap your progressing data
  around open (table) and end (/table) tags, and then call flush()
  so that one script will work for Netscape as well.
  
 
   I was browsing the net and I found a PHP chat script that claimed
   that it does not refresh, rather it has streaming text. This got
   my interest and was wondering how the script did it. I downloaded
   it's source code but couldn't find anything useful in it, very hard
   to read in my opinion. I did a search on PHP.net for streaming but I
   couldn't understand much of that, just my noobishness I suppose.
  
   How exactly would you go about streaming in PHP anyway? This has my
   interest now...
  
   Thanks,
   Stephen Craton
   http://www.melchior.us http://www.melchior.us/
  
 
  --
  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
 
 
 
 
 
 
 
 --
 paperCrane --Justin Patrin--
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 !DSPAM:40db4bef62072026120151!
 
 


-- 
paperCrane --Justin Patrin--

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



RE: [PHP] a stupid question

2004-06-24 Thread Vail, Warren
Your test that works suggests that the function is echoing its results,
and not actually returning its results.  To return its results the function
needs to end with

Function aFunction() {
  do something;
Return $resultstring;  // very last statement executed in function. 
}

This should allow

Echo some string value.aFunction().another string value;

To work,

Good luck,

Warren Vail
 


-Original Message-
From: Matt Matijevich [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 3:00 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] a stupid question


[snip]
echo Some text;
aFunction();
echo Some more text;
[/snip]

What is printed out?

if aFunction() is returning the string test then this code: echo Some
text.aFunction().some more text; should print out:

Some texttestsome more text

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

2004-06-24 Thread Stephen Craton
Thanks for all the help here.

The only question I have left is bandwidth. Would a while(true) { } loop hog
up enormous ammounts of bandwidth or just sit there quietly bugging noone?
The only other option I have going for me is the iframe hack, which I'm
getting annoyed of...
 
Thanks,
Stephen Craton
http://www.melchior.us

-Original Message-
From: Justin Patrin [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 5:01 PM
To: Stephen Craton
Cc: PHP List
Subject: Re: [PHP] Streaming

Your script is ending, so the page ends. PHP (HTTP) isn't really supposed to
do streaming. If you want it to stream you have to keep the script
running. Add something like this:

while(true) {
   while($db-next_record()) {
   echo 'b'.$db-Record[user].':/bnbsp;nbsp;';
   $sql = SELECT emote, image FROM c_emotes;
   $result = mysql_query($sql, $db-linkid);
   while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
   $emotes[] = $row['emote'];
   $images[] = img src='.$row['image'].';
   }
   if($db-Record['system'] != 1) {
   $message = htmlentities($db-Record[text]);
   } else {
   $message = $db-Record[text];
   }
   $message = str_replace($emotes, $images, $message);
   echo $message.br\n;
   flush();
}
sleep(5);
set_time_limit(30);
} 

This will actually run *forever* and will loop through the records again and
again, probably giving yu the same content as before. You would need some
kind of way to know which records are new so you can only display them in
the loop. I would suggest adding a time  $savedTime or some such to the
loop.

Please note, though, that this is a *very large hack*. You're not supposed
to keep your scripts running forever. If you really want to stream, write
a Java/C/C++/C#/etc. app. Or, if you're feeling adventurous, use JavaScript.

On Thu, 24 Jun 2004 16:54:57 -0500, Stephen Craton [EMAIL PROTECTED]
wrote:
 
 I just put it into my script, and it doesn't seem to be working. I put 
 ob_end_clean(); at the top of the script, but here's the while loop I
have:
 
 while($db-next_record()):
 echo 'b'.$db-Record[user].':/bnbsp;nbsp;';
 $sql = SELECT emote, image FROM c_emotes;
 $result = mysql_query($sql, $db-linkid);
 while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
 $emotes[] = $row['emote'];
 $images[] = img src='.$row['image'].';
 }
 if($db-Record['system'] != 1) {
 $message = htmlentities($db-Record[text]);
 } else {
 $message = $db-Record[text];
 }
 $message = str_replace($emotes, $images, $message);
 echo $message.br\n;
 flush();
 endwhile;
 
 It displays just fine if you refresh, but unless you refresh, you 
 don't see any new data. Any ideas?
 
 Thanks,
 Stephen Craton
 http://www.melchior.us
 
 
 
 -Original Message-
 From: Justin Patrin [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 24, 2004 4:47 PM
 To: Stephen Craton
 Cc: PHP List
 Subject: Re: [PHP] Streaming
 
 ob_end_clean() goes at the top.
 flush() goes after *every* pice of info you want to show real-time.
 Basically, after every echo or group of echos.
 
 On Thu, 24 Jun 2004 16:43:39 -0500, Stephen Craton 
 [EMAIL PROTECTED]
 wrote:
 
  Thanks for this, but how do I use it? Do I just put the 
  ob_end_clean() at the opening the page I want to stream and then put
flush() at the end?
 
  Thanks,
  Stephen Craton
  http://www.melchior.us
 
 
 
  -Original Message-
  From: svk [mailto:[EMAIL PROTECTED]
  Sent: Thursday, June 24, 2004 4:25 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] Streaming
 
  On Thu, 2004-06-24 at 16:41, Stephenpp
 
  To use streaming, you have to :
  Turn off output buffering: ob_end_clean() and flush the output has 
  it comes
  : flush()
 
  It is useful to note that :
  Some versions of Microsoft Internet Explorer will only start to 
  display the page after they have received 256 bytes of output, so 
  you may need to send extra whitespace before flushing to get those 
  browsers to
 display the page.
  
 
  and
  Pad your output with necessary spaces, wrap your progressing data 
  around open (table) and end (/table) tags, and then call flush() 
  so that one script will work for Netscape as well.
  
 
   I was browsing the net and I found a PHP chat script that claimed 
   that it does not refresh, rather it has streaming text. This got 
   my interest and was wondering how the script did it. I downloaded 
   it's source code but couldn't find anything useful in it, very 
   hard to read in my opinion. I did a search on PHP.net for 
   streaming but I couldn't understand much of that, just my noobishness
I suppose.
  
   How exactly would you go about streaming in PHP anyway? This has 
   my interest now...
  
   Thanks,
   Stephen Craton
   http://www.melchior.us http://www.melchior.us/
  
 
  --
  PHP General Mailing List 

Re: [PHP] Streaming

2004-06-24 Thread Justin Patrin
It will use up CPU time and bandwidth, yes. It should take less
bandwidth than the refresh constantly version, but only if you code
it right.

You could also write a little JS to pull some content from the server
(get messages after a certain time / message id) and inject them into
the page. This is really the best solution if you want to stay in the
browser and not do Flash or Java.

On Thu, 24 Jun 2004 17:24:31 -0500, Stephen Craton
[EMAIL PROTECTED] wrote:
 
 Thanks for all the help here.
 
 The only question I have left is bandwidth. Would a while(true) { } loop hog
 up enormous ammounts of bandwidth or just sit there quietly bugging noone?
 The only other option I have going for me is the iframe hack, which I'm
 getting annoyed of...
 
 Thanks,
 Stephen Craton
 http://www.melchior.us
 
 -Original Message-
 From: Justin Patrin [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 24, 2004 5:01 PM
 To: Stephen Craton
 Cc: PHP List
 Subject: Re: [PHP] Streaming
 
 Your script is ending, so the page ends. PHP (HTTP) isn't really supposed to
 do streaming. If you want it to stream you have to keep the script
 running. Add something like this:
 
 while(true) {
while($db-next_record()) {
echo 'b'.$db-Record[user].':/bnbsp;nbsp;';
$sql = SELECT emote, image FROM c_emotes;
$result = mysql_query($sql, $db-linkid);
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$emotes[] = $row['emote'];
$images[] = img src='.$row['image'].';
}
if($db-Record['system'] != 1) {
$message = htmlentities($db-Record[text]);
} else {
$message = $db-Record[text];
}
$message = str_replace($emotes, $images, $message);
echo $message.br\n;
flush();
 }
 sleep(5);
 set_time_limit(30);
 }
 
 This will actually run *forever* and will loop through the records again and
 again, probably giving yu the same content as before. You would need some
 kind of way to know which records are new so you can only display them in
 the loop. I would suggest adding a time  $savedTime or some such to the
 loop.
 
 Please note, though, that this is a *very large hack*. You're not supposed
 to keep your scripts running forever. If you really want to stream, write
 a Java/C/C++/C#/etc. app. Or, if you're feeling adventurous, use JavaScript.
 
 On Thu, 24 Jun 2004 16:54:57 -0500, Stephen Craton [EMAIL PROTECTED]
 wrote:
 
  I just put it into my script, and it doesn't seem to be working. I put
  ob_end_clean(); at the top of the script, but here's the while loop I
 have:
 
  while($db-next_record()):
  echo 'b'.$db-Record[user].':/bnbsp;nbsp;';
  $sql = SELECT emote, image FROM c_emotes;
  $result = mysql_query($sql, $db-linkid);
  while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  $emotes[] = $row['emote'];
  $images[] = img src='.$row['image'].';
  }
  if($db-Record['system'] != 1) {
  $message = htmlentities($db-Record[text]);
  } else {
  $message = $db-Record[text];
  }
  $message = str_replace($emotes, $images, $message);
  echo $message.br\n;
  flush();
  endwhile;
 
  It displays just fine if you refresh, but unless you refresh, you
  don't see any new data. Any ideas?
 
  Thanks,
  Stephen Craton
  http://www.melchior.us
 
 
 
  -Original Message-
  From: Justin Patrin [mailto:[EMAIL PROTECTED]
  Sent: Thursday, June 24, 2004 4:47 PM
  To: Stephen Craton
  Cc: PHP List
  Subject: Re: [PHP] Streaming
 
  ob_end_clean() goes at the top.
  flush() goes after *every* pice of info you want to show real-time.
  Basically, after every echo or group of echos.
 
  On Thu, 24 Jun 2004 16:43:39 -0500, Stephen Craton
  [EMAIL PROTECTED]
  wrote:
  
   Thanks for this, but how do I use it? Do I just put the
   ob_end_clean() at the opening the page I want to stream and then put
 flush() at the end?
  
   Thanks,
   Stephen Craton
   http://www.melchior.us
  
  
  
   -Original Message-
   From: svk [mailto:[EMAIL PROTECTED]
   Sent: Thursday, June 24, 2004 4:25 PM
   To: [EMAIL PROTECTED]
   Subject: Re: [PHP] Streaming
  
   On Thu, 2004-06-24 at 16:41, Stephenpp
  
   To use streaming, you have to :
   Turn off output buffering: ob_end_clean() and flush the output has
   it comes
   : flush()
  
   It is useful to note that :
   Some versions of Microsoft Internet Explorer will only start to
   display the page after they have received 256 bytes of output, so
   you may need to send extra whitespace before flushing to get those
   browsers to
  display the page.
   
  
   and
   Pad your output with necessary spaces, wrap your progressing data
   around open (table) and end (/table) tags, and then call flush()
   so that one script will work for Netscape as well.
   
  
I was browsing the net and I found a PHP chat script that 

[PHP] About the post Streaming

2004-06-24 Thread Pierre
Thanks to all for the explanation, but in fact in what kind of script can it
be useful? For a progress download bar? I think so but I don't see how I can
do this ... Can you please explain quickly in which case it can be useful ?
Thx a lot 

Pierre 

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



Re: [PHP] a stupid question

2004-06-24 Thread Michal Migurski
 Maybe it has to be Some text.aFunction();.sometext; with the
 semicolon after the function.
 I don't really know, just guessing.

Yeesh, that's not even remotely valid PHP. Why would that have been posted
as advice?

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



RE: [PHP] About the post Streaming

2004-06-24 Thread Stephen Craton
What I saw it applied in was a chat script, and that's what I'm planning on
using it for should I ever finish figuring it out...
 
Thanks,
Stephen Craton
http://www.melchior.us

-Original Message-
From: Pierre [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 6:05 PM
To: php-general
Subject: [PHP] About the post Streaming

Thanks to all for the explanation, but in fact in what kind of script can it
be useful? For a progress download bar? I think so but I don't see how I can
do this ... Can you please explain quickly in which case it can be useful ?
Thx a lot 

Pierre 

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

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



Re: [PHP] Re: MHTML in email

2004-06-24 Thread Manuel Lemos
Hello,
On 06/24/2004 01:59 PM, Juan Pablo Herrera wrote:
Thank you,
really i need incluided in email body a image (jpg or gif), too see html.
The MHTML file is a idea, but i think that not function with dinamic
content.How can i do this?
Yes, this class can do exactly that using multipart/relative parts. The 
HTML message example that comes with the class demonstrates clearly how 
to compose multipart/related in multipart/alternative messages. It shows 
how to send an HTML message using images in the body HTML and also as a 
background.


I need to attach a file extension .mhtml in function mail, but i too
need view the content from the body of e-mail.That is everything!
MHTML messages are just HTML messages with alternative plain text
version in the same body.
You may want to take a look at this class that lets you compose MHTML
messages easily:
http://www.phpclasses.org/mimemessage
--
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


[PHP] Re: Multipart Email Problem

2004-06-24 Thread Manuel Lemos
Hello,
On 06/24/2004 08:27 AM, Matt Macleod wrote:
I have a script that sends a multipart email from a php page.
The script appears to work fine on my mail client (Mail on Mac OSX) and 
on an online email reader (mail2web.com).

However a colleague using Outlook on Windows 2003 views the whole email 
(ie the raw code - both the text only and the HTML) and when I sent an 
email to his hotmail account, hotmail simply displayed a blank page.
This looks like a bug in the mail() function.
You may want to try this class for composing and sending messages that 
comes with an example for sending HTML messages with alternative text 
parts. The class has some workarounds to some of the mail() function 
problems.

http://www.phpclasses.org/mimemessage
--
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


[PHP] Re: Determine whether $_GET has a value

2004-06-24 Thread Al
You need to be specific about what you consider to be a legitimate value 
for your application.

consider:
$var= $_GET['myname'];
if((preg_match(/([0-9]|[a-z]|[A-Z]/, $var) { Do something }
No spaces and watch the | between the ] and the [
If $myname has at least one number or character, there will be a match.
You can put any legit character(s) in []s, just OR them in. 

Terence wrote:
Hi,
Say you have a querystring - index.php?myname=joe
To determine whether myname has a value I have come to the following 
conclusions / shortcomings when using one of the following:

ISSET = as long as the variable myname exists it's set, but there's no 
guarantee of a value

!EMPTY = if your name = 0 (zero) then it's considered empty, for all 
else it seems to work

STRLEN = I have found this to be the only sure way to know.
Is there any other way, or should we always use a combination of ISSET 
and STRLEN?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] a stupid question

2004-06-24 Thread Curt Zirzow
* Thus wrote Blake Schroeder:
 Hey
 
 I cant figureout the syntax please help
 
 echo Some text.aFunction().some more text;
 
 The function is not working.

For future reference, to make you're post not a stupid question it
would look more like:

snip
Subject: Calling a function between strings

I have some code that looks like this:
  echo Some Text.aFunction().some more text;

I keep getting the output like this:
  Text From function Some Textsomemore text
 

And I can't figure out why it keeps doing that.

/snip

That will:
  1. let people know what the topic is before reading the mail.
  2. Prevent everyone darkstabbing/dark at what is wrong.


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: [PHP] Re: MHTML in email

2004-06-24 Thread Juan Pablo Herrera
Thank you Manuel,
Tomorrow i work on this class. My idea is make a app that send newsletters
with html + image included. It app shows tracert when the email is open.Know you 
some app that make this?.

Regards,
Juan


 Hello,

 On 06/24/2004 01:59 PM, Juan Pablo Herrera wrote:
 Thank you,
 really i need incluided in email body a image (jpg or gif), too see
 html. The MHTML file is a idea, but i think that not function with
 dinamic content.How can i do this?

 Yes, this class can do exactly that using multipart/relative parts. The
  HTML message example that comes with the class demonstrates clearly
 how  to compose multipart/related in multipart/alternative messages. It
 shows  how to send an HTML message using images in the body HTML and
 also as a  background.


I need to attach a file extension .mhtml in function mail, but i too
need view the content from the body of e-mail.That is everything!

MHTML messages are just HTML messages with alternative plain text
version in the same body.

You may want to take a look at this class that lets you compose MHTML
messages easily:

http://www.phpclasses.org/mimemessage

 --

 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

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



[PHP] Re: Sort a text string by last word before separator

2004-06-24 Thread Lars Torben Wilson
Andre Dubuc wrote:
Given a text string:
$OK = Joe Blow, William Howard Anser, Hannie Jansen, etc, etc,;
[snip]
How would I get this 'before_last' function to iterate through the initial 
string, so I could build a sorted list with both first and last names, sorted 
by last name? I can't seem to get a proper 'foreach' statement to work, nor a 
'while' statement.
There are few different ways. Here's one:
---
function splitSortNames($namePartSeparator,
$nameSeparator,
$nameString)
{
preg_match_all('/(\w+)((\s(\w+)\s)*(\s?(\w+)))*/',
   $nameString,
   $tmp_names,
   PREG_SET_ORDER);
$names = array();
foreach ($tmp_names as $i = $name)
{
$tmp = array();
if (!empty($name[6])) $tmp[1] = $name[6];
if (!empty($name[1])) $tmp[2] = $name[1];
if (!empty($name[4]))
{
$tmp[2] .= ' ' . $name[4];
}
$names[$name[0]] = join(', ', $tmp);
}
asort($names);
$names = array_keys($names);
return $names;
}
$names = splitSortNames(' ', ', ', $OK);
print_r($names);
---
To check out a few other ideas along with a short (likely inaccurate) speed
test, check out http://www.thebuttlesschaps.com/sortByLast.html (there is
a 'View Source' link at the bottom of the page).
This code returns the names in the format in which they are given. You
can speed it up a bit by having it return the names in 'lastname, firstname'
format. For this, change
$names[$name[0]] = join(', ', $tmp);
to
$names[$i] = join(', ', $tmp);
and remove the lines:
asort($names);
$names = array_keys($names);
I'm really confused. I've read almost every entry on arrays/strings and 
searched code snippets. Almost all focus on one element arrays such apple, 
orange, peach rather than 2 or more elements such as  fancy cars, big 
trucks, fast dangerous motorcycles,

Is it even possible to accomplish this type sort on a string?

Any advice, pointers, or help will be greatly appreciated,
Tia,
Andre
Hopefully the code above will give you some aid--and you can probably improve
on that regexp in preg_match_all().  The other 2 ways on the site have totally
different methods, and different strengths and weaknesses. Maybe you can turn
one of them into something useful to you.
Hope this helps,
Torben
--
Torben Wilson [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Sort a text string by last word before separator

2004-06-24 Thread Lars Torben Wilson
Lars Torben Wilson wrote:
Sorry about following up to myself, but I was really really hungry
when I wrote the first one:
[snip]
This code returns the names in the format in which they are given. You
can speed it up a bit by having it return the names in 'lastname, 
firstname'
format. For this, change

$names[$name[0]] = join(', ', $tmp);
to
$names[$i] = join(', ', $tmp);
and remove the lines:
asort($names);
Don't remove the above line; just change it to:
sort($names);
$names = array_keys($names);

Cheers,
Torben
--
Torben Wilson [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Sort a text string by last word before separator

2004-06-24 Thread Andre Dubuc
Thanks Torben,

I've been messing about with code all afternoon, and my mind is blitzed. 
Didn't think it was possible since there was no way I could access the first 
name part (after I accessed the surname) since it had no delimiter except 
spaces. Managed to get the surname in a sorted array, but couldn't manage to 
merge the first names. 

I'll try this code -- hope it works, and get back to you!

Thanks again!

Andre



On Thursday 24 June 2004 11:21 pm, Lars Torben Wilson wrote:
 Andre Dubuc wrote:
  Given a text string:
 
  $OK = Joe Blow, William Howard Anser, Hannie Jansen, etc, etc,;

 [snip]

  How would I get this 'before_last' function to iterate through the
  initial string, so I could build a sorted list with both first and last
  names, sorted by last name? I can't seem to get a proper 'foreach'
  statement to work, nor a 'while' statement.

 There are few different ways. Here's one:

 ---
 function splitSortNames($namePartSeparator,
  $nameSeparator,
  $nameString)
 {
  preg_match_all('/(\w+)((\s(\w+)\s)*(\s?(\w+)))*/',
 $nameString,
 $tmp_names,
 PREG_SET_ORDER);
  $names = array();
  foreach ($tmp_names as $i = $name)
  {
  $tmp = array();
  if (!empty($name[6])) $tmp[1] = $name[6];
  if (!empty($name[1])) $tmp[2] = $name[1];
  if (!empty($name[4]))
  {
  $tmp[2] .= ' ' . $name[4];
  }
  $names[$name[0]] = join(', ', $tmp);
  }
  asort($names);
  $names = array_keys($names);
  return $names;
 }

 $names = splitSortNames(' ', ', ', $OK);
 print_r($names);
 ---


 To check out a few other ideas along with a short (likely inaccurate) speed
 test, check out http://www.thebuttlesschaps.com/sortByLast.html (there is
 a 'View Source' link at the bottom of the page).

 This code returns the names in the format in which they are given. You
 can speed it up a bit by having it return the names in 'lastname,
 firstname' format. For this, change

  $names[$name[0]] = join(', ', $tmp);

 to

  $names[$i] = join(', ', $tmp);

 and remove the lines:

  asort($names);
  $names = array_keys($names);

  I'm really confused. I've read almost every entry on arrays/strings and
  searched code snippets. Almost all focus on one element arrays such
  apple, orange, peach rather than 2 or more elements such as  fancy
  cars, big trucks, fast dangerous motorcycles,
 
  Is it even possible to accomplish this type sort on a string?
 
 
 
  Any advice, pointers, or help will be greatly appreciated,
  Tia,
  Andre

 Hopefully the code above will give you some aid--and you can probably
 improve on that regexp in preg_match_all().  The other 2 ways on the site
 have totally different methods, and different strengths and weaknesses.
 Maybe you can turn one of them into something useful to you.


 Hope this helps,

 Torben


 --
 Torben Wilson [EMAIL PROTECTED]

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



RE: [PHP] Streaming

2004-06-24 Thread Stephen Craton
I've been wracking my brains for the past few hours trying to figure out
this streaming business and the ways to avoid refreshing and polling the
server for data. I spent a few hours playing Sherlock Holmes in the
phpOpenChat software which is where I first found this technique, but I
didn't succeed.

The most I could find out is that it does indeed use output buffering, but
I'm not quite sure how it's looping the data (most I could find out it was
doing a do {} while() loop with an array called $lines) to display it
without illeffects on the processor. On top of that, I couldn't figure out
how it was printing and checking lines over and over again for a new message
to show in all the other client windows.

So my question is, does anyone know how the phpOpenChat system works? Can
anyone provide some insight into the world of streaming and avoiding the
refresh game?

I was also thinking of Javascript like you said, but again, I came back to
refreshing and then I can to XML HTTP Request but it's not supported well
with browsers. Any help here would be appreciated...

 
Thanks,
Stephen Craton
http://www.melchior.us

-Original Message-
From: Justin Patrin [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 5:28 PM
To: Stephen Craton
Cc: PHP List
Subject: Re: [PHP] Streaming

It will use up CPU time and bandwidth, yes. It should take less bandwidth
than the refresh constantly version, but only if you code it right.

You could also write a little JS to pull some content from the server (get
messages after a certain time / message id) and inject them into the page.
This is really the best solution if you want to stay in the browser and not
do Flash or Java.

On Thu, 24 Jun 2004 17:24:31 -0500, Stephen Craton [EMAIL PROTECTED]
wrote:
 
 Thanks for all the help here.
 
 The only question I have left is bandwidth. Would a while(true) { } 
 loop hog up enormous ammounts of bandwidth or just sit there quietly
bugging noone?
 The only other option I have going for me is the iframe hack, which 
 I'm getting annoyed of...
 
 Thanks,
 Stephen Craton
 http://www.melchior.us
 
 -Original Message-
 From: Justin Patrin [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 24, 2004 5:01 PM
 To: Stephen Craton
 Cc: PHP List
 Subject: Re: [PHP] Streaming
 
 Your script is ending, so the page ends. PHP (HTTP) isn't really 
 supposed to do streaming. If you want it to stream you have to 
 keep the script running. Add something like this:
 
 while(true) {
while($db-next_record()) {
echo 'b'.$db-Record[user].':/bnbsp;nbsp;';
$sql = SELECT emote, image FROM c_emotes;
$result = mysql_query($sql, $db-linkid);
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$emotes[] = $row['emote'];
$images[] = img src='.$row['image'].';
}
if($db-Record['system'] != 1) {
$message = htmlentities($db-Record[text]);
} else {
$message = $db-Record[text];
}
$message = str_replace($emotes, $images, $message);
echo $message.br\n;
flush();
 }
 sleep(5);
 set_time_limit(30);
 }
 
 This will actually run *forever* and will loop through the records 
 again and again, probably giving yu the same content as before. You 
 would need some kind of way to know which records are new so you can 
 only display them in the loop. I would suggest adding a time  
 $savedTime or some such to the loop.
 
 Please note, though, that this is a *very large hack*. You're not 
 supposed to keep your scripts running forever. If you really want to 
 stream, write a Java/C/C++/C#/etc. app. Or, if you're feeling
adventurous, use JavaScript.
 
 On Thu, 24 Jun 2004 16:54:57 -0500, Stephen Craton 
 [EMAIL PROTECTED]
 wrote:
 
  I just put it into my script, and it doesn't seem to be working. I 
  put ob_end_clean(); at the top of the script, but here's the while 
  loop I
 have:
 
  while($db-next_record()):
  echo 'b'.$db-Record[user].':/bnbsp;nbsp;';
  $sql = SELECT emote, image FROM c_emotes;
  $result = mysql_query($sql, $db-linkid);
  while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  $emotes[] = $row['emote'];
  $images[] = img src='.$row['image'].';
  }
  if($db-Record['system'] != 1) {
  $message = htmlentities($db-Record[text]);
  } else {
  $message = $db-Record[text];
  }
  $message = str_replace($emotes, $images, $message);
  echo $message.br\n;
  flush();
  endwhile;
 
  It displays just fine if you refresh, but unless you refresh, you 
  don't see any new data. Any ideas?
 
  Thanks,
  Stephen Craton
  http://www.melchior.us
 
 
 
  -Original Message-
  From: Justin Patrin [mailto:[EMAIL PROTECTED]
  Sent: Thursday, June 24, 2004 4:47 PM
  To: Stephen Craton
  Cc: PHP List
  Subject: Re: [PHP] Streaming
 
  ob_end_clean() goes at the 

Re: [PHP] Streaming

2004-06-24 Thread His Dudeness
[snip]
I was also thinking of Javascript like you said, but again, I came back to
refreshing and then I can to XML HTTP Request but it's not supported well
with browsers. Any help here would be appreciated...
[/snip]

As far as javascript and XML HTTP Requests, you could try the hidden
iframe trick.  That will work in almost all browsers, that have
javascript on.  Here is a link:

http://developer.apple.com/internet/webcontent/iframe.html

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



RE: [PHP] Streaming

2004-06-24 Thread Stephen Craton
Thanks for the information. I've been using the little iframe trick right
now, but this link you sent me may be different. I'm going to read here
soon, but just wanted to reply for the heck of it. The iframe trick, the way
I'm doing it, still requires a refresh and everything, so it's not exactly
what I'm looking for. Thanks for the replies! 
 
Thanks,
Stephen Craton
http://www.melchior.us

-Original Message-
From: His Dudeness [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 11:48 PM
To: Stephen Craton
Cc: PHP List
Subject: Re: [PHP] Streaming

[snip]
I was also thinking of Javascript like you said, but again, I came back to
refreshing and then I can to XML HTTP Request but it's not supported well
with browsers. Any help here would be appreciated...
[/snip]

As far as javascript and XML HTTP Requests, you could try the hidden iframe
trick.  That will work in almost all browsers, that have javascript on.
Here is a link:

http://developer.apple.com/internet/webcontent/iframe.html

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



Re: [PHP] Streaming

2004-06-24 Thread His Dudeness
 Thanks for the information. I've been using the little iframe trick right
 now, but this link you sent me may be different. I'm going to read here
 soon, but just wanted to reply for the heck of it. The iframe trick, the way
 I'm doing it, still requires a refresh and everything, so it's not exactly
 what I'm looking for. Thanks for the replies!

this one still requires a refresh, kind of. The user will never know a
refresh is happening.  Javascript does it all

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



  1   2   >