RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes

2002-07-22 Thread Demitrious S. Kelly

Yes. Write a daemon which listens on a socket and manages the
communications it gets from the satellite scripts and works the database
for them...

The scripts send off data, and process replies. They don't do the heavy
work...

-Original Message-
From: David Buerer [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 2:30 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate
processes

How to I inovoke a new Thread from the middle of a PHP script?

-Original Message-
From: Paul Maine [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 10:08 AM
To: David Buerer; [EMAIL PROTECTED]
Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate
processes


You can use threads with NT to accomplish what you are asking.

-Original Message-
From: David Buerer [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 22, 2002 11:29 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes


I've got effectivly a glorified chat server which upon the arrival of a
message thorugh a socket connection goes off and runs a bunch of
database
processed.  My questions is this:  How can I seperate the database
processing into a seperate processor process?  I really don't want the
chat
server to have to wait until after the database processing is done to go
intercept and process another request--this just doesn't seem right.  I
want
the chat server process to be able to deal with getting and receiving
messages, and another process to deal with the database processing.
That
way if one of the processes get's slow, the other isn't affected.
Something
like the fork command would work really well, but fork doesn't exist in
NT.

Anyone have any ideas?

I'm running Windows NT4.0 sp6a
Apache Server 1.3.xx
MySQL
and of course, PHP 4.2.1



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




RE: [PHP] Comma question

2002-07-22 Thread Demitrious S. Kelly

I think someone working on learning php after learning C was a little
too printf() happy :)

-Original Message-
From: B i g D o g [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 3:34 PM
To: PHP GEN
Subject: [PHP] Comma question

Tried to check the archive, but it is offline...


What does the , and {} do in this type of statement?

Example:  echo trtd{$strName}/td/tr, htmlspecialchars(
$teststr );

Thanks,


.: B i g D o g :.



-- 
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] Formating datevariables...

2002-07-22 Thread Demitrious S. Kelly

Why not let mysql do it? It has a function do to exactly that, I
think...

But php's date() is the function you're looking for...

-Original Message-
From: Ragnar [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 4:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Formating datevariables...

I have a column in a mysql table with a timestamp. The value of this
column
is for instance:

20020722185242

How do i change the format on this to DDMM (22072002) in php?

Thanx

-R



-- 
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: PHP and OOP

2002-06-27 Thread Demitrious S. Kelly

Comparison (do not compare the speeds between the versions of php as
they are on different servers under different loads.) The only
conclusion that I can draw from this so far is that different versions
of php handle these situations differently, newer versions may handle
OOP code better that proc code - this is just conjecture of course.  It
also may not be realistic to judge so harshly and quickly on benchmarks
like this. This kind of code isn't very real world when you get right
down to it. Other factors may also be in play - the kind of functions
used inside the proc/obj, types of variables - how about nested objects
- different kinds of loops - etc etc etc. It's a hard comparison to make
- as I do not have time to compile many versions of php on a given
machine and run the tests at the moment. Maybe someone with a bit of
time to spare would help shed some light on the subject?

If I get a chance I will look into the problem further. And I will have
the results amended to my article on phpbeginner.com (or the results of
the person (people?) who sheds light on the subject for us) so stay
tuned to the website  and I'll try to get something more definitive
soon.

Cheers everyone!

OOP: 
PHP Version: 4.1.2 Took 70.311300992966 seconds
PHP Version: 4.2.1 Took 76.400364041328 seconds
?php

set_time_limit(0);

class count {
function icount($vs) {
$var=0;
while($count  $vs) {
$date=time();
$count++;
}
}
}

function getmicrotime(){
list($usec, $sec) = explode( ,microtime());
return ((float)$usec + (float)$sec);
}

$time_start = getmicrotime();
$icount=new count;
$icount-icount(1000); 
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo Took $time seconds;
?

PROC:
PHP Version: 4.1.2 Took 69.567726969719 seconds 
PHP Version: 4.2.1 Took 86.658290982246 seconds
?php

set_time_limit(0);

function getmicrotime(){
list($usec, $sec) = explode( ,microtime());
return ((float)$usec + (float)$sec);
}

function icount($vs) {
$count=0;
while($count  $vs) {
$count++;
$date=time();
}
}

$time_start = getmicrotime();
icount(1000);
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo Took $time seconds;
?

-Original Message-
From: SP [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, June 27, 2002 12:01 PM
To: Remy Dufour; Kondwani Spike Mkandawire; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: PHP and OOP

Never tested it so I tried it out for the fun of it.  I didn't use yours
but
I used the other guy's code on separate pages and did it ten times.  I
guess
I was wrong, I got around 2% difference.  Definitely not the 20%
difference
that guy got in his.  He was probably using a older version.  Mine was
on
4.1.1 so everyone should be switching to OO from the looks of it.

OO Procedural
3.22   2.87
3.09   3.05
2.91   3.00
2.88   2.99
3.08   3.09
3.25   3.04
2.97   2.94
2.94   3.01
3.05   2.90
3.07   2.96

3.05   2.99 avg

-Original Message-
From: Remy Dufour [mailto:[EMAIL PROTECTED]]
Sent: June 27, 2002 1:34 PM
To: SP; Kondwani Spike Mkandawire; [EMAIL PROTECTED]
Subject: Re: [PHP] Re: PHP and OOP


I've tested thecode and there is what i've got
Proceduraltook 1.24408602715 seconds
OOtook 1.24240803719 seconds
Here is the code. Test it by yourself
?phpfunction getmicrotime(){list($usec, $sec) = explode(
,microtime());return ((float)$usec + (float)$sec);}
function
icount($vs) {$var=0;while($count  $vs) {
$count++;}}$time_start = getmicrotime();
icount(100);
echo Proceduralbr took . (getmicrotime() - $time_start) .
secondsbr;
class count {function icount($vs) {$var=0;
while($count  $vs) {$count++;}}
}
$time_start = getmicrotime();$icount = new count;
$icount-icount(100);echo brOObr took . (getmicrotime() -
$time_start) . seconds;?

 OO is slower then procedural.  You can test that out yourself or look
at
 this article where the guy did a very basic test.  Maybe they will fix
the
 speed problem by the time php5 comes around.
 http://www.phpbeginner.com/columns/demitrious/objects/8



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

RE: [PHP] grabbing content of a web page...

2002-06-27 Thread Demitrious S. Kelly

File() or fgets()

-Original Message-
From: Kelly Meeks [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, June 27, 2002 12:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP] grabbing content of a web page...

Howdy,

I know there has to be a way to grab output of an url on another site?
Let's say you wanted to get the output of yahoo.com (just for example)?

Is there any way you can stick that into a variable, and then manipulate
it?

Thanks,

Kelly


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




RE: [PHP] PHP Session Idle Time

2002-06-27 Thread Demitrious S. Kelly

Save time as a session variable... and if current time minute time is
greater than x seconds, then destroy the session and start over.

-Original Message-
From: Jefferson Cowart [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, June 27, 2002 2:13 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP Session Idle Time

I'm writing a web application in which I would like the session to
expire after a certain amount of idle time. I tried using the
session_set_cookie_params function but that is time from session start.
How would I go about doing idle time?


Thanks
Jefferson Cowart
[EMAIL PROTECTED] 

Support Open Instant Messaging Protocols
http://www.petitiononline.com/openIM/petition.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] ok what kind of crack is my computer smoking?

2002-06-27 Thread Demitrious S. Kelly

You check and make sure the date was set right on the box?

You could try make clean for everything before configuring...


-Original Message-
From: Rick Kukiela [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, June 27, 2002 2:10 PM
To: [EMAIL PROTECTED]
Subject: [PHP] ok what kind of crack is my computer smoking?

I needed to recompile php to support some extra features so i went to my
/usr/local/src direcotry and i rm -rf'ed apache mod_perl and php src
dirs.

I then re-extracted the tarballs for thoes programs...

Re built everything the way i normally did (including rm -rf
/usr/local/apache) which is my apache install dir before i rebuilt.

I finish getting it all compiled and installed and start up apache,

go to my phpinfo() script that just echos that func.

and i get:

build date: Jun 21 2002 16:47:12
when it should be
build dat: June 27 2002 13:00:00

and the ./configure options are still the origional options...

SO what do i have to do to get php to acknolege the fact that it has
been
recompiled with new options


Rick


-- 
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] ok what kind of crack is my computer smoking?

2002-06-27 Thread Demitrious S. Kelly

Whoa! Good idea!

-Original Message-
From: Kurth Bemis (List Monkey) [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, June 27, 2002 2:35 PM
To: Demitrious S. Kelly
Cc: 'Rick Kukiela'; [EMAIL PROTECTED]
Subject: RE: [PHP] ok what kind of crack is my computer smoking?

At 02:19 PM 6/27/2002 -0700, Demitrious S. Kelly wrote:

hey - RESTART APACHE!

~kurth

You check and make sure the date was set right on the box?

You could try make clean for everything before configuring...


-Original Message-
From: Rick Kukiela [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 2:10 PM
To: [EMAIL PROTECTED]
Subject: [PHP] ok what kind of crack is my computer smoking?

I needed to recompile php to support some extra features so i went to
my
/usr/local/src direcotry and i rm -rf'ed apache mod_perl and php src
dirs.

I then re-extracted the tarballs for thoes programs...

Re built everything the way i normally did (including rm -rf
/usr/local/apache) which is my apache install dir before i rebuilt.

I finish getting it all compiled and installed and start up apache,

go to my phpinfo() script that just echos that func.

and i get:

build date: Jun 21 2002 16:47:12
when it should be
build dat: June 27 2002 13:00:00

and the ./configure options are still the origional options...

SO what do i have to do to get php to acknolege the fact that it has
been
recompiled with new options


Rick


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


Kurth Bemis - Network/Systems Administrator, USAExpress.net/Ozone
Computer

Jedi business, Go back to your drinks - Anakin Skywalker, AOTC

[EMAIL PROTECTED] | http://kurth.hardcrypto.com
PGP key available - http://kurth.hardcrypto.com/pgp



-- 
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: PHP and OOP

2002-06-27 Thread Demitrious S. Kelly

Php version 4.06 (yet another server)

Obj: Took 72.846336007118 seconds
Proc: Took 72.550191044807 seconds

Yea... I'm coming to the conclusion that unless you're coding for a
REALLY high traffic website this difference does not matter... 

But the again under the circumstances it might matter greatly... its all
situational.

-Original Message-
From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, June 27, 2002 1:04 PM
To: 'SP'; 'Remy Dufour'; 'Kondwani Spike Mkandawire';
[EMAIL PROTECTED]
Subject: RE: [PHP] Re: PHP and OOP

Comparison (do not compare the speeds between the versions of php as
they are on different servers under different loads.) The only
conclusion that I can draw from this so far is that different versions
of php handle these situations differently, newer versions may handle
OOP code better that proc code - this is just conjecture of course.  It
also may not be realistic to judge so harshly and quickly on benchmarks
like this. This kind of code isn't very real world when you get right
down to it. Other factors may also be in play - the kind of functions
used inside the proc/obj, types of variables - how about nested objects
- different kinds of loops - etc etc etc. It's a hard comparison to make
- as I do not have time to compile many versions of php on a given
machine and run the tests at the moment. Maybe someone with a bit of
time to spare would help shed some light on the subject?

If I get a chance I will look into the problem further. And I will have
the results amended to my article on phpbeginner.com (or the results of
the person (people?) who sheds light on the subject for us) so stay
tuned to the website  and I'll try to get something more definitive
soon.

Cheers everyone!

OOP: 
PHP Version: 4.1.2 Took 70.311300992966 seconds
PHP Version: 4.2.1 Took 76.400364041328 seconds
?php

set_time_limit(0);

class count {
function icount($vs) {
$var=0;
while($count  $vs) {
$date=time();
$count++;
}
}
}

function getmicrotime(){
list($usec, $sec) = explode( ,microtime());
return ((float)$usec + (float)$sec);
}

$time_start = getmicrotime();
$icount=new count;
$icount-icount(1000); 
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo Took $time seconds;
?

PROC:
PHP Version: 4.1.2 Took 69.567726969719 seconds 
PHP Version: 4.2.1 Took 86.658290982246 seconds
?php

set_time_limit(0);

function getmicrotime(){
list($usec, $sec) = explode( ,microtime());
return ((float)$usec + (float)$sec);
}

function icount($vs) {
$count=0;
while($count  $vs) {
$count++;
$date=time();
}
}

$time_start = getmicrotime();
icount(1000);
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo Took $time seconds;
?

-Original Message-
From: SP [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, June 27, 2002 12:01 PM
To: Remy Dufour; Kondwani Spike Mkandawire; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: PHP and OOP

Never tested it so I tried it out for the fun of it.  I didn't use yours
but
I used the other guy's code on separate pages and did it ten times.  I
guess
I was wrong, I got around 2% difference.  Definitely not the 20%
difference
that guy got in his.  He was probably using a older version.  Mine was
on
4.1.1 so everyone should be switching to OO from the looks of it.

OO Procedural
3.22   2.87
3.09   3.05
2.91   3.00
2.88   2.99
3.08   3.09
3.25   3.04
2.97   2.94
2.94   3.01
3.05   2.90
3.07   2.96

3.05   2.99 avg

-Original Message-
From: Remy Dufour [mailto:[EMAIL PROTECTED]]
Sent: June 27, 2002 1:34 PM
To: SP; Kondwani Spike Mkandawire; [EMAIL PROTECTED]
Subject: Re: [PHP] Re: PHP and OOP


I've tested thecode and there is what i've got
Proceduraltook 1.24408602715 seconds
OOtook 1.24240803719 seconds
Here is the code. Test it by yourself
?phpfunction getmicrotime(){list($usec, $sec) = explode(
,microtime());return ((float)$usec + (float)$sec);}
function
icount($vs) {$var=0;while($count  $vs) {
$count++;}}$time_start = getmicrotime();
icount(100);
echo Proceduralbr took . (getmicrotime() - $time_start) .
secondsbr;
class count {function icount($vs) {$var=0;
while($count  $vs) {$count++;}}
}
$time_start = getmicrotime();$icount = new count;
$icount-icount

RE: [PHP] Re: PHP and OOP

2002-06-27 Thread Demitrious S. Kelly

I agree... its trivial when presented as is. But what would be the
difference when you're doing quite a lot more with only 10 iterations?
100? That's something to think about...

-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, June 27, 2002 5:21 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Re: PHP and OOP

I haven't got around to reading all the other replies yet, so this reply
might already be covered...

So I went to that url - and okay, according to the person writing that
page,
there's a ~3sec increase in the time it takes to execute - BUT - that's
to
do 1 million iterations, doesn't seem too much of a difference to me.

So that's just .03sec increase per iteration - I'm not too fussed
about
that. Compared to easier coding/reading/extensiblity/etc, it's a good
trade
off.

Just my 2c worth
Martin

-Original Message-
From: SP [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 11:50 PM
To: Kondwani Spike Mkandawire; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: PHP and OOP


OO is slower then procedural.  You can test that out yourself or look at
this article where the guy did a very basic test.  Maybe they will fix
the
speed problem by the time php5 comes around.
http://www.phpbeginner.com/columns/demitrious/objects/8

[snip]

-- 
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] POST Format

2002-05-29 Thread Demitrious S. Kelly

No you can do

Index.php?name=apokalyptik[EMAIL PROTECTED]subscribe=n
o



?php
echo 'pre';
echo 'NAME: '.$name.chr(10);
echo 'EMAIL:'.$email.chr(10);
echo 'SUBSCRIBE:'.$subscribe;
echo '/pre';
?

-Original Message-
From: Jonathan Rosenberg [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, May 29, 2002 7:58 PM
To: PHP General
Subject: [PHP] POST Format

This is not entirely a PHP question  I should know the answer,
but ...

I'm trying to figure out how to correct the proper format for
simulating the data sent in a POST.  I believe the basic syntax
is

name1=value1name2=value2 ...

Is this correct?

If so, how are the value's encoded?  Is each value surrounded by
?  Do I need to urlencode() each value (without the surrounding
)?

Any help appreciated.

--
JR


-- 
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] Mail Archives

2002-05-29 Thread Demitrious S. Kelly

Archives of the mailing list are available here: http://news.php.net/
Tutorials (good as books) check www.zend.com, www.hotscripts.com and
www.phpbuilder.net (com?org?)

-Original Message-
From: Natarajan [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, May 29, 2002 6:40 PM
To: PHP
Subject: [PHP] Mail Archives

HI,
1. Where are the mail archives of this mailing list? 
2. Any free online downloadable books ( html / pdf formats) on
PHP?
Thanks
-- 
Natarajan



-- 
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] fsockopen, and remaining data in buffer

2002-05-09 Thread Demitrious S. Kelly

Hello Guys!

 

I'm having troubles with not knowing the amount of data which is waiting
to be received in the buffer for a specific socket I can use fsockopen,
establish a connection, and write to the socket, I can read from the
socket just fine as well. The trouble I'm running into is illustrated in
this example

 

Eg: Open a socket to an ftp site (port 21). I can expect a banner from 

EG: the ftp server, but this is not always the case. if there is a 

EG: banner it is usually only one line, but this is not always the case.

EG: I can then fputs($fp, 'user anonymous'.chr(10)); After that fputs I 

EG: can expect one line to be in the buffer. I then fputs($fp, 'pass 

EG: [EMAIL PROTECTED]'.chr(10)); There can then be anything from 0 to 

EG: (lots) of bytes in the buffer, spanning multiple lines.

 

I want to be able to pull all of the waiting information out of the
socket, process it, and then proceed - not knowing the amount of data to
expect.  A while( $data=fgets($fp, ) ) works, but either a) hangs
when there is no more data to receive, or b) times the socket out when a
socket timeout on the file pointer is used, or c) is VERY unreliable
when the socket is set to non-blocking mode.  I've tried using
$var=socket_get_status($fp), but then $var['unread_bytes'] is always 0
or null... Am I missing something?

 

The development server is running slackware 8, kernel 2.4.18,
apache-1.3.24, and php 4.2

 

I'll send sample code if asked, Thanks in advance for the help!

 

 

 

 

-

  -- Demitrious S. Kelly

  -- Eagle Networks

 

-

 

 

 

 

-

  -- Demitrious S. Kelly

  -- Eagle Networks

 

-

 




RE: [PHP] Within the date format

2002-04-19 Thread Demitrious S. Kelly

Wouldn't it be easier to convert each date into a unix timestamp, then
subtract... the resulting number is the difference in seconds.  Then
devide by 60 for minutes, again for hours 24 for days, etc, etc


-Original Message-
From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
Sent: Friday, April 19, 2002 8:44 AM
To: Ron Allen
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Within the date format

On Fri, 19 Apr 2002, Ron Allen wrote:
 This is what I have right now
 
 $totaltime= date(:H:i:s, mktime(0,0,$totaltime));
 
 This is the result
 
 04:20:46
 
 from the following dates
 2002-04-25 16:30:16
 2002-04-19 12:09:30
 534046 seconds
 
 I would like to be able to get the days and, if needed, the number of
months
 and years

Well, I think the easiest way is going to be to split your date apart
into 
$day, $month, $year and then subtract.

You can't just do a cascading modulus calculation on the delta between
the
timestamps, because that won't take leap years into account.

miguel


-- 
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] Within the date format

2002-04-19 Thread Demitrious S. Kelly

function is_leap($) {
$leap=0;
$refy=2000;
while ( $ = $refy ) {
if ( $refy == $ ) {
$leap=1;
} else if ( $refy  $ ) {
break;
}
$refy++;
$refy++;
$refy++;
$refy++;
}
return($leap);
}

-Original Message-
From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
Sent: Friday, April 19, 2002 8:52 AM
To: Demitrious S. Kelly
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Within the date format

Like I said, if it crosses through a leap year, your calculation may be 
off. How many days are there in February when you don't know what year
it 
is?

miguel

On Fri, 19 Apr 2002, Demitrious S. Kelly wrote:
 Wouldn't it be easier to convert each date into a unix timestamp, then
 subtract... the resulting number is the difference in seconds.  Then
 devide by 60 for minutes, again for hours 24 for days, etc, etc
 
 
 -Original Message-
 From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, April 19, 2002 8:44 AM
 To: Ron Allen
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Within the date format
 
 On Fri, 19 Apr 2002, Ron Allen wrote:
  This is what I have right now
  
  $totaltime= date(:H:i:s, mktime(0,0,$totaltime));
  
  This is the result
  
  04:20:46
  
  from the following dates
  2002-04-25 16:30:16
  2002-04-19 12:09:30
  534046 seconds
  
  I would like to be able to get the days and, if needed, the number
of
 months
  and years
 
 Well, I think the easiest way is going to be to split your date apart
 into 
 $day, $month, $year and then subtract.
 
 You can't just do a cascading modulus calculation on the delta between
 the
 timestamps, because that won't take leap years into account.
 
 miguel
 
 
 


-- 
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] Within the date format

2002-04-19 Thread Demitrious S. Kelly

Whatever works

And the function works fine for any year after 2000

Besides... it was just a quick and dirty example

-Original Message-
From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
Sent: Friday, April 19, 2002 9:14 AM
To: Demitrious S. Kelly
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Within the date format

1) That function isn't correct.

2) It's slow.

3) You still would have to call it once for each year in the range in 
order to figure out how many intervening leap years there are, and you'd

have to check whether the dates in question fell before or after Feb 29.

Much easier to just calculate the difference of days, months, and years.

BTW, off the top of my head (untested), here's a more accurate (and a
million times faster) way to check for a leap year:

  function is_leap ($year)
  {
return (!($year % 4)  (($year % 100) || !($year % 400)));
  }

miguel

On Fri, 19 Apr 2002, Demitrious S. Kelly wrote:
 function is_leap($) {
 $leap=0;
 $refy=2000;
 while ( $ = $refy ) {
 if ( $refy == $ ) {
 $leap=1;
 } else if ( $refy  $ ) {
 break;
 }
 $refy++;
 $refy++;
 $refy++;
 $refy++;
 }
 return($leap);
 }
 
 -Original Message-
 From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, April 19, 2002 8:52 AM
 To: Demitrious S. Kelly
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP] Within the date format
 
 Like I said, if it crosses through a leap year, your calculation may
be 
 off. How many days are there in February when you don't know what year
 it 
 is?
 
 miguel
 
 On Fri, 19 Apr 2002, Demitrious S. Kelly wrote:
  Wouldn't it be easier to convert each date into a unix timestamp,
then
  subtract... the resulting number is the difference in seconds.  Then
  devide by 60 for minutes, again for hours 24 for days, etc, etc
  
  
  -Original Message-
  From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
  Sent: Friday, April 19, 2002 8:44 AM
  To: Ron Allen
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP] Within the date format
  
  On Fri, 19 Apr 2002, Ron Allen wrote:
   This is what I have right now
   
   $totaltime= date(:H:i:s, mktime(0,0,$totaltime));
   
   This is the result
   
   04:20:46
   
   from the following dates
   2002-04-25 16:30:16
   2002-04-19 12:09:30
   534046 seconds
   
   I would like to be able to get the days and, if needed, the number
 of
  months
   and years
  
  Well, I think the easiest way is going to be to split your date
apart
  into 
  $day, $month, $year and then subtract.
  
  You can't just do a cascading modulus calculation on the delta
between
  the
  timestamps, because that won't take leap years into account.
  
  miguel
  
  
  
 
 
 




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




RE: [PHP] Forms in PHP

2002-04-18 Thread Demitrious S. Kelly

Use an array
input type=hidden name=itemid[] value=11/input
input type=hidden name=itemid[] value=22/input
input type=hidden name=itemid[] value=33/input

$numberofitemids=count($itemid);
echo $itemid[0]; // == 1
echo $itemid[1]; // == 2
echo $itemid[2]; // == 3


cheers
-Original Message-
From: Alia Mikati [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, April 17, 2002 2:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Forms in PHP

Hello
I hope u can help me with this problem. I dont know if it is possible to

do it. I'm using PHP and XML to generate the folowing HTML:
...
form method=post action=cart.php
input type=hidden name=itemid value=11/input
...
input type=hidden name=itemid value=22/input
...
input type=hidden name=itemid value=33/input
...
...

I want to use PHP to count the number of $itemid in this file. Is it 
possible? And how?
Thx a lot



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

2002-04-18 Thread Demitrious S. Kelly

Use the dir class

-Original Message-
From: Jeroen Timmers [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 16, 2002 4:57 AM
To: [General]
Subject: [PHP] Directory

Hello,

can i read a directory for files and other directory's with a php
function

for exameple

d:\localhost\

had the follow dirs and files

test.php
test2.php
\test\
\test2\

now i want that in my browser with a php function

Jeroen


-- 
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: Any ideas on combining arrays????

2002-04-03 Thread Demitrious S. Kelly

Use a multi-dimensional array... try this as a kind of 'proof of
concept'

?php

$array[tu4r][]=0
$array[tu4r][]=10
$array[tu4r][]=100
$array[tu4r][]=1000
$array[ph10][]=0;
$array[ph10][]=1;
$array[ph10][]=2;
$array[ph10][]=126;

echo 'pre';
foreach ( $array[ph10] as $value ) {
echo '  PH10: '.$value.chr(10);
}
echo '/pre';
echo 'pre';
foreach ( $array[tu4r] as $value ) {
echo '  TU4R: '.$value.chr(10);
}
echo '/pre';

?

cheers
-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, April 03, 2002 10:15 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Any ideas on combining arrays

Well, I don't thinik this will work.  Because I will recieve an
unknown
number of data.  The number of PH10 I would get would be either 1 or 2
or
126, etc.  There is no way to determine the number, so I already create
an
counter to tell me how many of them.  So, that leave me with an need to
create an array to unlimited number of PH10 without overwritting the
current
PH10.  Here's my demo.

TU4R = TU4R is 0
PH10 = PH10 is 0
PH10 = PH10 is 1
PH10 = PH10 is 2

Can anyone write a multidimentional array demostration to handle
this
demo?

Thanks a Million!
 Scott

Maxim Maletsky [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 See, Scott.. It is all about your logic.

 For instance, you can create a nice multidimentional array like this:

 Array(
 '0'=Array(
 'data'=Array( // your whole data array
   data
   data
   data
 ),
 'parameters'=Array( // the settings rlative to data array
 'count'='256',
 'type_of_data'='strings',
 'came_from_DB'='PostgreSQL',
 'came_from_table'='thisTable'
 'etc'='bla...bla..bla..'
 )
 ),
 '1'=Array(
 'data'=Array( // your whole data array
   data
   data
   data
 ),
 'parameters'=Array( // the settings rlative to data array
 'count'='258',
 'type_of_data'='integers',
 'came_from_DB'='mySQL',
 'came_from_table'='thatTable'
 'etc'='bla...bla..bla..'
 )
 ),

 ... etcetc...etc...

 );



 in this way you can loop the whole thing, access the data by refering
to
the
 'data' subarray and then get the parameters (counts, types whatever
you
 want) by accessing 'parameters' subarray containing the relative
settings
 for that very array.

 As I said in the very first line - all up to your logic and the
organization
 rules within the code.

 Hope it is of any help to you.


 Maxim Maletsky

 Founder, Chief Developer
 PHPBeginner.com (Where PHP Begins)

 www.PHPBeginner.com
 [EMAIL PROTECTED]







 Scott Fletcher writes:

  Hi!
 
  Need some ideas on combining some arrays into one!  I have array
for
  data and other array for counter.  How do I make an array that would
show
  different data for each counter number?
 
  -- clip --
 $FFR = array (
TU4R  = array( data = , count =  ),
PH01  = array( data = , count =  ),
 );
  -- clip --
 
  The response should look something like this when I pick the
correct
  data and correct count;
 
 $FFR[TU4R][data][0][count]  = TU4R is 0;
 $FFR[TU4R][data][1][count] = TU4R is 1;
 $FFR[TU4R][data][2][count]  = TU4R is 2;
 
  I tried to do something like this but it doesn't work.  I have
been
  working for 2 days trying to figure it out.  I appreciate any help
you
can
  provide for me.
 
  Thanks,
Scott
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 



 Maxim Maletsky

 Founder, Chief Developer
 PHPBeginner.com (Where PHP Begins)

 www.PHPBeginner.com
 [EMAIL PROTECTED]




-- 
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] tired by linux - recompiling.._PHP SERVER

2002-04-01 Thread Demitrious S. Kelly

I don't know any offhand... but taking the easy road never produced
anything more secure then a bad IIS server...

Try my walkthrough... (ok... not walkthrough, but example)

http://www.apokalyptik.com/lsftgu/Apache-Frontpage-Mod_ASP-Mod_SSL-Mod_P
erl-Php/index.htm

-Original Message-
From: Septic Flesh [mailto:[EMAIL PROTECTED]] 
Sent: Monday, April 01, 2002 8:55 AM
To: [EMAIL PROTECTED]
Subject: [PHP] tired by linux - recompiling.._PHP SERVER

anyone found any webserver for linux to support HTML - PHP - SSL without
much/any compiling . .
just the binary to uncompress and run .???

I am really tired by linux..


--


Sapilas@/dev/pinkeye





-- 
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] fetching a parameter from url like on php.net A mirarcle?

2002-03-31 Thread Demitrious S. Kelly

I believe this is done with mod_rewrite

-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, March 31, 2002 12:54 AM
To: [EMAIL PROTECTED]
Subject: [PHP] fetching a parameter from url like on php.net A mirarcle?

Hi there,

I am wondering how to get a parameter from url like on php.net Example:
php.net/functionname

I guess this is a server config isn't it? The server would otherwise
asume
this is a file and return a 404 error.
How could I tell the server to run index.php if the file name is not on
the
server. And then .. how to get a 404 if
this is not a function, but really a not existant page?

Maybe someone of the php.net team could uncouver the miracle :-)

Thanx Andy



-- 
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] Pulling data into an array and sorting

2002-03-30 Thread Demitrious S. Kelly

Run a while loop on your data and pull it into an array

Heres an example (though this pulls from a text file the idea is the
same...) Hope this helps...

?php
 // READING THE DATA
function read_data($datafile) {
$data=file($datafile);
foreach ( $data as $line ) {
$temp=explode(':', $line);
$cp=$temp[4];
$return[$cp][]=$line;
}
if ( is_array($return) ) {
return($return);
} else {
return(NULL);
}
}
?

?php
 // USING THE DATA  
$hosts=read_data('./hosts.dat');
if ( $hosts != 'NULL' ) {
$count=0;
foreach ( $hosts as $host ) {
$temp=explode(':', $host[0]);
$hostss.=str_replace(%%COMPANY%%,
decode($company=$temp[4]),$template_company_begin);
foreach ( $host as $hst ) {
$temp=explode(':', $hst);
$h_names[]=$temp[0];
$hostss.=str_replace(%%DISPLAY%%,
display_host($hst, $count),
$template_company_mid);
$count++;
}
$hostss.=$template_company_end;
}
} else { 
$hosts=No Hosts In Database...br;
}
?


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, March 30, 2002 4:22 PM
To: php
Subject: [PHP] Pulling data into an array and sorting


I need to pull data into and array from a mysql database and then sort
that data according to one of the fields and then print it to the
screen.

Hear is an example of the data in the database

username Pnumber sec2 sec3 sec4 sec5 sec6
 Gary  123.345.122YES  YES   NO  YES  YES
 Fred  123.345.123YES  YES   NO  YES  YES
 Jone  123.345.124YES  YES   YES  NO  YES
 Tom   123.345.124YES  YES   NO  YES  YES
 Frank 123.345.123YES  YES   NO  YES  YES

 If you will notice the Pnumber for some are the same and some are
 different. I what to be able to sort on this number and then when they
 are printed they would be printed according to this number in groups

  

-- 
Best regards,
 rdkurth  mailto:[EMAIL PROTECTED]


-- 
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] Disabling the Back Button?

2002-03-30 Thread Demitrious S. Kelly

You could use sessions for the script... store a variable in the session
when the page has been completed and make sure the script does not
execute if the current session has the appropriate variable...

-Original Message-
From: David Johansen [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, March 30, 2002 4:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Disabling the Back Button?

OK, I basically just want to make it so that the user can't go back once
they're done with an application form that I'm working on. I don't case
if
they go back in the middle and my page handles that just fine, but I
want
them to not be able to go back when they're all done. Is there some way
that
I can do this? Thanks,
Dave



-- 
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] For Loop going too long

2002-03-30 Thread Demitrious S. Kelly

Try a foreach... it works well...

-Original Message-
From: Lars Torben Wilson [mailto:[EMAIL PROTECTED]] On Behalf Of Lars
Torben Wilson
Sent: Saturday, March 30, 2002 4:38 PM
To: David Johansen
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] For Loop going too long

On Sat, 2002-03-30 at 15:40, David Johansen wrote:
 I have a question about something weird that I've noticed Here's some
code
 that I have that loads up
 
$sql = SELECT * FROM pickup_times WHERE DAYOFMONTH(time0_name) =
 $dayofmonth;
 
$result = mysql_query($sql, $dbh);
$day = mysql_fetch_array($result);
for ($i=0; $isizeof($day); $i++)
   echo I: $i Result: $day[$i]br;
 
 When I do this it prints out 2 times the number of columns that I
actually
 have plus 1. All of the ones past the actual number of columns are
just
 empty, but is there something that I'm doing wrong? Thanks,
 Dave

Yup. ;) Give http://www.php.net/mysql_fetch_array a thorough beating.
The function returns the results both in associatively-indexed elements
and in indexed ones, so you get each one twice. Try the following and it
should become clearer:


$result = mysql_query($sql, $dbh);
// Try both of the following lines and notice the difference.
//$day = mysql_fetch_array($result);
$day = mysql_fetch_array($result, MYSQL_ASSOC);
foreach ($day as $colname = $value) {
echo Column name: $colname; Value: $value\n;
}


Cheers!

-- 
 Torben Wilson [EMAIL PROTECTED]
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
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: Re[2]: [PHP] Pulling data into an array and sorting

2002-03-30 Thread Demitrious S. Kelly

Take a look at this:

?php

$result = mysql_query();
while ( $data = mysql_fetch_array($result) ) {
$pnumber=$data[Pnumber];
$ourdata[$pnumber][]=$data;
}

echo pre;
foreach ( $ourdata as $data ) {
foreach ( $data as $array ) {
echo Username: .$array[0].br;
echo Pnumber:  .$array[1].br;
echo sec2: .$array[2].br;
echo sec3: .$array[3].br;
echo sec4: .$array[4].br;
echo sec5: .$array[5].br;
echo sec5: .$array[6].br;
echo hr;
}
}
echo /pre;
?



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, March 30, 2002 4:49 PM
To: php-general
Subject: Re[2]: [PHP] Pulling data into an array and sorting


Thank you for the response to my question unfortunately your answer just
confused me even more.

Saturday, March 30, 2002, 4:25:40 PM, you wrote:

DSK Run a while loop on your data and pull it into an array

DSK Heres an example (though this pulls from a text file the idea is
the
DSK same...) Hope this helps...

DSK ?php
DSK  // READING THE DATA
DSK function read_data($datafile) {
DSK $data=file($datafile);
DSK foreach ( $data as $line ) {
DSK $temp=explode(':', $line);
DSK $cp=$temp[4];
DSK $return[$cp][]=$line;
DSK }
DSK if ( is_array($return) ) {
DSK return($return);
DSK } else {
DSK return(NULL);
DSK }
DSK }
?

DSK ?php
DSK  // USING THE DATA  
DSK $hosts=read_data('./hosts.dat');
DSK if ( $hosts != 'NULL' ) {
DSK $count=0;
DSK foreach ( $hosts as $host ) {
DSK $temp=explode(':', $host[0]);
DSK $hostss.=str_replace(%%COMPANY%%,
DSK decode($company=$temp[4]),$template_company_begin);
DSK foreach ( $host as $hst ) {
DSK $temp=explode(':', $hst);
DSK $h_names[]=$temp[0];
DSK $hostss.=str_replace(%%DISPLAY%%,
DSK display_host($hst, $count),
DSK $template_company_mid);
DSK $count++;
DSK }
DSK $hostss.=$template_company_end;
DSK }
DSK } else { 
DSK $hosts=No Hosts In Database...br;
DSK }
?


DSK -Original Message-
DSK From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
DSK Sent: Saturday, March 30, 2002 4:22 PM
DSK To: php
DSK Subject: [PHP] Pulling data into an array and sorting


DSK I need to pull data into and array from a mysql database and then
sort
DSK that data according to one of the fields and then print it to the
DSK screen.

DSK Hear is an example of the data in the database

DSK username Pnumber sec2 sec3 sec4 sec5 sec6
DSK  Gary  123.345.122YES  YES   NO  YES  YES
DSK  Fred  123.345.123YES  YES   NO  YES  YES
DSK  Jone  123.345.124YES  YES   YES  NO  YES
DSK  Tom   123.345.124YES  YES   NO  YES  YES
DSK  Frank 123.345.123YES  YES   NO  YES  YES

DSK  If you will notice the Pnumber for some are the same and some are
DSK  different. I what to be able to sort on this number and then when
they
DSK  are printed they would be printed according to this number in
groups

  




-- 
Best regards,
 rdkurthmailto:[EMAIL PROTECTED]


-- 
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] Program Looping ?

2002-03-28 Thread Demitrious S. Kelly

Well you'd have to work with inputs, etc... for the key... but the look
isn't hard

$loop=1;
$sleep=300;
while ( $loop == 1 ) {
code();
sleep($sleep);
if ( %%keypresscode%% ) {
$loop = 0;
}
}

I'd probably just touch a file somewhere when I want it to stop.. and
make it if (is_file($file)) { $loop=0; }

That's my opinion

-Original Message-
From: Jason Caldwell [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, March 28, 2002 10:56 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Program Looping ?

I've written a script that checks my email.  However, when I run the
script
(from the command line) -- I want it to loop with a 5 minute delay and
the
ability to stop the program anytime by pressing a key on the keyboard
(say)
the ~ key.

Anyone know how to do this?

?

function check_mail()
{
// my email code is here
}

check_mail();

?

thanks.
jason



-- 
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] Require variable declaration?

2002-03-27 Thread Demitrious S. Kelly

You don't need to do this with PHP... a variable is created when you
assign a value to it. It is also unnecessary to assign a type. PHP will
typecast automatically as necessary

-Original Message-
From: Kjell Hansen [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 27, 2002 12:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Require variable declaration?

Hi,
I've just started making my database/PHP-scripts and I'm used to, from
my earlier development, have my variables declared at the top of each
routine.
But I can't find the command that would force me to declare my variables
and I can't find the declare statement either.

Is there a way to do this?

Regards
/Kjell


-- 
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] Regex Form Filter Help

2002-03-27 Thread Demitrious S. Kelly

Why not just limit it to one br?


?php
$string=blahbrbrbrbrbrbrbrbrbrstuff;
while ( stristr($string, 'brbr') ) {
$string=str_replace('brbr', 'br', $string);
}
echo $string;
?

something like that would wok well enough...

-Original Message-
From: James Taylor [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 27, 2002 12:26 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Regex Form Filter Help

I have a site where users can type whatever they want in and it posts it
to a 
database.  I'm trying to eliminate whatever types of abuse I can think
of, 
and, since I'm using nl2br on the posts, I'm afraid a user might just
hold 
down enter for a couple of seconds and scroll everything off the page.
I'm 
trying to figure out a regex pattern that searches for say, more than 5
br 
/ strings in a row, and anything after 5 gets stripped out.  Any ideas
on 
how to possibly do this?

-- 
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] ID NUMBER HELP

2002-03-26 Thread Demitrious S. Kelly

Try echo 'a
href='.$PHP_SELF.'?id='.$row[ID].''.row[name].'/a';

if $row[id] still isn't shown, then you most likely aren't getting the
right data from the database to the correct variable...

-Original Message-
From: Omland Christopher m [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, March 26, 2002 7:53 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [PHP] ID NUMBER HELP

Can someone help me with this. I'm trying to get ?id= set to the id
number
of the name in the database. I can get ?id=THE NAME but I can't get it
to pick up the id number. here is the code im trying:
while($row = mysql_fetch_array($result))
{

 printf(a href=\%s?id=%s\%s/abr\n, $PHP_SELF,
$row[ID], $row[Name], $row[Name]);
}

If I change the first $row[ID] to $row[Name] then ?id=Name here
but
then when I try to extract the information from the database using:

$result = mysql_query(SELECT * FROM Profiles WHERE id=$id, $dbcnx);
$row = mysql_fetch_array($result);

It won't work, but in the address bar if I manually change ?id=1 then
the
information will load fine. Can anyone help?
Thanks.
-Chris


-- 
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] Does this seem odd? File Upload Permissions

2002-03-26 Thread Demitrious S. Kelly

The default file permission for new files on the *nix system may be set
to something like 755... that could be the problem...

-Original Message-
From: David McInnis [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, March 26, 2002 11:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Does this seem odd? File Upload Permissions

Why does PHP set the execute bit on an uploaded file?  This means a user
could upload a script and it would be executable.  Ouch!  Especially if
the file is available via httpd after upload. . . HELP.

I am saving to a directory with permissions of 766

And when php copies the file it assigns the following permissions.  

rwxr-xr-x  

I am using the copy command to move the file from the tmp directory.

David McInnis




-- 
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] Does this seem odd? File Upload Permissions

2002-03-26 Thread Demitrious S. Kelly

That's not entirely true... if php is running as cgi it would need the
execution bit set. Or if someone wanted to write a shell script in php
to be used to help compromise a server it would need to be executable as
well...

-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, March 26, 2002 11:08 PM
To: David McInnis
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Does this seem odd? File Upload Permissions

First, the execute bit means nothing over HTTP.  So they couldn't just
execute it remotely.  They would need an account on the box.

And second, PHP does not set the x bit, you are doing that.  Check your
default umask or set it explicitly with a call to umask() before copying
the file into place.


On Tue, 26 Mar 2002, David McInnis wrote:

 Why does PHP set the execute bit on an uploaded file?  This means a
user
 could upload a script and it would be executable.  Ouch!  Especially
if
 the file is available via httpd after upload. . . HELP.

 I am saving to a directory with permissions of 766

 And when php copies the file it assigns the following permissions.

   rwxr-xr-x

 I am using the copy command to move the file from the tmp directory.

 David McInnis




 --
 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] Does this seem odd? File Upload Permissions

2002-03-26 Thread Demitrious S. Kelly

Either severely mis-configure, or make a mistake (damn us humans and our
mistakes :)

-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, March 26, 2002 11:15 PM
To: Demitrious S. Kelly
Cc: 'David McInnis'; [EMAIL PROTECTED]
Subject: RE: [PHP] Does this seem odd? File Upload Permissions

But it would mean that you would have to severly misconfigure your
server
and write severely braindead code.  Simply putting a file in your
document_root that has the x bit set will under normal circumstances not
do anything.

On Tue, 26 Mar 2002, Demitrious S. Kelly wrote:

 That's not entirely true... if php is running as cgi it would need the
 execution bit set. Or if someone wanted to write a shell script in php
 to be used to help compromise a server it would need to be executable
as
 well...

 -Original Message-
 From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, March 26, 2002 11:08 PM
 To: David McInnis
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Does this seem odd? File Upload Permissions

 First, the execute bit means nothing over HTTP.  So they couldn't just
 execute it remotely.  They would need an account on the box.

 And second, PHP does not set the x bit, you are doing that.  Check
your
 default umask or set it explicitly with a call to umask() before
copying
 the file into place.


 On Tue, 26 Mar 2002, David McInnis wrote:

  Why does PHP set the execute bit on an uploaded file?  This means a
 user
  could upload a script and it would be executable.  Ouch!  Especially
 if
  the file is available via httpd after upload. . . HELP.
 
  I am saving to a directory with permissions of 766
 
  And when php copies the file it assigns the following permissions.
 
  rwxr-xr-x
 
  I am using the copy command to move the file from the tmp directory.
 
  David McInnis
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


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






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





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




RE: [PHP] mail() function returns TRUE but no email is sent

2002-03-25 Thread Demitrious S. Kelly

I would check the mail logs on the smtp server ?(if you have access)
or... try this and see if ANY mail is bveing sent to you (assumes a unix
server with sendmail (or compatible) binary installed)

 $fp=fopen('./tmp', 'w');
 fputs($fp, 'Subject: '.$reportsubject.chr(10));
 fputs($fp, $reportmail);
 fclose($fp);
 foreach($reportaddr as $addr) {
`cat ./tmp | $sendmail $addr`;
 }
 unlink('./tmp');

(taken from a script I wrote for a server which didn't have mail() due
to an annoying problem 

http://www.apokalyptik.com/watchtower/watchtower-1.0.phps

)

-Original Message-
From: Kevin Stone [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 25, 2002 4:26 PM
To: php-general-list
Subject: [PHP] mail() function returns TRUE but no email is sent

Anyone run into this problem before?  I've got a simple email parser
that I've set up for our clients to access from their websites.  It just
uses the simple mail() function to send the parsed HTML to their
account.  The mail() function is returning TRUE  but the email no email
is being received.  How does the mail() function check if the email has
actually been sent?  Is it possible that the mail() function could be
given the proper signals to return TRUE but then the server not send the
email?
 
Thanks,
Kevin



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




RE: [PHP] Database connection problem

2002-03-25 Thread Demitrious S. Kelly

I have no idea what you meant to ask... but instead of an ip address I
would use the hostname 'localhost' which most servers are setup by
default to understand as 127.0.0.1 (loopback). And you can add an entry
to /etc/hosts or C:\windows\hosts or c:\winnt\(?system(?32?)\?)hosts

But that's just me...

-Original Message-
From: Omland Christopher m [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 25, 2002 5:55 PM
To: Cameron Just
Cc: [EMAIL PROTECTED]
Subject: [PHP] Database connection problem

Hi, can anyone help me with this problem.
I'm trying to connect to a MySQL database on my computer, I don't have a
hostname for it, so I just insert the IP, something like this.

...
mysql_cos?
Thanks.
-Chris


-- 
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] Creating table in mySQL db

2002-03-24 Thread Demitrious S. Kelly

http://www.apokalyptik.com/ftp/src/bin/ftp_indexer.phps

look at the Create table sql queries I used...

-Original Message-
From: Piotr Skorupski [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, March 24, 2002 11:59 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Creating table in mySQL db

Hello

Is there a way to create a teble in mySQL database by PHP?


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




RE: [PHP] A Language Script?

2002-03-22 Thread Demitrious S. Kelly

$HTTP_ACCEPT_LANGUAGE

-Original Message-
From: ::: rObEr2 ::: [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 22, 2002 1:59 PM
To: [EMAIL PROTECTED]
Subject: [PHP] A Language Script?

Hey!

I want to have my website on English, Spanish and Norwegian so I want to
have a PHP script that sends the user to the page on their language.

I've seen some portals doing some PHP things, and sending the user to a
'fancy' URL with the Languange that their Borwser/OS is on.

Can someone please tell me how it's done?

Thanks for your support...



-- 
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] GOOD PRACTICE (was: RE: [PHP] A Language Script?)

2002-03-22 Thread Demitrious S. Kelly

I've been watching the lists from time to time and I see a lot of
requests for information like this floating around. I wonder if people
know of the phpinfo() command... in my experience it's been an
invaluable tool to help with little issues that pop up with 'where do I
find out XXX about XXX' make a 3 line php script called info.php
containing:


?php
phpinfo();
?


And you then find yourself amongst a wealth of useful information.  I
apologize if this sounds patronizing - it most certainly is not
delivered in such a tone... I really do think that people just don't
know about this... Or they are too lazy to check it first... (hopefully
more of the former rather then the later)

Ok I'm done ranting..

Cheers everyone!

-Original Message-
From: ::: rObEr2 ::: [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 22, 2002 1:59 PM
To: [EMAIL PROTECTED]
Subject: [PHP] A Language Script?

Hey!

I want to have my website on English, Spanish and Norwegian so I want to
have a PHP script that sends the user to the page on their language.

I've seen some portals doing some PHP things, and sending the user to a
'fancy' URL with the Languange that their Borwser/OS is on.

Can someone please tell me how it's done?

Thanks for your support...



-- 
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] A Language Script?

2002-03-22 Thread Demitrious S. Kelly

http://vancouver-webpages.com/multilingual/ccodes.txt
http://vancouver-webpages.com/multilingual/iso639a.txt

This seems like useful information for this purpose... and so I've
decided to forward it to the list as well... if this is considered
spamming please let me know so that I can avoid it in the future.
Thanks

Cheers!

-Original Message-
From: ...:: Rober2 ::... [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 22, 2002 2:25 PM
To: Demitrious S. Kelly
Subject: Re: [PHP] A Language Script?

Thanks!!

BTW: do you know about any site that provides the e.g. en-us tag but
for
other languages? I've tried the W3 but no result...



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




RE: [PHP] What is the PHP version of Grep?

2002-03-22 Thread Demitrious S. Kelly

Stristr()

-Original Message-
From: David Duong [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 22, 2002 4:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP] What is the PHP version of Grep?

I was wondering what is the equvilent of the perl coommand: grep.

Can you list all the files in a certain directory and put it in an
array.
Can you list all the files with *.htm in a certain directory and put it
in
an array.



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

2002-03-22 Thread Demitrious S. Kelly

I'm willing to help host the project...

I'd be on a slack 8 box with a cable connection... only one IP address.
It's my home connection so we'd have to share bandwidth... but I think
it could be a valuable resource...

-Original Message-
From: J. Scott Johnson [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 22, 2002 2:40 PM
To: 'Kevin Stone'; [EMAIL PROTECTED]
Subject: RE: [PHP] FAQ

Hi,

New poster, no need to flame unnecessarily...

Following up on James' original posting, I took 2000 or so message
headers
from the archive and extracted (Perl, sorry) keywords for about 50% of
the
postings.  This gave the following metrics on problems:

13   table
65  apache
70  array
17  authentication
19  browser
13  cgi
39  cookie
35  database
9   dates
2   debug
9   editor
7   eval
6   fields
140 file
25  include
33  install
9   ip address
14  javascript
4   jpg
15  ldap
12  login
91  mail
146 mysql
11  oracle
20  pdf
2   PostgreSQL
15  Regex
7   rpm
8   security
93  session
11  socket
50  upload
29  variables
14  while
7   win32
37  xml
10  xsl

It seems like the hotspots are:

Database / Mysql
File handling
Apache
Arrays
XML

When James and I talked off list, he recommended:

You're probably also going to be dealing with global built in vars,
$_SESSION, $_POST, $_GET and older vars quite a bit as well.

I'm willing to grovel through old messages and write this up.  If anyone
has
any other common topics that I'm not finding, please email them to me.
When
its done, and useful, we can see about getting it auto posted (which is
a
_good_ idea).

Thanks
Scott

J. Scott Johnson

Virtual:
* * * * * * * * * * * * * * * * * * * * * * * * * *
[EMAIL PROTECTED]
http://www.fuzzygroup.com/
Yahoo IM: fuzzygroup


-Original Message-
From: Kevin Stone [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 5:24 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] FAQ


Too often novices are expected to know how to find this information by
mental telepathy because they either don't know the keywords to search
for or don't realize that certain common resources exist.  If the list
administrators would simply compile a short email containing FAQ and
RESOURCE links then have the system send it to php-general once a week,
then they could reduce a great deal of these repetitious questions.
IMHO, of course.
-Kevin


-Original Message-
From: James Taylor [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 1:25 PM
To: Rasmus Lerdorf
Cc: PHP List
Subject: Re: [PHP] FAQ

The PHP FAQ isn't really specific when it comes to most problems. The
'code'
section has like 10 questions, the rest of the FAQ is mainly how to
download/compile, what do these PHP errors mean, migration, etc.  A FAQ
that
had answers to questions that people ask on this list on a frequent
basis
would be more helpful.



On Friday 22 March 2002 12:05 pm, you wrote:
 I just don't see what the difference is.  This is a PHP mailing list
which
 supposedly gets questions about PHP.  Why would the PHP FAQ not be the
 right place for this?

 -Rasmus

 On Fri, 22 Mar 2002, James Taylor wrote:
  You are correct sir.  The purpose of the FAQ would be so that, like
I
  said, similar questions that pop up say, once a week, could be
answered
  in the FAQ instead of on the list - That way I won't get 300
messages a
  day :)
 
  On Friday 22 March 2002 11:36 am, you wrote:
   Despite what Rasmus just said, I think that you are saying a PHP
   Mailing List faq based on the q's that the mailing list gets, not
the
   general PHP faq.
  
   Scott
  
   -Original Message-
   From: James Taylor [mailto:[EMAIL PROTECTED]]
   Sent: Friday, March 22, 2002 2:30 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] FAQ
  
  
   Has anyone given any thought to possibly maintaining a FAQ
containing
   the answers to the most commonly asked PHP questions on this list?
I
   notice duplicates roll through every couple of days, and it would
   probably be a really nice PHP resource.
  
   Or, does one already exist? Ha.
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

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




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



-- 
PHP 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] drop down box

2002-03-20 Thread Demitrious S. Kelly

This is actually a small excerpt from a program I've written in the
past... hope it helps...

function show_downtime_form() {
global $conf_file;
global $filter;
$data=file($conf_file);
foreach ( $data as $line ) {
$bang=explode(':', $line);
$idents[]=$bang[0];
}
$idents=array_unique($idents);
echo 'div align=centerhr width=300';
echo 'form name=inputform action=reports.php
method=post';
echo 'Match Idents To:br';
echo 'input type=text name=filter value='.$filter.'';
echo 'br - OR Select - br';
echo 'select name=temp onchange=doEcho()';
echo 'option selected--From Current Idents--';
foreach($idents as $ident) {
echo 'option value='.$ident.''.$ident;
}
echo '/select';
echo 'br';
echo 'input type=submit value=search';
echo '/form';
echo '/div';
}

-Original Message-
From: ...::: M.E. Suliman :::... [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 20, 2002 9:57 AM
To: [EMAIL PROTECTED]
Subject: [PHP] drop down box

Hi

I need to get info from a specific field in a MySQL database to appear
in a
drop box as options. Has anyone any ideas on this.

Thanks

Mohamed





-- 
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] How do I make tab spaces in a mail?

2002-03-19 Thread Demitrious S. Kelly

With less preach and more answer 

Using chr(9) will give you a tab

?php
echo 'pre';
echo 'TAB'.chr(9).'TAB'.chr(9).'TAB';
echo '/pre';
?

cheers
-Original Message-
From: Analysis  Solutions [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, March 19, 2002 1:29 PM
To: PHP List
Subject: Re: [PHP] How do I make tab spaces in a mail?

On Tue, Mar 19, 2002 at 09:40:17PM +0100, Jan Grafström wrote:
 Hi!
 I have read several tricks of how to remove white spaces but how to
create
 them?

 productitemspriceamount
 book22550
 cd-rom 31545

I'd avoid using tabs due to them being rendered as different widhts on 
different machines/programs/etc.  sprintf() is the way to go.

Here's a quick and dirty example of an approach that prints out your 
data to the browser.  You'll need to tweak it to get the values from the

right variable names and to put the string into a variable rather than 
echoing it, but you get the idea...

pre
product   itemspriceamount
?php

$product = 'catnip';
$items = 5;
$price = .5;
$amount = $items * $price;

$padding = 15 - strlen($product);

echo $product . sprintf(%$padding.s%6.2f%7.2f, $items, $price, 
$amount);

?
/pre


-- 
PHP scripts that make your job easier
  http://www.analysisandsolutions.com/code/
 SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y

-- 
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] building a control panel in php

2002-03-19 Thread Demitrious S. Kelly

I agree.  Unless there isn't a product which matches your needs I
personally would consider my time better spent contributing to a project
that has only a short distance left to go rather then starting a new
project which would take months/years before perfection (if there is
such a thing)

Onto my opinions of the technical aspects of creating a control panel in
php... there are two ideas (that I see looming obvious on the
horizon)... Both of these ideas deal with permissions.  To be a truly
effective 'system control panel' it would be necessary to have root
priv's to accomplish tasks... the fact that apache runs as a specific
non-root user (and if it doesn't it d#%!#$^mned well should!) is a
drawback... Webmin circumvents this project by incorporating its own
http/https server which runs on an assigned port (idea 1). Otherwise it
may be possible to use a php front-end-script which modifies a text
file, mysql, or some other form of database, and either a daemon script
running as root or a single pass script running as a cron job... this
process would interpret information in the data file and act accordingly
on the server.  

PHP is a wonderful lang. in my experience, and it's becoming more
advanced by the second.  I don't think the problem would be the lang.
itself but the time invested in learning it and implementing it...

So I guess it boils down to these questions:

1) do you NEED to do it?
2) do you want to do it?
3) are you willing to invest in yourself to get it done?

From my experience creating these types of things tends to be a
thankless job right up until the end :) stick in there and it's
possible...

-Original Message-
From: Miguel Cruz [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, March 19, 2002 5:49 PM
To: Paul ...
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] building a control panel in php

On Wed, 20 Mar 2002, Paul ... wrote:
 just thinking about making a small control panel for my server so i
can do
 the web hosting related things from the web... would php be a good
language
 to do this in and if so why?.. what would be the ups and downs?

The fastest way would be to download Webmin from here
(http://www.webmin.com/), then change all the comments so it says you
wrote it.

Seriously, you might want to look into that because a lot of people have

already put a lot of work into making something fairly comprehensive.

miguel


-- 
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: Problems with ftp_get

2002-03-18 Thread Demitrious S. Kelly

The connection to the ftp may need to be put into passive mode to
transfer any files, and even the directory listings... try that and see
if the problem is fixed... this is especially true on machines accessing
the internet through NAT (network access translation) network
firewalls/servers

-Original Message-
From: Philip Hallstrom [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 18, 2002 4:44 PM
To: Ian Wayne
Cc: [EMAIL PROTECTED]
Subject: [PHP] Re: Problems with ftp_get

I would double check the values of $newName and $oldName and make sure
that you have read permission on the one and write permission on the
other... seems like the error should tell you what file it's having
problems with, but maybe not.

-philip

On Mon, 18 Mar 2002, Ian Wayne wrote:

 I'm getting an unhelpful error message from my ftp script. It says
Warning,
 error opening file... The code in question runs like this.

 $conn = ftp_connect(ftp.mysite.com);
 ftp_login($conn,user,pass);
 ftp_get($conn, $newName, $oldName , FTP_BINARY);

 I can't see what's causing the error. Any help greatly appreciated as
my
 forehead is getting sore from all the banging it's doing on my desktop
(the
 literal one).

 Also, what I want to do is allow users to download a large movie
(70-90MB)
 rather than be forced to watch it in the browser window. I figured
that
 making an ftp link would be the best way to do this, but are there
other
 ways? Thanks. Ian.


 --
 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] include() question

2002-03-14 Thread Demitrious S. Kelly

Try to simplify the problem
$file='index.php?var=';
$file.=$var;
include($file);

-Original Message-
From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, March 14, 2002 1:20 PM
To: [EMAIL PROTECTED]
Subject: [PHP] include() question

Why doesn't this work...
 
include(index.php?var='$var');
 
I want to include a page in my code and send a variable to it but I get
some funky error.
 
THANKS!!


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




[PHP] RE: [PHP-DB] Random Selecting from mySQL

2002-03-13 Thread Demitrious S. Kelly

Pass along a hidden form which documents exactly what rows have already
been shown

input type=hidden name=seen value=1:4:3:9:10:5:27

then you could use 

$seen=explode(':', $seen); to break it into an array...

after that use a foreach to add a 'and id != '.$seen into the sql query
for every element in $seen... thus not allowing duplicates on a per
visit basis...

-Original Message-
From: Georgie Casey [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 13, 2002 4:11 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Random Selecting from mySQL

yea, i know how to display 10 results per page, but that doesnt work
when
you want to do a ORDER BY rand() query.

Gurhan Ozen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 are you just looking for a way to display 10  results per page? If yes
then
 you can just use LIMIT to limit your result to 10 .. So, for the first
page,
 you can do SELECT  LIMIT 1, 10; and for the second page SELECT
...
 LIMIT 11, 20 etc etc .
   You can sure use ORDER BY with LIMIT to to sort the results for
a
 given criteria ..

 Gurhan


 -Original Message-
 From: Georgie Casey [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, March 13, 2002 2:00 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: [PHP-DB] Random Selecting from mySQL


 I know how to use the ORDER BY rand() command on the end of queries
to
 randomize selection, but that's no good when you want to only display
10
 results per page. The next page the user chooses, randomizes again and
could
 show duplicate fields and not at all show other fields.

 Does anyone know a way round this?

 --
 Regards,
 Georgie Casey
 [EMAIL PROTECTED]

 ***
 http://www.filmfind.tv
 Ireland's Online Film Production Directory
 ***



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




-- 
PHP Database 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] rand()

2002-03-13 Thread Demitrious S. Kelly

Something to the effect of

$num=0;
do {
$num=rand(33,146);
if ( $num  90  $num  125 ) {
$num=0;
} else if ( $num  146 || $num  33 ) {
$num=0;
} 
} while ( $num == 0 );
 

note: ths is just off the top of my head... check for validity and
syntax.
-Original Message-
From: Jeff Sittler [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 13, 2002 9:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] rand()

I am wanting to use rand() to generate a number between 33-90 OR
125-146.
Is there a way to do this?  I don't want any numbers before 33 or
between
91-124 or after 146.  Could someone point me in the direction I need to
look
to accomplish this.

Thanks,
Jeff



-- 
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] rand()

2002-03-13 Thread Demitrious S. Kelly

And I just realized how redundant the checks for less then and grater
then the rand min and rand max are...

Oh well... I'm tired :)

-Original Message-
From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 13, 2002 9:45 PM
To: 'Jeff Sittler'; [EMAIL PROTECTED]
Subject: RE: [PHP] rand()

Something to the effect of

$num=0;
do {
$num=rand(33,146);
if ( $num  90  $num  125 ) {
$num=0;
} else if ( $num  146 || $num  33 ) {
$num=0;
} 
} while ( $num == 0 );
 

note: ths is just off the top of my head... check for validity and
syntax.
-Original Message-
From: Jeff Sittler [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, March 13, 2002 9:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] rand()

I am wanting to use rand() to generate a number between 33-90 OR
125-146.
Is there a way to do this?  I don't want any numbers before 33 or
between
91-124 or after 146.  Could someone point me in the direction I need to
look
to accomplish this.

Thanks,
Jeff



-- 
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] php array

2002-03-12 Thread Demitrious S. Kelly

Something like this:
?php
$valid=1;
foreach ( $name as $value ) {
if ( $value == '' || ! isset($value) ) {
$valid=0;
}
}
if ( $valid == 1 ) {
do_stuff();
} else {
give_error();
}   
?
-Original Message-
From: Rodrigo Peres [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, March 12, 2002 10:11 AM
To: PHP
Subject: [PHP] php array

Hi list,

I think this could be an idiot question but I couldn't find an answer.
I have 4 input text in a html, and I'd like to store them as a list, so
I've
named it Name[]. OK, php understand it as an array, but how can I make
an
validation code with javascript to know if the user didn't typed in this
fields??? I couldn't do javascript recognize my name[] field


Thank's in advance

Rodrigo
-- 



-- 
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] removing ALL whitespace from a string

2002-03-11 Thread Demitrious S. Kelly

You can use strtok() with ' ' as the delim

-Original Message-
From: Lee P Reilly [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 11, 2002 8:56 AM
To: PHP List
Subject: [PHP] removing ALL whitespace from a string

Can somebody tell me if there is a function that will remove *all*
whitespace (\n, \r, \t, \w, etc) from a string i.e. from the beginning,
the end, and the middle?. Something like chop(), trim()?

e.g. input =12 3ad 
e.g. output = 123ad

Thanks,

Lee


-- 
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] Scope problem in while loop

2002-03-11 Thread Demitrious S. Kelly

I may be wrong, but that's exactly what I ended up having to do... but
don't quote me - I'm just learning OOP

http://www.apokalyptik.com/forum/viewtopic.php?topic=140forum=60

-Original Message-
From: Randall Perry [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 11, 2002 6:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Scope problem in while loop

According to the PHP 4 docs all variables are global unless within a
function. I've got the following test code which should output 2, but
outputs 1. The while loop creates it's own class object (which seems
strange
since it isn't explicitly instantiated by my code; I would think it
would
cause errors).

The reason I created an object for my variable (actually, I started
testing
with regular strings) is that I've had similar scoping problems in perl,
where variables got out of scope within loops (or even if statements).
In
perl, declaring an object outside these structures will protect it's
scope.
Not so in PHP I see.

Can anyone explain this behavior? Do I have to create functions that
return
values every time I need a loop that modifies a variable?

?php

class Ccust_data {
function Cform_data() {
$this-test = ;
}
}

$o = new Ccust_data();
$o-test = 1;

while ($y = 0) {
global $o-test;
$o-test = 2;
$y = 1;

}

echo \$o-test = $o-test\n;

?
-- 
Randy Perry
sysTame
Mac Consulting/Sales

phn 561.589.6449
mobile email[EMAIL PROTECTED]



-- 
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] Testing mail functionality on a local network possible?

2002-03-10 Thread Demitrious S. Kelly

If you are running a good mailserver (I use qmail + linux or freebsd)
you can send mail internally without being connected to anything...
generally address@localhost will send without a connection to the
internet, or [EMAIL PROTECTED] if the mail server is configured to
accept mail for domain.com.  

After that the matter of connecting to the mailbox and actually reading
the mail is your problem :)

Cheers 


-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, March 10, 2002 2:01 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Testing mail functionality on a local network possible?

Hi there,

I am wondering if it would be possible to send an e-mail inside my
production environment without connecting to the internet. My
application is
running on OSX and I would like to send mail via php to the win2k
machine. I
was reading something about mailservers but did not really get if this
would
be possible without connection to the internet.

Does anybody know a good article on that, or could give me a hint?

Thanx,

Andy



-- 
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: A stupid question...

2002-03-10 Thread Demitrious S. Kelly

You haven't given anyone any specifics... nor a link to a phps, so I
cannot be any more specific with my advice


You could probably get away with looking through each of the elements in
the array and using something like 


if ( substr($element, 0, 1) == $letter ( {
Stuff();
}


at least that's how I would go about it if I wanted a quick fix...

$.002 given ;)

cheers

-Original Message-
From: Chuck PUP Payne [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, March 10, 2002 7:04 PM
To: Chuck PUP Payne; Cary; mysql lists.mysql.com
Cc: PHP General
Subject: Re: [PHP] Re: A stupid question...

I want to sort by a letter in a colomn. Let say I want to sort the
colomn
last_name. I can do order by but I can do just the A's.

http://www.myserver.com/mysort.php?Letter=A

Like to create a link on a web A then sort only the last name are A.
 
I hope that's helps. I can order by, but I can't so a sort like the
example
above.

Chuck Payne
Magi Design and Support


 on 3/10/02 9:42 PM, Cary at [EMAIL PROTECTED] wrote:
 
 At 08:24 PM 3/10/02, Chuck \PUP\ Payne wrote:
 Hi,
 
 I not a newie but I am not a pro at mysql either. I want to do a
query by
 letter(a, b, c..ect.). Is there a simple way to do it. I am writing
in PHP.
 So can someone please so me the how.
 
 
 I'm not totally sure what your looking for. If you could elaborate a
little
 I am sure that one of us could help you out.
 
 Cary
 
 
 
 


-- 
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] Verify script location...

2002-03-05 Thread Demitrious S. Kelly


http://www.php.net/manual/en/language.variables.predefined.php

$HTTP_HOST
Contents of the Host: header from the current request, if there is one. 

$HTTP_REFERER
The address of the page (if any) which referred the browser to the
current page. This is set by the user's browser; not all browsers will
set this.

-Original Message-
From: jas [mailto:[EMAIL PROTECTED]] 
Sent: Monday, March 04, 2002 10:50 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Verify script location...

Ok I have a question that i havent seen a tutorial on... How would I go
about making an included file check the host before executing?  I want
to
make sure that any files I use as included in a php document verify the
request is coming from a valid script on the same server for instance..
Is
this possible and if so could someone give me some more insight or a
tutorial on this?  Thanks in advance...
Jas



-- 
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] value of an array into a sendmail function

2002-03-05 Thread Demitrious S. Kelly

$mail='';
foreach($automail as $mailline) {
$mail.=$mailline;
}
$to = $EMAILADDRESS
$subject = Thank You for your submission!;
$message = eval($automail);
$fromaddress = [EMAIL PROTECTED];
mail($to, $subject, $mail, $fromaddress);


that's my $.02

-Original Message-
From: Kris Vose [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, March 05, 2002 12:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP] value of an array into a sendmail function

I want to take the value of an array and define it as $message.  This
variable will be called in the sendmail function mail().  Here is what I
have so far. (does not work!) Can anyone help me with this problem?
 
$automail = file(DOCUMENT_ROOT/BetterBus/1/AutoEmail.txt);
$number_of_lines = count($automail);
 
for ( $i=0; $i$number_of_lines; $i++)
{
$auto = explode(\n, $automail[$i]);
echo $auto[0].\n;
}
 
$to = $EMAILADDRESS
$subject = Thank You for your submission!;
$message = eval($automail);
$fromaddress = [EMAIL PROTECTED];
 
mail($to, $subject, $message, $fromaddress);
 
 


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




RE: [PHP] OOP .. I just don't get it.

2002-03-05 Thread Demitrious S. Kelly

I've often wondered the same thing... which is why I've never moved to
OOP

So I'm patiently waiting for a reply to this message as well :)

-Original Message-
From: mojo jojo [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, March 05, 2002 12:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP] OOP .. I just don't get it.

Hi

I've been using php for a while now but I have not got my head around
OOP
(classes).

Why bother using them? I've read thru a few tutorials on using classes
and
the examples given are quite simple. This is probably the problem - I
just
can't see the benefit of using this style of programming.

Here is what I'm getting  at.

USING A CLASS-
class Table {

var $rows;
var $columns;

function MakeTable() {

draw a table with $this-columns as the number of columns
and $this-rows as the number of rows

}
}

$mytable = new Table;
$mytable-rows = 5;
$mytable-columns = 10;
$mytable-MakeTable();

---USING A NORMAL FUNCTION-

function MakeTable($rows,$columns) {

make a table with $rows as the number of rows
and $columns as the number of columns

}

$rows = 5;
$columns = 10;
MakeTable($rows,$columns);

---

Using a class doesn't appear to give me any benefits - in fact the code
is
longer.

I know that you can spawn more instances of the same class which sounds
useful, however I can also run my function as many times as I like using
different variables.

What am I missing here?

Thanks

Mojo



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

2002-03-02 Thread Demitrious S. Kelly

Heres a script I wrote to pull the top viruses from antivirus.com

Hope this helps...

?php
$antivirus=file ('http://www.antivirus.com/');
unset($start);
unset($stop);
$count=0;
foreach($antivirus as $line) {
   if ( ! isset($stop) ) {
  if ( eregi('Top viruses', $line) ) {
   $start=$count;
  }
   }
   
   if ( isset($start)  ! isset($stop) ) {
  if ( $count  $start ) {
 if ( eregi('/table', $line) ) {
$stop=$count;
 }
  }
   }

   if ( ! isset($stop) ) { 
$count++;
   }
}
$count=$start;
while ($count = $stop ) {
   $data=str_replace('', chr(10).'', $antivirus[$count]);
   $data=str_replace('', ''.chr(10), $data);
   $data=explode(chr(10), $data);
   foreach($data as $line) {
  if ( !eregi('.*', $line)  trim($line) != ''  !eregi('!--',
$line)  !eregi('\(.*\)', $line) ) {
 ?
  tr
   td bgcolor=#33 align=center
 ?php
 if ( $count != $start ) {
echo 'a
href=http://216.33.22.211/vinfo/virusencyclo/default5.asp?VName=';
echo eregi_replace([0-9]..., '', trim($line));
echo ' target=_blank'.chr(10);
 } else { 
echo 'font color=#FF'.chr(10);
 }
 echo $line.chr(10);
 if ( $count != $start ) {
echo '/a'.chr(10);
 } else {
echo '/font'.chr(10);
 }
 echo 'br'.chr(10);
 ?
 /td/tr
 ?php
  }
   }
   $count++;
}
?
-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, March 02, 2002 3:54 PM
To: Craig Westerman; php-general-list
Subject: Re: [PHP] fopen

Craig,

AFAIK you can't: fopen opens the file and leaves it up to you to read it
a character or some other chunk at a time, keeping what you want, and
leaving the rest. There is no concept of opening a file at a particular
character position, other than to write-over or write-append. (see
http://www.php.net/manual/en/function.fopen.php)

Regards,
=dn


 How can I use fopen to retrieve just one html table out of a whole web
page.

 I need to extract just this table (shown below) from this web page:
 http://quotes.nasdaq.com/quote.dll?page=multimode=stocksymbol=drooy

 Thanks Craig
 ***

 table border=0 cellspacing=0 cellpadding=0 width=578
 tr
  td nowrap 
  table border=0 cellspacing=0 cellpadding=0 
   tr
   td align=left width=100 rowspan=2 class=logoFont
img

src=http://a676.g.akamaitech.net/f/676/838/1h/nasdaq.com/logos/DROO.GIF

 border=0 align=absmiddle height=40nbsp;
   /td
   td nowrapfont face=Arial, Helvetica, Verdana
size=2bDurban
 Roodeport Deep, Ltd./bnbsp;DROOY/font/td
   /tr
   tr
   td width=247 align=rightfont face=Arial, Helvetica,
Verdana
 size=2Mar. 1, 2002nbsp;Market Closed/font/td
   /tr
 /table
 /td
 /tr
 tr
  td nowrap
  table border=0 cellpadding=0 cellspacing=0
   tr
   td nowrap width=85Last Sale:/td
   td align=right
width=85nobrb$nbsp;2.76/b/nobr/td
   td width=20nbsp;nbsp;nbsp;nbsp;nbsp;/td
   td align=left nowrap width=100Net Change:/td
   td align=rightnobrbnbsp;font
color=.FF0.02/fontimg

src=http://a676.g.akamaitech.net/7/676/838/b801fe1d2351e8/nasdaq.com/im
ages
 /nc_down.gif border=0 width=11
 height=10/b/nobrnbsp;nobrbnbsp;font
 color=FF0.72%/font/b /nobr/td
   td width=20nbsp;nbsp;nbsp;nbsp;nbsp;/td
   td rowspan=5 valign=top align=left nowrap
font face=Arial, Helvetica, Verdana size=1
   a

href=http://www.nasdaq.com/asp/offsite_quotes.asp?symbol=DROOY%60selec
ted=
 DROOY%60content=http://www.drd.co.za;img

src=http://a676.g.akamaitech.net/f/676/838/1d/nasdaq.com/images/new_web
link
 s.gif border=0/anbsp;nbsp;a

href=http://www.nasdaq.com/asp/offsite_quotes.asp?symbol=DROOY%60selec
ted=
 DROOY%60content=http://www.drd.co.za; class=clsAWeb Site/abr
/font
   /td
   /tr
   tr
   td nowrap width=85Today's High:/td
   td align=rightnobrb$nbsp;2.80/b/nobr/td
   td width=20nbsp;/td
   td nowrap width=100Today's Low:/td
   td align=right nowrap nobrb$nbsp;2.64/b/nobr/td
   /tr
   tr
   td nowrap width=85Best Bid:/td
   td align=right
width=85nobrb$nbsp;2.75/b/nobr/td
   td width=20nbsp;/td
   td nowrap width=100Best Ask:/td
   td align=right nowrapnobrb$nbsp;2.76/b/nobr/td
   /tr
   tr
   td nowrap width=85Volume:/td
   td align=right width=85b1,551,300/b/td
   td width=20nbsp;/td
   td nowrap width=100Previous Close:/td
   td align=right nowrapnobrb$nbsp;2.78/b/nobr/td
   /tr
   tr
   td nowrap valign=top width=85Market:/td
   td nowrap align=right valign=top width=85Nasdaq-SCM/td
   td width=20nbsp;/td
   td nowrap width=200 align=left valign=top
 colspan=2bAmerican Depositary Shares/b/td
   /tr
  /table





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





RE: [PHP] Re: Does anybody have code for this?

2002-03-01 Thread Demitrious S. Kelly

function scramble($string) {
$count2++;
while ( $count2 != strlen($string) ) {
$bad=1;
while ( $bad == 1 ) {
$rand=rand(0, (strlen($string) - 1));
if ( $used[$rand] != 1 ) {
$bad=0;
$used[$rand]=1;
}
}
$newstring.=substr($string, $rand, 1);
$count2++;
}
return($newstring);
}

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, February 28, 2002 11:50 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Does anybody have code for this?

on 3/1/02 2:43 AM, Monty at [EMAIL PROTECTED] wrote:

 Maybe try looking into the crypt() or md5() functions on php.net.
These will
 encrypt a string more than scramble, but maybe one of these serves
the
 purpose.
No, that isn't what I'm looking for.  It's not for encryption.  I just
need
a function that scrambles a string.



-- 
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: Andrey this is for you.

2002-03-01 Thread Demitrious S. Kelly

Type: 

find / -name mysql -type f 2 /dev/null

if  you see something like /usr/local/bin/mysql then you do (that dosent
mean that the demon is running, but the client is at least installed...

to see if you have the daemon installed 

find / -name safe_mysqld -type f 2 /dev/null

and to see if it's running type netstat -lnp and look for port 3306,
or mysql in the listing...


-Original Message-
From: Sean Kennedy [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 01, 2002 9:47 AM
To: [EMAIL PROTECTED]
Subject: [PHP] RE: Andrey this is for you.

hello,

locate mysql returned this:

/home/chiliasp/odbc/direct/locale/en_US/LC_MESSAGES/ivmysql15.po
/home/sites/home/web/CFIDE/administrator/datasources/drivers/myodbc_mysq
l.cfm
/home/sites/home/web/CFIDE/administrator/datasources/drivers/mysql.cfm
/home/sites/home/web/CFIDE/administrator/server_settings/drivers/mysql.c
fm
/home/coldfusion/lib/locale/en_US/LC_MESSAGES/CFmysql15.mo
/home/coldfusion/lib/CFmysql15.so
/home/coldfusion/scripts/mysql_expire.cfm 

what does this mean? do i have mysql? thanks,

-sean


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




[PHP] php compiler project(s)?

2002-02-28 Thread Demitrious S. Kelly

Are there any win32 / *nix PHP compilers out there to make a binary
executable I remember one for win32 a while back but that's no longer
even a glimmer in somebody's eyes anymore Anyone have any info on the
subject? (I'm not even looking for something GTK compliant just
something that works)


-- 
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




RE: [PHP] Variables containing HTML?

2002-02-28 Thread Demitrious S. Kelly

Consider

?php
echo serialize('blah');
?

it returns 's:4:blah;'

now, consider

encode('blah');

it returns '098108097104'

now consider which of the two output strings you end up having to escape
special characters for...

:)


-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, February 28, 2002 1:41 PM
To: Demitrious S. Kelly
Cc: 'Nick Richardson'; 'PHP General'
Subject: Re: [PHP] Variables containing HTML?


What's the difference between this and the serialize() function?


Erik




On Monday, February 25, 2002, at 11:27  PM, Demitrious S. Kelly wrote:

 It breaks the individual characters down into their ascii equivalent,
 and makes it one big 'numerical' string... then breaks the string back
 into separate values and translates each value back into a character,
 then recreates the string from the characters...

 I got sick of slashing and un slashing and validating, and
revalidating,
 etc, etc, etc, etc so I made this. Which makes things 1000% simpler

 -Original Message-
 From: Nick Richardson [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 25, 2002 8:11 PM
 To: Demitrious S. Kelly; 'PHP General'
 Subject: RE: [PHP] Variables containing HTML?

 Right on!!! - This works great!!

 Can you explain what it does ;) - i'm completly lost in it ;)

 //Nick

 -Original Message-
 From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 25, 2002 8:02 PM
 To: 'Nick Richardson'; 'PHP General'
 Subject: RE: [PHP] Variables containing HTML?


 Try these...

 function encode($string) {
 $string=stripslashes($string);
 $temp='';
 $newstring='';
 for ( $counter=0; $counter != ; $counter++ ) {
 $temp=substr($string, $counter, 1);
 if ( $temp == '' ) {
 break;
 }
 $newstring=$newstring . str_pad( ord($temp), 3, 0,
 STR_PAD_LEFT);
 }
 return ($newstring);
 }

 function decode($string) {
 $temp='';
 $newstring='';
 for ( $counter=0; $counter != ; $counter+=3 ) {
 $temp=substr($string, $counter, 3);
 if ( $temp == '' ) {
 break;
 }
 $newstring=$newstring . chr($temp);
 }
 return ($newstring);
 }

 -Original Message-
 From: Nick Richardson [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 25, 2002 7:56 PM
 To: PHP General
 Subject: [PHP] Variables containing HTML?

 Stupid question for everyone... i'm just having one of those braindead
 moments.

 I have a page which allows users to add custom headers and footers in
 HTML.
 (i.e. Fill in a text area with a bunch of html, and that's stored in a
 mysql
 database and retrived when that user logs in again).

 The problem i'm having is this:

 When a users fills in all the info, and hits submit, they are taken to
a
 preview page which renders everything and has an accept button.
 If i try to store the header and footer data in a hidden input it just
 renders it on the screen (if it's more than one line it gets even
 worse).

 How can i get this info (variable w/ strings that are QUITE long, and
 include quotes and apostrophes) from the form they are entered on,
into
 a
 preview page, then back into the script to be written into the
database?

 I have thought about sessions, and they work until the user decides
they
 dont like the way it turned out and try to discard and change it, even
 after
 re-registering the variables in the session, they do not change to the
 new
 input.

 I hope someone out there can make sence of what i have said... because
i
 think i confused even myself ;)

 Thanks for any help!

 //Nick Richardson


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









Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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

2002-02-26 Thread Demitrious S. Kelly


Also, make sure that if you run the script with user input that you
validate the input...

Input like 'username; cat /etc/passwd' would be no fun at all

-Original Message-
From: Simon Willison [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 26, 2002 7:14 AM
To: bvr
Cc: php-general
Subject: Re: [PHP] CGI

bvr wrote:

Please note that plain this:

or 
?
if (action==cgi) echo `./cgi-bin/cgiscripts/${scripts} 21`;
?

is not a good idea, because it allows a visitor to run arbitrary
commands on your server.

bvr.

If you still want to use that method have a look at these two functions 
which can be used to make user input safe for use on a command line:

http://www.php.net/manual/en/function.escapeshellarg.php
http://www.php.net/manual/en/function.escapeshellcmd.php

Simon


-- 
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] cool PHP sites

2002-02-26 Thread Demitrious S. Kelly

well my site isn't 'big name' but it's got a very cool catch to it...

it's got an ftp indexer that I'm developing. You submit an ftp site, and
it logs onto the ftp, grabs all of the filenames and sizes, pops
everything into a mysql database, which is searchable from a web page
(located on the same site, and also written in php) plus the source is
available in .phps format (I haven't gotten any time to package it
nicely into an what I would call an end-user-quality .tgz yet...)

http://www.apokalyptik.com

and http://www.apokalyptik.com/ftp/ respectively... the entire web site
runs purely off of php... not that you are interested, but just in
case...

-Original Message-
From: Chris Lott [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 26, 2002 11:08 AM
To: [EMAIL PROTECTED]
Subject: [PHP] cool PHP sites

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

It strikes me that my students really don't have a good grasp of what
PHP
is capable of doing, since they are getting bogged down in learning the
minutiae of the language itself. So (quickly if possible-- I'd like to
demo
some sites tonight) what are some examples of cool and publically
accessible sites that use PHP? I'm looking for sites that demonstrate
what
PHP can do, examples of big name sites using PHP, etc. 

I can explain how the back end technology is working if I have some good
sites to use as a framework. I'd like to keep them excited about the
potential, you know?

c

-BEGIN PGP SIGNATURE-
Version: 6.5.8ckt - KeyID: 0x51046CFD -
http://www.chrislott.org/geek/pgp/

iQA/AwUBPHvc/daLYehRBGz9EQI9KwCgu7SKkrKqmcQ7zf+lAZBwKgvAlWcAmwQ7
xCs+oCAo6Hn5UkHuDmR4ZzlT
=koDz
-END PGP SIGNATURE-



-- 
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] is_uploaded_file() emulation?

2002-02-26 Thread Demitrious S. Kelly

Create a tmp file with the script and get the owner/group from that

My $.02

-Original Message-
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 26, 2002 1:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP] is_uploaded_file() emulation?

Hello all!

How do I find out if a file was actually uploaded /without/ using 
is_uploaded_file()?

My first though is that I should use fileowner() on the file and see if 
it's the same as the user who runs PHP (Apache) - but how do I find that

out? I don't want to use exec(id -u) either because the syntax may be 
different for distinct systems and I'd like to avoid system calls if 
possible.

I'm open to any suggestions to solve the original problem - not 
necessarily using UID's.

Thanks!

Bogdan



-- 
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] How many files can be in one directory?

2002-02-26 Thread Demitrious S. Kelly

Yes and no.

The directory would use an inode, but splitting the stores into separate
directories would help drastically improve cpu and memory utilization
when working with large numbers of files (10's of thousands)

Right or wrong that's what I have to say

-Original Message-
From: Andy [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 26, 2002 2:32 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] How many files can be in one directory?


So this means, that I can not increas the amount by splitting the files
into
more than 1 directory? In fact it would make it even less, because dirs
also
need those i-nods, right?

Thanx

Andy


Thalis A. Kalfigopoulos [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Mon, 25 Feb 2002, Andy wrote:

  Hi there,
 
  I am building a web application which is storing pictures.
 
  Is there a limit of files in one directory on LINUX systems? Perhaps
it
  might end in a problem after having 3 files in the same dir?
Performance
  issues ore something else.

 The limit depends on how many inodes you have on the filesystem this
dir
resides on. This is a parameter when first mke3fs was ran to create the
fs.
Usually you'll have 1 i-node every 4096 bytes and you need 1 inode per
file.
So do your calculations depending on the size of your partition.

 cheers,
 thalis

 
  Has anybody got experiance on that?
 
  Thanx for any comment,
 
  Andy
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 




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

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





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




RE: [PHP] Variables containing HTML?

2002-02-25 Thread Demitrious S. Kelly

Try these...

function encode($string) {
$string=stripslashes($string);
$temp='';
$newstring='';
for ( $counter=0; $counter != ; $counter++ ) {
$temp=substr($string, $counter, 1);
if ( $temp == '' ) {
break;
}
$newstring=$newstring . str_pad( ord($temp), 3, 0,
STR_PAD_LEFT);
}
return ($newstring);
}

function decode($string) {
$temp='';
$newstring='';
for ( $counter=0; $counter != ; $counter+=3 ) {
$temp=substr($string, $counter, 3);
if ( $temp == '' ) {
break;
}
$newstring=$newstring . chr($temp);
}
return ($newstring);
}

-Original Message-
From: Nick Richardson [mailto:[EMAIL PROTECTED]] 
Sent: Monday, February 25, 2002 7:56 PM
To: PHP General
Subject: [PHP] Variables containing HTML?

Stupid question for everyone... i'm just having one of those braindead
moments.

I have a page which allows users to add custom headers and footers in
HTML.
(i.e. Fill in a text area with a bunch of html, and that's stored in a
mysql
database and retrived when that user logs in again).

The problem i'm having is this:

When a users fills in all the info, and hits submit, they are taken to a
preview page which renders everything and has an accept button.
If i try to store the header and footer data in a hidden input it just
renders it on the screen (if it's more than one line it gets even
worse).

How can i get this info (variable w/ strings that are QUITE long, and
include quotes and apostrophes) from the form they are entered on, into
a
preview page, then back into the script to be written into the database?

I have thought about sessions, and they work until the user decides they
dont like the way it turned out and try to discard and change it, even
after
re-registering the variables in the session, they do not change to the
new
input.

I hope someone out there can make sence of what i have said... because i
think i confused even myself ;)

Thanks for any help!

//Nick Richardson


-- 
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] Variables containing HTML?

2002-02-25 Thread Demitrious S. Kelly

It breaks the individual characters down into their ascii equivalent,
and makes it one big 'numerical' string... then breaks the string back
into separate values and translates each value back into a character,
then recreates the string from the characters...

I got sick of slashing and un slashing and validating, and revalidating,
etc, etc, etc, etc so I made this. Which makes things 1000% simpler

-Original Message-
From: Nick Richardson [mailto:[EMAIL PROTECTED]] 
Sent: Monday, February 25, 2002 8:11 PM
To: Demitrious S. Kelly; 'PHP General'
Subject: RE: [PHP] Variables containing HTML?

Right on!!! - This works great!!

Can you explain what it does ;) - i'm completly lost in it ;)

//Nick

-Original Message-
From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 25, 2002 8:02 PM
To: 'Nick Richardson'; 'PHP General'
Subject: RE: [PHP] Variables containing HTML?


Try these...

function encode($string) {
$string=stripslashes($string);
$temp='';
$newstring='';
for ( $counter=0; $counter != ; $counter++ ) {
$temp=substr($string, $counter, 1);
if ( $temp == '' ) {
break;
}
$newstring=$newstring . str_pad( ord($temp), 3, 0,
STR_PAD_LEFT);
}
return ($newstring);
}

function decode($string) {
$temp='';
$newstring='';
for ( $counter=0; $counter != ; $counter+=3 ) {
$temp=substr($string, $counter, 3);
if ( $temp == '' ) {
break;
}
$newstring=$newstring . chr($temp);
}
return ($newstring);
}

-Original Message-
From: Nick Richardson [mailto:[EMAIL PROTECTED]] 
Sent: Monday, February 25, 2002 7:56 PM
To: PHP General
Subject: [PHP] Variables containing HTML?

Stupid question for everyone... i'm just having one of those braindead
moments.

I have a page which allows users to add custom headers and footers in
HTML.
(i.e. Fill in a text area with a bunch of html, and that's stored in a
mysql
database and retrived when that user logs in again).

The problem i'm having is this:

When a users fills in all the info, and hits submit, they are taken to a
preview page which renders everything and has an accept button.
If i try to store the header and footer data in a hidden input it just
renders it on the screen (if it's more than one line it gets even
worse).

How can i get this info (variable w/ strings that are QUITE long, and
include quotes and apostrophes) from the form they are entered on, into
a
preview page, then back into the script to be written into the database?

I have thought about sessions, and they work until the user decides they
dont like the way it turned out and try to discard and change it, even
after
re-registering the variables in the session, they do not change to the
new
input.

I hope someone out there can make sence of what i have said... because i
think i confused even myself ;)

Thanks for any help!

//Nick Richardson


-- 
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] What's wrong w/ this line?

2002-02-25 Thread Demitrious S. Kelly

A .phps would be helpful

-Original Message-
From: Nick Richardson [mailto:[EMAIL PROTECTED]] 
Sent: Monday, February 25, 2002 10:05 PM
To: PHP General
Subject: [PHP] What's wrong w/ this line?

PHP seems to be completly ignoring this line...

Funny part is that i use this same line in another place in my code and
it
works fine there... i have no clue - Need coffee.

 } elseif(!(preg_match(/^[A-Za-z0-9-]+$/,$uname))) {

//Nick Richardson
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--
--   We must come to see that the end we seek, is a society --
-- at peace with itself.  A society that can live with its  --
-- concience.  That will be a day not of the white man, not --
-- of the black man... That will be the day of man, as man! --
--  -Dr. Martin Luther King Jr. --
-- -March 25th, 1965--
--


-- 
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] How can I decrypt a password I previously coded with md5()?

2002-01-30 Thread Demitrious S. Kelly

You don’t. md5 is one way encryption

-Original Message-
From: Jason G. [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 30, 2002 2:06 PM
To: Nicolas Costes; Jose; [EMAIL PROTECTED]
Subject: Re: [PHP] How can I decrypt a password I previously coded with
md5()?

Hi Nicolas,

I would be interested in seeing the javascript md5 function if possible.

Thanks,

Jason Garber
IonZoft.com



At 11:18 AM 1/30/2002 +0100, Nicolas Costes wrote:

As already said here, you cannot reverse the md5() function ...
So :

 -The user fills a login box (login, password)
 -The PHP script 'crypts' this password with md5();
 -The already-encrypted password in the database (or the passwd

 file) is
 compared with the one provided by the user (and encrypted by
PHP) 
 : if they
 aren't the same ... Bye !!!

And for more security, I use a JavaScript MD5 function to encrypt the
provided password in the user's browser so it goes already encrypted on
the
net ... Then PHP's just got to compare it with the one in the database
!!!


Le Mercredi 30 Janvier 2002 10:51, Jose a écrit :
  I'm making a proyect in php, and I have some doubts about the md5.
  I encript a password with it, but I don't know how to decrypt it
again.
 
  Thanks.
 
 
 

---
 - --
  Jose Fco. ( [EMAIL PROTECTED] ).
  OLINET, S.L. Teléfono: 952207135 - Fax: 952207600
  Avda. Juan Sebastián Elcano, 39-41. 29017 Málaga.
 

---
 - --

--
  ( ° Nicolas Costes
  //\\  IUT de La Roche / Yon
/ \/ ) [EMAIL PROTECTED]
`-  http://luxregina.free.fr

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail:
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]