[PHP] fsockopen server monitor

2003-09-29 Thread Cameron Metzke
Hi there,
I have been trying to make a simple monitor script using fsockopen. here it
is
--Start Code-

?php
error_reporting(0);
include 'config.php';
$domain = $_POST['domain'];
?
html
head
titlemonitor script/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body bgcolor=#00 text=#FF link=#FF vlink=#FF
alink=#FF

table width=40% border=2 cellpadding=5 cellspacing=5
bordercolor=#66 align=center
  tr
td width=50%HTTP Server :/td
td width=50%?php
// Http port connection
 $http = fsockopen($domain, $httpport, $errno, $errstr, 30);
 if (!$http)
 {
 echo (img src=\fail.jpg\img src=\fail.jpg\img
src=\fail.jpg\);
 }

 else
 {
 echo (img src=\pass.jpg\img src=\pass.jpg\img
src=\pass.jpg\);
 }
?
/td
  /tr
  tr
tdFTP Server :/td
td?php
//ftp port connection
 $ftp = fsockopen($domain, $ftpport, $errno, $errstr, 30);
 if (!$ftp)
 {
 echo (img src=\fail.jpg\img src=\fail.jpg\img
src=\fail.jpg\);
 }

 else
 {
 echo (img src=\pass.jpg\img src=\pass.jpg\img
src=\pass.jpg\);
 }
?
/td
  /tr
  tr
tdPOP Server :/td
td?php
//pop port connection
 $pop = fsockopen($domain, $popport, $errno, $errstr, 30);
 if (!$pop)
 {
 echo (img src=\fail.jpg\img src=\fail.jpg\img
src=\fail.jpg\);
 }

 else
 {
 echo (img src=\pass.jpg\img src=\pass.jpg\img
src=\pass.jpg\);
 }
?
/td
  /tr
  tr
tdIMAP Server :/td
td?php
//Imap server connection
 $imap = fsockopen($domain, $imapport, $errno, $errstr, 30);
 if (!$imap)
 {
 echo (img src=\fail.jpg\img src=\fail.jpg\img
src=\fail.jpg\);
 }

 else
 {
 echo (img src=\pass.jpg\img src=\pass.jpg\img
src=\pass.jpg\);
 }
?
/td
  /tr
  tr
tdSMTP Server :/td
td?php
//ssh port connection
 $smtp = fsockopen($domain, $smtpport, $errno, $errstr, 30);
 if (!$smtp)
 {
 echo (img src=\fail.jpg\img src=\fail.jpg\img
src=\fail.jpg\);
 }

 else
 {
 echo (img src=\pass.jpg\img src=\pass.jpg\img
src=\pass.jpg\);
 }
?
/td
  /tr
  tr
tdSSH Server :/td
td?php
//ssh port connection
 $ssh = fsockopen($domain, $sshport, $errno, $errstr, 30);
 if (!$ssh)
 {
 echo (img src=\fail.jpg\img src=\fail.jpg\img
src=\fail.jpg\);
 }

 else
 {
 echo (img src=\pass.jpg\img src=\pass.jpg\img
src=\pass.jpg\);
 }
?
/td
  /tr
  tr
tdBogus Server :/td
td?php
// bogus port
 $test = fsockopen($domain, $bogusport, $errno, $errstr, 30);
 if (!$test)
 {
 echo (img src=\fail.jpg\img src=\fail.jpg\img
src=\fail.jpg\);
 }

 else
 {
 echo (img src=\pass.jpg\img src=\pass.jpg\img
src=\pass.jpg\);
 }
?
/td
  /tr
/table

/body
/html

END CODE

all seems to work ok , except that the http and smtp ports always come up ok
even when the domain doesnt exist. I am thinking mabey it has something to
do with verisign playing with the .com names lattley?. any ideas and help
would be appreciated :)

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



[PHP] fsockopen server monitor

2003-09-29 Thread Cameron Metzke
Hi there,
I have been trying to make a simple monitor script using fsockopen. here it
is
--Start Code-

?php
error_reporting(0);
include 'config.php';
$domain = $_POST['domain'];
?
html
head
titlemonitor script/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body bgcolor=#00 text=#FF link=#FF vlink=#FF
alink=#FF

table width=40% border=2 cellpadding=5 cellspacing=5
bordercolor=#66 align=center
  tr
td width=50%HTTP Server :/td
td width=50%?php
// Http port connection
 $http = fsockopen($domain, $httpport, $errno, $errstr, 30);
 if (!$http)
 {
 echo (img src=\fail.jpg\img src=\fail.jpg\img
src=\fail.jpg\);
 }

 else
 {
 echo (img src=\pass.jpg\img src=\pass.jpg\img
src=\pass.jpg\);
 }
?
/td
  /tr
  tr
tdFTP Server :/td
td?php
//ftp port connection
 $ftp = fsockopen($domain, $ftpport, $errno, $errstr, 30);
 if (!$ftp)
 {
 echo (img src=\fail.jpg\img src=\fail.jpg\img
src=\fail.jpg\);
 }

 else
 {
 echo (img src=\pass.jpg\img src=\pass.jpg\img
src=\pass.jpg\);
 }
?
/td
  /tr
  tr
tdPOP Server :/td
td?php
//pop port connection
 $pop = fsockopen($domain, $popport, $errno, $errstr, 30);
 if (!$pop)
 {
 echo (img src=\fail.jpg\img src=\fail.jpg\img
src=\fail.jpg\);
 }

 else
 {
 echo (img src=\pass.jpg\img src=\pass.jpg\img
src=\pass.jpg\);
 }
?
/td
  /tr
  tr
tdIMAP Server :/td
td?php
//Imap server connection
 $imap = fsockopen($domain, $imapport, $errno, $errstr, 30);
 if (!$imap)
 {
 echo (img src=\fail.jpg\img src=\fail.jpg\img
src=\fail.jpg\);
 }

 else
 {
 echo (img src=\pass.jpg\img src=\pass.jpg\img
src=\pass.jpg\);
 }
?
/td
  /tr
  tr
tdSMTP Server :/td
td?php
//ssh port connection
 $smtp = fsockopen($domain, $smtpport, $errno, $errstr, 30);
 if (!$smtp)
 {
 echo (img src=\fail.jpg\img src=\fail.jpg\img
src=\fail.jpg\);
 }

 else
 {
 echo (img src=\pass.jpg\img src=\pass.jpg\img
src=\pass.jpg\);
 }
?
/td
  /tr
  tr
tdSSH Server :/td
td?php
//ssh port connection
 $ssh = fsockopen($domain, $sshport, $errno, $errstr, 30);
 if (!$ssh)
 {
 echo (img src=\fail.jpg\img src=\fail.jpg\img
src=\fail.jpg\);
 }

 else
 {
 echo (img src=\pass.jpg\img src=\pass.jpg\img
src=\pass.jpg\);
 }
?
/td
  /tr
  tr
tdBogus Server :/td
td?php
// bogus port
 $test = fsockopen($domain, $bogusport, $errno, $errstr, 30);
 if (!$test)
 {
 echo (img src=\fail.jpg\img src=\fail.jpg\img
src=\fail.jpg\);
 }

 else
 {
 echo (img src=\pass.jpg\img src=\pass.jpg\img
src=\pass.jpg\);
 }
?
/td
  /tr
/table

/body
/html

END CODE

all seems to work ok , except that the http and smtp ports always come up ok
even when the domain doesnt exist. I am thinking mabey it has something to
do with verisign playing with the .com names lattley?. any ideas and help
would be appreciated :)

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



Re: [PHP] trans_sid and forms -- feature request???

2003-09-29 Thread Curt Zirzow
* Thus wrote Justin French ([EMAIL PROTECTED]):
 Hi all,
 
 enable_trans_sid in the PHP ini has given me no grief to date, but now 
 I'm working towards XHTML 1.0 Strict, and PHP seems to fall over when 
 dealing with forms.
 
 So, one option is to exclude form= from the list or rewrite tags in 
 php.ini, but this places a burden on the developers and writers to 
 manually do this.
 
 Option 2 I had *hoped* would be for the action='' attribute of a form 
 tag to be re-written rather than a hidden form element being added, but 
 I haven't been able to get this to work.
 
 
 Can anyone offer a solution?
 Has this feature been requested before, or is it likely to be included 
 in PHP 5?
 
I found this:
 http://bugs.php.net/bug.php?id=13472

After reading that I'm still confused wether it was fixed.
So I tested it a bit with php 4.3.3 trans_id on...

; does nothing
url_rewriter.tags =a=href,area=href,frame=src,input=src

; makes bad forminput/ entry 
url_rewriter.tags =a=href,area=href,frame=src,input=src,form=fakeentry

; makes bad forminput/ entry AND appends SID to 'action'
url_rewriter.tags =a=href,area=href,frame=src,input=src,form=action

I would think that the last one should only append the SID to
action and not add the input entry.


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

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



Re: [PHP] fsockopen server monitor

2003-09-29 Thread Curt Zirzow
* Thus wrote Cameron Metzke ([EMAIL PROTECTED]):
 Hi there,
 I have been trying to make a simple monitor script using fsockopen. here it
 is
 --Start Code-
 
 ?php
 error_reporting(0);
 include 'config.php';
 $domain = $_POST['domain'];

 [... unneeded code ...]

 td width=50%?php
 // Http port connection
  $http = fsockopen($domain, $httpport, $errno, $errstr, 30);
  if (!$http)
  {

  [.. (130 lines) more unneeded  code  ..]

 
 END CODE
 
 all seems to work ok , except that the http and smtp ports always come up ok
 even when the domain doesnt exist. I am thinking mabey it has something to
 do with verisign playing with the .com names lattley?. any ideas and help
 would be appreciated :)

It seems that you've already answered your question.

rant
and playing is a rather nice term; I'd rather say something like
destroying, stealing, monopolizing, betraying, untrusting,
stupidly trying to make the 'internet' more friendly by taking
advantage of certain organizations that weren't on the ball with
the .com names.
/rant

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

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



Re: [PHP] fsockopen server monitor

2003-09-29 Thread Cameron Metzke
Sorry about that . Its my first post, :(
Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 * Thus wrote Cameron Metzke ([EMAIL PROTECTED]):
  Hi there,
  I have been trying to make a simple monitor script using fsockopen. here
it
  is
  --Start Code-
 
  ?php
  error_reporting(0);
  include 'config.php';
  $domain = $_POST['domain'];
 
  [... unneeded code ...]
 
  td width=50%?php
  // Http port connection
   $http = fsockopen($domain, $httpport, $errno, $errstr, 30);
   if (!$http)
   {
 
   [.. (130 lines) more unneeded  code  ..]
 
 
  END CODE
 
  all seems to work ok , except that the http and smtp ports always come
up ok
  even when the domain doesnt exist. I am thinking mabey it has something
to
  do with verisign playing with the .com names lattley?. any ideas and
help
  would be appreciated :)

 It seems that you've already answered your question.

 rant
 and playing is a rather nice term; I'd rather say something like
 destroying, stealing, monopolizing, betraying, untrusting,
 stupidly trying to make the 'internet' more friendly by taking
 advantage of certain organizations that weren't on the ball with
 the .com names.
 /rant

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

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



Re: [PHP] trans_sid and forms -- feature request???

2003-09-29 Thread Curt Zirzow
* Thus wrote Curt Zirzow ([EMAIL PROTECTED]):
 * Thus wrote Justin French ([EMAIL PROTECTED]):
  Hi all,
  
  enable_trans_sid in the PHP ini has given me no grief to date, but now 
  I'm working towards XHTML 1.0 Strict, and PHP seems to fall over when 
  dealing with forms.
  
  So, one option is to exclude form= from the list or rewrite tags in 
  php.ini, but this places a burden on the developers and writers to 
  manually do this.
  
  Option 2 I had *hoped* would be for the action='' attribute of a form 
  tag to be re-written rather than a hidden form element being added, but 
  I haven't been able to get this to work.
  
  
  Can anyone offer a solution?
  Has this feature been requested before, or is it likely to be included 
  in PHP 5?
  
 I found this:
  http://bugs.php.net/bug.php?id=13472
 
 After reading that I'm still confused wether it was fixed.
 So I tested it a bit with php 4.3.3 trans_id on...
 
Hmm..  Set up your form like this:

form
div
fieldset
!-- input elements here --
/fieldset
/div
/form

Then with ini setting:
url_rewriter.tags=a=href,area=href,frame=src,input=src,fieldset=

Works like a Charm :)



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

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



Re: [PHP] Submit button

2003-09-29 Thread Nitin
Never mind, but could you state the reason?

Nitin


- Original Message - 
From: Chris Shiflett [EMAIL PROTECTED]
To: Nitin [EMAIL PROTECTED]; Karina S [EMAIL PROTECTED]
Cc: PHP-General [EMAIL PROTECTED]
Sent: Monday, September 29, 2003 3:34 AM
Subject: Re: [PHP] Submit button


 --- Nitin [EMAIL PROTECTED] wrote:
  img src=image.gif alt=Submit onClick=document.entry.submit()
 
 This is a great example of what not to do.
 
 Use input type=image...
 
 Chris
 

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



Re: [PHP] PHP coders spare time [OT}

2003-09-29 Thread Marek Kilimajer
Curt Zirzow wrote:
And what they do with it...

http://zirzow.dyndns.org/html/mlists/php_general/

Curt


CPT John W. Holmes [EMAIL PROTECTED] and John W. Holmes 
[EMAIL PROTECTED] is the same address, just a different name 
(in and out of office ;) John made it to be second.

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


Re: [PHP] gettext: changed .mo file, caching issue

2003-09-29 Thread Christophe Chisogne
daniel hahler wrote:
This works good, but if the .mo file gets changed the old content is
returned by calls to gettext, until I restart Apache.
gettext uses a caching method to speed up looking translation
strings, which explain why Apache must be reloaded [1]
Setting all LANG, LANGUAGE and LC_ALL _seems_ mandatory to avoid 
problems with some servers (I saw this with win2000 and linux).
That's really poorly documented in [2], like the path used to find the 
.mo files
Ex for french: wich of fr/ fr_BE/, fr_FR/, french/ ? Answer depend on
 OS (win/unix), server (locale config, env vars, ...) and I dont know
 what (sometimes uses fr when fr_BE dont exist)...

Perhaps you can try php-i18n mailing list, which is really low
traffic.
[1] GNU gettext info manual
GNU `gettext' caches previous translation results.
When the same translation is requested twice, with no new message
catalogs being loaded in between, `gettext' will, the second time, find
the result through a single cache lookup.
[2] PHP Manual
http://www.php.net/manual/en/function.gettext.php
Christophe

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


Re: [PHP] gettext: changed .mo file, caching issue

2003-09-29 Thread Christophe Chisogne
About performance issues surrounding i18n,
is gettext better than storing strings in a RDBMS ?
Can someone argue in favour or again opinion that say
the RDBMS way is faster ? [1]
[1] Re: [Phpgroupware-users] I18N: why not gettext?!
http://mail.gnu.org/archive/html/phpgroupware-users/2003-04/msg00209.html
Christophe

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


[PHP] add element to an array

2003-09-29 Thread Angelo Zanetti
Hi, I want to add a new element to an array in php, is the following way the
correct way? assuming that $chk is an array and $ID contains a value.


$j = count($chk);
$j++;
$chk[$j] = $ID;

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



Re: [PHP] General .htaccess question

2003-09-29 Thread Eugene Lee
On Sun, Sep 28, 2003 at 08:53:13PM -0400, Mike Brum wrote:
: 
: I think I know the answer to this, but want some confirmation from someone a
: bit more knowledgable about Apache and .htaccess files.

Okay.

: My webhost has the default 404 page set to 404.html. For the sake of
: consistancy on a number of levels, I prefer a PHP file for this (404.php).
: So to do this, I created a basic .htaccess file for this very purpose and it
: sits in the root dir.

Sure.

: Now, does this .htaccess file get read for EVERY resource request on my site
: - even when the page is found?

Yes.

: Aside from a META redirect from 404.html to 404.php, is there a less
: server-intensive way to set my 404 in Apache when I don't have root access?

No.

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



Re: [PHP] add element to an array

2003-09-29 Thread Matthias Nothhaft
Hi Angelo Zanetti, you wrote:
Hi, I want to add a new element to an array in php, is the following way the
correct way? assuming that $chk is an array and $ID contains a value.
$j = count($chk);
$j++;
$chk[$j] = $ID;
Keep it simple, this is enough:

	$chk[] = $ID;

This appends a new element at the end of your array.

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


[PHP] How to install sqlite in redhat 9 with php rpm?

2003-09-29 Thread Kernel Panic
Dear all,

I cant install the sqlite package in redhat 9 with original php rpm. here is
the message i got:

[EMAIL PROTECTED] root]# pear install SQLite-1.0.tgz
48 source files, building
running: phpize
building in /var/tmp/pear-build-root/SQLite-1.0
running: /tmp/tmpagWscI/SQLite-1.0/configure
configure: error: cannot find sources (Makefile.in) in
/tmp/tmpagWscI/SQLite-1.0 or ..
`/tmp/tmpagWscI/SQLite-1.0/configure' failed

please help, thx.

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



[PHP] restart httpd after php.ini change?

2003-09-29 Thread David T-G
Hi, all --

We've added a browscap.ini file to our server and I want to 1) make sure
it's referenced correctly and 2) know whether or not httpd needs a restart.

The file is now

  /usr/local/lib/php/browscap.ini

and my php.ini entry is

  [browscap]
  browscap = browscap.ini

with phpinfo() reporting

  include_path = .:/usr/local/lib/php = .:/usr/local/lib/php

for my include path (though I didn't see an entry in the php.ini file or
compile-time directives; I take it, then, that this is the default).


TIA  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] restart httpd after php.ini change?

2003-09-29 Thread Marek Kilimajer
I'm not sure if include_path counts for browscap file, I would say no. 
You should use absolute path. Then restart httpd.

David T-G wrote:
Hi, all --

We've added a browscap.ini file to our server and I want to 1) make sure
it's referenced correctly and 2) know whether or not httpd needs a restart.
The file is now

  /usr/local/lib/php/browscap.ini

and my php.ini entry is

  [browscap]
  browscap = browscap.ini
with phpinfo() reporting

  include_path = .:/usr/local/lib/php = .:/usr/local/lib/php

for my include path (though I didn't see an entry in the php.ini file or
compile-time directives; I take it, then, that this is the default).
TIA  HAND

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


[PHP] php xvfb gives xauth command not found

2003-09-29 Thread Daniel Struck
Hello,

I am using the program njplot in a script, an unfortunately it reqires a minimal X 
environment.

So I am executing this programm by:

$test=exec(/usr/bin/xvfb-run /usr/bin/njplot -psonly testfile 21);
echo $test;

As a result I get:

xvfb-run: xauth command not found; exiting.

The strange thing is, that this command did work properly, but got broken some days 
ago. The script is being executed on a debian woody server.
On the other side, the command /usr/bin/xvfb-run /usr/bin/njplot -psonly testfile 
21 is working properly when being executed manually.

Does anyone by chance know how to resolve this problem?

Best regards,
Daniel Struck

-- 
Retrovirology Laboratory Luxembourg
Centre Hospitalier de Luxembourg
4, rue E. Barblé
L-1210 Luxembourg

phone: +352-44116105
fax:   +352-44116113
web: http://www.retrovirology.lu
e-mail: [EMAIL PROTECTED]

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



[PHP] Compare dates

2003-09-29 Thread Shaun
Hi,

How can I compare two dates with PHP, to see if one date occurred before the
other?

Thanks for your help

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



RE: [PHP] Compare dates

2003-09-29 Thread chris . neale
I always use Unix timestamps until I need to format it to a (what's the
word) date for presentation.

Then you can just to a if $x  $y then it happened before $y.

look for mktime(), time(), date() in the manual.

C

-Original Message-
From: Shaun [mailto:[EMAIL PROTECTED]
Sent: 29 September 2003 10:52
To: [EMAIL PROTECTED]
Subject: [PHP] Compare dates


Hi,

How can I compare two dates with PHP, to see if one date occurred before the
other?

Thanks for your help

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



Re: [PHP] fgets prob... !?

2003-09-29 Thread Marek Kilimajer
I don't think php just comes and changes your output. Check the source 
html output if it is realy only one #.

mArK wrote:

H!

I have this segment of script...

...
$resp = fgets( $sock, 512 );
echo $resp;
...
the output must be:
[EMAIL PROTECTED]
but here came php and take the 3 # and convert
they in only one #, and the output currently is:
[EMAIL PROTECTED]

How I say to php: STOP, leave my # in peace?
--

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


php-general Digest 29 Sep 2003 11:23:22 -0000 Issue 2325

2003-09-29 Thread php-general-digest-help

php-general Digest 29 Sep 2003 11:23:22 - Issue 2325

Topics (messages 164182 through 164215):

General .htaccess question
164182 by: Mike Brum
164183 by: Justin French
164184 by: Jon Kriek
164185 by: Robert Cummings
164186 by: Robert Cummings
164207 by: Eugene Lee

PHP coders spare time [OT}
164187 by: Curt Zirzow
164188 by: Robert Cummings
164189 by: Justin French
164191 by: Chris Shiflett
164192 by: - Edwin -
164195 by: Curt Zirzow
164203 by: Marek Kilimajer

trans_sid and forms -- feature request???
164190 by: Justin French
164198 by: Curt Zirzow
164201 by: Curt Zirzow

PHP to Adobe's Flashpaper for reports?
164193 by: dvanatta.azanty.com

Re: mail(); and embedding pictures
164194 by: Manuel Lemos

fsockopen server monitor
164196 by: Cameron Metzke
164197 by: Cameron Metzke
164199 by: Curt Zirzow
164200 by: Cameron Metzke

Re: Submit button
164202 by: Nitin

Re: gettext: changed .mo file, caching issue
164204 by: Christophe Chisogne
164205 by: Christophe Chisogne

add element to an array
164206 by: Angelo Zanetti
164208 by: Matthias Nothhaft

How to install sqlite in redhat 9 with php rpm?
164209 by: Kernel Panic

restart httpd after php.ini change?
164210 by: David T-G
164211 by: Marek Kilimajer

php  xvfb gives xauth command not found
164212 by: Daniel Struck

Compare dates
164213 by: Shaun
164214 by: chris.neale.somerfield.co.uk

Re: fgets prob... !?
164215 by: Marek Kilimajer

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
I think I know the answer to this, but want some confirmation from someone a
bit more knowledgable about Apache and .htaccess files.

My webhost has the default 404 page set to 404.html. For the sake of
consistancy on a number of levels, I prefer a PHP file for this (404.php).
So to do this, I created a basic .htaccess file for this very purpose and it
sits in the root dir.

Now, does this .htaccess file get read for EVERY resource request on my site
- even when the page is found?

Aside from a META redirect from 404.html to 404.php, is there a less
server-intensive way to set my 404 in Apache when I don't have root access?

Thanks 

-M
---End Message---
---BeginMessage---
This is the perfect candidate for a question on an apache list, don't 
you think?

Justin

On Monday, September 29, 2003, at 10:53  AM, Mike Brum wrote:

I think I know the answer to this, but want some confirmation from 
someone a
bit more knowledgable about Apache and .htaccess files.

My webhost has the default 404 page set to 404.html. For the sake of
consistancy on a number of levels, I prefer a PHP file for this 
(404.php).
So to do this, I created a basic .htaccess file for this very purpose 
and it
sits in the root dir.

Now, does this .htaccess file get read for EVERY resource request on 
my site
- even when the page is found?

Aside from a META redirect from 404.html to 404.php, is there a less
server-intensive way to set my 404 in Apache when I don't have root 
access?

Thanks

-M

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

---End Message---
---BeginMessage---
*nods at Justin*



Utterly nothing to do with php.general at all.




-- 
Jon Kriek
http://phpfreaks.com



Justin French [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 This is the perfect candidate for a question on an apache list, don't
 you think?

 Justin


 On Monday, September 29, 2003, at 10:53  AM, Mike Brum wrote:

  I think I know the answer to this, but want some confirmation from
  someone a
  bit more knowledgable about Apache and .htaccess files.
 
  My webhost has the default 404 page set to 404.html. For the sake of
  consistancy on a number of levels, I prefer a PHP file for this
  (404.php).
  So to do this, I created a basic .htaccess file for this very purpose
  and it
  sits in the root dir.
 
  Now, does this .htaccess file get read for EVERY resource request on
  my site
  - even when the page is found?
 
  Aside from a META redirect from 404.html to 404.php, is there a less
  server-intensive way to set my 404 in Apache when I don't have root
  access?
 
  Thanks
 
  -M
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
  ---
  [This E-mail scanned for viruses]
 
 
---End Message---
---BeginMessage---
In your 404.php script, add a line like error_log( '404.php invoked' ),
then check your log.

Cheers,
Rob.

On Sun, 2003-09-28 at 20:53, 

Re: [PHP] Compare dates

2003-09-29 Thread Blue Prawn
 How can I compare two dates with PHP, to see if one date occurred before
 the other?

probably not the best way but:

if the date is formated like this 20030929 (today) 20030928 (yesterday)
I think it is quite easy:
if ( (int)$today  (int)$yesterday )
or perhaps like this:
if ( strcmp($today, $yesterday) )

if you have to change the format, you can use :
http://www.php.net/manual/en/function.preg-replace.php

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



[PHP] php and checkboxes.

2003-09-29 Thread Angelo Zanetti

Hi all

I have a table that is populated from a database which gets the IDs of the
records from a php array.Every row in the table has a checkbox next to the
actual record, what I want to do is to allow the user to select the records
they want to remove by clicking the checkbox(es) and then click a button to
submit the form.

so how do I remove these records? do I:

-do I do an array_diff and then just select the records that are remaining?

this to me seems the most logical.

tia

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



Re: [PHP] php and checkboxes.

2003-09-29 Thread Marek Kilimajer
Simple:
foreach($_POST['del_checkboxes'] as $id) {
$sql=delete from table where id='$id';
}
Checkboxes are created using
input  name=del_checkboxes value=?= $id ?
Angelo Zanetti wrote:

Hi all

I have a table that is populated from a database which gets the IDs of the
records from a php array.Every row in the table has a checkbox next to the
actual record, what I want to do is to allow the user to select the records
they want to remove by clicking the checkbox(es) and then click a button to
submit the form.
so how do I remove these records? do I:

-do I do an array_diff and then just select the records that are remaining?

this to me seems the most logical.

tia

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


RE: [PHP] php and checkboxes.

2003-09-29 Thread Angelo Zanetti

Hi Marek,

I dont actually want to delete the record from the database, perhaps I wasnt
very clear in my explanation, but I just need to remove that entry from the
table.

kinda like when deleting mail from your web email account like hotmail.


-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: Monday, September 29, 2003 1:36 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] php and checkboxes.


Simple:
foreach($_POST['del_checkboxes'] as $id) {
$sql=delete from table where id='$id';
}

Checkboxes are created using
input  name=del_checkboxes value=?= $id ?

Angelo Zanetti wrote:

 Hi all

 I have a table that is populated from a database which gets the IDs of the
 records from a php array.Every row in the table has a checkbox next to the
 actual record, what I want to do is to allow the user to select the
records
 they want to remove by clicking the checkbox(es) and then click a button
to
 submit the form.

 so how do I remove these records? do I:

 -do I do an array_diff and then just select the records that are
remaining?

 this to me seems the most logical.

 tia


--
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] regexp: 'a correctly parenthesized substring advanced'

2003-09-29 Thread Jaaboo
Hi ,
this is my regex for php to extract php-function-calls from source. It now
works for strings like:
func1($param,abc)
func1($param1,func2($param2,abc))

but if i try to catch

func1($param1,(c) by ARTADA for example)´, func2($param2,786))

 it fails because of the paranthesis between the   .
hás anyone an idea of how i can ignore paranthesis between the   for
correct
counting the closing paranthesis

here is my current regex:
/([a-zA-Z]\w*?)\s*(\(((?.*?)|.*?(?R)*)\))+/msi

this looks a little stupid but it catches all function calls within an
codeblock without the need of an function delimiter like ; in php
I need the functionality for a templating system where the syntax for the
templating system would be simpler and resitricted php code that i complete
to full working php code.

thax a lot for any suggestion

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



Re: [PHP] php and checkboxes.

2003-09-29 Thread Eugene Lee
On Mon, Sep 29, 2003 at 01:43:08PM +0200, Angelo Zanetti wrote:
: 
: Marek Kilimajer suggested:
: 
:  Angelo Zanetti wrote:
:  
:   I have a table that is populated from a database which gets the
:   IDs of the records from a php array.Every row in the table has a
:   checkbox next to the actual record, what I want to do is to allow
:   the user to select the records they want to remove by clicking the
:   checkbox(es) and then click a button to submit the form.
:  
:   so how do I remove these records?
:  
:  Simple:
:  foreach($_POST['del_checkboxes'] as $id) {
:  $sql=delete from table where id='$id';
:  }
: 
: I dont actually want to delete the record from the database, perhaps I
: wasnt very clear in my explanation, but I just need to remove that
: entry from the table.

To remove a record is to delete a row.  Same thing.  When you say
entry, do you mean record or row?  Or do you mean something else?

If you want to change one or more columns of a row (this can also
be stated as one or more fields of a record), use the SQL command
UPDATE table SET col1=expr1,col1=expr2,... WHERE ID=id_expr.

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



[PHP] PHP Rading excel files

2003-09-29 Thread BENARD Jean-philippe
Hi !

It's possible to export data to excel (csv, xml, PEAR excel file
writing, ...) but is it possible to import data from excel ? (i.e.: I
want to get the data which is in Cell A1 of sheet Toto in the posted
.xls file).

Thanks in advance.

(o_   BENARD Jean-Philippe - Consultant STERIA Infogérance
(o_   (o_   //\ RENAULT DTSI/ODPS/[EMAIL PROTECTED] * ALO * API : MLB 02C 1 14
(/)_  (\)_  V_/_   2 Av du vieil étang * 78181 MONTIGNY-LE-BRETONNEUX
   Tél : +33 1-30-03-47-83 * Fax : +33 1-30-03-42-10

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



Re: [PHP] Compare dates

2003-09-29 Thread Leif K-Brooks
Shaun wrote:

How can I compare two dates with PHP, to see if one date occurred before the
other?
 

Convert them to a timestamps (strtotime()), then just compare them:

$date1 = 'september 10th 2003';
$date2 = 'september 20th 2003';
$date1_ts = strtotime($date1);
$date2_ts = strtotime($date2);
if($date1_ts  $date2_ts){
echo 'Date 1 is before date 2.';
}else{
echo 'Date 2 is before date 1.';
}
--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] General .htaccess question

2003-09-29 Thread Marek Kilimajer
This should not bother you. If you get enough load then .htaccess file 
is cached in the memory. If your load is moderate then it does not make 
much difference. And since your webhost enabled this feature they should 
know what they are doing.

Mike Brum wrote:

I think I know the answer to this, but want some confirmation from someone a
bit more knowledgable about Apache and .htaccess files.
My webhost has the default 404 page set to 404.html. For the sake of
consistancy on a number of levels, I prefer a PHP file for this (404.php).
So to do this, I created a basic .htaccess file for this very purpose and it
sits in the root dir.
Now, does this .htaccess file get read for EVERY resource request on my site
- even when the page is found?
Aside from a META redirect from 404.html to 404.php, is there a less
server-intensive way to set my 404 in Apache when I don't have root access?
Thanks 

-M

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


[PHP] nonblocking socket causes 100% cpu usage

2003-09-29 Thread Joe
I have a commandline php script, which opens a nonblocking socket to
a server.  Inside the message loop, where it polls the socket to determine
whether there is any data to read/write, I've been running into problems,
where the application takes as much CPU time as it can (80%, 90%,
sometimes 99%, etc)...  Normally, using socket_select() with a timeout
should allow allow it to poll the socket without using all the cpu time,
but it isn't working.  I've tried with timeouts of 15ms, 100ms, 200ms,
500ms, 1sec, and it's still using 100% cpu time.  Even adding sleep() and
usleep() calls will not relieve the system load that the script causes. 
For now, I've fixed the problem temporarily by not setting the socket in
nonblocking mode (so it blocks when reading), but the reason I need to use
nonblocking is that I'm adding more to it that will require that the
script can respond to events *between* reading from the socket.  Can
anyone explain why socket_select and other timeout function calls would
still cause it to use 100% cpu time?  If it makes a difference, the script
is on gentoo linux, and it includes a fork() call, to fork into the
background (though this shouldn't make a difference).

Is it possible that socket_select() ignores the timeout values, if the
sockets are nonblocking?  Or would I be able to use socket_select() on a
blocking socket, to simulate the effect of a nonblocking socket (so that I
would only call socket_read() IF socket_select() indicates that there is
data waiting.)

Thanks
Joe

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



[PHP] MerlinWork PHP Framework

2003-09-29 Thread Fabrizio Balliano
Hi to all,
I'd like to present show you a PHP framework written by my company:
MerlinWork.

Its built with the concept of allowing developers to build a web
application like they would do with a client application developing
environment.

The result is a stateful application, managed by events.
Developer has a set of widget to use, like tables, fields, buttons etc.

It's distribuited under the GPL licence and it's available at
http://merlinwork.sourceforge.net.

An interactive (easy development) demo is available at
http://merlinwork-demo.crealabs.it.

Its core features are:
- strongly object oriented
- stateful
- many usable and customizable objects
- self installing
- no database required

Feel free to download and try it and make me know what do you think
about it.
Regards

-- 
Fabrizio Balliano


CREALABS
Viale dei Mughetti, 13/A - 10151 Torino - Italy
Tel. +39-011-735645 - Fax +39-011-735645
http://www.crealabs.it - mailto:[EMAIL PROTECTED]

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



RE: [PHP] MerlinWork PHP Framework

2003-09-29 Thread chris . neale
I like I like.

Look like it might cut a lot of tedious leg-work out.

Regards

Chris

-Original Message-
From: Fabrizio Balliano [mailto:[EMAIL PROTECTED]
Sent: 29 September 2003 12:37
To: [EMAIL PROTECTED]
Subject: [PHP] MerlinWork PHP Framework


Hi to all,
I'd like to present show you a PHP framework written by my company:
MerlinWork.

Its built with the concept of allowing developers to build a web
application like they would do with a client application developing
environment.

The result is a stateful application, managed by events.
Developer has a set of widget to use, like tables, fields, buttons etc.

It's distribuited under the GPL licence and it's available at
http://merlinwork.sourceforge.net.

An interactive (easy development) demo is available at
http://merlinwork-demo.crealabs.it.

Its core features are:
- strongly object oriented
- stateful
- many usable and customizable objects
- self installing
- no database required

Feel free to download and try it and make me know what do you think
about it.
Regards

-- 
Fabrizio Balliano


CREALABS
Viale dei Mughetti, 13/A - 10151 Torino - Italy
Tel. +39-011-735645 - Fax +39-011-735645
http://www.crealabs.it - mailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



RE: [PHP] Resource Limits

2003-09-29 Thread Donald Tyler
Just incase you weren't aware. You can change the Max execution time
during the script with:

set_time_limit(Milliseconds);

-Original Message-
From: Decapode Azur [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 27, 2003 5:51 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Resource Limits

hi the list,

How can I get the values of 'max_execution_time', 'max_input_time' and 
'memory_limit' from my php script ?


thanks

-- 
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 to smart refresh php section using iframe?

2003-09-29 Thread Donald Tyler
This is not possible with PHP alone. You need to use some client side
code such as JavaScript or Flash.

I would recommend JavaScript. It would be pretty easy to accomplish what
you are talking about with that.

Grab yourself a copy of JavaScript the Definitive Guide by Orielly.
It's pretty comprehensive.

-Original Message-
From: ascll [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 27, 2003 1:44 AM
To: [EMAIL PROTECTED]
Subject: [PHP] How to smart refresh php section using iframe?

Greetings,

I'm newbie in php and I would like to develop a .php page that
constantly
retrieves data from MySQL database, but I having difficulties to doing
so.
Please show me the complete code, if possible.


Thanks in advance.

= index.php =
html
body
table

!-- 
// SECTION A
// =
// Load one only, no need to refresh
--
tr
  tdColumn1/td
  tdColumn2/td
  tdColumn3/td
  tdColumn4/td
  tdColumn5/td
/tr


!-- 
// SECTION B
// =
// Using .php to retrieve data from MySQL database (no problem)
// together with iframe (I don't know how to configure iframe)
// and also use javascript to auto refresh this section every 1-second
(SECTION B ONLY)
// since the data show on section B would keep on changing (I don't know
the
codes)
--
tr
  td . $Column1 . /td
  td . $Column2 . /td
  td . $Column3 . /td
  td . $Column4 . /td
  td . $Column5 . /td
/tr


!-- 
// SECTION C
// =
// Auto refresh this section every 30-second (SECTION C ONLY and I don't
know the codes)
--
tr
  td . $Column1 . /td
  td . $Column2 . /td
  td . $Column3 . /td
  td . $Column4 . /td
  td . $Column5 . /td
/tr


!-- 
// SECTION D
// =
// Load one only, no need to refresh
--
tr
  tdEnd of Record/td
/tr


/table
/body
/html
= index.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] Please visit my php program

2003-09-29 Thread Nelson Rodrguez-Pea Alarcn
Hi Ryan,

Ryan A wrote:
Hey everyone,
Please visit my captcha program here and tell me if its good
here I got the following error (or notice):

Notice: Undefined index: TheSecretWord in 
/usr163/home/b/e/bestweb/public_html/captcha/3/samplePost.php on line 25
	[alt]Human Input Validation Failed

--
regards,

Nelson Rodrguez-Pea A.
Diseo y Desarrollo Web y Multimedia

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


RE: [PHP] PHP coders spare time [OT}

2003-09-29 Thread Jay Blanchard
[snip]
 http://zirzow.dyndns.org/html/mlists/php_general/

The fact that you're the top responder in the last 30 days pretty much 
confirms you have too much spare time Curt!
[/snip]

LOL! Very revealing and funny stuff 

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



[PHP] search a string backwards - like reversed stripos

2003-09-29 Thread Chris Widmer
hello,

i am looking for a function that easily searches a sting backwards - 
just like stripos but reversed. is there already one part of php or does 
anyone have a nice function written? right now i do it by reversing the 
sting and using strpos, but this is highly inefficient. any ideas/solutions?

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


RE: [PHP] PHP coders spare time [OT}

2003-09-29 Thread Jay Blanchard
[snip]
And whats really scary is I'm tempted to do that :) I can easily
read all the 164194 messages sitting on the news server (since May
2000) and then build a summary poster summary page.

Then I just need to come up with some logic to determain who has a
tendency to (be) flamed.
[/snip]

You may also want to include logic to determine who is most likely to do
the flaming. 

:)

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



RE: [PHP] PHP coders spare time [OT}

2003-09-29 Thread chris . neale
And possibly the best looking site I've seen in years. Colours, curves -
bring it on

PLENTY of spare time I think...

C

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED]
Sent: 29 September 2003 13:00
To: Justin French; Curt Zirzow
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] PHP coders spare time [OT}


[snip]
 http://zirzow.dyndns.org/html/mlists/php_general/

The fact that you're the top responder in the last 30 days pretty much 
confirms you have too much spare time Curt!
[/snip]

LOL! Very revealing and funny stuff 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

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



Re: [PHP] Resource Limits

2003-09-29 Thread Eugene Lee
On Mon, Sep 29, 2003 at 07:49:40AM -0500, Donald Tyler wrote:
:
: Decapode Azur asked:
:  
:  How can I get the values of 'max_execution_time', 'max_input_time' and 
:  'memory_limit' from my php script ?
:
: Just incase you weren't aware. You can change the Max execution time
: during the script with:
: 
: set_time_limit(Milliseconds);

That should be seconds, not milliseconds.  :-)

http://www.php.net/manual/en/function.set-time-limit.php

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



RE: [PHP] How to smart refresh php section using iframe?

2003-09-29 Thread Jay Blanchard
[snip]
This is not possible with PHP alone. You need to use some client side
code such as JavaScript or Flash.
[/snip]

I think that with a combination (I have not tested this) of ob_start,
ob_flush(), sleep(), and header() that this could be accomplished.

ob_start();

gather output

ob_flush(); //flush output
sleep(); //waiting to refresh
header($PHP_SELF); exit();

Again, this is not tested, but my very foggy Monday morning brain says
this should work, no?

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



Re: [PHP] PHP coders spare time [OT}

2003-09-29 Thread CPT John W. Holmes
From: Marek Kilimajer [EMAIL PROTECTED]

 CPT John W. Holmes [EMAIL PROTECTED] and John W. Holmes
 [EMAIL PROTECTED] is the same address, just a different name
 (in and out of office ;) John made it to be second.

Maybe this list shouldn't be public, since it appears I send just as much
email from work as I do at home ;)

---John Holmes...

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



Re: [PHP] php and checkboxes.

2003-09-29 Thread CPT John W. Holmes
From: Angelo Zanetti [EMAIL PROTECTED]

 I dont actually want to delete the record from the database, perhaps I
wasnt
 very clear in my explanation, but I just need to remove that entry from
the
 table.

 kinda like when deleting mail from your web email account like hotmail.

Same idea...

input type=checkbox name=remove[] value=xx

Where xx is the ID of that entry/row.

Then, to select whatever is in the table, minus whatever was selected...

$list = implode(',',$_POST['remove']);
$query = SELECT * FROM Table WHERE id NOT IN ($list);

If you want this list to propagate each time things are selected, then
you'll have to remember what's been selected using the session or hidden
elements.

---John Holmes...

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



[PHP] RE : [PHP] PHP Rading excel files

2003-09-29 Thread BENARD Jean-philippe
I know exporting xls file to csv (or other tagged export) is not very
difficult but in order to make a « all-users » application we must
accept xls files.

 

Cordialement,
Jean-Philippe BENARD
Consultant STERIA Infogérance
([EMAIL PROTECTED]) 

-Message d'origine-
De : Kevin Bruce [mailto:[EMAIL PROTECTED] 
Envoyé : lundi 29 septembre 2003 14:40
À : BENARD Jean-philippe
Objet : Re: [PHP] PHP  Rading excel files

 

I created a database dump that accepts tab delimited files. You'd have
to export your xls file to a tab delimited file (which is a no-brainer).

Here is the code (it was made to import into a user database, change it
to suite your purposes):

?

if(!$dump)
{
?
  There are currently b?php echo $total ?/b
entries in the 
  ?php echo $user_admin ? database.br
  Choose your ?php echo $mod_name ? Admin action from
the above 
  menu. /font/p
h1font size=2Database Import/font/h1
font size=2 
form action=?php echo $_SERVER[PHP_SELF]
??dump=predumpcategory=?php echo $category ? method=post
enctype=multipart/form-data name=form1
  font size=2 Tab Delimited File Database Import 
  input type=file name=file accesskey=1/label
  input name=user_level type=hidden id=user_level
value=?php echo $category ?
  br
  input type=submit name=Submit value=Submit
  /font 
/form
?php
}

if($dump == predump)
{
if(!$file_name)
{
echo File did not upload! Please hit your back button and
upload your import file.;
}
else
{
//read file
$fp = fopen($file, r);
$data = fread($fp, filesize($file));
fclose($fp);
$fileC = explode(\r, $data);
flush();

//get the 1st line, which usually contains the field names
$sample = $fileC[0];

//get the longest entry as a sample of all fields, just in
case the first line doesn't contain the field names
$sample2 = max($fileC);
$samplenum = explode(\t,$sample);
$numfields = count($samplenum);
$sample = td .
str_replace(\t,nbsp;/tdtd,$sample) . nbsp;/td\n;
$sample2 = td .
str_replace(\t,nbsp;/tdtd,$sample2) . nbsp;/td\n;

//set the form variable to carry over into next form
$import = implode($fileC,|);
?
form name=form2 method=post action=?php echo
$_SERVER[PHP_SELF] ??dump=dumpcategory=?php echo $category ?
  input name=category type=hidden value=?php echo
$category ?
  ?php 
$fieldrop = fieldrop($dbh,$DBname,$tablename);
?
  table  border=1 cellpadding=5 cellspacing=0
bordercolor=#CC summary=Match up the database fields with the
sample entry form this import
caption align=top
Match up the database fields with the sample entry
form this 
import br
There are ?php echo $numfields - 1; ?-?php echo
$numfields; ? entries in this import.
/caption
tr bgcolor=#CC 
  ?php
for($n=0;$n$numfields;$n++)
{
  echo td 
div align=\center\ 
  select name=\field[$n]\ id=\field[$n]\

echo $fieldrop
  /select
/div/td;
} 
?
/tr
tr class=fonty ?php echo $sample ? /tr
tr class=fonty ?php echo $sample2 ? /tr
tr bgcolor=#CC 
  td colspan=15 div align=centerfont
size=2 
  input name=numfields type=hidden
value=?php echo $numfields; ?
  input name=import type=hidden
value=?php echo base64_encode($import) ?
  /font/div
div align=centerfont size=2font
size=2 br
label
input name=notify type=checkbox
value=1 checked
Send welcome email to imported entries.
(choosing this means it will take appximately ?php echo $numfields - 1;
?-?php echo $numfields; ? seconds to complete the import)/label
  br
  input type=submit name=Submit
value=Submit
  /font/font/div/td
/tr
  /table
/form
?php 
}
}
elseif($dump == dump)
{
//set up the insert query
$insert = ;
$maxfield = count($field);
for($n=0; $n$numfields;$n++)
{

[PHP] Export resultset

2003-09-29 Thread DPCMA Metalito
Hi There,

New to this list. I would like to know if anybody knows where can I found 
information about how can I generate an Excel Spreadsheet, with the resulset 
of an LDAP query that my script made. The goal is that MS Explorer can 
download and load the xls inside the browser, and other ones download the 
file.

Thanx in advance.
Regards.

DPC
_
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus

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


Re: [PHP] RE : [PHP] PHP Rading excel files

2003-09-29 Thread Marek Kilimajer
Given that excel (and generaly any microsoft app/bloatware) puts so much 
junk into the files that sometimes excel itself cannot read it it is 
virtualy impossible to write a pure php solution. The easiest path is to 
use COM and run excel on the server, but this rules out any non windows 
server. Or try to dig into openoffice and wrap its excel routines in a 
php extension.

BENARD Jean-philippe wrote:

I know exporting xls file to csv (or other tagged export) is not very
difficult but in order to make a « all-users » application we must
accept xls files.
 

Cordialement,
Jean-Philippe BENARD
Consultant STERIA Infogérance
([EMAIL PROTECTED]) 

-Message d'origine-
De : Kevin Bruce [mailto:[EMAIL PROTECTED] 
Envoyé : lundi 29 septembre 2003 14:40
À : BENARD Jean-philippe
Objet : Re: [PHP] PHP  Rading excel files

 

I created a database dump that accepts tab delimited files. You'd have
to export your xls file to a tab delimited file (which is a no-brainer).
Here is the code (it was made to import into a user database, change it
to suite your purposes):
?

if(!$dump)
{
?
  There are currently b?php echo $total ?/b
entries in the 
  ?php echo $user_admin ? database.br
  Choose your ?php echo $mod_name ? Admin action from
the above 
  menu. /font/p
h1font size=2Database Import/font/h1
font size=2 
form action=?php echo $_SERVER[PHP_SELF]
??dump=predumpcategory=?php echo $category ? method=post
enctype=multipart/form-data name=form1
  font size=2 Tab Delimited File Database Import 
  input type=file name=file accesskey=1/label
  input name=user_level type=hidden id=user_level
value=?php echo $category ?
  br
  input type=submit name=Submit value=Submit
  /font 
/form
?php
}

if($dump == predump)
{
if(!$file_name)
{
echo File did not upload! Please hit your back button and
upload your import file.;
}
else
{
//read file
$fp = fopen($file, r);
$data = fread($fp, filesize($file));
fclose($fp);
$fileC = explode(\r, $data);
flush();
//get the 1st line, which usually contains the field names
$sample = $fileC[0];
//get the longest entry as a sample of all fields, just in
case the first line doesn't contain the field names
$sample2 = max($fileC);
$samplenum = explode(\t,$sample);
$numfields = count($samplenum);
$sample = td .
str_replace(\t,nbsp;/tdtd,$sample) . nbsp;/td\n;
$sample2 = td .
str_replace(\t,nbsp;/tdtd,$sample2) . nbsp;/td\n;
//set the form variable to carry over into next form
$import = implode($fileC,|);
?
form name=form2 method=post action=?php echo
$_SERVER[PHP_SELF] ??dump=dumpcategory=?php echo $category ?
  input name=category type=hidden value=?php echo
$category ?
  ?php 
$fieldrop = fieldrop($dbh,$DBname,$tablename);
?
  table  border=1 cellpadding=5 cellspacing=0
bordercolor=#CC summary=Match up the database fields with the
sample entry form this import
caption align=top
Match up the database fields with the sample entry
form this 
import br
There are ?php echo $numfields - 1; ?-?php echo
$numfields; ? entries in this import.
/caption
tr bgcolor=#CC 
  ?php
for($n=0;$n$numfields;$n++)
{
  echo td 
div align=\center\ 
  select name=\field[$n]\ id=\field[$n]\

echo $fieldrop
  /select
/div/td;
} 
?
/tr
tr class=fonty ?php echo $sample ? /tr
tr class=fonty ?php echo $sample2 ? /tr
tr bgcolor=#CC 
  td colspan=15 div align=centerfont
size=2 
  input name=numfields type=hidden
value=?php echo $numfields; ?
  input name=import type=hidden
value=?php echo base64_encode($import) ?
  /font/div
div align=centerfont size=2font
size=2 br
label
input name=notify type=checkbox
value=1 checked
Send welcome email to imported entries.
(choosing this means it will take appximately ?php echo $numfields - 1;
?-?php echo $numfields; ? seconds to complete the 

RE: [PHP] RE : [PHP] PHP Rading excel files

2003-09-29 Thread chris . neale
I'd consider using COM to work with Excel files if you can't find another
way to get the information out. The PHP Handbook (O'Reilly) has a good
chapter on that sort of thing. Then you can just refer to a cell as you
would in Excel VBA.

Sorry I can't think of anything better!

C

-Original Message-
From: BENARD Jean-philippe
[mailto:[EMAIL PROTECTED]
Sent: 29 September 2003 13:24
To: 'Kevin Bruce'
Cc: [EMAIL PROTECTED]
Subject: [PHP] RE : [PHP] PHP  Rading excel files


I know exporting xls file to csv (or other tagged export) is not very
difficult but in order to make a « all-users » application we must
accept xls files.

 

Cordialement,
Jean-Philippe BENARD
Consultant STERIA Infogérance
([EMAIL PROTECTED]) 

-Message d'origine-
De : Kevin Bruce [mailto:[EMAIL PROTECTED] 
Envoyé : lundi 29 septembre 2003 14:40
À : BENARD Jean-philippe
Objet : Re: [PHP] PHP  Rading excel files

 

I created a database dump that accepts tab delimited files. You'd have
to export your xls file to a tab delimited file (which is a no-brainer).

Here is the code (it was made to import into a user database, change it
to suite your purposes):

?

if(!$dump)
{
?
  There are currently b?php echo $total ?/b
entries in the 
  ?php echo $user_admin ? database.br
  Choose your ?php echo $mod_name ? Admin action from
the above 
  menu. /font/p
h1font size=2Database Import/font/h1
font size=2 
form action=?php echo $_SERVER[PHP_SELF]
??dump=predumpcategory=?php echo $category ? method=post
enctype=multipart/form-data name=form1
  font size=2 Tab Delimited File Database Import 
  input type=file name=file accesskey=1/label
  input name=user_level type=hidden id=user_level
value=?php echo $category ?
  br
  input type=submit name=Submit value=Submit
  /font 
/form
?php
}

if($dump == predump)
{
if(!$file_name)
{
echo File did not upload! Please hit your back button and
upload your import file.;
}
else
{
//read file
$fp = fopen($file, r);
$data = fread($fp, filesize($file));
fclose($fp);
$fileC = explode(\r, $data);
flush();

//get the 1st line, which usually contains the field names
$sample = $fileC[0];

//get the longest entry as a sample of all fields, just in
case the first line doesn't contain the field names
$sample2 = max($fileC);
$samplenum = explode(\t,$sample);
$numfields = count($samplenum);
$sample = td .
str_replace(\t,nbsp;/tdtd,$sample) . nbsp;/td\n;
$sample2 = td .
str_replace(\t,nbsp;/tdtd,$sample2) . nbsp;/td\n;

//set the form variable to carry over into next form
$import = implode($fileC,|);
?
form name=form2 method=post action=?php echo
$_SERVER[PHP_SELF] ??dump=dumpcategory=?php echo $category ?
  input name=category type=hidden value=?php echo
$category ?
  ?php 
$fieldrop = fieldrop($dbh,$DBname,$tablename);
?
  table  border=1 cellpadding=5 cellspacing=0
bordercolor=#CC summary=Match up the database fields with the
sample entry form this import
caption align=top
Match up the database fields with the sample entry
form this 
import br
There are ?php echo $numfields - 1; ?-?php echo
$numfields; ? entries in this import.
/caption
tr bgcolor=#CC 
  ?php
for($n=0;$n$numfields;$n++)
{
  echo td 
div align=\center\ 
  select name=\field[$n]\ id=\field[$n]\

echo $fieldrop
  /select
/div/td;
} 
?
/tr
tr class=fonty ?php echo $sample ? /tr
tr class=fonty ?php echo $sample2 ? /tr
tr bgcolor=#CC 
  td colspan=15 div align=centerfont
size=2 
  input name=numfields type=hidden
value=?php echo $numfields; ?
  input name=import type=hidden
value=?php echo base64_encode($import) ?
  /font/div
div align=centerfont size=2font
size=2 br
label
input name=notify type=checkbox
value=1 checked
Send welcome email to imported entries.
(choosing this means it will take appximately ?php 

RE: [PHP] RE : [PHP] PHP Rading excel files

2003-09-29 Thread chris . neale
Just thought that it might be worth considering putting some functionality
into the Excel spreadsheet to trigger the PHP application.

I've created Excel spreadsheets in the past with a VBA macro or two in it
which allows users to update information on a intranet site from the
spreadsheet. They update their spreadsheet as normal and then press a button
which opens up a web browser control and passes the information to the
server in a get statement. Page reloads, capture the return message from the
server and show to user who never sees the web browser.

I don't know exactly what you're developing so can't be sure if this will be
of any use.

Regards

Chris



-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: 29 September 2003 13:41
To: BENARD Jean-philippe
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] RE : [PHP] PHP  Rading excel files


Given that excel (and generaly any microsoft app/bloatware) puts so much 
junk into the files that sometimes excel itself cannot read it it is 
virtualy impossible to write a pure php solution. The easiest path is to 
use COM and run excel on the server, but this rules out any non windows 
server. Or try to dig into openoffice and wrap its excel routines in a 
php extension.

BENARD Jean-philippe wrote:

 I know exporting xls file to csv (or other tagged export) is not very
 difficult but in order to make a « all-users » application we must
 accept xls files.
 
  
 
 Cordialement,
 Jean-Philippe BENARD
 Consultant STERIA Infogérance
 ([EMAIL PROTECTED]) 
 
 -Message d'origine-
 De : Kevin Bruce [mailto:[EMAIL PROTECTED] 
 Envoyé : lundi 29 septembre 2003 14:40
 À : BENARD Jean-philippe
 Objet : Re: [PHP] PHP  Rading excel files
 
  
 
 I created a database dump that accepts tab delimited files. You'd have
 to export your xls file to a tab delimited file (which is a no-brainer).
 
 Here is the code (it was made to import into a user database, change it
 to suite your purposes):
 
 ?
 
 if(!$dump)
 {
 ?
   There are currently b?php echo $total ?/b
 entries in the 
   ?php echo $user_admin ? database.br
   Choose your ?php echo $mod_name ? Admin action from
 the above 
   menu. /font/p
 h1font size=2Database Import/font/h1
 font size=2 
 form action=?php echo $_SERVER[PHP_SELF]
 ??dump=predumpcategory=?php echo $category ? method=post
 enctype=multipart/form-data name=form1
   font size=2 Tab Delimited File Database Import 
   input type=file name=file accesskey=1/label
   input name=user_level type=hidden id=user_level
 value=?php echo $category ?
   br
   input type=submit name=Submit value=Submit
   /font 
 /form
 ?php
 }
 
 if($dump == predump)
 {
 if(!$file_name)
 {
 echo File did not upload! Please hit your back button and
 upload your import file.;
 }
 else
 {
 //read file
 $fp = fopen($file, r);
 $data = fread($fp, filesize($file));
 fclose($fp);
 $fileC = explode(\r, $data);
 flush();
 
 //get the 1st line, which usually contains the field names
 $sample = $fileC[0];
 
 //get the longest entry as a sample of all fields, just in
 case the first line doesn't contain the field names
 $sample2 = max($fileC);
 $samplenum = explode(\t,$sample);
 $numfields = count($samplenum);
 $sample = td .
 str_replace(\t,nbsp;/tdtd,$sample) . nbsp;/td\n;
 $sample2 = td .
 str_replace(\t,nbsp;/tdtd,$sample2) . nbsp;/td\n;
 
 //set the form variable to carry over into next form
 $import = implode($fileC,|);
 ?
 form name=form2 method=post action=?php echo
 $_SERVER[PHP_SELF] ??dump=dumpcategory=?php echo $category ?
   input name=category type=hidden value=?php echo
 $category ?
   ?php 
 $fieldrop = fieldrop($dbh,$DBname,$tablename);
 ?
   table  border=1 cellpadding=5 cellspacing=0
 bordercolor=#CC summary=Match up the database fields with the
 sample entry form this import
 caption align=top
 Match up the database fields with the sample entry
 form this 
 import br
 There are ?php echo $numfields - 1; ?-?php echo
 $numfields; ? entries in this import.
 /caption
 tr bgcolor=#CC 
   ?php
 for($n=0;$n$numfields;$n++)
 {
   echo td 
 div align=\center\ 
   select name=\field[$n]\ id=\field[$n]\
 
   

Re: [PHP] php xvfb gives xauth command not found

2003-09-29 Thread Ray Hunter
 $test=exec(/usr/bin/xvfb-run /usr/bin/njplot -psonly testfile 21);
 echo $test;

Try 

$test=exec(/usr/bin/xvfb-run /usr/bin/njplot -psonly testfile );

--
BigDog

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



Re: [PHP] Export resultset

2003-09-29 Thread Marek Kilimajer
I use this class: 
http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/

DPCMA Metalito wrote:

Hi There,

New to this list. I would like to know if anybody knows where can I 
found information about how can I generate an Excel Spreadsheet, with 
the resulset of an LDAP query that my script made. The goal is that MS 
Explorer can download and load the xls inside the browser, and other 
ones download the file.

Thanx in advance.
Regards.

DPC
_
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus

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


Re: [PHP] Export resultset

2003-09-29 Thread CPT John W. Holmes
From: DPCMA Metalito [EMAIL PROTECTED]

 New to this list. I would like to know if anybody knows where can I found
 information about how can I generate an Excel Spreadsheet, with the
resulset
 of an LDAP query that my script made. The goal is that MS Explorer can
 download and load the xls inside the browser, and other ones download the
 file.

Look on phpclasses.org or sourceforge.net for some classes. There are some
out there.

Although the easiest method is to just create an HTML table and send Excel
headers with header(). Excel will turn the HTML into a spreadsheet.

---John Holmes...

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



Re: [PHP] php xvfb gives xauth command not found

2003-09-29 Thread Ray Hunter

 $test=exec(/usr/bin/xvfb-run /usr/bin/njplot -psonly testfile );

Actually, I think that you can just run the command without the xvfb-run
command...

$test = exec(/usr/bin/njplot -psonly testfile );

that should just create the testfile.ps file and not fire up a x-window.
The error with the xvfb-run is that the command cannot find the xauth
command that it needs to set up the x server environment. Try the above
one and see if that works for you...if not then install xauth and revert
to running it in xvfb-run.

--
BigDog

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



Re: [PHP] add element to an array

2003-09-29 Thread Chris Sherwood

-- snip --
 Hi, I want to add a new element to an array in php, is the following way
the
 correct way? assuming that $chk is an array and $ID contains a value.


 $j = count($chk);
 $j++;
 $chk[$j] = $ID;
-- snip --

Yes that is one method of doing it. another method of adding an element to
an array is by using array_push

syntax is

array_push($array,$vartoadd);

there is also a keyed method but I am not 100% familiar with it and still
getting the hang of it.

Chris

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



Re: [PHP] gettext: changed .mo file, caching issue

2003-09-29 Thread daniel hahler
on Mon, 29 Sep 2003 10:24:09 +0200 Christophe Chisogne wrote:

 This works good, but if the .mo file gets changed the old content is
 returned by calls to gettext, until I restart Apache.

CC gettext uses a caching method to speed up looking translation
CC strings, which explain why Apache must be reloaded [1]

That's bad, as I cannot restart Apache at my remote hosts computer..

I also found a blog entry, saying that Because when PHP is running as
an Apache module, each page gets handled by a separated thread of the
same process. And the problem is, you set the language by writing a
variable to the environment (puttenv()). That's how gettext works.
Unfortunately, changing the environment affects the whole process...
thus all running (sleeping indeed ) threads for that process!
see http://fplanque.net/Blog/devblog/2003/08/20/p355

That would mean that two different people accessing the page at the
same time could get mixed up translations, as through PutEnv usage?

CC Perhaps you can try php-i18n mailing list, which is really low
CC traffic.

Thanks for the hint. Just went through the archive, but did not find a
good solution. Also discovered this list in the past days through
google.

So, I think I'll go back to simple include(). Still I have to think
about using a single big one for each language or seperate it for
sections with more content..

:/


-- 
shinE!
http://www.thequod.de ICQ#152282665
PGP 8.0 key: http://thequod.de/danielhahler.asc
I'm sitting in silence or radio music. 

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



[PHP] RE: Add element

2003-09-29 Thread Chris Sherwood
Warning ! Don't add one to your key ($j++) in this case. The count()
method count ( :) ) return the number of existing keys in the $chk
array. You'll make hole in your array if you do this :

$arr[0] = toto;

count($arr) = 1;

$arr[1] = tata;

count($arr) = 2;

$arr[count[$arr]++] = titi; = $arr(0=toto, 1=tata, 3=titi) (no
2=)

Prefer array_push($arr, ...)

Cordialement,
Jean-Philippe BENARD
Consultant STERIA Infogérance
([EMAIL PROTECTED])


Thanks for catching that Jean

:| damn I hate monday mornings

Re: [PHP] search a string backwards - like reversed stripos

2003-09-29 Thread Curt Zirzow
* Thus wrote Chris Widmer ([EMAIL PROTECTED]):
 hello,
 
 i am looking for a function that easily searches a sting backwards - 
 just like stripos but reversed. is there already one part of php or does 
 anyone have a nice function written? right now i do it by reversing the 
 sting and using strpos, but this is highly inefficient. any ideas/solutions?

You could use the strrchr function to achieve this:

$pos = strrpos(strtolower($str), $needle);


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

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



[PHP] Evolution syncing

2003-09-29 Thread David Norman
I telecommute, so I want my coworkers to see what I have on my plate and 
add to my project list. I figured syncing the Evolution calendar and 
task list with a PHP-based site would be good. Then I could make a few 
scripts for my boss to run reports on my timesheet and such.

Is there a project doing something like this already? I'm particularly 
interested in the part of the sync with Evolution. The closest I've seen 
to getting started in the right direction is MultiSync on sourceforge.

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


[PHP] How many Mondays in a month?

2003-09-29 Thread Phil Dowson
Hi,

I have posted a similar question in php.db, but I was wondering if someone
could help out with a non-db issue. I am trying to display statistics of
visitors to my web site, and what I would like to do is show the average
number of visitors that have visited the site in a given month for a certain
day e.g..:

Stats for www.mysite.com for 09/2003

Monday - 15 average - 65 total
Tuesday - 16 average - 66 total
Wednesday - 14 average - 65 total
Thursday - 13 average - 63 total
Friday - 15 average - 65 total
Saturday - 5 average - 25 total
Sunday - 6 average - 28 total

I have tried a number of ways to do this, but I cannot work out a way to
show the number for example Mondays that will be in a given month, which I
need to work out the average. I can work out the total easy enough, just not
the average.

TIA

Phil Dowson

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



Re: [PHP] How many Mondays in a month?

2003-09-29 Thread Curt Zirzow
* Thus wrote Phil Dowson ([EMAIL PROTECTED]):
 Hi,
 
 I have posted a similar question in php.db, but I was wondering if someone
 could help out with a non-db issue. I am trying to display statistics of
 visitors to my web site, and what I would like to do is show the average
 number of visitors that have visited the site in a given month for a certain
 day e.g..:
 
 Stats for www.mysite.com for 09/2003
 
 Monday - 15 average - 65 total
 Tuesday - 16 average - 66 total
 Wednesday - 14 average - 65 total
 Thursday - 13 average - 63 total
 Friday - 15 average - 65 total
 Saturday - 5 average - 25 total
 Sunday - 6 average - 28 total

Still sort of a db question:

select dayofweek(datefield) as dayindex, 
   count(*) total, 
from stats group by dayindex;



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

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



RE: [PHP] How many Mondays in a month?

2003-09-29 Thread Greg Wiley
Funny you should ask this because I've been meaning to share some code that
I wrote a few months ago that does exactly this for any day of the week.

Please feel free to use this and make changes. I'd appreciate any
changes/bug fixes being sent back to me though.

?php
/*
 * num_days
 *
 * A function that takes a day, a month and a year and returns the number of
 * occurrences of that day in the given month and year.
 *
 * Arguments:
 *  day - the day required
 *  month - which month are we talking about
 *  year - which year are we talking about
 *
 * Returns:
 *  occ - the number of times the day occurs in the month.
 *  or NULL if there are invalid parameters.
 */
function num_days ($day, $month, $year)
{
$day_array = array(Mon = Monday,
   Tue = Tuesday,
   Wed = Wednesday,
   Thu = Thursday,
   Fri = Friday,
   Sat = Saturday,
   Sun = Sunday);

$month_array = array(1 = Jan, Feb, Mar, Apr, May, Jun,
 Jul, Aug, Sep, Oct, Nov, Dec);

/*
 * Check our arguments are valid.
 */

/*
 * $day must be either a full day string or the 3 letter
abbreviation.
 */
if (!(in_array($day, $day_array) ||
array_key_exists($day, $day_array))) {
echo num_days: invalid argument. \$day must be day name or
three letter abbreviation;
return;
}

/*
 * $month must be either a full month name or its 3 letter
abrreviation
 */
if (($mth = array_search(substr($month,0,3), $month_array)) = 0) {
echo num_days: invalid argument. \$month must be month name
or three letter abbreviation;
return;
}

/*
 * Now fetch the previous $day of $month+1 in $year;
 * this will give us the last $day of $month.
 */

/*
 * Calculate the timestamp of the 01/$mth+1/$year.
 */
$time = mktime(0,0,0,$mth+1,1,$year);

$str = strtotime(last $day, $time);

/*
 * Return nth day of month.
 */
$date = date(j, $str);

/*
 * If the difference between $date1 and $date2 is 28 then
 * there are 5 occurences of $day in $month/$year, otherwise
 * there are just 4.
 */
if ($date = 28) {
return 4;
} else {
return 5;
}
}

?

The other function I have does this:

/*
 * nth_day
 *
 * A function that takes a number and a day and returns the date of
 * nth occurrence of that day in the given month and year.
 *
 * Arguments:
 *  nth - the nth occurence required
 *  day - the day required
 *  month - which month are we talking about
 *  year - which year are we talking about
 *
 * Returns:
 *  date - the date on which the nth day occurs in month and year.
 *  or NULL for errors.
 */

Give me a shout if anyone wants this one.

Cheers, Greg.


 -Original Message-
 From: Phil Dowson [mailto:[EMAIL PROTECTED] 
 Sent: 29 September, 2003 16:22
 To: [EMAIL PROTECTED]
 Subject: [PHP] How many Mondays in a month?
 
 
 Hi,
 
 I have posted a similar question in php.db, but I was 
 wondering if someone could help out with a non-db issue. I am 
 trying to display statistics of visitors to my web site, and 
 what I would like to do is show the average number of 
 visitors that have visited the site in a given month for a 
 certain day e.g..:
 
 Stats for www.mysite.com for 09/2003
 
 Monday - 15 average - 65 total
 Tuesday - 16 average - 66 total
 Wednesday - 14 average - 65 total
 Thursday - 13 average - 63 total
 Friday - 15 average - 65 total
 Saturday - 5 average - 25 total
 Sunday - 6 average - 28 total
 
 I have tried a number of ways to do this, but I cannot work 
 out a way to show the number for example Mondays that will be 
 in a given month, which I need to work out the average. I can 
 work out the total easy enough, just not the average.
 
 TIA
 
 Phil Dowson
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



[PHP] A _post question I guess

2003-09-29 Thread John Taylor-Johnston
I have a form. It has any number of hidden fields, named exercise 1-100. Their names 
all start with exercise as in:

input type=hidden name=exercise1
... ?
input type=hidden name=exercise11
any number fo these possible ...
input type=hidden name=exercise71

How can I create one scipt that will recognise all of them? Any number of them. My 
idea is a bit like formmail.pl that reads any old field and mails it. Mine will read 
any number of exercise fields.

John

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



Re: [PHP] PHP Rading excel files

2003-09-29 Thread Tom Rogers
Hi,

Monday, September 29, 2003, 10:10:43 PM, you wrote:
BJp Hi !

BJpIt's possible to export data to excel (csv, xml, PEAR excel file
BJp writing, ...) but is it possible to import data from excel ? (i.e.: I
BJp want to get the data which is in Cell A1 of sheet Toto in the posted
BJp .xls file).

BJp Thanks in advance.

I have been working on a php excel reader class which is nearing a usable state,
At the moment it just displays the sheets but it should be easy to extract the
cell data. You can test it here http://fred.kwikin.com/xl/
There are still a few display bugs to iron out but it will be a good start :)
It will only work with ole2 xls files at the moment.
Let me know if it will help and I will send you the files.


-- 
regards,
Tom



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



Re: [PHP] A _post question I guess

2003-09-29 Thread Brad Pauly
John Taylor-Johnston wrote:
I have a form. It has any number of hidden fields, named exercise 1-100. Their names all start with exercise as in:

input type=hidden name=exercise1
... ?
input type=hidden name=exercise11
any number fo these possible ...
input type=hidden name=exercise71
How can I create one scipt that will recognise all of them? Any number of them. My idea is a bit like formmail.pl that reads any old field and mails it. Mine will read any number of exercise fields.
You could just loop over the _POST array.

foreach ($_POST as $field_name = $field_value) {
$content .= $field_name = $field_value\n;
}
Then just email $content. You could filter out the excerciseN fields if 
you only wanted to send those.

- Brad

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


Re: [PHP] A _post question I guess

2003-09-29 Thread Tom Rogers
Hi,

Tuesday, September 30, 2003, 1:41:11 AM, you wrote:
JTJ I have a form. It has any number of hidden fields, named exercise
JTJ 1-100. Their names all start with exercise as in:

JTJ input type=hidden name=exercise1
JTJ ... ?
JTJ input type=hidden name=exercise11
JTJ any number fo these possible ...
JTJ input type=hidden name=exercise71

JTJ How can I create one scipt that will recognise all of them? Any
JTJ number of them. My idea is a bit like formmail.pl that reads any old field
JTJ and mails it. Mine will read any number of exercise fields.

JTJ John


name them as   name=exercise[1]

then do

if(isset($_POST['exercise'])){
  foreach($_POST['exercise'] as $key=$val){
echo 'Key '.$key.' val '.$val.'br';
  }
}

-- 
regards,
Tom

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



Re: [PHP] A _post question I guess

2003-09-29 Thread John Taylor-Johnston
Ok, but the problem is that I will, might have other fields. I need to filter out just 
the exerciseN fields. Interesting though thanks,
John

Brad Pauly wrote:

 You could just loop over the _POST array.

 foreach ($_POST as $field_name = $field_value) {
 $content .= $field_name = $field_value\n;
 }

 Then just email $content. You could filter out the excerciseN fields if
 you only wanted to send those.

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



Re: [PHP] A _post question I guess

2003-09-29 Thread Brad Pauly
John Taylor-Johnston wrote:
Ok, but the problem is that I will, might have other fields. I need to filter out just the exerciseN fields. Interesting though thanks,
Then just look at $feild_name and see if it is one of the 'exercise' fields.

foreach ($_POST as $field_name = $field_value) {
if (stristr($field_name, 'exercise')) {
$content .= $field_name = $field_value\n;
}
}
- Brad

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


[PHP] Does the AOL browser break any standards?

2003-09-29 Thread Dan Anderson
I am having problems with one of the web sites I have -- AOL users are
reporting they can't view it.  Does AOL break any major standards it
shouldn't?

p.s. the page is at
http://www.mathjunkies.com/jtlinks/jtlinks_interface.php if you feel
like taking a look.  :-D

Thanks in advance,

Dan

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



Re: [PHP] A _post question I guess

2003-09-29 Thread John Taylor-Johnston
Brad. Perfect thanks.

 Brad Pauly wrote:
 foreach ($_POST as $field_name = $field_value) {
  if (stristr($field_name, 'exercise')) {
  $content .= $field_name = $field_value\n;
  }
 }

Tom, Not sure why, but wouldn't work

Tom Rogers wrote:
if(isset($_POST['exercise'])){
  foreach($_POST['exercise'] as $key=$val){
echo 'Key '.$key.' val '.$val.'br';
  }
}

Thanks all.
P.S. I try to surf and contribute when I see something I can answer.
John

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



Re: [PHP] Does the AOL browser break any standards?

2003-09-29 Thread Chris Shiflett
--- Dan Anderson [EMAIL PROTECTED] wrote:
 I am having problems with one of the web sites I have -- AOL users
 are reporting they can't view it. Does AOL break any major standards
 it shouldn't?

AOL uses IE libraries, so yes, it breaks as many standards as it can. What
specific symptoms are users reporting?

Chris

=
HTTP Developer's Handbook
 http://shiflett.org/books/http-developers-handbook
My Blog
 http://shiflett.org/

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



Re: [PHP] Does the AOL browser break any standards?

2003-09-29 Thread Dan Anderson
 AOL uses IE libraries, so yes, it breaks as many standards as it can. What
 specific symptoms are users reporting?

Users can't access the web page at all.  They are getting some kind of
error.

-Dan

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



Re: [PHP] Does the AOL browser break any standards?

2003-09-29 Thread Larry Rosenman


--On Monday, September 29, 2003 12:43:06 -0400 Dan Anderson 
[EMAIL PROTECTED] wrote:

AOL uses IE libraries, so yes, it breaks as many standards as it can.
What specific symptoms are users reporting?
Users can't access the web page at all.  They are getting some kind of
error.
and that error would be?


-Dan

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


--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED]
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


pgp0.pgp
Description: PGP signature


Re: [PHP] Does the AOL browser break any standards?

2003-09-29 Thread Dan Anderson
I'm not sure.  They left angry messages on my machine this morning and
didn't leave a core dump or error.  They just said the page couldn't
load.  So I was wondering if there was something I should have paid
attention to -- i.e. IE hates Style Sheets or something else I
overlooked.

-Dan

On Mon, 2003-09-29 at 12:47, Larry Rosenman wrote:
 --On Monday, September 29, 2003 12:43:06 -0400 Dan Anderson 
 [EMAIL PROTECTED] wrote:
 
  AOL uses IE libraries, so yes, it breaks as many standards as it can.
  What specific symptoms are users reporting?
 
  Users can't access the web page at all.  They are getting some kind of
  error.
 and that error would be?
 
 
 
  -Dan
 
  --
  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 Mondays in a month?

2003-09-29 Thread Phil Dowson
Greg,

That worked brilliantly... I bow down to your sheer excellence!!! Thankyou
Thankyou Thankyou



Greg Wiley [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Funny you should ask this because I've been meaning to share some code that
I wrote a few months ago that does exactly this for any day of the week.

Please feel free to use this and make changes. I'd appreciate any
changes/bug fixes being sent back to me though.

?php
/*
 * num_days
 *
 * A function that takes a day, a month and a year and returns the number of
 * occurrences of that day in the given month and year.
 *
 * Arguments:
 * day - the day required
 * month - which month are we talking about
 * year - which year are we talking about
 *
 * Returns:
 * occ - the number of times the day occurs in the month.
 * or NULL if there are invalid parameters.
 */
function num_days ($day, $month, $year)
{
$day_array = array(Mon = Monday,
   Tue = Tuesday,
   Wed = Wednesday,
   Thu = Thursday,
   Fri = Friday,
   Sat = Saturday,
   Sun = Sunday);

$month_array = array(1 = Jan, Feb, Mar, Apr, May, Jun,
 Jul, Aug, Sep, Oct, Nov, Dec);

/*
* Check our arguments are valid.
*/

/*
* $day must be either a full day string or the 3 letter
abbreviation.
*/
if (!(in_array($day, $day_array) ||
array_key_exists($day, $day_array))) {
echo num_days: invalid argument. \$day must be day name or
three letter abbreviation;
return;
}

/*
* $month must be either a full month name or its 3 letter
abrreviation
*/
if (($mth = array_search(substr($month,0,3), $month_array)) = 0) {
echo num_days: invalid argument. \$month must be month name
or three letter abbreviation;
return;
}

/*
* Now fetch the previous $day of $month+1 in $year;
* this will give us the last $day of $month.
*/

/*
* Calculate the timestamp of the 01/$mth+1/$year.
*/
$time = mktime(0,0,0,$mth+1,1,$year);

$str = strtotime(last $day, $time);

/*
* Return nth day of month.
*/
$date = date(j, $str);

/*
* If the difference between $date1 and $date2 is 28 then
* there are 5 occurences of $day in $month/$year, otherwise
* there are just 4.
*/
if ($date = 28) {
return 4;
} else {
return 5;
}
}

?

The other function I have does this:

/*
 * nth_day
 *
 * A function that takes a number and a day and returns the date of
 * nth occurrence of that day in the given month and year.
 *
 * Arguments:
 * nth - the nth occurence required
 * day - the day required
 * month - which month are we talking about
 * year - which year are we talking about
 *
 * Returns:
 * date - the date on which the nth day occurs in month and year.
 * or NULL for errors.
 */

Give me a shout if anyone wants this one.

Cheers, Greg.


 -Original Message-
 From: Phil Dowson [mailto:[EMAIL PROTECTED]
 Sent: 29 September, 2003 16:22
 To: [EMAIL PROTECTED]
 Subject: [PHP] How many Mondays in a month?


 Hi,

 I have posted a similar question in php.db, but I was
 wondering if someone could help out with a non-db issue. I am
 trying to display statistics of visitors to my web site, and
 what I would like to do is show the average number of
 visitors that have visited the site in a given month for a
 certain day e.g..:

 Stats for www.mysite.com for 09/2003

 Monday - 15 average - 65 total
 Tuesday - 16 average - 66 total
 Wednesday - 14 average - 65 total
 Thursday - 13 average - 63 total
 Friday - 15 average - 65 total
 Saturday - 5 average - 25 total
 Sunday - 6 average - 28 total

 I have tried a number of ways to do this, but I cannot work
 out a way to show the number for example Mondays that will be
 in a given month, which I need to work out the average. I can
 work out the total easy enough, just not the average.

 TIA

 Phil Dowson

 -- 
 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 the AOL browser break any standards?

2003-09-29 Thread Jay Blanchard
[snip]
I am having problems with one of the web sites I have -- AOL users are
reporting they can't view it.  Does AOL break any major standards it
shouldn't?
[/snip]

And this is a PHP problem how?

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



RE: [PHP] Does the AOL browser break any standards?

2003-09-29 Thread Dan Anderson
 And this is a PHP problem how?

Well the script is coded within PHP.  I probably should have put an OT:
on the first line of the subject.  But I figured that some kind soul may
be willing to help and let me know if there is something I am missing.

-Dan

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



RE: [PHP] PHP coders spare time [OT}

2003-09-29 Thread Chris W. Parker
Curt Zirzow mailto:[EMAIL PROTECTED]
on Sunday, September 28, 2003 6:50 PM said:

 And what they do with it...
 
 http://zirzow.dyndns.org/html/mlists/php_general/

Two comments:

1. Top 10! w00t! w00t!
2. Good job Curt.


Chris.

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



Re: [PHP] Does the AOL browser break any standards?

2003-09-29 Thread Jason Wong
On Tuesday 30 September 2003 00:50, Dan Anderson wrote:
 I'm not sure.  They left angry messages on my machine this morning and
 didn't leave a core dump or error.  They just said the page couldn't
 load.  So I was wondering if there was something I should have paid
 attention to -- i.e. IE hates Style Sheets or something else I
 overlooked.

Aside from it being OT, how can you expect anyone to help, if even you don't 
know (can't describe) what the problem is?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
What you don't know won't help you much either.
-- D. Bennett
*/

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



RE: [PHP] How many Mondays in a month?

2003-09-29 Thread Greg Wiley
No problem, just glad it's found some wider use.

Cheers, Greg. 

 -Original Message-
 From: Phil Dowson [mailto:[EMAIL PROTECTED] 
 Sent: 29 September 2003 17:55
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] How many Mondays in a month?
 
 Greg,
 
 That worked brilliantly... I bow down to your sheer 
 excellence!!! Thankyou Thankyou Thankyou
 
 
 
 Greg Wiley [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 er.demon.net...
 Funny you should ask this because I've been meaning to share 
 some code that I wrote a few months ago that does exactly 
 this for any day of the week.
 
 Please feel free to use this and make changes. I'd appreciate 
 any changes/bug fixes being sent back to me though.
 
 ?php
 /*
  * num_days
  *
  * A function that takes a day, a month and a year and 
 returns the number of
  * occurrences of that day in the given month and year.
  *
  * Arguments:
  * day - the day required
  * month - which month are we talking about
  * year - which year are we talking about
  *
  * Returns:
  * occ - the number of times the day occurs in the month.
  * or NULL if there are invalid parameters.
  */
 function num_days ($day, $month, $year)
 {
 $day_array = array(Mon = Monday,
Tue = Tuesday,
Wed = Wednesday,
Thu = Thursday,
Fri = Friday,
Sat = Saturday,
Sun = Sunday);
 
 $month_array = array(1 = Jan, Feb, Mar, Apr, May,
Jun,
  Jul, Aug, Sep, Oct, Nov, Dec);
 
 /*
 * Check our arguments are valid.
 */
 
 /*
 * $day must be either a full day string or the 3 letter
abbreviation.
 */
 if (!(in_array($day, $day_array) ||
 array_key_exists($day, $day_array))) { echo num_days: 
 invalid argument. \$day must be day name or three letter 
 abbreviation; return; }
 
 /*
 * $month must be either a full month name or its 3 letter 
 abrreviation */ if (($mth = array_search(substr($month,0,3), 
 $month_array)) = 0) { echo num_days: invalid argument. 
 \$month must be month name or three letter abbreviation;
return; }
 
 /*
 * Now fetch the previous $day of $month+1 in $year;
 * this will give us the last $day of $month.
 */
 
 /*
 * Calculate the timestamp of the 01/$mth+1/$year.
 */
 $time = mktime(0,0,0,$mth+1,1,$year);
 
 $str = strtotime(last $day, $time);
 
 /*
 * Return nth day of month.
 */
 $date = date(j, $str);
 
 /*
 * If the difference between $date1 and $date2 is 28 then
 * there are 5 occurences of $day in $month/$year, otherwise
 * there are just 4.
 */
 if ($date = 28) {
 return 4;
 } else {
 return 5;
 }
 }
 
 ?
 
 The other function I have does this:
 
 /*
  * nth_day
  *
  * A function that takes a number and a day and returns the date
of
  * nth occurrence of that day in the given month and year.
  *
  * Arguments:
  * nth - the nth occurence required
  * day - the day required
  * month - which month are we talking about
  * year - which year are we talking about
  *
  * Returns:
  * date - the date on which the nth day occurs in month and
year.
  * or NULL for errors.
  */
 
 Give me a shout if anyone wants this one.
 
 Cheers, Greg.
 
 
  -Original Message-
  From: Phil Dowson [mailto:[EMAIL PROTECTED]
  Sent: 29 September, 2003 16:22
  To: [EMAIL PROTECTED]
  Subject: [PHP] How many Mondays in a month?
 
 
  Hi,
 
  I have posted a similar question in php.db, but I was
wondering if 
  someone could help out with a non-db issue. I am trying to
display 
  statistics of visitors to my web site, and what I would 
 like to do is 
  show the average number of visitors that have visited the site
in a 
  given month for a certain day e.g..:
 
  Stats for www.mysite.com for 09/2003
 
  Monday - 15 average - 65 total
  Tuesday - 16 average - 66 total
  Wednesday - 14 average - 65 total
  Thursday - 13 average - 63 total
  Friday - 15 average - 65 total
  Saturday - 5 average - 25 total
  Sunday - 6 average - 28 total
 
  I have tried a number of ways to do this, but I cannot work 
 out a way 
  to show the number for example Mondays that will be in a 
 given month, 
  which I need to work out the average. I can work out the total
easy 
  enough, just not the average.
 
  TIA
 
  Phil Dowson
 
  --
  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 coders spare time [OT}

2003-09-29 Thread Jon Kriek
Very nice!

-- 
Jon Kriek
http://phpfreaks.com

Chris W. Parker [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Curt Zirzow mailto:[EMAIL PROTECTED]
on Sunday, September 28, 2003 6:50 PM said:

 And what they do with it...

 http://zirzow.dyndns.org/html/mlists/php_general/

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



[PHP] captcha WAS Please visit my php program

2003-09-29 Thread Chris W. Parker
Ryan A mailto:[EMAIL PROTECTED]
on Saturday, September 27, 2003 12:22 PM said:

 Please visit my captcha program here and tell me if its good or if
 you think i need to make some changes in text,color or anything.

Exactly what is the purpose of this? Let me clarify. I know that it's
supposed to prevent computers from submitting forms automatically
because they cannot read the graphic, but what I don't understand is in
what cases this is useful?

And specifically Ryan, where will you be using this?


I'm trying to gauge whether or not this would be worthwhile for a
project I'm working on right now.


Thanks,
Chris.

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



Re: [PHP] Does the AOL browser break any standards?

2003-09-29 Thread Dan Anderson
 Aside from it being OT, how can you expect anyone to help, if even you don't 
 know (can't describe) what the problem is?

Well I was mostly looking for known issues.  For instance IE has some
problems if you try and do certain things, so I figured AOL's browser
might do the same.  For instance, a problem with CSS, HTML 4, XHTML, or
something like that.

-Dan

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



Re: [PHP] captcha WAS Please visit my php program

2003-09-29 Thread Chris Shiflett
--- Chris W. Parker [EMAIL PROTECTED] wrote:
 Exactly what is the purpose of this? Let me clarify. I know that
 it's supposed to prevent computers from submitting forms
 automatically because they cannot read the graphic, but what I
 don't understand is in what cases this is useful?

You have a page that collects credit card information for payment. An attacker
finds a database full of credit card numbers but wants to verify which ones are
still valid (it might be a very old database). So, after noticing your page,
this attacker writes a quick little script in PHP that loops through the list
of credit card numbers, submitting them to your site, and compares the output
to distinguish success from failure.

You end up with so many chargebacks that you lose your merchant account, and
your company loses so much money that you lose your job.

How's that? :-)

Chris

=
HTTP Developer's Handbook
 http://shiflett.org/books/http-developers-handbook
My Blog
 http://shiflett.org/

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



Re: [PHP] Does the AOL browser break any standards?

2003-09-29 Thread Kevin Bruce
Well, I'm not sure about any particular standards, but I do know that it
views web pages with CSS wrong. I have a client that uses AOHELL and the
font sizes blow up to about 5 +50. REALLY annoying. I hope that helps a
little:P

 Aside from it being OT, how can you expect anyone to help, if even you don't
 know (can't describe) what the problem is?
 
 Well I was mostly looking for known issues.  For instance IE has some
 problems if you try and do certain things, so I figured AOL's browser
 might do the same.  For instance, a problem with CSS, HTML 4, XHTML, or
 something like that.
 
 -Dan

-- 
Kevin Bruce
Educational Web Designer
VIP K-16 Grant
http://www.scienceinquiry.org
[EMAIL PROTECTED]
Maryland Sea Grant College
4321 Hartwick Road, Suite 300
College Park, MD 20740
301.403.4220 ext. 25
OR (on Wednesdays and Fridays)
717.637.5370

AOL Instant Messenger screen name- mdsgkevin

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



RE: [PHP] captcha WAS Please visit my php program

2003-09-29 Thread Chris W. Parker
Chris Shiflett mailto:[EMAIL PROTECTED]
on Monday, September 29, 2003 10:34 AM said:

 You end up with so many chargebacks that you lose your merchant
 account, and your company loses so much money that you lose your job.
 
 How's that? :-)

Sounds fine to me thanks!



Chris.

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



Re: [PHP] Does the AOL browser break any standards?

2003-09-29 Thread Jason Wong
On Tuesday 30 September 2003 01:33, Dan Anderson wrote:
  Aside from it being OT, how can you expect anyone to help, if even you
  don't know (can't describe) what the problem is?

 Well I was mostly looking for known issues.  For instance IE has some
 problems if you try and do certain things, so I figured AOL's browser
 might do the same.  For instance, a problem with CSS, HTML 4, XHTML, or
 something like that.

Seems like you're going about this the wrong way.

What's the point in indulging in idle speculation about what *could* go wrong, 
when you should be asking your users what really *is* going wrong.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Noncombatant:  A dead Quaker.
-- Ambrose Bierce
*/

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



Re: [PHP] How many Mondays in a month?

2003-09-29 Thread Burhan Khalid
Greg Wiley wrote:
Funny you should ask this because I've been meaning to share some code that
I wrote a few months ago that does exactly this for any day of the week.
Please feel free to use this and make changes. I'd appreciate any
changes/bug fixes being sent back to me though.
[ snip ]
function num_days ($day, $month, $year)
{
[ snip ]

One tip that I would add is that instead of using individual arguments, 
you might want to consider using an array as an argument. This prevents 
people from inserting the arguments in the wrong order, which would not 
yield the correct results.

Function call would be :

$my_date = array();
$my_date['day'] = Mon;
$my_date['month'] = Jan;
$my_date['year'] = 2003;
num_days($my_date);

Of course the indexes could be in any order, as long as they have day, 
month, year as keys.

Just a thought, good work though :)

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] How many Mondays in a month?

2003-09-29 Thread Greg Wiley
 -Original Message-
 From: Burhan Khalid [mailto:[EMAIL PROTECTED] 
 
 Greg Wiley wrote:
  Funny you should ask this because I've been meaning to 
 share some code 
  that I wrote a few months ago that does exactly this for 
 any day of the week.
  
  Please feel free to use this and make changes. I'd appreciate
any 
  changes/bug fixes being sent back to me though.
  
 [ snip ]
  function num_days ($day, $month, $year) {
 [ snip ]
 
 One tip that I would add is that instead of using individual 
 arguments, you might want to consider using an array as an 
 argument. This prevents people from inserting the arguments 
 in the wrong order, which would not yield the correct results.
 
Thanks, that's a good idea; though I would have to change my form
code to match:-(

When I make this change, where would be a good place to submit it?

Cheers, Greg.

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



RE: [PHP] captcha WAS Please visit my php program

2003-09-29 Thread Roger B.A. Klorese
 Exactly what is the purpose of this? Let me clarify. I know that it's
 supposed to prevent computers from submitting forms automatically
 because they cannot read the graphic, but what I don't 
 understand is in
 what cases this is useful?

Not being able to auto-subscribe to mailing lists in order to spam, for one.

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



[PHP] Strange comportment ...

2003-09-29 Thread alain
Hi,

I got a function that do a very strange calculation ... Here is the code
fragment


function ChiffreEnLettre($chiffre)
{

$centaine = 0;
$dizaine = 0;
$unite  = 0;
$reste  = 0;
$y  = 0;
$dix   = false;
$lettre  = ;
$reste   = $chiffre;

// print( Valeur recue = $restebr);

for( $i = 10; $i = 1; $i = $i / 1000)
{
 $y = (int) ($reste / $i);
 print($y   =   $reste   /   $i  );

...
...


When i call this function many time with different number i got strange
values for the $y var.

Sometime when i call the function with $chiffre = 5,  I got  got $y = 5 ,
and other time i got $y = 4  I also got the same strange comportment
when I call the function with $chiffre = 45, sometime i got $y = 45 and
dometime i got $y = 44 ...

This problem only occur when $i = 1. So in this case, for PHP,  5 / 1 = 4
!!!

if i replace  $y  = (int)($reste / $i); by  $y  = ($reste / $i); evrything
is ok, so it appear that it's the casting that is transforming the 5 value
in the 4 value.

If anybody has an explication,

Best regards,

Alain Deseine.

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



[PHP] Central authentication for multiple sites

2003-09-29 Thread Fraser Campbell
Hi,

Does anyone know of a way to authenticate a person on one site and have that 
authentication carried through to multiple sites?

Basically I'd like to have someone login on www.domain1.com and then have 
their login be valid on www.domain2.com and www.domain3.com ... the domain 
name is different so I don't see how I could use a common cookie.

The 3 sites in question are hosted on a common server with a common user 
database if that helps but still the domain names that people access the 
sites with are unique.

Any ideas?

Thanks!
-- 
Fraser Campbell [EMAIL PROTECTED] http://www.wehave.net/
Halton Hills, Ontario, Canada   Debian GNU/Linux

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



Re: [PHP] Central authentication for multiple sites

2003-09-29 Thread Kevin Bruce
Maybe you could go off of a timestamp in a last_visited, last_visitedIP
fields. If it was less than 10 minutes ago, then they can move on. This, of
course, would mean you'd have to add some UPDATE last_visited,
last_visitedIP code at the header of every page (or on a common included
header). Hmm... It wouldn't be foolproof, though:P

 Hi,
 
 Does anyone know of a way to authenticate a person on one site and have that
 authentication carried through to multiple sites?
 
 Basically I'd like to have someone login on www.domain1.com and then have
 their login be valid on www.domain2.com and www.domain3.com ... the domain
 name is different so I don't see how I could use a common cookie.
 
 The 3 sites in question are hosted on a common server with a common user
 database if that helps but still the domain names that people access the
 sites with are unique.
 
 Any ideas?
 
 Thanks!

-- 
Kevin Bruce
Educational Web Designer
VIP K-16 Grant
http://www.scienceinquiry.org
[EMAIL PROTECTED]
Maryland Sea Grant College
4321 Hartwick Road, Suite 300
College Park, MD 20740
301.403.4220 ext. 25
OR (on Wednesdays and Fridays)
717.637.5370

AOL Instant Messenger screen name- mdsgkevin

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



[PHP] Cleaning up my messy code

2003-09-29 Thread Chris
I am working on a fairly large scale (for myself anyway) project using PHP 
and MySQL. I am victim of teaching myself to program, not separating 
presentation from my code-- all the things that lead to masses of spaghetti 
code so atrocious even I can't figure out what I was doing an hour ago.

I'm not looking for an IDE or code generator so much as some practical 
advice for organization and framework when developing a larger app. I know 
of PHP Fusebox, having programmed with Cold Fusion fusebox for a while, but 
it seems like that might be too much. Maybe I just need a sensical, 
practical approach to application layout. What do you all do? How can I 
learn to be a better PHP programmer in this regard?

c

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



[PHP] Re: Central authentication for multiple sites

2003-09-29 Thread Kevin Stone
If all domains have access to the same database then there is absolutely nothing 
preventing you from using a Cookie.  Have a normal login on Domain1.com.  Once 
authenticated produce a random ID and store it in the database.  Store the ID in a 
cookie then Redirect the client to the desired domain.  The page the client is 
redirected to checks to see if the ID matches one stored in the database.  If it does 
then the user is valid.  A logout request on any one of the domains destroys the ID in 
the database and erases the cookie.  Associate a timestamp with the ID in the database 
so that you can make the login invalid after a period of no activity.

- Kevin


Fraser Campbell [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 Hi,
 
 Does anyone know of a way to authenticate a person on one site and have that 
 authentication carried through to multiple sites?
 
 Basically I'd like to have someone login on www.domain1.com and then have 
 their login be valid on www.domain2.com and www.domain3.com ... the domain 
 name is different so I don't see how I could use a common cookie.
 
 The 3 sites in question are hosted on a common server with a common user 
 database if that helps but still the domain names that people access the 
 sites with are unique.
 
 Any ideas?
 
 Thanks!
 -- 
 Fraser Campbell [EMAIL PROTECTED] http://www.wehave.net/
 Halton Hills, Ontario, Canada   Debian GNU/Linux


Re: [PHP] Central authentication for multiple sites

2003-09-29 Thread Marek Kilimajer
Because the sites are on the same server, it is simple. Use sessions and 
pass SID in urls to other domains.

Fraser Campbell wrote:
Hi,

Does anyone know of a way to authenticate a person on one site and have that 
authentication carried through to multiple sites?

Basically I'd like to have someone login on www.domain1.com and then have 
their login be valid on www.domain2.com and www.domain3.com ... the domain 
name is different so I don't see how I could use a common cookie.

The 3 sites in question are hosted on a common server with a common user 
database if that helps but still the domain names that people access the 
sites with are unique.

Any ideas?

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


Re: [PHP] Cleaning up my messy code

2003-09-29 Thread Burhan Khalid
Chris wrote:

I am working on a fairly large scale (for myself anyway) project using PHP 
and MySQL. I am victim of teaching myself to program, not separating 
presentation from my code-- all the things that lead to masses of spaghetti 
code so atrocious even I can't figure out what I was doing an hour ago.

I'm not looking for an IDE or code generator so much as some practical 
advice for organization and framework when developing a larger app. I know 
of PHP Fusebox, having programmed with Cold Fusion fusebox for a while, but 
it seems like that might be too much. Maybe I just need a sensical, 
practical approach to application layout. What do you all do? How can I 
learn to be a better PHP programmer in this regard?
Chris, I'm glad that you have realized that your programming practices 
are leading your into trouble. That's a big step. A lot of people refuse 
to believe that.

Getting rid of spaghetti code can easily be done if you start using a 
template engine ( smarty from smarty.php.net is my favorite ). This 
allows you to atleast on some level, separate your presentation from 
your logic.

The old mantra about documentation also holds true here. If you document 
your code as you write it, it will help you try to figure out what you 
were doing an hour ago.

Compartmentalizing your code and separating it into logical components 
(not necessarily classes, but those help) will allow you to organize 
your code better.  Arranging these components into separate files will 
lead to better managability of code.

As far as frameworks are concerned, I don't use any formal or 
published framework, but rather have my own application skeleton that 
is comprised of some PEAR classes along with a sprinkling of my own 
modules. It has served me well, especially since all of the grunt work 
is taken care of by PEAR.

Good luck, and I hope this helps.
--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] download queue

2003-09-29 Thread Alex
I'm considering start up a small download site with the large amount of 
excess bandwith I have on my site, however I thought it would be cool to 
put some sort of download queue up (you know, so all my bandwith doesn't 
get eaten up when 500 random people suddenly decide to download a 500meg 
 file i've put up.

In any case, I'm once again to the point where I know what I want, but 
the logic of it escapes me. If anyone has ever done this before, seen 
the code behind this before, or knows basically how this would be done, 
I'd be more than happy if you would share your wisdom with me.

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


RE: [PHP] Re: Central authentication for multiple sites

2003-09-29 Thread Vail, Warren
Fraser,

Kevin is right on, but it wasn't clear to me that you wanted the users to log onto 
each site.  Seems you may expect them to go to the site in another browser, or perhaps 
the same, without having to signon again.  Perhaps this can be done if you do a form 
post to the new domain from the existing one, passing the session key (or some other 
indication who has signed on) as a hidden variable, and using target=_BLANK to open 
a new browser.  I would recommend checking that you haven't created a BIG security 
hole with this one.

Warren Vail

-Original Message-
From: Kevin Stone [mailto:[EMAIL PROTECTED]
Sent: Monday, September 29, 2003 12:33 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Central authentication for multiple sites


If all domains have access to the same database then there is absolutely nothing 
preventing you from using a Cookie.  Have a normal login on Domain1.com.  Once 
authenticated produce a random ID and store it in the database.  Store the ID in a 
cookie then Redirect the client to the desired domain.  The page the client is 
redirected to checks to see if the ID matches one stored in the database.  If it does 
then the user is valid.  A logout request on any one of the domains destroys the ID in 
the database and erases the cookie.  Associate a timestamp with the ID in the database 
so that you can make the login invalid after a period of no activity.

- Kevin


Fraser Campbell [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 Hi,
 
 Does anyone know of a way to authenticate a person on one site and have that 
 authentication carried through to multiple sites?
 
 Basically I'd like to have someone login on www.domain1.com and then have 
 their login be valid on www.domain2.com and www.domain3.com ... the domain 
 name is different so I don't see how I could use a common cookie.
 
 The 3 sites in question are hosted on a common server with a common user 
 database if that helps but still the domain names that people access the 
 sites with are unique.
 
 Any ideas?
 
 Thanks!
 -- 
 Fraser Campbell [EMAIL PROTECTED] http://www.wehave.net/
 Halton Hills, Ontario, Canada   Debian GNU/Linux

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



Re: [PHP] Re: Central authentication for multiple sites

2003-09-29 Thread Fraser Campbell
On Monday 29 September 2003 15:33, Kevin Stone wrote:

 If all domains have access to the same database then there is absolutely
 nothing preventing you from using a Cookie.  Have a normal login on
 Domain1.com.  Once authenticated produce a random ID and store it in the
 database.  Store the ID in a cookie then Redirect the client to the desired
 domain.  The page the client is redirected to checks to see if the ID

Ok.  So then the client has a cookie set for www.domain1.com, when I redirect 
him to www.domain2.com why would his browser send me the cookie?  I think I'm 
missing something ...

-- 
Fraser Campbell [EMAIL PROTECTED] http://www.wehave.net/
Halton Hills, Ontario, Canada   Debian GNU/Linux

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



Re: [PHP] Cleaning up my messy code

2003-09-29 Thread Brent Baisley
You should search the web for articles on MVC, Model View Controller. 
This is a standard technique for separating your presentation from your 
logic from your database. The concept can be applied to any programming 
or scripting language since it actually falls under the much bigger 
realm of design patterns. I would highly recommend reading at least one 
or two articles on MVC, you don't have to completely understand it, but 
it will give you a could foundation.
After that, there were a few articles written on using MVC specific to 
PHP over at phparch.com. I subscribed to that magazine a few months ago 
and I think it's well worth it. You may need to subscribe yourself to 
see the past articles, but it's not expensive for the PDF subscription 
version.

I looked into the templating systems at first, but really wanted to try 
what they were doing myself. It ends up being very easy to implement 
using output buffering. Just look into the ob_start() command. Here is 
an example of how I load a template file into a variable:
ob_start();
include(templateFile.tpl);
$tpl_content = ob_get_contents();
ob_end_clean();

On Monday, September 29, 2003, at 03:22 PM, Chris wrote:

I am working on a fairly large scale (for myself anyway) project using 
PHP
and MySQL. I am victim of teaching myself to program, not separating
presentation from my code-- all the things that lead to masses of 
spaghetti
code so atrocious even I can't figure out what I was doing an hour ago.

I'm not looking for an IDE or code generator so much as some practical
advice for organization and framework when developing a larger app. I 
know
of PHP Fusebox, having programmed with Cold Fusion fusebox for a 
while, but
it seems like that might be too much. Maybe I just need a sensical,
practical approach to application layout. What do you all do? How can I
learn to be a better PHP programmer in this regard?

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


  1   2   >