Re: [PHP] Formatted text from mySQL DB

2003-08-10 Thread Curt Zirzow
* Thus wrote David Nicholson ([EMAIL PROTECTED]):
> Hello,
> 
> The newlines will be there if you view the source of your page.
> Browsers do not render newlines in the source as newlines in the
> browser display, as you have found out you have to convert the
> newlines to s.

It probably could be add that html doesn't render newlines 'by
default'.  You can wrap the text inside a html tag that has the
style 'white-space: pre' set on it.


cheers,

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

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



Re: [PHP] Re: Frequent Mode Switching

2003-08-10 Thread Jason Sheets


Kevin Stone wrote:

I used to program that way.  The logic and presentation portions of my
scripts were combined into one or two monolithic files.  That worked well
for small projects.  But as I got involved in larger projects and had to
juggle many code files at once I found that I prefered to separate as much
of the HTML from the PHP code as possible.
 

Typically what I do now is set up my HTML in a template-like format using
 as the outputs.  



Jason

$next_year
$prev_year
$cur_year
$cur_month
$cur_day
$january
$february
$march
$april
$may
$june
$july
$august
$september
$october
$november
$december
$event_list
$event_header
Each output contains a portion of the final calendar page.  So I could take
the months and put them into rows or columns, take the event list and put it
on the top or the bottom, take the interface elements and place them where
they work best.  Or I can ignore half of the outputs and display only one
month if I wanted to.  Point being I could do this in a fraction of the time
it would take me to do it in logic portion of the script.
Anyway.. just my two bits.  Take it or leave it.  :-)

- Kevin



 



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


Re: [PHP] chown / chgrp of a http owned file after upload

2003-08-10 Thread Adrian
you could setup a cronjob running as root which chowns the files.
or maybe you can so something with sudo





-- 
Adrian
mailto:[EMAIL PROTECTED]
www: http://www.planetcoding.net
www: http://www.webskyline.de



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



Re[2]: [PHP] config tests

2003-08-10 Thread Uros Gruber
Hi,

You don't need to do that way. I also test speed if you select for
example 5 diferent values. You get 5 queries.

I just select everything in one place then I use

$config['config_color']

or you can write some function getConfig('config_color') to get
selected value from this array.

I use text to store this because there's no need to index this.

I also make some script to easy add and remove config values.

But I agree with you that 1st one is more flexible.

-- 
Best regards,
 Uros
 
Sunday, August 10, 2003, 10:32:13 AM, you wrote:

JWH> Uros Gruber wrote:

>> Hello!
>> 
>> I just made some speed tests getting configuration from DB.
>> 
>> For now I figured 2 ways doing this.
>> 
>> 1. One value in each row
>> 
>> id   |   name| val
>> --
>> 1| name1 | value1
>> 
>> 
>> 2. using serialize($config) and saving this in one row.
>>$config is predefined array of configuration.
>> 
>> 
>> I test this with 100 config values. First I read all 100 rows for 1st
>> example, then I read only one row and then unserialize this to get
>> array.
>> 
>> Here is result:
>> 
>> 1st example 0.0478450059891 86.74%
>> 2nd example 0.0073139667511 13.26%
>> 
>> There you can see speed of second example. I wan't to know what do you
>> think about this. And what's your solutions of reading config from DB.
>> I saw that many big project still use first example.
>> 

JWH> Question: How many people selected 'blue' for their config color?

JWH> 1. SELECT COUNT(*) FROM Table WHERE config_color = 'blue';

JWH> 2. ?? SELECT COUNT(*) FROM Table WHERE serialized_column LIKE 
JWH> '"config_color";s:4:"blue";'

JWH> Basically, method 1 is more flexible. With method 2, you'll need to 
JWH> store it in a TEXT column or hope your serialized value never goes over 
JWH> 255 characters.


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



Re: [PHP] PHP Name of Script -0-T-

2003-08-10 Thread Justin French
I'd say it sounds like a 'services directory' or a 'staff directory' or  
'contact database', broken into categories.

However, like with almost everything else, I doubt you'll find exactly  
what you want.

Do a tutorial to do with contact databases (adding, editing, deleting,  
searching) so that you get used to the techniques, then add/modify that  
set of scripts to suit, or start from scratch with some decent  
knowledge behind you.

You're also probably going to want membership (login/password/etc)  
integrated with it, so again, IMHO, it's best to start from scratch.

There is a nice article by Kevin Yank on sitepoint.com about membership  
stuff, which has recently been revised:
http://www.sitepoint.com/article/319

And a whole bunch of contact databases at google:
http://www.google.com/search?q=%22contact+database%22+PHP+Mysql&ie=UTF- 
8&oe=UTF-8

Justin French



On Wednesday, August 6, 2003, at 11:33  PM, Ryan A wrote:

Hi,
I want to have an index of services available on my site..
eg:
webdesigners
programmers (if possible sub category here - JSP,ASP,PHP,C etc)
graphic artists
webhosting
etc etc
where a person comes, clicks on the category and either searches the
available entries or can enter his/her own entrywhat do you call  
these
scripts? I tried "PHP index services scripts" on google without  
success.. or
if someone has any experience with using a script like this kindly  
give me
the URL if possible.

I'm pretty sure this must be popular and dont want to go writing this  
from
scratch if there is a ready made one out there which may just need its  
guts
rearranged or is already good to go.

Thanks for any suggestions,links,comments etc.

Cheers,
-Ryan


We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
---
[This E-mail scanned for viruses]



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


[PHP] Re: Frequent Mode Switching

2003-08-10 Thread Kevin Stone

"Derrick Fogle" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thoughts on frequent switching in and out of PHP mode:
>
>  ?>Switch out, static HTML
>  ?>Switch out, more static HTML
>
> I've found that I prefer programming this way, for the most part,
> putting most of the heavy PHP programming at the top, and then using
> static HTML interspersed mostly with quick  statements
> for what users see.
>
> I'm sure there's more than one viewpoint out there, so I'd like to hear
> a couple of them. Is this frequent mode switching good, bad, or
> indifferent? Is there a point at which the mode switching starts to
> seriously degrade performance and reliability?
>
> -Derrick


I used to program that way.  The logic and presentation portions of my
scripts were combined into one or two monolithic files.  That worked well
for small projects.  But as I got involved in larger projects and had to
juggle many code files at once I found that I prefered to separate as much
of the HTML from the PHP code as possible.

Typically what I do now is set up my HTML in a template-like format using
 as the outputs.  Very little logic goes between the  tags
in my HTML files but of course sometimes it's unaviodable and that's why you
want to use  tags here and not some phoney template language.  Then
sipmly include() the HTML file back into the script allowing the outputs to
fill in.  This makes for a very 'plastic' interface that you can mold very
easily in an HTML editor without screwing up your script.  For example I did
a calendar script recently with the following outputs...

$next_year
$prev_year
$cur_year
$cur_month
$cur_day
$january
$february
$march
$april
$may
$june
$july
$august
$september
$october
$november
$december
$event_list
$event_header

Each output contains a portion of the final calendar page.  So I could take
the months and put them into rows or columns, take the event list and put it
on the top or the bottom, take the interface elements and place them where
they work best.  Or I can ignore half of the outputs and display only one
month if I wanted to.  Point being I could do this in a fraction of the time
it would take me to do it in logic portion of the script.

Anyway.. just my two bits.  Take it or leave it.  :-)

- Kevin



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



Re: [PHP] htmlspecialchars() and HTML code

2003-08-10 Thread CPT John W. Holmes
From: "Thaddeus J. Quintin" <[EMAIL PROTECTED]>
> I'm working on a site where users have the option to type HTML code into
> a textarea, or upload HTML code from a local file which is then
> displayed in the text area.
>
> The obvious problem is that an uploaded file that contains a closing tag
> for a textarea can wreak havoc and eat up the rest of the page.  So, in
> order to get it to display properly, I called htmlspecialchars() on the
> string and that works fine.
>
> After any editing has been done, I can convert the text back using
> html_entity_decode().  This seems to be a decent solution to the problem.
>
> However, if the user has included htmlentities in their code, won't
> these get converted when I call the decode function?  Even something
> simple like using a '<' symbol for a little arrow.  This would need to
> remain a '<' and not get converted when html_entity_decode() is called.

You should not have to call html_entity_decode() at all. You encode the text
to get it to show in the text area. When the form is submitted, you get the
text exactly as it appears in the textarea. in other words, without the html
entities.

Try this:

This is  text

If you submit that "text" and then print $_REQUEST['text'], you'll see that
you have

This is  text

---John Holmes...


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



[PHP] Re: Question on class syntax

2003-08-10 Thread Greg Beaver
Hi Luis,

http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php

Basically, if this is global code, you are calling the method cleanup of 
class htmlcleaner as if it were simply a function.  Within a class, the 
$this variable is set, and calling htmlcleaner::cleanup() will work as 
if cleanup() were a method of your own class.

Greg
--
phpDocumentor
http://www.phpdoc.org
Luis Lebron wrote:
I am currently using a php class that uses the following syntax:

$value= htmlcleaner::cleanup($value);

What exactly is the :: used for? Is there a different syntax for :: ?

thanks,

Luis R. Lebron
Project Manager
Sigmatech, Inc


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


Re: [PHP] magical file writing truncation

2003-08-10 Thread skate
[snip]
Session+Start+%28Yahoo%21+-+fatcubanskate%3Athe_lady_in_waiting1982%29%3
A+Th
u+Jul+10+21%3A23%3A42+2003+%3Cbr+%2F%3E%0D%0A%5B21%3A23%5D+the_lady_in_w
aiti
ng1982%3A+hey+sexy%21%21%21+%3Cbr+%2F%3E%0D%0A%5B21%3A24%5D+fatcubanskat
e%3A
+hey+sugar+%3Cbr+%2F%3E%0D%0A%5B21%3A24%5D+fatcubanskate%3A+how%5C%27s+t
hing
%3F+%3Cbr+%2F%3E%0D%0A%5B21%3A25%5D+the_lady_in_waiting1982%3A+you+know+
we+c
ould+do+a+whole+roll+playing+thing%2C+that+would+be+a+big+as+turn+on+%3C
br+%
2F%3E%0D%0A%5B21%3A25%5D+fatcubanskate%3A+oh+really%3F+like...+i+pretend
+to+
be+a+pirate%3F+%3Cbr+%2F%3E%0D%0A%5B21%3A25%5D+fatcubanskate%3A+raaar%21
%21%
21
[/snip]

OK, put stripslashes back in and show the echo'd out put again.

-

  $text = urlencode(stripslashes(nl2br($text)));
  print $text;

..

Session+Start+%28Yahoo%21+-+fatcubanskate%3Athe_lady_in_waiting1982%29%3A+Th
u+Jul+10+21%3A23%3A42+2003+%3Cbr+%2F%3E%0D%0A%5B21%3A23%5D+the_lady_in_waiti
ng1982%3A+hey+sexy%21%21%21+%3Cbr+%2F%3E%0D%0A%5B21%3A24%5D+fatcubanskate%3A
+hey+sugar+%3Cbr+%2F%3E%0D%0A%5B21%3A24%5D+fatcubanskate%3A+how%27s+thing%3F
+%3Cbr+%2F%3E%0D%0A%5B21%3A25%5D+the_lady_in_waiting1982%3A+you+know+we+coul
d+do+a+whole+roll+playing+thing%2C+that+would+be+a+big+as+turn+on+%3Cbr+%2F%
3E%0D%0A%5B21%3A25%5D+fatcubanskate%3A+oh+really%3F+like...+i+pretend+to+be+
a+pirate%3F+%3Cbr+%2F%3E%0D%0A%5B21%3A25%5D+fatcubanskate%3A+raaar%21%21%21



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



[PHP] how do i get assosciative name in foreach

2003-08-10 Thread Dan Anderson
I want to send an assosciative array to a foreach loop.  Is there any
way to get the name?

For instance, now I have:



I want to do:



Is what I want possible?

Thanks in advance,

Dan


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



Re: [PHP] Piping and the CLI parser

2003-08-10 Thread Tom Rogers
Hi,

Tuesday, August 5, 2003, 3:25:47 PM, you wrote:
NF> Greets everybody.

NF> My question regards psuedo-DOS (XP cmd.exe) piping and the CLI php parser.
NF> If you could help please continue reading.

NF> The documention specifies that the CLI php parser "sets up" STDIN and its
NF> kin.

NF> It does in fact work fine assuming the STDIN is the console, but while I was
NF> just toying around with my File Type default command (setting it up WinXP so
NF> that 'foobar.php arg1 arg2' entered at the command line actually executes
NF> the script with arguments), I attempted some piping; which, through very
NF> shallow research, I've come to think uses STDIN.

NF> It fails; no piping whatsoever. Even the simplest 'dir | echo.php', where
NF> echo just implodes() $argv and echoes, gives no output.

NF> Is my suspicion that the CLI php parser does not set up STDIN to receive
NF> from a pipe correct, or am I missing something here?

NF> Thank you very much for your time,
NF> Nick

NF> ps - the type of File Type work I used to make the command line work is
NF> described here:
NF> http://www.php.net/manual/en/features.commandline.php -> do an in-page
NF> search for "phpNOSPAM" to find the comment quickly

NF> pps - if someone could try similar piping on a *nix box, I'd be interested
NF> to know how that goes

You need to do something like this

while(!feof(STDIN)) {
echo fgets(STDIN, 1024);
}

stdin is a file stream not part of the command line arguments

Note that this simple code will sit there for ever if you have no
input or till you send it ^d (tested on linux)
-- 
regards,
Tom


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



RE: [PHP] Best PHP CMS

2003-08-10 Thread Ralph Guzman
Any opinions on ezPublish 3? 

http://www.ez.no/

I am considering this as a CMS and framework for my future projects.


-Original Message-
From: Matt Schroebel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 05, 2003 12:14 PM
To: Anthony; [EMAIL PROTECTED]
Subject: RE: [PHP] Best PHP CMS


> -Original Message-
> From: Anthony [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, August 05, 2003 9:52 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Best PHP CMS
> 
> 
> I'm just looking for some opinions.  I've been going though 
> sourceforge
> looking at different CMS systems.  There are a lot of really good CMS
> projects out there.  I'm looking for some opinions on the 
> best ones out
> there.  I'm obviously looking at something PHP based and using mySQL
> backend.  Some of the features that I'd like are an easy template
> implementation, blog features, media gallery and something 
> that's easy to
> build custom modules to add features.  So far I'm looking at 
> about 6 CMS
> systems, I like certain things in each of them. so what's 
> your opinion.
I've looked at these:

http://www.midgard-project.org/
Midgard looked good but I couldn't get the admin to work right, and it
requires php-4.2.2 or lower (which drove me a little nuts at first).
It's optimized for php as it's functions are written in C and become
built in php functions with --with-midgard, plus it has a mod_midgard to
link into apache.  Midgard allows lots of customization and you could
place php code just about anywhere.  Runs on *nix only and requires
access to add modules to php and apache.

http://www.tikiwiki.org/
TikiWiki had lots of cool features.  It looked to me to be more suitable
for a community CMS (baseball team etc) rather than a general CMS. All
php.

http://www.geeklog.net/
There's also GeekLog, with a similar community slant as TikiWiki, and it
was reviewed in last months php-architect magazine. All php.

http://www.typo3.org
I agree with what Nick Tabbet said.  Of these 4 CMSs, this one has the
most refined user interface, and most general purpose features.  It's
written in all object oriented php and will easily install on an ISP
hosted system.  Quick setup 1-2-3, and your ready to go.  It does have a
long learning curve, but anything complex does.  Since it's all OO, has
it's own TypoScript code to design content and big, it will really
benefit if run with a php accelerator to cache the intermediate code.
Has good tutorial for getting started, and another good intro to it's
templates.  It's more for small to mid-sized sites, as anything larger
should be written in native C, C++, etc.

-- 
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] need help with table lock - could this be performed with mysql commands or do I to write my own PHP function

2003-08-10 Thread anders thoresson
Hi,

For an application that I'm working on, I wan't users to be able to show 
content even while an editor/administrator makes changes in one of my 
database's tables. But if another editor tries to load the same content for 
editing, he/she shouldn't be able to do this.

I've been reading up on MySQL's internal LOCK command, but it doesn't seem 
to be what I need. I need a read/write lock based on what the current 
user/editor want's to do, and not only based on what content an editor is 
working with at the moment.

I'm thinking of the following solution:

Create a new database:

CREATE TABLE table_lock
(
table_name VARCHAR(40),
table_id INT,
PRIMARY_KEY (table_name, row_id)

);
And two functions:

set_lock($table_name, $row_id), check_lock($table_name, $row_id) and 
release_lock($table_name, $row_id). Whenever an editor opens some content 
for editing, check_lock() will be called to se if table_lock contains a row 
with the same table_name and row_id. If, the content isn't loaded and the 
editor is told that someone else is working on the content, and are asked 
to try again later. If not, set_lock() is called to make sure that no other 
editor opens the content before it's saved and release_lock() is called, 
which will remove the line from table_lock again.

Is this a good way to do this? Or are there any other suggestions?

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


RE: [PHP] Stop neurotic posting

2003-08-10 Thread Chris W. Parker
John Manko 
on Tuesday, August 05, 2003 11:36 PM said:

> perhaps there should be two lists (novice and advanced), and the
> advanced listed shouldn't answer questions if it's considered
> trivial enough for the novice list to answer.

w00t! w00t!

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



RE: [PHP] Problem sortiing dyn query

2003-08-10 Thread Creative Solutions New Media
Hi John,

Thanks.

Just wanted to make sure we were on the same page as the line of code in
question wrapped in my original message.

You saying the solution is

$query_Recordset1 = sprintf("SELECT * FROM sti_tracking ORDER BY %s
%s",$reSort_Recordset1,$direction_Recordset1);

Correct?




Tim Winters
Manager, Creative Development
Sampling Technologies Incorporated (STI)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
W: 902 450 5500
C:  902 430 8498

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: August 7, 2003 7:15 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Problem sortiing dyn query

Creative Solutions New Media wrote:
> Hi
>
> Can someone give me some indication why this might not be working?
>
> $query_Recordset1 = sprintf("SELECT * FROM sti_tracking ORDER BY '%s'
'%s'",

$query_Recordset1 = sprintf("SELECT * FROM sti_tracking ORDER BY %s %s",

> $reSort_Recordset1,$direction_Recordset1);
>
> the values for $reSort_Recordset1 and $direction_Recordset1 are passed
> through from another page.  $reSort_Recordset1 is the files to sort on and
> $direction_Recordset1 is the direction (ASC or DESC).
>
> Thanks

You're more than welcome.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals - www.phparch.com






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



Re: [PHP] problem using unlink()

2003-08-10 Thread Pascal Miquet
I think that the safe mode is on
But no executables into the safe_mode_exec_dir

beware if you set the safe mode to OFF. This is my value, but my server
is in a safe place.

HTH
Regards



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



[PHP] Frequent Mode Switching

2003-08-10 Thread Derrick Fogle
Thoughts on frequent switching in and out of PHP mode:

Switch out, static HTML
Switch out, more static HTML
I've found that I prefer programming this way, for the most part, 
putting most of the heavy PHP programming at the top, and then using 
static HTML interspersed mostly with quick  statements 
for what users see.

I'm sure there's more than one viewpoint out there, so I'd like to hear 
a couple of them. Is this frequent mode switching good, bad, or 
indifferent? Is there a point at which the mode switching starts to 
seriously degrade performance and reliability?

-Derrick

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


[PHP] Re: Repopulating forms

2003-08-10 Thread Anthony
Opp... forgot this use htmlspecialchars( ) to fix it.  It will convert
your " to " for you.  So you code should look like this:
";
echo '';
?>


 
 



and it will work :)

- Anthony

Gerard L Petersen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> My code looks like this.
>
>  $test = "gerard's name is \"gerard\"";
> echo $test."";
> echo '';
> ?>
>
> 
>  
>  
>
> 
>
>
> When i run it the bit after the quotes are truncated. Where it truncates
> depends on what type of quote i am using.
>
> Any ideas?
>
> Thanks
>
> Gerard
>
>



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



[PHP] posix_kill process group

2003-08-10 Thread Victor
Hi.

I am trying to use posix_kill(0, $signo); to signal children forked by 
the parent. All children seem to be in the processgroup of the parent, 
but sending either 0 or -10 does not seem to signal the children at all.

What am I doing wrong? I even tried setting the process group (didn't 
affect anything). It doesn't seem like sending the kill to 0 reaches the 
children.

Has anybody used pcntl and posix_kill with success and if so, could you 
provide me a code sniplet?

Here is my main:

   function main()
   {
  global $logfile;
  $logfile = "/tmp/runner.log.".date("Ymd:Hi");
  //posix_setsid();
  pcntl_signal(SIGINT,   array("runner","sig_handler_parent"));
  pcntl_signal(SIGTERM,  array("runner","sig_handler_parent"));
  pcntl_signal(SIGHUP,   array("runner","sig_handler_parent"));
  pcntl_signal(SIGUSR1,  array("runner","sig_handler_parent"));
  do {
 if ($this->numChildren <= MAXCHILDREN && $this->count > 0) {
$pid = pcntl_fork();
if ($pid < 0) {
die("could not fork");
} elseif ($pid == 0) {
   $ret = $this->child($args);
   exit ($ret);
} else {
   $this->log("Child Started: [PID:$pid] -> [JOB:test]");
   $this->numChildren++;
   // posix_setpgid($pid,posix_getpgid($this->pid));
   $this->count--;
}
 }
 // sleep(5);
 $out = pcntl_waitpid ( -1, &$status, WNOHANG );
 if ($out > 0) {
$this->numChildren--;
 }
  } while ($this->count > 0 || $this->numChildren > 1);

  echo "Done \n";
   }
   function sig_handler_parent($signo)
   {
  switch($signo) {
 case SIGINT:
 case SIGUSR1;
 case SIGTERM:
 posix_kill(0, $signo);
 exit;
 break;
 case SIGHUP:
 // handle restart tasks
 echo "SIGHUP\n";
 break;
 default:
 echo "ANOTHER EVENT\n";
 // handle all other signals
  }
   }
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] trying to match the front and end...

2003-08-10 Thread Ford, Mike [LSS]
On 08 August 2003 15:39, Dan Joseph wrote:

> I've searched the high heavens for a method of doing this...
> Here's what
> I'm doing... First, the code..
> 
> $middlenum = preg_replace("/^".$this->start_num."/", "",
> $this->ach_acct_num); $middlenum =
> preg_replace("/".$this->end_num."$/", "", $middlenum); 
> 
> In a nutshell, what I want to do is chop off the front and the back.
> Example: 
> 
> I have: 1234567890
> I want: 456
> 
> I have a start num and an end num.  start = 123, end = 7890.
> 
> This is working fine as I have it above, however I'd like to combine
> it into one regular express, instead of two.  Can someone give me an
> example of matching the beginning and end at the same time?

   $middlenum = preg_replace("/^${this->start_num}(.*)${this->end_num}$/", '$1', 
$this->ach_acct_num);

Cheers!

Mike

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

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



[PHP] trying to match the front and end...

2003-08-10 Thread Dan Joseph
Hi Everyone,

I've searched the high heavens for a method of doing this...  Here's what
I'm doing... First, the code..

$middlenum = preg_replace("/^".$this->start_num."/", "",
$this->ach_acct_num);
$middlenum = preg_replace("/".$this->end_num."$/", "", $middlenum);

In a nutshell, what I want to do is chop off the front and the back.
Example:

I have: 1234567890
I want: 456

I have a start num and an end num.  start = 123, end = 7890.

This is working fine as I have it above, however I'd like to combine it into
one regular express, instead of two.  Can someone give me an example of
matching the beginning and end at the same time?

-Dan Joseph


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



Re: [PHP] com obj from php

2003-08-10 Thread Stephen Holly
Cheers Jay, but Ive seen this already, i'ts the wrong way round!!

Steve.

"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
This is using COM in php scripts, I want to create a com obj (or
anything
really) that was written in php and use it in a .NET app
[/snip]

OK, I found this, which may or may not help
http://www.devarticles.com/art/1/222
Got Google?

Have a pleasant and resourceful day!



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



Re: [PHP] does PHP have a equivalent to the C++ #ifndef #define?

2003-08-10 Thread Curt Zirzow
* Thus wrote Dan Anderson ([EMAIL PROTECTED]):
> 
> Is there an equivalent to the C++:
> 
> #ifndef some_header_file_h
> #define some_header_file_h
> 
> // insert code that shouldn't be repeated here
> 
> #endif // some_header_file_h
> 

Yes. sort of..

  if (! defined('_SOME_HEADER_FILE_H_') ) {
define('_SOME_HEADER_FILE_H_', 1);

  } // some_header_file_h

I usually define it like this though, to avoid the extra
indentation.

  if (defined('_SOME_HEADER_FILE_H_') )
return; // leave included file

  // define header file and continue.
  define('_SOME_HEADER_FILE_H_', 1);


HTH,

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

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



[PHP] PHP Name of Script -0-T-

2003-08-10 Thread Ryan A
Hi,
I want to have an index of services available on my site..
eg:
webdesigners
programmers (if possible sub category here - JSP,ASP,PHP,C etc)
graphic artists
webhosting
etc etc

where a person comes, clicks on the category and either searches the
available entries or can enter his/her own entrywhat do you call these
scripts? I tried "PHP index services scripts" on google without success.. or
if someone has any experience with using a script like this kindly give me
the URL if possible.

I'm pretty sure this must be popular and dont want to go writing this from
scratch if there is a ready made one out there which may just need its guts
rearranged or is already good to go.

Thanks for any suggestions,links,comments etc.

Cheers,
-Ryan



We will slaughter you all! - The Iraqi (Dis)information ministers site
http://MrSahaf.com



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



Re: [PHP] Reformatting phone number string from user input

2003-08-10 Thread John W. Holmes
Verdon vaillancourt wrote:

Hi :)

I've been working on reformatting a phone number string from user input via
a form field. Ultimately, my goal is to format all phone numbers in the same
way regardless of whether a user inputs '(123) 456-7890', '123-456-7890',
'123.456.7890', etc. before I insert them into a db.
I know I've got a ways to go, but so far, after trying a few things I found
in the manual, I'm going in this direction...
$patterns[0] = "/\(/";
$patterns[1] = "/\)/";
$patterns[2] = "/-/";
$replacements[0] = "";
$replacements[1] = "";
$replacements[2] = " ";
$phone = preg_replace($patterns, $replacements, $phone);

This will change '(123) 456-7890' to '123 456 7890' which is what I am
after. I'm just wondering if there is a better or more elegant way to handle
this before I start trying to cover all the bases?
Could do something like this:

$phone = preg_replace('/[^0-9]/','',$phone);
if(strlen($phone) != 10)
{ echo "phone number is not valid!"; }
$phone = substr($phone,0,3) . ' ' . substr($phone,3,3) . ' ' . 
substr($phone,-4);

Which should cover all of the bases. :)

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





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


Re: [PHP] Allowed mem size exhausted

2003-08-10 Thread David Nicholson
Hello,

This is a reply to an e-mail that you wrote on Tue, 5 Aug 2003 at
17:57, lines prefixed by '>' were originally written by you.
> I would prepare the file on disk instead of memory. If you do
> increase the memory to handle bigger files, what happens when you
> get 10 requests at the same time?  about 80MB of memory used.

Correct me if I am wrong but would it not be better to use the
functions he is currently using (which prepare the data in volitile
memory) for as long as they allow for this.  The OS should then
realise when it does not have enough physical RAM for each of the
requests and handle swapping onto disk itself as and when it is
needed.  This would mean you haven't got the overheads of writing
lots of data to disk, just to delete it again when you do only have
one request at a time and have plenty of RAM spare to take care of
the operation.

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/
Free PHP error handling script: www.phpmachine.com/error-handler/

  Professional Web Development by David Nicholson
http://www.djnicholson.com/

QuizSender.com - How well do your friends actually know you?
 http://www.quizsender.com/

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



Re: [PHP] Stop neurotic posting

2003-08-10 Thread Nicholas Robinson
Andu's right. I've left several lists in the past, not because of people 
listing questions where they should have read the manual first, but because I 
couldn't stand the sad b**ds who get their kicks by belittling people 
with less knowledge but more manners than themselves.

I've actually learned quite a few useful things from questions in the past 
couple of weeks since I joined this list that have obviously reappeared 
several times. Now, I could spend hours trawling the archives to see if 
there's anything of interest, but I don't really have the time - and in any 
event they're often things I wouldn't have thought about looking up anyway.

So, keep the questions coming.

Nick

On Wednesday 06 Aug 2003 5:31 am, andu wrote:
> This is a very busy list, over 100 message in a quiet day and most people
> are helpful and decent, don't mind reading and learning. Unfortunately
> there are some who mostly post stuff like 'read the manual' and other shit
> like that. Stuffing e-mailboxes with such garbage day after day doesn't do
> anybody any good even if the manual is  not being read as much as it should
> be. Is it too difficult to not answer the post at all if you disagree with
> the content?
>
>
> Andu


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



Re: [PHP] gzip to max 9

2003-08-10 Thread Decapode Azur

> try setting zlib.output_compression_level in your php.ini

won't it turn  'zlib.output_compression'  to On ?
(because I prefere to keep it Off)


-- 
> >  > function wrl2wrz($buffer) { return gzencode ($buffer, 9); }
> > ob_start("wrl2wrz");
> > /* here the file */
> > ob_end_flush(); # end of the output buffering
> > ?>
> >
> > In this exemple with output beffering it is possible to select the
> > maximum compression level,
> >
> > is it possible to select the maximum compression level too
> > when writing in a file like below ??
> >
> > $gzp = fopen($output_file, 'w');
> > gzwrite($gzp, $content);
> > gzclose($gzp);
> >
> > I think that the default compression level here is 6,
> > and I would like to bring it to the maximum value 9.


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



RE: [PHP] Unzipping Files

2003-08-10 Thread Matt Palermo
Yeah, I know someone mentioned using the exec for this, but I was
wondering if anyone knew where I could find the command-line code for
this to use in PHP...  Anyone know?

Thanks,

Matt

-Original Message-
From: Mike Migurski [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 05, 2003 8:53 PM
To: Matt Palermo
Cc: 'Adam Alkins'; [EMAIL PROTECTED]
Subject: RE: [PHP] Unzipping Files

>I am doing this for a client, and he doesn't have the ZZIPlib
installed,
>and would like to avoid it if possible.  Any other ideas?

It has been mentioned before: use exec, or the backtick operator, and
the
command-line tools: unzip, bunzip, gunzip, etc.

-
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




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



Re: [PHP] Configuring PHP to use aspell

2003-08-10 Thread daniel
talking of aspell how could i intergrate this into a search engine, so i
could correct typos in a search ?
> I have the following set up...
>
> RH Linux version 7.3
>
> PHP 4.3.2
>
> Aspell installed on the server
>
> I have NEVER configured PHP and am looking for some assistance in
> configuring PHP to use Aspell so I can take advantage of this great
> feature that (as I can see from my searches) is not as well documented.
>
> I'm not sure of the path to my Aspell either...
>
> Jeff




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



[PHP] Re: suggestion on php-editor?

2003-08-10 Thread AciD
I use PHPed from nusphere (www.nusphere.com),
it's a very good editor which can work under windows or linux.
On Fri, 8 Aug 2003 09:57:45 +0200, Rush <[EMAIL PROTECTED]> wrote:

"Louie Miranda" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
But i was wondering if you guys have any other suggestions?
For the extensive list see Keith's listof editors:

http://linuxbackup.co.uk/

rush
--
http://www.templatetamer.com/





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


[PHP] Regular Expression

2003-08-10 Thread Ralph Guzman
Been working on this one for a while but can't get it working properly.
I need a regular expression to match if address is 

1. PO Box 
2. P.O. Box
3. P.O.Box

I'm using /i to make this case insensitive.

I got it working with 1 & 2, but it's still not matching 3. Any
suggestions?

if(preg_match( "/p[\.]o\.* +box/i", trim($_POST['address'])){ 
   echo "Address is P.O. BOX";
}



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



[PHP] bug in code - can't find it!

2003-08-10 Thread Amanda McComb
Ok, after all of the discussion on posting, I'm afraid to post.
Unfortunately, no one I know is a programmer, and I am a beginner.  I can
normally figure out what I've done wrong, but I'm missing something here.

Ok, here is my query and the bit of code I can't figure out:

$query = "SELECT * from apt_user_t a, apt_company_t b ";
$query .= "WHERE a.user_cd = b.user_cd ";
$query .= "ORDER BY a.username";

 $search_results = mysql_query($query) or die("Select
Failed!");
while ($search_result2 = mysql_fetch_array($search_results)) 
{
 
}
Nothing shows up with the echo or the value.  I only included this
checkbox, but all of the other values show up fine.  Can someone give me a
hint?




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



Re: [PHP] mail() usage in for loops

2003-08-10 Thread Curt Zirzow
* Thus wrote John W. Holmes ([EMAIL PROTECTED]):
> Mohanaraj wrote:
> 
> >What would be the best way to handle this ?
> 
> Go get a program that's made to send out emails like this. Odds are 
> it'll be faster and less of a strain on your server. PHP is great, but 
> there are other solutions out there.

yeah this might be a better suggestion than trying to handle all
the mails yourself.  ezmlm or majordomo would do the job quite
well.

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

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



Re: [PHP] Old version of PHP

2003-08-10 Thread Philip Olson
> > > Thanks for all the feedback, guys. Is there an errata page somewhere
> > > lists known bugs in the PHP interpretter?
> >
> > google > php bugs
>
> I appreciate the (rather indirect) pointer to the PHP bug tracking site - I
> didn't know about that. Errata, it seems to me anyway, perform a different
> purpose. I don't mind RTFM-style responses, but please at least read my
> question more closely.
> 
> I find the "reporting bugs" link on the PHP website a bit misleading since
> that page serves more purposes than simply reporting bugs.

There is no Errata per se, but there is a changelog that
lists bugs/fixes and even links to the bug reports in
question.  One day the manual will have its own changelog
that will list every change, such as new parameters, 
name changes, default value changes, etc.  But it doesn't
exist yet.

Here are the changelogs:

  http://www.php.net/ChangeLog-4.php
  http://www.php.net/ChangeLog-5.php

Regards,
Philip


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



[PHP] Imagick

2003-08-10 Thread Jacob Marble
Excuse me, I accidentally sent that last incomplete message.
I have successfully compiled PHP 4.3.3RC3 with the --with-imagick flag after
compiling and installing ImageMagick 5.5.7 (that was a headache on it's
own).  The following error keeps cropping up:

Fatal error: Call to undefined function: imagick_readimage() in
/usr/local/lib/php/docs/imagick/examples/border.php on line 5

I've tried compiling PHP without the --with-imagick flag and then doing a
"pear install imagick" to get the pear version 0.9.7 package.  The same
problem occurs.  I don't even know how to use imagick yet; I can't get the
thing to work with example files, so I can't start writing my own stuff yet.
Does anyone at this NG use the imagick tools?  Is there something I have to
include maybe?  Like "require 'imagick.php'" or something?  I can't find any
files that look appropriate for that.

Thanks in advance,

Jake

LandEZ



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



Re: [PHP] PHP Fusebox

2003-08-10 Thread daniel
ok i have a standard of executing things i use a switch case to switch $_GET
['action'] , so i can have ?action=add_entry ?action=edit ?action=insert ?
action=update ?action=delete etc .. this works well for a cms system

> Hi Ralph!
>
> I suggest MVC.
>
> http://phrame.sourceforge.net/
> http://www.phpmvc.net/
>
> Regards,
> TM.
>
> Ralph Guzman wrote:
>
>>I am trying to standardize my development process and have been looking
>>at the different frameworks out there.
>>
>>One of the philosophies I like is that of Fusebox, although originally
>>developed for ColdFusion it is now available for PHP:
>>
>>http://bombusbee.com/
>>
>>Anybody have any experience working with Fusebox, or can anybody
>>recommend any other frameworks that I should also look at? I am looking
>>for a framework that will be developed going into PHP 5 also.
>>
>>Your help is appreciated.
>>
>>Ralph
>>
>>
>
>
>
> --
> 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] problem looping through records

2003-08-10 Thread David Otton
On Sun, 10 Aug 2003 22:11:09 +0100, you wrote:

>I have a sql statement which brings about 15 records... inside the while
>loop i am trying to get data from another table by passing an id, the
>problem is i am only getting the first record .. not the whole 15 records..
>
>any suggestion??
>
>function list_ss_cats(){
>global $db;
>$sql = "SELECT DISTINCT(new_cat) FROM logos WHERE format =3";
>$result = $db->sql_query($sql);
>$num = $db->sql_numrows();
>while($row = $db->sql_fetchrow()){
>
> $sql2 = "SELECT * FROM cats WHERE id='$row[new_cat]'";

Others have answered your immediate question, but it looks to me like you
should be doing a join and only using one SQL statement instead of sixteen.
Something along the lines of

SELECT DISTINCT(logos.new_cat), cats.*
  FROM logos, cats
  WHERE logos.format = 3
  AND logos.new_cat = cats.id

(Though I'd remove the * personally, it can slow things down. Oh, and you
get $num but never actually use it, and "$row1[en]" should be throwing a
warning - it should be "$row1['en']").


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



Re: [PHP] htmlspecialchars() and HTML code

2003-08-10 Thread Robert Cummings
You're safe because when you apply htmlentities() these will be doubly
marked up. So if the file contains "&" then the browser will receive
"&".

HTH,
Rob.


On Fri, 2003-08-08 at 11:57, Thaddeus J. Quintin wrote:
> CPT John W. Holmes wrote:
> 
>  > Try this:
>  >
>  > This is  text
>  >
>  > If you submit that "text" and then print $_REQUEST['text'], you'll 
> see that
>  > you have
>  >
>  > This is  text
> 
> Ok, but that only makes me realize the further extent of the problem.
> 
> If the HTML file that they upload has '<' or '>' entities, then 
> these characters will be displayed in the text area as '<' and '>' 
> symbols.  So when  the text is submitted from the textarea, all of the 
> user's HTML entities will have been destroyed.
> 
> Any thoughts on this problem?
> 
> Thaddeus
> 
> CPT John W. Holmes wrote:
> 
> > From: "Thaddeus J. Quintin" <[EMAIL PROTECTED]>
> > 
> >>I'm working on a site where users have the option to type HTML code into
> >>a textarea, or upload HTML code from a local file which is then
> >>displayed in the text area.
> >>
> >>The obvious problem is that an uploaded file that contains a closing tag
> >>for a textarea can wreak havoc and eat up the rest of the page.  So, in
> >>order to get it to display properly, I called htmlspecialchars() on the
> >>string and that works fine.
> >>
> >>After any editing has been done, I can convert the text back using
> >>html_entity_decode().  This seems to be a decent solution to the problem.
> >>
> >>However, if the user has included htmlentities in their code, won't
> >>these get converted when I call the decode function?  Even something
> >>simple like using a '<' symbol for a little arrow.  This would need to
> >>remain a '<' and not get converted when html_entity_decode() is called.
> > 
> > 
> > You should not have to call html_entity_decode() at all. You encode the text
> > to get it to show in the text area. When the form is submitted, you get the
> > text exactly as it appears in the textarea. in other words, without the html
> > entities.
> > 
> > Try this:
> > 
> > This is  text
> > 
> > If you submit that "text" and then print $_REQUEST['text'], you'll see that
> > you have
> > 
> > This is  text
> > 
> > ---John Holmes...
> > 
> > 
> > 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
.-.
| Worlds of Carnage - http://www.wocmud.org   |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

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



[PHP] MySQL field data type for ISBN numbers

2003-08-10 Thread James Johnson
Hi,

Don't know if this is an OT or not.

I have a MySQL database for books. The ISBN field is set as varchar(15) and
I've put a test ISBN number in of 1--111-11. Can someone tell me why
this SQL query isn't working?

$ISBN = $_GET['isbn'];
$query = "SELECT * FROM book_details WHERE ISBN = '$ISBN'";

Since the field is a varchar, should wrapping the variable (1--111-11)
in single quotes work?

If I change the data in the table to 'abcd' and run this query

$ISBN = 'abcd';
$query = "SELECT * FROM book_details WHERE ISBN = '$ISBN'";

It works.

PHP Version 4.3.2
mysql-4.0.14b

Thanks,
James


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



[PHP] Reformatting phone number string from user input

2003-08-10 Thread Verdon vaillancourt
Hi :)

I've been working on reformatting a phone number string from user input via
a form field. Ultimately, my goal is to format all phone numbers in the same
way regardless of whether a user inputs '(123) 456-7890', '123-456-7890',
'123.456.7890', etc. before I insert them into a db.

I know I've got a ways to go, but so far, after trying a few things I found
in the manual, I'm going in this direction...

$patterns[0] = "/\(/";
$patterns[1] = "/\)/";
$patterns[2] = "/-/";

$replacements[0] = "";
$replacements[1] = "";
$replacements[2] = " ";

$phone = preg_replace($patterns, $replacements, $phone);

This will change '(123) 456-7890' to '123 456 7890' which is what I am
after. I'm just wondering if there is a better or more elegant way to handle
this before I start trying to cover all the bases?

Note: I found a variety of examples in the mailing list archives, but none
of them seem to use the method above. Hmmm, does that mean I'm taking the
long way around ;) I know I could just copy some examples from there, but
I'm trying to use this as a learning opportunity and there seems to be more
than one way to skin the cat (no offence to cat lovers ;)

TIA for any advice,
Verdon


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



Re: [PHP] Container functions....

2003-08-10 Thread Mike Morton
Justin:

Not ColdFusion - ancient language by Brian Fox called MetaHTML - actually a
VERY good language - just not supported or developed anymore as far as I can
tell ;)

Anyhow - that is one solution that I had not thought of - but ideally I
would like to use a function rather than an IF statement - just the anal
developer attutude that is in me ;)

For instance, in an IF statement, is there a way to reference, or access the
code/etc contained within the { } ?  If there was, then this solution:

developer_execute() {
 execute this code only
}

Where the function developer_execute would be defined as:
function developer_execute() {
if(getenv("REMOTE_ADDR")=="000.000.000.000") {
%body
}
}

Would work - I am just hitting the wall as to how to reference the code
between { and } represented in the function definition by %body

Anybody?


On 8/10/03 7:46 PM, "Justin French" <[EMAIL PROTECTED]> wrote:

> Sounds like you're trying to replicated something in ColdFusion?
> 
> I have a few blocks of code on my pages which are only executed on my
> development server, not the live server -- is this what you want?
> 
> if(ereg("192.168.0.",$_SERVER['SERVER_ADDR']))
> {
> $local = 1;
> }
> else
> {
> $local = 0;
> }
> 
> 
> if($local)
> {
> // do whatever you want
> }
> 
> 
> Justin
> 
> 
> On Monday, August 11, 2003, at 12:50  AM, Mike Morton wrote:
> 
>> In a language that I used to program in - for development we used to
>> be able
>> to make a function that basically just executed everything inbetween:
>> 
>> Print "This is html printed"  Print "this is
>> more
>> code";
>> 
>> 
>> So basically everything in between hidecode and /hidecode is executed
>> the
>> same as if the hide code did not exist - except that the hidecode
>> container
>> would be something like:
>> 
>> Function hidecode() {
>> if(getenv("remoteaddress")=="myaddress") {
>> %s (all code contained within the tags)
>> }
>> }
>> 
>> So - the question is does PHP have some way that I cannot see to do
>> this?
>> 
>> I realize that I could create a function and pass everything in as an
>> argument - but that would involve putting everything into variables,
>> and
>> overall being just a pain in the ass to add and remove the container.
>> 
>> Is PHP too sophisticated a language to be able to do this easily and
>> quickly?  Or am I just missing some form of function that is totally
>> obvious?
>> 
>> Finally - yes, I know that I could slap an if tag around it - but that
>> is
>> also a big pain in the ass to add and remove each if tag when you go
>> 'live'
>> with the change, as opposed to a quick find and replace with a
>> container
>> function like this...
>> 
>> TIA

--
Cheers

Mike Morton


*
* Tel: 905-465-1263
* Email: [EMAIL PROTECTED]
*


"Indeed, it would not be an exaggeration to describe the history of the
computer industry for the past decade as a massive effort to keep up with
Apple."
- Byte Magazine

Given infinite time, 100 monkeys could type out the complete works of
Shakespeare. Win 98 source code? Eight monkeys, five minutes.
-- NullGrey 


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



Re: [PHP] Allowed mem size exhausted

2003-08-10 Thread Curt Zirzow
* Thus wrote Shawn McKenzie ([EMAIL PROTECTED]):
> I have the following code that generates the following error.  I am using
> this code to prepare a zip or tar.gz file as an email attachment.  Can
> someone suggest a better / more efficient way to do this and maybe avoid the
> error???
> 
> I believe that the file that generated this error was about 1.8MB.
> 
> 6 $fp = fopen($path.$filename, "r");
> 7 $content = fread($fp, filesize($path.$filename));
> 8 $attachment = base64_encode($content);
> 9 $attachment = chunk_split($attachment);
> 
> Fatal error: Allowed memory size of 8388608 bytes exhausted at (null):0
> (tried to allocate 2228273 bytes) in
> /home/user/public_html/dir/subdir/include/functions.php on line 9

I would prepare the file on disk instead of memory. If you do
increase the memory to handle bigger files, what happens when you
get 10 requests at the same time?  about 80MB of memory used.

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

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



RE: [PHP] undefined function imagecreate()

2003-08-10 Thread Jay Blanchard
[snip]
What am I looking for in the output of phpinfo?
Must I alter extensions in php.ini?
Is this gd librabry not inlcuded in the originial install of php?
[/snip]

You are looking to see soemthing like this in the Configure Command
section

Configure Command  './configure' '--with-apxs=/usr/local/sbin/apxs'
'--with-config-file-path=/usr/local/etc' '--enable-versioning'
'--with-system-regex' '--disable-debug' '--enable-track-vars'
'--with-zlib' '--with-mysql=/usr/local' '--prefix=/usr/local/'
'--enable-ftp' 'i386--freebsd4.5' '--with-jpeg-dir=/usr/local'
'-with-png-dir=/usr/local' '--with-gd=/usr/local' 

See '--with-gd=/usr/local' 

You shouldn't have to mess with php.ini. GD library may not be compiled
with PHP dependent upon the version.

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



RE: [PHP] Piping and the CLI parser

2003-08-10 Thread Ford, Mike [LSS]
On 06 August 2003 15:19, Jason Wong wrote:

> On Wednesday 06 August 2003 21:29, Nicolas Frisby wrote:
> 
> > Regardless of that, do you know anything of how the piping mechanism
> > works?
> 
> Not really. I do know that what you're trying to do doesn't work for
> bash scripts either. IE you cannot use a pipe to pass command line
> arguments to a bash script, nor a php script.

Well, no -- command line arguments are not STDIN, as a general rule.  That's
why they're passed separately in argc, argv.

When you pipe one process into another:

   x | y

the standard output (STDOUT) of x is "piped" directly into the standard
input (STDIN) of y -- so whatever x sends to STDOUT, y will see on STDIN.
The mechanics of this aren't really important (although commonly x's STDOUT
is written to a tempfile, which y's STDIN is then read from), so long as you
understand the principles of it.

Cheers!

Mike

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

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



Re: [PHP] how do i get assosciative name in foreach

2003-08-10 Thread CPT John W. Holmes
From: "Dan Anderson" <[EMAIL PROTECTED]>
> I want to do:
> 
>  
> $array['element1'] = 'element1';
> $array['element2'] = 'element2';
> 
> foreach ($array as $element)
> {
>   // assuming get_assoc gets the assosciative name
>   if (get_assoc($element) == 'element1')
> {get_assoc($element) do_something(); }
>   elseif ( == 'element1')
> { do_somethingelse(); }
> }
> 
> ?>

Refer to the manual:

foreach($array as $key => $value)

So...

foreach($array as $key => $element)
{
  if($key == 'element1' ...
  if($key == 'element2' ...

---John Holmes...

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



Re: [PHP] Old version of PHP

2003-08-10 Thread Dan Phiffer
I appreciate the (rather indirect) pointer to the PHP bug tracking site - I
didn't know about that. Errata, it seems to me anyway, perform a different
purpose. I don't mind RTFM-style responses, but please at least read my
question more closely.

I find the "reporting bugs" link on the PHP website a bit misleading since
that page serves more purposes than simply reporting bugs.

Okay enough of my bitching,
-Dan


- Original Message - 
From: "Jason Wong" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, August 08, 2003 10:21 AM
Subject: Re: [PHP] Old version of PHP


> On Saturday 09 August 2003 00:54, Dan Phiffer wrote:
> > Thanks for all the feedback, guys. Is there an errata page somewhere
that
> > lists known bugs in the PHP interpretter?
>
> google > php bugs
>
> -- 
> 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
> --
> /*
> The difference between waltzes and disco is mostly one of volume.
> -- T.K.
> */
>


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



Re: [PHP] MySQL field data type for ISBN numbers

2003-08-10 Thread Michael Geier
functions you should consider:
   trim
   urlencode/urldecode
   rawurlencode/rawurlencode

try "echo '{$_GET['isbn']}'" (or $query) on the result page to see what you are 
truly getting.  I bet the browser is encoding the variable in the GET string, 
even though it doesn't appear that way to you.

Or, is the action of the FORM GET, or is it POST?
  if (!isset($_GET['isbn'])) { echo "no isbn"; } should verify that (if you can 
  see the data in the URI string, it is GET...if not, POST)

Quoting James Johnson <[EMAIL PROTECTED]>:

> Hi,
> 
> Don't know if this is an OT or not.
> 
> I have a MySQL database for books. The ISBN field is set as varchar(15) and
> I've put a test ISBN number in of 1--111-11. Can someone tell me why
> this SQL query isn't working?
> 
> $ISBN = $_GET['isbn'];
> $query = "SELECT * FROM book_details WHERE ISBN = '$ISBN'";
> 
> Since the field is a varchar, should wrapping the variable (1--111-11)
> in single quotes work?
> 
> If I change the data in the table to 'abcd' and run this query
> 
> $ISBN = 'abcd';
> $query = "SELECT * FROM book_details WHERE ISBN = '$ISBN'";
> 
> It works.
> 
> PHP Version 4.3.2
> mysql-4.0.14b
> 
> Thanks,
> James
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


===
Michael Geier
CDM Sports, Inc. Systems Administration
   email: [EMAIL PROTECTED]
   phone: 314.692.3540

---
 This email sent using CDM Sports Webmail v3.1
  [ http://webmail.cdmsports.com ]

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



[PHP] Container Functions Continued.....

2003-08-10 Thread Mike Morton
Thanks to everyone who responded to me so far, but I fear that I have not
explained myself too clearly.

First of all, I understand the argument about having a testing, development
and live servers, however, in the real world not every client can afford
that hardware and it is not always feasable for smaller websites to have all
the equipment.  

So, lets base this on the fact that there is one server that has one URL,
One IP and all development/testing is done on the live website.

Now that I have that out of the way.

What I am trying to accomplish is a function that can contain code blocks,
like an if statement.  Something that would operate like:

developer_execute() {
 execute this code only
}

Where the function developer_execute would be defined as:
function developer_execute() {
if(getenv("REMOTE_ADDR")=="000.000.000.000") {
%body
}
}

Where the %body is the actual code represented by 'execute this code only'
above.

So, the question is, is there a way to create a function like an if function
that does not only reply on the arguments between the ( and ) in the
function call?

Thanks again.



--
Cheers

Mike Morton


*
* Tel: 905-465-1263
* Email: [EMAIL PROTECTED]
*


"Indeed, it would not be an exaggeration to describe the history of the
computer industry for the past decade as a massive effort to keep up with
Apple."
- Byte Magazine

Given infinite time, 100 monkeys could type out the complete works of
Shakespeare. Win 98 source code? Eight monkeys, five minutes.
-- NullGrey 


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



Re: [PHP] Stop neurotic posting

2003-08-10 Thread CPT John W. Holmes
Honestly, if you people ignored the stupid responses as much as you want us
to ignore the stupid questions... we wouldn't be having this "discussion".

---John Holmes...

- Original Message - 
From: "Nicholas Robinson" <[EMAIL PROTECTED]>
To: "andu" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, August 06, 2003 10:55 AM
Subject: Re: [PHP] Stop neurotic posting


Andu's right. I've left several lists in the past, not because of people
listing questions where they should have read the manual first, but because
I
couldn't stand the sad b**ds who get their kicks by belittling people
with less knowledge but more manners than themselves.

I've actually learned quite a few useful things from questions in the past
couple of weeks since I joined this list that have obviously reappeared
several times. Now, I could spend hours trawling the archives to see if
there's anything of interest, but I don't really have the time - and in any
event they're often things I wouldn't have thought about looking up anyway.

So, keep the questions coming.

Nick

On Wednesday 06 Aug 2003 5:31 am, andu wrote:
> This is a very busy list, over 100 message in a quiet day and most people
> are helpful and decent, don't mind reading and learning. Unfortunately
> there are some who mostly post stuff like 'read the manual' and other shit
> like that. Stuffing e-mailboxes with such garbage day after day doesn't do
> anybody any good even if the manual is  not being read as much as it
should
> be. Is it too difficult to not answer the post at all if you disagree with
> the content?
>
>
> Andu


-- 
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 good read about posting to lists.

2003-08-10 Thread Chris Edwards
I know there is alot of heated debate.  Maybe this will help.

http://www.catb.org/~esr/faqs/smart-questions.html

I think a link to this document should be on the php mailing list sign-up
page.

-- 
Chris Edwards
Web Application Developer
Outer Banks Internet, Inc.
252-441-6698
[EMAIL PROTECTED]
http://www.OuterBanksInternet.com


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



RE: [PHP] Max script size

2003-08-10 Thread Jay Blanchard
[snip]
URL's correct.  If I cut the script in half it runs fine.

FYI The scrpit in full of 4000 or so mysql SQL statements.
[/snip]

It is not a PHP issue then. It is probably an issue with Apache (look in
httpd.conf or perhaps a local .htaccess).
4000 MySQL statements? WOW. Why? Is it necessary to have output to the
browser? Could you run the script from the command line?

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



[PHP] Container functions....

2003-08-10 Thread Mike Morton
In a language that I used to program in - for development we used to be able
to make a function that basically just executed everything inbetween:

Print "This is html printed"  Print "this is more
code";


So basically everything in between hidecode and /hidecode is executed the
same as if the hide code did not exist - except that the hidecode container
would be something like:

Function hidecode() {
if(getenv("remoteaddress")=="myaddress") {
%s (all code contained within the tags)
}
}

So - the question is does PHP have some way that I cannot see to do this?

I realize that I could create a function and pass everything in as an
argument - but that would involve putting everything into variables, and
overall being just a pain in the ass to add and remove the container.

Is PHP too sophisticated a language to be able to do this easily and
quickly?  Or am I just missing some form of function that is totally
obvious?

Finally - yes, I know that I could slap an if tag around it - but that is
also a big pain in the ass to add and remove each if tag when you go 'live'
with the change, as opposed to a quick find and replace with a container
function like this...

TIA



--
Cheers

Mike Morton


*
* Tel: 905-465-1263
* Email: [EMAIL PROTECTED]
*


"Indeed, it would not be an exaggeration to describe the history of the
computer industry for the past decade as a massive effort to keep up with
Apple."
- Byte Magazine

Given infinite time, 100 monkeys could type out the complete works of
Shakespeare. Win 98 source code? Eight monkeys, five minutes.
-- NullGrey 


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



Re: [PHP] segmentation faults

2003-08-10 Thread Mike Migurski
>I have a large project underway which is (hopefully!) nearing completion,
>running on the latest stable release, 4.3.2.  However, strange things
>have started happening...
>
>My main page sometimes causes Apache to seg fault at some point during
>the execution (e.g. [Sun Aug 10 18:05:55 2003] [notice] child pid 29674
>exit signal Segmentation fault (11)). I thought I'd track through it to
>find out where the problem might be, but having sprinkled a few echo
>statements around it now isn't crashing any more.

I have also had this problem, and asking about it here provided no help.

Mine seems to be related to abnormally high numbers of instantiated
objects and large amounts of reference-passing. Occasionally Apache
children will die (with the error you've described), or spin out of
control and hog the CPU for a while (Apache 1.3.27, Red Hat 9, PHP 4.3.2).
I have not been able to track down the problem, though I did attempt to
re-create it using the command-line PHP interpreter to write Apache out of
the picture, and was not able to reproduce the errors.

I've tried to route around them somewhat, and have been moderately
successful, except when they bump my CPU load to 100%. :-P

-
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] gettin parameters from url, architecture question

2003-08-10 Thread Curt Zirzow
* Thus wrote Merlin ([EMAIL PROTECTED]):
> Hi there,
> 
> I recently dumped into a site which was kind of search engine optimized.
> They had urls like this:
> 
> server.com/country_province_city_222.html
> 
> where country would be a php file, but how are those guys picking the right
> file? Where is the php file stored and how does the server know which file
> to call??
> 
> Can anybody shed a bit of lite on that? ;-)

It almost looks to me that those are static pages. but if they
aren't a simple way to handle that would be to set your
ErrorDocument in the webserver.


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

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



[PHP] Re: PHP Fusebox

2003-08-10 Thread Nicolas Frisby
I just recently did a bit of research into "standardized development
processes" and such and the most robust system I have found is XML and XSLT.

I realize that the whole idea of the 'fusebox' page is lost, but XSL allows
you to generate just about anything and XML's standard formats (DocBook and
Apache's Cocoon to name a couple) guarantee some degree of easy sharing or
even an easy switch to a different system in the future.

Come to think of it, if you are really set on this Fusebox idea, you could
(theoretically) use XSL to generate your php files that conatin your fusebox
templates from XML...

Hope this offers even the tiniest bit of illumination
-Nick

"Ralph Guzman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am trying to standardize my development process and have been looking
> at the different frameworks out there.
>
> One of the philosophies I like is that of Fusebox, although originally
> developed for ColdFusion it is now available for PHP:
>
> http://bombusbee.com/
>
> Anybody have any experience working with Fusebox, or can anybody
> recommend any other frameworks that I should also look at? I am looking
> for a framework that will be developed going into PHP 5 also.
>
> Your help is appreciated.
>
> Ralph
>
>



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



Re: [PHP] Mail

2003-08-10 Thread Sean
Got it if anyone else has trouble.
In the IIS SMTP properties go to the Access Tab.
Click the Relay button at the bottom and change the selection from "Only the
list below" to "All except the list below" I have no idea if this is a
security risk it works that's all I care about for now.

Sean



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



RE: [PHP] Still can't pass variable through url

2003-08-10 Thread Martin Towell
See if changing it to
page.php?year=$year&month=$month
works


The separator between the page and the query string is "?"
The separator between each key/value pair is just "&"

-Original Message-
From: Jack [mailto:[EMAIL PROTECTED]
Sent: Friday, 8 August 2003 4:30 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] Still can't pass variable through url


Dear all
I had set the "register_global=on" and "magic_quotes_runtime=off" already,
but when i click my hyperlink "page.php?year=$year&?month=$month", it
doesn't pass the variable for
?year and ?month to the destination page "page.php"
I'm using php 5.0 above , if the same case apply to php4.04, then there is
no problem at all!
Can anyone please give me more help on this?

Thx alot
Jack



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__ Information from NOD32 1.468 (20030725) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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



Re: [PHP] find string

2003-08-10 Thread David Nicholson
Hello,

This is a reply to an e-mail that you wrote on Mon, 11 Aug 2003 at
00:25, lines prefixed by '>' were originally written by you.

> Isn't there an in_array function you can use?
> If (in_array($action, array(a1,a2,a3,a4)) {
> // do something
> else {
> // do something else
> Carl.

Make sure that your string values are in quotes or PHP will belooking
for constants with those names, i.e. array('a1','a2','a3','a4')

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/
Free PHP error handling script: www.phpmachine.com/error-handler/

  Professional Web Development by David Nicholson
http://www.djnicholson.com/

QuizSender.com - How well do your friends actually know you?
 http://www.quizsender.com/

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



[PHP] MIME Mail Problem with Netscape

2003-08-10 Thread Hendry J
Hi all,

I'm having problem sending MIME Mail using PHP (SMTP) to netscape.net
emails,
it didn't display the content of html, (although i've filled the
content-type with  text/html),
instead, it display the garbled text.

I've tried to encode the message with 7bit and base64 encoding, but those
don't work either ;(
All other emails (yahoo!, hotmail, etc.) display the emails in html, only
netscape that can't interpret it?

Is there some way so that netscape understand the emails and displayed it
correctly?
Am i providing enough information?

BTW, I'm using PHP v4.2.3

TIA,
Cordially yours,
Hendry Johan



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



Re: [PHP] [PROBLEM] Killed sshd, want to start it via PHP script.

2003-08-10 Thread Jason Wong
On Monday 11 August 2003 13:01, Simon Fredriksson wrote:

> Anyway; I want to make some sort of PHP backdoor to start sshd again. As
> far as I know, only root can do so though so just an exec() won't do.
> How can I switch to root, enter the password and then start sshd via a
> PHP script that I run via the web?

I know PHP is pretty versatile and all that, but I'm still amazed at the kinds 
of things that people want PHP to do when there are better and more 
appropriate alternatives:

The simplest requiring no more than a shell script is to run a cron job which 
figures out whether sshd is running, if not start it.

Further up the scale you can use xinetd.

Even further, you can use something like daemontools to supervise your "must 
run" daemons.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
It is so very hard to be an 
on-your-own-take-care-of-yourself-because-there-is-no-one-else-to-do-it-for-you
grown-up.
*/


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