Re: [PHP] PEAR::SOAP returns objects instead of associative arrays

2005-02-03 Thread Jochem Maas
William Lovaton wrote:
Hello,
I just found out that since version 0.7, PEAR::SOAP returns stdClass
objects instead of associative arrays.
http://pear.php.net/package-changelog.php?pacid=87release=0.7.3
What is the reason for this? I _need_ to get associative arrays, how do
I revert to the old behavior?
lets say that you have a return value from PEAR::SOAP in the variable $a
does the following give you what you need?:
$a = (array) $a;


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


[PHP] Howto disable echo back in windows?

2005-02-03 Thread Unreal HSHH
I need to get data from stdin, but i don't know how to disable echo
back in windows.
There is stty -echo in unix like OS, but what about windows?

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



[PHP] Hoe does that work - http://www.domainname.con/?var=lakjhd (instead of http://www.domainname.con/file.php?var=lakjhd)?

2005-02-03 Thread symbulos partners
How do you activate / allow the behavious

http://www.domainname.con/?var=lakjhd

instead of the more traditional

http://www.domainname.con/file.php?var=lakjhd
-- 
symbulos partners
-.-
symbulos - ethical services for your organisation
http://www.symbulos.com

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



Re: [PHP] Hoe does that work - http://www.domainname.con/?var=lakjhd (instead of http://www.domainname.con/file.php?var=lakjhd)?

2005-02-03 Thread Unreal HSHH
Rename the file.php to your web server default index file name, such
as index.php.
Or make a rewrite for it


On Thu, 03 Feb 2005 09:42:45 +, symbulos partners
[EMAIL PROTECTED] wrote:
 How do you activate / allow the behavious
 
 http://www.domainname.con/?var=lakjhd
 
 instead of the more traditional
 
 http://www.domainname.con/file.php?var=lakjhd
 --
 symbulos partners
 -.-
 symbulos - ethical services for your organisation
 http://www.symbulos.com
 
 --
 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] Hoe does that work - http://www.domainname.con/?var=lakjhd (instead of http://www.domainname.con/file.php?var=lakjhd)?

2005-02-03 Thread Chris Ramsay
[snip]
How do you activate / allow the behavious

http://www.domainname.con/?var=lakjhd

instead of the more traditional

http://www.domainname.con/file.php?var=lakjhd

[snip]

Are you using Apache? -
http://httpd.apache.org/docs-2.0/mod/mod_dir.html
 || 
http://httpd.apache.org/docs-2.0/mod/core.html#directory

Chris Ramsay
Web Developer - The Danwood Group Ltd.
Tel #: +44 (0)1522 882 288
DDI #: +44 (0)1522 834 482
Fax #: +44 (0)1522 884 488
Email: [EMAIL PROTECTED]
Web  : http://www.danwood.co.uk

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



Re: [PHP] Howto disable echo back in windows?

2005-02-03 Thread Jochem Maas
Unreal HSHH wrote:
I need to get data from stdin, but i don't know how to disable echo
back in windows.
There is stty -echo in unix like OS, but what about windows?
not strictly php related butI think what your looking for
is to start your batch script with:
@echo off
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Need help with ereg regular expression

2005-02-03 Thread Jochem Maas
John Nichel wrote:
Argghhhreturn receipts
indeed - I believe there was an informal decision that everyone should 
actually
 return the requested reciept - the idea being that 1000+ reciepts will probably
make said person change their ways.
I notice that KHS (the OP) didn't seem to have return reciepts on on his 
subsequent posts ;-)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Need help with ereg regular expression

2005-02-03 Thread Jochem Maas
Mikey wrote:
Argghhhreturn receipts

I just mailed the guy and gave him a friendly nod - they are off now :-)
damn ;-) I was hoping a barrage of RRs would be what made him turn them off.
oh well on to the next victim ;-)
Mikey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Need help with ereg regular expression

2005-02-03 Thread Jochem Maas
Jason Wong wrote:
On Thursday 03 February 2005 02:18, John Nichel wrote:
Argghhhreturn receipts

Use a *real* mail client -- one that ignores those stupid things.
Jason, I use Thunderbird - AFAICT its pretty real, BUT I have to have
allow return reciepts because of other things/work I do - turning them off
is not an option for me - this may also be the case for others, of course
if you are using Outlook out of your own free will (as opposed to having it
forced on you by corporation suits) then I guess your point sticks :-).
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Need help with ereg regular expression

2005-02-03 Thread Jason Wong
On Thursday 03 February 2005 18:08, Jochem Maas wrote:

 Jason, I use Thunderbird - AFAICT its pretty real, BUT I have to have
 allow return reciepts because of other things/work I do - turning them off
 is not an option for me

I can understand it if it's to enable scheduling features. However if it's to 
inform people that you've received their mail, or read their mail, or (gasp) 
deleted their mail without reading it (because you've already read in the 
preview pane) then that is totally dumb (with a capital D ( U  M  B  A 
 ...))

-- 
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
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] Need help with ereg regular expression

2005-02-03 Thread Jochem Maas
Jason Wong wrote:
On Thursday 03 February 2005 18:08, Jochem Maas wrote:

Jason, I use Thunderbird - AFAICT its pretty real, BUT I have to have
allow return reciepts because of other things/work I do - turning them off
is not an option for me

I can understand it if it's to enable scheduling features. However if it's to 
inform people that you've received their mail, or read their mail, or (gasp) 
deleted their mail without reading it (because you've already read in the 
preview pane) then that is totally dumb (with a capital D ( U  M  B  A 
 ...))

well actually in my case its company policy to honour read reciepts to a
number of clients. they are:
a, rich - and we want their business (telling them to turn that shit off is not 
an option)
b, they have no f* idea about setting up their apps/system properly
but then again I kind of take pleasure in returning a read reciept to
someone who has sent an email to a mailing list - the vision of them recieving 
1000s
of receipts I find very amusing :-)
as a side note - how come your [EMAIL PROTECTED] address always bounces?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Multiline data Insert Into table from a generated form?

2005-02-03 Thread Mike Smith
Change:
  while ($c=0;$ccount($_POST['tourid']):$c++)

to (change the : before $c++ to ;): 

for ($c=0;$ccount($tourid);$c++) 

I think i mentioned the while loop in my first reply. I should have said for.
(See: http://us2.php.net/for, http://us3.php.net/while,
http://us4.php.net/foreach)

I'm not  sure what you mean by form is posted to itself. Do you have
the function at the top of the page with the form? If so, you can do
something like

if($_POST['var']){

add_to_database( $tourid, $dayno, $fromto, $bld, $descrip,
$dberror)
//ideally you'd forward to another page to let the user know the form
was received OK...
} else {

//Show form

}

Please post any specific error message you may get, not just a parse
error, it will save my eyes!

Thanks,
Mike

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



[PHP] Script stuck on final ?

2005-02-03 Thread Alp
Why would a php script get stuck at the ver last line of code in php/mysql
combination? I'm getting a parse error at the very last line.

Thanks in advance for your help.

Alp

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



RE: [PHP] Script stuck on final ?

2005-02-03 Thread Reinhart Viane
Probably because you forgot to use a closing } somewhere or you forgot a ;
somewhere

Greetings

-Oorspronkelijk bericht-
Van: Alp [mailto:[EMAIL PROTECTED] 
Verzonden: donderdag 3 februari 2005 12:36
Aan: php-general@lists.php.net
Onderwerp: [PHP] Script stuck on final ?

Why would a php script get stuck at the ver last line of code in php/mysql
combination? I'm getting a parse error at the very last line.

Thanks in advance for your help.

Alp

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




-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.4 - Release Date: 1/02/2005




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.4 - Release Date: 1/02/2005

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



Re: [PHP] Script stuck on final ?

2005-02-03 Thread Jochem Maas
Alp wrote:
Why would a php script get stuck at the ver last line of code in php/mysql
combination? I'm getting a parse error at the very last line.
probably because you have an unmatch curly brace somewhere ({ or }).
Thanks in advance for your help.
Alp
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Script stuck on final ?

2005-02-03 Thread Alp
Thanks to both of you. Unfortunately I have found out it was due to another
reason: in one function I am trying to insert 3 sets of data into 3 seperate
tables. In trying to accomplish that I am using a 'for' loop. The minute I
write in the second 'for' loop I loose the page in browser and receive this
parse error pointing to the last line of code.

Any ideas to how I can overcome this? The loop I am using is given below.

Thanks in advance.

Alp
Code:
 for ($c=0;$ccount($_POST['inctourid']);$c++) {
  if ($_POST['inctourid'][$c]!=  $_POST['included'][$c]!=){
   $sql = INSERT INTO tour_includes (tour_id, included) VALUES
('{$_POST['inctourid'][$c]}', '{$_POST['included'][$c]}')\n;
  }
  if (! mysql_query($sql, $link))
   {
   $dberror = mysql_error();
   return false;
   }
// for ($i=0;$icount($_POST['extourid']);$i++) {
//  if ($_POST['extourid'][$c]!=  $_POST['excluded'][$c]!=){
//   $sql = INSERT INTO tour_excludes (tour_id, excluded) VALUES
('{$_POST['extourid'][$c]}', '{$_POST['excluded'][$c]}')\n;
//  }
//  if (! mysql_query($sql, $link))
//   {
//   $dberror = mysql_error();
//   return false;
//   }




Alp [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Why would a php script get stuck at the ver last line of code in php/mysql
 combination? I'm getting a parse error at the very last line.

 Thanks in advance for your help.

 Alp

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



Re: [PHP] Re: Script stuck on final ?

2005-02-03 Thread Jochem Maas
Alp wrote:
Thanks to both of you. Unfortunately I have found out it was due to another
reason: in one function I am trying to insert 3 sets of data into 3 seperate
tables. In trying to accomplish that I am using a 'for' loop. The minute I
write in the second 'for' loop I loose the page in browser and receive this
what does write in the 'for' loop mean?
what does loose the page in the browser mean?
parse error pointing to the last line of code.
Any ideas to how I can overcome this? The loop I am using is given below.
fix the syntax error, I guess.
Thanks in advance.
Alp
Code:
 for ($c=0;$ccount($_POST['inctourid']);$c++) {
  if ($_POST['inctourid'][$c]!=  $_POST['included'][$c]!=){
   $sql = INSERT INTO tour_includes (tour_id, included) VALUES
('{$_POST['inctourid'][$c]}', '{$_POST['included'][$c]}')\n;
  }
  if (! mysql_query($sql, $link))
   {
   $dberror = mysql_error();
   return false;
   }
where is the * closing brace for the for loop?
// for ($i=0;$icount($_POST['extourid']);$i++) {
//  if ($_POST['extourid'][$c]!=  $_POST['excluded'][$c]!=){
//   $sql = INSERT INTO tour_excludes (tour_id, excluded) VALUES
('{$_POST['extourid'][$c]}', '{$_POST['excluded'][$c]}')\n;
//  }
//  if (! mysql_query($sql, $link))
//   {
//   $dberror = mysql_error();
//   return false;
//   }

Alp [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Why would a php script get stuck at the ver last line of code in php/mysql
combination? I'm getting a parse error at the very last line.
Thanks in advance for your help.
Alp

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


Re: [PHP] Re: Script stuck on final ?

2005-02-03 Thread James Kaufman
On Thu, Feb 03, 2005 at 08:25:43PM +0800, Alp wrote:
 Thanks to both of you. Unfortunately I have found out it was due to another
 reason: in one function I am trying to insert 3 sets of data into 3 seperate
 tables. In trying to accomplish that I am using a 'for' loop. The minute I
 write in the second 'for' loop I loose the page in browser and receive this
 parse error pointing to the last line of code.
 
 Any ideas to how I can overcome this? The loop I am using is given below.
 
 Thanks in advance.
 
 Alp
 Code:
  for ($c=0;$ccount($_POST['inctourid']);$c++) {
   if ($_POST['inctourid'][$c]!=  $_POST['included'][$c]!=){
$sql = INSERT INTO tour_includes (tour_id, included) VALUES
 ('{$_POST['inctourid'][$c]}', '{$_POST['included'][$c]}')\n;
   }
   if (! mysql_query($sql, $link))
{
$dberror = mysql_error();
return false;
}
 // for ($i=0;$icount($_POST['extourid']);$i++) {
 //  if ($_POST['extourid'][$c]!=  $_POST['excluded'][$c]!=){
 //   $sql = INSERT INTO tour_excludes (tour_id, excluded) VALUES
 ('{$_POST['extourid'][$c]}', '{$_POST['excluded'][$c]}')\n;
 //  }
 //  if (! mysql_query($sql, $link))
 //   {
 //   $dberror = mysql_error();
 //   return false;
 //   }

}   // Add closing brace here

-- 
Jim Kaufman
Linux Evangelist
public key 0x6D802619, CISSP# 65668
http://www.linuxforbusiness.net
---
The most merciful thing in the world ... is the inability of the human mind to
correlate all its contents.
-- H. P. Lovecraft

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



RE: [PHP] Hoe does that work - http://www.domainname.con/?var=lakjhd (instead of http://www.domainname.con/file.php?var=lakjhd)?

2005-02-03 Thread Chris Ramsay
 
Dear Symbulos Partners,

OK this is becoming off topic really...but here we go very briefly...

If you are using apache web server(?) then you need to edit your httpd.conf
and add index.php to your DirectoryIndex list; Reference all calls to the
file (will have to be called index.php) to /... If you want your file to
be called anything else other than index.php, best you check out the apache
mailing list archives: http://marc.theaimsgroup.com/?l=apache-httpd-users as
this is a PHP mailing list ;)

Chris Ramsay
Web Developer - The Danwood Group Ltd.
Tel #: +44 (0)1522 882 288
DDI #: +44 (0)1522 834 482
Fax #: +44 (0)1522 884 488
Email: [EMAIL PROTECTED]
Web  : http://www.danwood.co.uk

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



Re: [PHP] PEAR::SOAP returns objects instead of associative arrays

2005-02-03 Thread William Lovaton
Hi,

It works but in some cases.  It works with this:
stdClass Object
(
[cod_tipo_identi] = 4
[des_identificacion] = REGISTRO CIVIL
[abr_identificacion] = RC
)

It convert it to an Array, but it doesn't work with this:
Array
(
[0] = stdClass Object
(
[cod_tipo_identi] = 1
[des_identificacion] = CEDULA CIUDADANIA
[abr_identificacion] = CC
)

[1] = stdClass Object
(
[cod_tipo_identi] = 2
[des_identificacion] = NRO. IDENTIF. TRIBUTARIA
[abr_identificacion] = NIT
)

[2] = stdClass Object
(
[cod_tipo_identi] = 3
[des_identificacion] = TARJETA DE IDENTIDAD
[abr_identificacion] = TI
)

[3] = stdClass Object
(
[cod_tipo_identi] = 4
[des_identificacion] = REGISTRO CIVIL
[abr_identificacion] = RC
)
)

I need the nested objects to be arrays and your suggestion won't do
the trick and I don't want to be iterating over the array to convert
the objects.

I was talking with some of the PEAR::SOAP maintainers and he told me
there is an option/constant that controls this behavior.  Does any
one know where it is?  I couldn't find it.

-William


El jue, 03-02-2005 a las 09:04 +0100, Jochem Maas escribi:
 William Lovaton wrote:
  Hello,
  
  I just found out that since version 0.7, PEAR::SOAP returns stdClass
  objects instead of associative arrays.
  http://pear.php.net/package-changelog.php?pacid=87release=0.7.3
  
  What is the reason for this? I _need_ to get associative arrays, how do
  I revert to the old behavior?
 
 lets say that you have a return value from PEAR::SOAP in the variable $a
 does the following give you what you need?:
 
 $a = (array) $a;
 
 
  
  
  -William
  
 

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



Re: [PHP] PEAR::SOAP returns objects instead of associative arrays

2005-02-03 Thread Jochem Maas
William Lovaton wrote:
Hi,
...
I need the nested objects to be arrays and your suggestion won't do
the trick and I don't want to be iterating over the array to convert
the objects.
well its either iterate the array and typecast or set the option,
you best bet for finding out how/where/what regarding said option is
to read the source:
http://cvs.php.net/pear/SOAP/
(I haven't any experience with PEAR::SOAP so I don't know offhand what/where
the option might be)
ALTERNATIVELY: you may want to change you code to make use of the objects
that are returned.
I was talking with some of the PEAR::SOAP maintainers and he told me
there is an option/constant that controls this behavior.  Does any
one know where it is?  I couldn't find it.
-William
El jue, 03-02-2005 a las 09:04 +0100, Jochem Maas escribi:
William Lovaton wrote:
Hello,
I just found out that since version 0.7, PEAR::SOAP returns stdClass
objects instead of associative arrays.
http://pear.php.net/package-changelog.php?pacid=87release=0.7.3
What is the reason for this? I _need_ to get associative arrays, how do
I revert to the old behavior?
lets say that you have a return value from PEAR::SOAP in the variable $a
does the following give you what you need?:
$a = (array) $a;

-William


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


Re: [PHP] Need help with ereg regular expression

2005-02-03 Thread John Nichel
Jason Wong wrote:
On Thursday 03 February 2005 02:18, John Nichel wrote:
Argghhhreturn receipts

Use a *real* mail client -- one that ignores those stupid things.
I'm using Thunderbird on a RHEL AS 3 box.  About as real as it gets. 
Unfortunately, here at work, I need to have them on.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Copy mySQL database...

2005-02-03 Thread Russell P Jones
I just need to make a duplicate copy of a mySQL database (I have to
reinstall some web software and I am afraid it will overwrite the existing
database, so i would like to make a backup of it)...

Any classes, scripts, etc out there to do this?

Russ

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



RE: [PHP] Copy mySQL database...

2005-02-03 Thread Mikey
 I just need to make a duplicate copy of a mySQL database (I 
 have to reinstall some web software and I am afraid it will 
 overwrite the existing database, so i would like to make a 
 backup of it)...
 
 Any classes, scripts, etc out there to do this?
 
 Russ

Try RTFM for mySQL, section 5.6.1 in my local copy.  Don't use a
sledgehammer to open a walnut :-)

Mikey

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



Re: [PHP] Copy mySQL database...

2005-02-03 Thread Jochem Maas
Russell P Jones wrote:
I just need to make a duplicate copy of a mySQL database (I have to
reinstall some web software and I am afraid it will overwrite the existing
database, so i would like to make a backup of it)...
Any classes, scripts, etc out there to do this?
oh for gods sake, do you not think that the guys at mysql have thought that 
backups
might be a good thing?:
http://dev.mysql.com/doc/mysql/en/mysqldump.html
or try phpmyadmin

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


Re: [PHP] Reading a .doc or .rtf file in php

2005-02-03 Thread Marek Kilimajer
sunil wrote:
I have got a task of reading a .doc(word document) using php.
But while reading doc file, some meta character like boxes and some other characters also appears. 

I will be highly obliged to you if you send me the code for reading a .doc file 
using php.
Any help appriciated.
You can use COM functions available on windows machines. There are many 
basic tutorials on the web that will teach you how to open a doc file, 
write something and close it. If you need more don't ask here but go to 
www.microsoft.com

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


Re: [PHP] Copy mySQL database...

2005-02-03 Thread Steve Buehler
At 08:52 AM 2/3/2005, you wrote:
I just need to make a duplicate copy of a mySQL database (I have to
reinstall some web software and I am afraid it will overwrite the existing
database, so i would like to make a backup of it)...
Any classes, scripts, etc out there to do this?
This is more of a question for the mysql mailing list unless you 
MUST use PHP to do it.  In that case, I would suggest phpmyadminjust my 
preference.
Besides mysqldump and a few other things.  You can also just copy 
the directory to a new directory if you have root access.  Just make sure 
that you keep the same permissions.
cd /var/lib/mysql  (assuming this is where your databases are)
mkdir backuptest (this would be the name of the new directory)
cp -pr test/* backuptest (this would copy the database test to the new 
directory you just created)

It would be a good idea to stop the database first then do a myisamchk.
myisamchk --silent --force --fast --update-state -O key_buffer=64M \
-O sort_buffer=64M -O read_buffer=1M -O write_buffer=1M \
/var/lib/mysql/*/*.MYI
Those \ backslash characters are to tell you that the command is all one 
line (without the backslashes).
After you have done all of this, then restart the database.  If 
you are moving to a new machine with the data, then you can either use the 
mysqldump of the database or tar/gzip up the directory before you restart 
mysqld and untar/ungzip it onto the new machine.  I am not going to 
guarantee that the last method will always work for you, but I have done it 
in the past from linux to linux, linux to windows and windows to linux with 
no problem.  If you are moving it to a new server, you will need to make 
sure to setup the access permissions again in the mysql database.  Also, 
you can use the backuptest database by doing the same thing if you are not 
root and root doesn't have full privileges on every database.  Strange, but 
I have seen a setup like that.

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


[PHP] Using a recursive ArrayIterator

2005-02-03 Thread V Kam
Hello all

I need some assistance converting code to use the
RecursiveIterator in PHP 5 SPL. I have the following
function which scans through a nested array set and
returns the path to all matches.

?php
function arraySearchRecursive($needle, $haystack,
$path=) 
{
foreach($haystack as $key=$value)
{
$path .= $key/;

// unset the path once the end of the tree is
reached
if (is_array($value)) 
{
arraySearchRecursive($needle, $value, $path);
unset($path);
} 

else 
{
echo $path;
}
}
}
?

I'm trying to convert this to use iterators as I
believe that may be faster/more efficient. However I'm
totally confused as to how to do it given the large
number of interfaces/classes and lack of
documentation. Could someone knowledgeable on the list
help me get started? Ideally I'd like a
framework/outline in pseudocode.

Thanks!

Kam




__ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail

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



[PHP] String - Number Automatic Conversion

2005-02-03 Thread Nuzzo Art-CINT116
I am not sure if this is a bug or I am just doing something dumb but I am 
having a problem with automatic converting of strings to a number between 0 and 
-1. For example:
 
$p1 = Array ( 0 = -.15, 
  1 = -.15 + 0, 
  2 = (float) -.15 + 0,
  5 = -1.15, 
  6 = -1.15 + 0, 
  7 = (float) -1.15 + 0,
  8 = .15,
  9 = .15 + 0, 
  10 = (float) .15 + 0,
  11 = 1.15, 
  12 = 1.5 + 0, 
  13 = (float) 1.5 + 0
);

 
If I print $p1 I get:
 
Array
(
[0] = -.15
[1] = 0
[2] = -0.15
[5] = -1.15
[6] = -1.15
[7] = -1.15
[8] = .15
[9] = 0.15
[10] = 0.15
[11] = 1.15
[12] = 1.5
[13] = 1.5
)

 
Note that the results for element [1] is 0 not -.15 as I had expected.  It does 
not matter what value is added to the string.  Any value outside the range of  
-1  value   0 gives the correct results. 
 
Is this a bug or am I missing something.
 
 
Thanks for any help,
 
 
Art Nuzzo


[PHP] mcrypt_module_open

2005-02-03 Thread blackwater dev
Do I have to compile php5 with a specific option to use this function
(mcrypt_module_open)?  I just have it compiled with mysql and it
throws errors that this function is undefined.

Thanks!

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



Re: [PHP] String - Number Automatic Conversion

2005-02-03 Thread Richard Lynch
Nuzzo Art-CINT116 wrote:
   1 = -.15 + 0,
   6 = -1.15 + 0,
 [1] = 0
 [6] = -1.15

 Is this a bug or am I missing something.

Looks like a bug to me...

It's remotely possible that it's documented somewhere that -.15 doesn't
turn into a number, but that would be pretty bogus, eh?

But who knows:  There may well be a technical or philosophical reason for
not allowing that format.  I can't see why, but I ain't the guy writing
the code :-)

Check and file it at http://bugs.php.net

I suppose it's also remotely possible that rounding errors are at fault,
but that's pretty damn big round error...  More likely, the regex to
detect a number at the start of a string doesn't include -.[0-9]* as a
valid case.

Possible work-around:
I suspect that
$p1[14] = -0.15 + 0;
will do what you want, since the leading 0 will probably trigger the regex
properly.

Try it and see.

PS You should probably have posted the PHP version and whatnot as well, as
I wouldn't be surprised if the bug is version-specific...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Script stuck on final ?

2005-02-03 Thread Richard Lynch
Alp wrote:
 Why would a php script get stuck at the ver last line of code in php/mysql
 combination? I'm getting a parse error at the very last line.

It may help you (now and in the future) to remember that PHP is just a
program, that reads your script, line by line, and then tries to convert
what you typed into an action for it to take.

If it's complaining on the last line, then, most likely, it expecting
something *MORE* from you, based on what you already have typed.

So you're missing the ending part of something, like an ending  mark, or
an ending ' or an ending } or an ending ) or an ending ] or something of
that nature.

It's also a good idea to be FANATIC about your alignment of beginning and
ending { } markers -- There are religious arguments about where exactly
they should be placed, but pick whatever seems most reasonable to you and
stick to it, and ALWAYS line them up the same with CONSISTENT indentation.

Otherwise, you'll spend the rest of your programming life looking for
missing }

You may also want to get a good color-coding editor.  A quick Google for
PHP Editors should turn up tons of them.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Premature end of script headers: php

2005-02-03 Thread Claudio
Hi,
Im trying to use PHP4 and PHP5 at the same time. PHP4 as CGI and PHP5 as
module.
PHP5 ist actually not present and not installed
PHP4 runs find as module, when I try to use it as CGI I receive the error
message:
Premature end of script headers: php

Can someone help me?


Here my used configurations:

Testfile: ?php phpinfo(); ?

Webserver: Apache 2.0.50 (Linux/Suse) installed as RPM

PHP4 version 4.3.10 self compiled from downloaded tar
   ./configure \
--with-apxs2=/usr/sbin/apxs2-prefork \
--prefix=/usr/local/php-4.3.10 \
--with-mysql --with-ldap

httpd.conf:
#
# If PHP4 is loaded as module
#
#IfModule sapi_apache2.c
IfModule mod_php4.c
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php
DirectoryIndex index.php3
DirectoryIndex index.php4
/IfModule

#
# To load PHP4 as CGI
#
IfDefine PHP4_CGI
ScriptAlias /php4/ /usr/local/php-4.3.10/bin/
Directory /usr/local/php-4.3.10/bin/
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from 192.168.11
/Directory
AddType application/x-httpd-php4 .php
AddType application/x-httpd-php4 .php3
AddType application/x-httpd-php4 .php4
AddType application/x-httpd-php-source .phps

Action application/x-httpd-php4 /php4/php

DirectoryIndex index.php
DirectoryIndex index.php3
DirectoryIndex index.php4
/IfDefine

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



Re: [PHP] mcrypt_module_open

2005-02-03 Thread Richard Lynch
blackwater dev wrote:
 Do I have to compile php5 with a specific option to use this function
 (mcrypt_module_open)?  I just have it compiled with mysql and it
 throws errors that this function is undefined.

./configure --help | less
/mcrypt

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] I need to create a search that will search partial files names of images and display the images. Basically, I have a folder on the internet that has security camera images dumped into it with a file name like this:

2005-02-03 Thread Vin
I need to create a search that will search partial files names of images and
display the images.  Basically, I have a folder on the internet that has
security camera images dumped into it with a file name like this:

MDcameraname20050109104846001N38B.jpg
MDcameranameMMDDHHMMSS001N38B

So what I would like to create is a search that will allow a user to input
the year, month, day, and hour, and have the website display the images from
that hour. Could someone help me with this?

Thanks in advance,
Vinny

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



[PHP] Re: PHP5 + SPL - Creating an object as an array.

2005-02-03 Thread Yotam Ofek
Jason Barnett wrote:
Yotam Ofek wrote:
I would like to create an object like this:
?php
class TestClass {
private $some_array;
public $just;
public $some;
public $public;
public $vars;
}
?
Is it possible, through SPL, to make the class accessible as 
$testclass['array_key'], which will return the value for the key 

Yes, this is exactly what the SPL is for.  Actually the exact classes 
you will want to check out are called ArrayIterator and ArrayObject. 
Although I don't know for certain about making $some_array private... it 
*might* need to be public.  No promises either way on that one, just 
look out for it ;)

'array_key' from $some_array? Not only that, but I want the class to 
be accessable as $testclass-just aswell!
Is that possible? Examples are welcome.

Thanks in advance,
Yotam Ofek!


Thanks.
Seems that it you were right about ArrayIterator and ArrayObject.
If anyone needs further help with this, email me.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: How to make binary strings useful?

2005-02-03 Thread Richard Lynch
Jerry Miller wrote:
 There's a FAQ section entitled PHP and Other Languages,
 C isn't even listed among them!

Neither is COBOL. :-)

But you could Google for PHP and C and probably come up with something
worth reading.

But do feel free to write up a new section for the manual.

You can skip doing the COBOL one, however. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] problems with session timeout

2005-02-03 Thread Richard Lynch
Pedro Henrique Calais wrote:
 I'm with the following problem:
 my PHP scripts takes a very long time to execute (about 3 hours) because
 it has has system call to a perl script that is very time consuming.

I would recommend either using  in the call to the Perl script, or
inserting whatever you need into a database and having cron (Google: man 5
crontab) run the Perl script or *ANYTHING* that doesn't tie up your HTTP
connection for 3 hours, and that relies on users not closing their
browser, or PHP's ignore_user_abort function which didn't work right in
some older versions in some weird cases or something like that...

Basically, it just seems silly to me to risk the three-hour job not
getting done if at all possible to avoid that.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] I need to create a search that will search partial files names of images and display the images. Basically, I have a folder on the internet that has security camera images dumped into it with a file name like this:

2005-02-03 Thread Richard Lynch
Vin wrote:
 I need to create a search that will search partial files names of images
 and
 display the images.  Basically, I have a folder on the internet that has
 security camera images dumped into it with a file name like this:

 MDcameraname20050109104846001N38B.jpg
 MDcameranameMMDDHHMMSS001N38B

 So what I would like to create is a search that will allow a user to input
 the year, month, day, and hour, and have the website display the images
 from
 that hour. Could someone help me with this?

Take the sample code from http://php.net/readdir and then the sample code
from http://php.net/preg_match and you're pretty much done...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP Memory limit exceeded

2005-02-03 Thread Ben-Nes Yonatan
 Ben-Nes Yonatan wrote:
 Hi all,

 I got a problem with uploading files which encounter the memory limit
 when their size is not even close to the memory limit itself, let me
 explain.

 My server is as follows:
 1. PHP 4.3.9
 2. DB - Postgresql 7.4
 3. Apache 1.3.26

 Here is my code that i made for testing the problem (along the code i
 echoed the function memory_get_usage() to know how much memory was
 allocated already for the script):

 $imagefile=$_FILES['imagefile']; // recieve the file
 echo memory_get_usage().'br /';// 118592 memory bytes allocated
   $data = pg_escape_bytea(`cat $imagefile[tmp_name]`);
 echo memory_get_usage().'br /';// 5570280 memory bytes allocated

 $data = INSERT INTO test_files (bin_data, filename, filesize, filetype)
VALUES ('$data', '$imagefile[name]', '$imagefile[size]',
 '$imagefile[type]');   // creating the sql for the insert, i called the
 received value also $data cause i dont want to keep the previous $data
 (after all we want to save our precious memory no? :))
 echo memory_get_usage().'br /';// 5570400 memory bytes allocated
 {changed from b4 only alittle}

 if ( !$res = pg_query ($this-conn, $data) )  // try to insert the sql
 string
return 'error';
 else
return 'gr8';
 echo memory_get_usage().'br /';// 5570648 memory bytes allocated
 {again changed only alittle}


 Now as far as i see the script needed about 5.5MB of memory to upload a
 file of 4.7MB but thats what so weird here... i receive the memory limit
 error even if the php.ini memory_limit is set to 16MB! {twice of the
 default of 8MB!}  at 32MB it works fine... but thats way too much..
 I suspect that the problem is connected to the pg_query function itself
 but i didnt find what made it exactly...

 Do you suspect or that's where the script output ends?

 Even between 2nd and 3rd memory_get_usage() call your script's memory
 usage increased rapidly - first the sql query was created, then it was
 assigned to $data. So for a moment the file was in memory twice.

 Something similar is with pg_query() - the file was at a moment in $data
 string, then it is copied somewhere in the php_pg module and the memory
 usage tripples.

 As a solution you might want to implement (or look for implementation of)
 mysql's load_file() function.


Hi Marek and Richard thanks for answering,

First about the memory consumption i knew what u say though wasnt sure 100% 
how its working (im self learned so this part wasnt known/clear to me :)), 
because of that the option of 16MB to the memory limit seemed logical to me.
At the other hand i did find some huge mistake at my side... only the 
download of the file require 28MB (god knows why! but i wont start to bother 
u folks about it now) the upload need 16MB so clearly u were correct but im 
sorry to admit that i didnt understand y its getting tripled... after all 
the result $res is a result of an INSERT not a SELECT therfore it doesnt 
return all the data but just an identification if the action went succesful 
or not... or maybe im wrong here also?
About the mysql's function... well its mysql and im using postgresql... i 
tried to search for something that could help uploading files data to the 
server but didnt find anything useful.

I think that i will go on the solution of Richard and just upload the files 
to the file system though i dont really like this solution cause ill lose 
the integrity of the database but then again apprantly i dont really 
have any option do i? :P

Thanks again for helping me out,
Ben-Nes Yonatan 

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



RE: [PHP] String - Number Automatic Conversion

2005-02-03 Thread Nuzzo Art-CINT116
 
 Possible work-around:
 I suspect that
 $p1[14] = -0.15 + 0;
 will do what you want, since the leading 0 will probably 
 trigger the regex properly.
 
 Try it and see.

Changing it to -0.15 + 0 works.  This data is actually coming from a numeric 
field in an Oracle database using the OCI interface so I am not sure why it's a 
string instead of a number but that's a separate issue I need to look into.


 
 PS You should probably have posted the PHP version and 
 whatnot as well, as I wouldn't be surprised if the bug is 
 version-specific...
 


Ah... Yes, I meant to include that information:

HP-UX: 11.11
PHP:   4.3.9 


Art Nuzzo

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



Re: [PHP] RE: How to make binary strings useful?

2005-02-03 Thread Richard Lynch
Jerry Miller wrote:
 Here's the code (with the domain name removed)
 that doesn't work, despite the poor documentation
 of the variable types:

 ?
 $dir = /home/domain_name/www/binary/;
 $dh = opendir ($dir);
 do
 {
 $file = readdir ($dh);
 }
 while (!strncmp ($file, ., 1));
 $filename = sprintf (%s%s, $dir, $file);
 $fh = fopen ($filename, r);
 $cont = fread ($fh, 4);
 echo file:BR;
 echo $filename;
 echo BRcont:BR;
 printf (%02x %02x %02x %02x, $cont{0}, $cont{1}, $cont{2},
 $cont{3});
 fclose ($fh);
 closedir ($dh);
 ?

 Here's the output of od -c glance_date up to the fourth byte:

 000 177   E   L   F

 All four bytes are non-zero!

http://us4.php.net/language.types.type-juggling

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] I need to create a search that will search partial files names of images and display the images. Basically, I have a folder on the internet that has security camera images dumped into it with a file name like this:

2005-02-03 Thread Marek Kilimajer
Vin wrote:
I need to create a search that will search partial files names of images and
display the images.  Basically, I have a folder on the internet that has
security camera images dumped into it with a file name like this:
MDcameraname20050109104846001N38B.jpg
MDcameranameMMDDHHMMSS001N38B
So what I would like to create is a search that will allow a user to input
the year, month, day, and hour, and have the website display the images from
that hour. Could someone help me with this?
Thanks in advance,
Vinny
http://sk2.php.net/manual/en/function.glob.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Memory limit exceeded

2005-02-03 Thread Ben-Nes Yonatan
 Ben-Nes Yonatan wrote:
 Hi all,

 I got a problem with uploading files which encounter the memory limit
 when their size is not even close to the memory limit itself, let me
 explain.

 My server is as follows:
 1. PHP 4.3.9
 2. DB - Postgresql 7.4
 3. Apache 1.3.26

 Here is my code that i made for testing the problem (along the code i
 echoed the function memory_get_usage() to know how much memory was
 allocated already for the script):

 $imagefile=$_FILES['imagefile']; // recieve the file
 echo memory_get_usage().'br /';// 118592 memory bytes allocated
   $data = pg_escape_bytea(`cat $imagefile[tmp_name]`);
 echo memory_get_usage().'br /';// 5570280 memory bytes allocated

 $data = INSERT INTO test_files (bin_data, filename, filesize, filetype)
VALUES ('$data', '$imagefile[name]', '$imagefile[size]',
 '$imagefile[type]');   // creating the sql for the insert, i called the
 received value also $data cause i dont want to keep the previous $data
 (after all we want to save our precious memory no? :))
 echo memory_get_usage().'br /';// 5570400 memory bytes allocated
 {changed from b4 only alittle}

 if ( !$res = pg_query ($this-conn, $data) )  // try to insert the sql
 string
return 'error';
 else
return 'gr8';
 echo memory_get_usage().'br /';// 5570648 memory bytes allocated
 {again changed only alittle}


 Now as far as i see the script needed about 5.5MB of memory to upload a
 file of 4.7MB but thats what so weird here... i receive the memory limit
 error even if the php.ini memory_limit is set to 16MB! {twice of the
 default of 8MB!}  at 32MB it works fine... but thats way too much..
 I suspect that the problem is connected to the pg_query function itself
 but i didnt find what made it exactly...

 Do you suspect or that's where the script output ends?

 Even between 2nd and 3rd memory_get_usage() call your script's memory
 usage increased rapidly - first the sql query was created, then it was
 assigned to $data. So for a moment the file was in memory twice.

 Something similar is with pg_query() - the file was at a moment in $data
 string, then it is copied somewhere in the php_pg module and the memory
 usage tripples.

 As a solution you might want to implement (or look for implementation of)
 mysql's load_file() function.


Hi Marek and Richard thanks for answering,

First about the memory consumption i knew what u say though wasnt sure 100%
how its working (im self learned so this part wasnt known/clear to me :)),
because of that the option of 16MB to the memory limit seemed logical to me.
At the other hand i did find some huge mistake at my side... only the
download of the file require 28MB (god knows why! but i wont start to bother
u folks about it now) the upload need 16MB so clearly u were correct but im
sorry to admit that i didnt understand y its getting tripled... after all
the result $res is a result of an INSERT not a SELECT therfore it doesnt
return all the data but just an identification if the action went succesful
or not... or maybe im wrong here also?
About the mysql's function... well its mysql and im using postgresql... i
tried to search for something that could help uploading files data to the
server but didnt find anything useful.

I think that i will go on the solution of Richard and just upload the files
to the file system though i dont really like this solution cause ill lose
the integrity of the database but then again apprantly i dont really
have any option do i? :P

Thanks again for helping me out,
Ben-Nes Yonatan

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



Re: [PHP] How to make binary strings useful?

2005-02-03 Thread Richard Lynch
Jerry Miller wrote:
 Is there an example of the UNIX od utility written
 in PHP?

I dunno.  Goodle for PHP octal dump

 Is such a useful task even possible??

Certainly it's possible, though I'm not sure why you wouldn't just USE the
existing 'od' utility.

 From what I've seen of strings, they're completely
 opaque, so what good does it do to be able to read
 binary-safe strings from a file???

Strings are strings in PHP.

They're not bytes thinly disguised as strings by some declarative fiat of
the programmer.

If you want to convert a string to an integer, then you have to use the
http://php.net/ord function to do that.

You can then use functions to convert to binary, hex, octal etc.

 Even the deprecated
 (why) $str{$inx} notation apparently results in

You'd have to read the PHP-Developer list to find out what the rationale
for deprecating that feature was.

Perhaps the confusion that arose from people thinking strings where
arrays, since the syntax for array indexing was the same wasn't worth
the benefit of being able to use [] on a string.

 another string, because trying to printf it with the
 %02x format always comes out with 00.  (Maybe
 that's why -- it's useless!)

Actually, I've always found [] access to a string quite useful.

But since I read the manual, I knew I just got a string which happened to
be one character in length from that.

 As an experienced C
 programmer, I'm finding PHP to be as counter-intuitive
 for low-level work as Perl is.

So write your utility in C. [shrug]

 I need to convert binary
 dumps of data structures into database table rows, and
 MySQL on my server doesn't support queries from C.

Okay, but don't wade into PHP programming pretending that it's C just
because the syntax has a surface resemblance to C.

 I thought about writing a CGI script (in C) that
 would generate the hard-coded PHP output for
 each instance, but a URL that ends in .cgi is
 never intercepted by the PHP interpreter.  Worse

Then your web server PHP CGI configuration is borked.

Fix it.

 yet, the SCRIPT LANGUAGE= SRC=
 that works perfectly well with JavaScript is
 likewise ignored if the language is PHP!  Finally,

Actually, you can use SCRIPT LANGUAGE=PHP on the server to have it
parse PHP, but PHP is always parsed on the SERVER, never on the client, so
the browser is not going to be able to do much intelligent with SCRIPT
LAGNGUAGE=PHP SRC=xxx

 I'm not aware of a Content-type such as text/php.
 What exactly was the purpose of designing yet
 another inflexible language?!

If you want to send PHP source code to the browser, you'd send it as
text/plain

Other than that, PHP is SERVER-SIDE and sending text/php would be silly,
as browsers don't have PHP interpreters (and likely never will).

Basically, as far as I can tell, you've waded into PHP pretending that
it's C and now are pissed off because it's not C.  Well duh!

Why not spend a little time to read the [bleep] manual?!

http://php.net/manual/

Just focus on the first few sections, up to the point where it starts
listing all the extensions and functions.

An experienced C programmer could probably read through all that in, what,
an hour or two?

You would have saved yourself a GREAT DEAL of frustration, and wouldn't
have wasted so much time on your rant and the replies.

Good Luck!

http://php.net/manual/

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Credit card storing, for processing

2005-02-03 Thread Richard Lynch
Brian Dunning wrote:
 I agree with this. There is way too much paranoia about credit cards
 online. 99% of stolen credit card numbers are acquired by phishing and
 the other 1% by uncrumpling receipts out of a wastebasket. There's no
 longer any reason to go to the trouble of trying to crack encryption.
 Remember the knight who went into battle wearing armor only on his
 legs?

Source for these statistics?

Cuz I believe the crumpled paper is MUCH higher than that, from resources
I've consulted.

However, phishing may be much higher than in the past, so would love to
learn where you got these numbers.

Or if you just made them up and wanted to imply that compromised servers
are the almost-zero that's fine too -- Just want to know if these are
real stats or made-up.

I would guess that 99%++ are still from external sources (phish + paper),
rather than compromised servers.

But I am *NOT* willing to be the one unlucky guy who loses $50K and all my
customers from a compromised server -- And I simply won't implement
something that would let my client be that one unlucky guy.

The credit card companies charge exhorbitant rates and fees and whatnot to
cover the losses to these things, and they have the resources to better
manage the data safely.  Let *THEM* worry about it.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Clear POST variables on page refresh

2005-02-03 Thread Richard Morley
I'm not sure if this is specifically a PHP problem, but here we go. Is  
there a way to clear the POST variables when the user refreshes a page?  
Specifically, my webpage POSTs a form to update or delete a record from  
the database -- it POSTs to itself, however. But if the user then clicks  
the browser's refresh button, it will try to delete or modify a  
non-existent record. I would like, if the users presses the refresh  
button, that PHP processes the page as no POST variables are set. I have a  
button on the page entitled Reload that executes a short Javascript:  
onclick=window.location=? echo PHP_SELF; ? which accomplishes the  
desired effect. But it tries to resend the POST information if the browser  
refresh button is clicked.

I read something somewhere that seemed to imply this could be done with  
PHP sessions? Is this the way to go? If so, how?

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


RE: [PHP] Credit card storing, for processing

2005-02-03 Thread Richard Lynch
Brandon Thompson wrote:
 WowI was hoping someone would respond with a little balance to that
 reactionary doomsday speech.  Don't get me wrong...those are some very
 valid
 points that need to be considered, but my gosh...

I'd rather frighten away somebody from storing CCs insecurely than
blithely stand by while they risk a small fortune and the [client's]
customers for all time.

 The key-pair idea is very good.  I've done systems in the past for clients
 that work in a similar fashion.

Why?

What reason is there for doing this instead of just letting the credit
card vendor store the credit card numbers and setting up a recurring
charge?

Convince me it's a valid reason, and I'll talk welcome more discussion
about how to do it securely.  Otherwise, I remain the doom-sayer:  DON'T
DO IT

 There are multiple layers of security with two main aspects:
 1. The technical implemenation and complexity of the system
 2. The responsibility/priveledges granted to users/admins

 You can come up with the most complex, technical secret key solution
 around (aspect #1)but if you entrust that secret key to the wrong
 person
 (aspect #2), it's all for nothing.

NO!

It's not about who you trust:  It's about who can BREAK IN and gain access
to the trusted user/admin area.

Or the physical devices and bypass your security completely.

I trusted my client completely and implicitly.

I did NOT trust every single employee, customer, or visitor who could
wander into his office, co-location space, etc.

If you do *NOT* have documented processes in place for how you will keep
out the Bad Guys to every link of the processing chain, software and
hardware, where the credit card number will exist, however briefly, then
you have no business storing credit card numbers.

 In the end...it's about common sense.  It's FAR less dangerous to
 implement
 what you are suggesting than it is to simply pay for your dinner with a
 credit card.

Which is FAR less dangerous than Christmas shopping with a credit card.

That doesn't make it safe.

Playing with M-80s is FAR less dangerous than playing with dynamite, which
is FAR less dangerous than playing with nitroglycerine.

NONE of them are safe and if you don't follow established procedures and
policies, it's just plain stupid to do it.

 One thing I agree with Richard wholeheartedly on is his Hi, I'm about to
 perform brain surgery.  Which scalpel should I use? anology.  If the
 technicaly aspects of implementing a system like this escape you...then
 please learn how to do it in theory first.  Don't learn on the job with
 something as precious as your credit rating.

It was clear, to me at least, that the original poster did NOT have a good
grasp on some rather large issues.

More importantly, NOTHING posted indicated a true need to store credit
card numbers.

So, to simplify:
If you don't NEED to store credit card numbers, if you can find ANY way to
*NOT* store credit card numbers, then you will save a TON of money by not
storing them, because storing them comes with a very very very large price
tag in development, maintenance, auditing, and ongoing physical security
of all hardware involved.

If you absolutely HAVE to store credit card numbers, be prepared to shell
out tens of thousands on an annual basis to keep them safe.  If that's too
expensive, then you're not ready to store credit card numbers.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] String - Number Automatic Conversion

2005-02-03 Thread Richard Lynch
Nuzzo Art-CINT116 wrote:
 Possible work-around:
 I suspect that
 $p1[14] = -0.15 + 0;
 will do what you want, since the leading 0 will probably
 trigger the regex properly.

 Try it and see.

 Changing it to -0.15 + 0 works.  This data is actually coming from a
 numeric field in an Oracle database using the OCI interface so I am not
 sure why it's a string instead of a number but that's a separate issue I
 need to look into.

I'm not certain about OCI or others, but generally PHP database extensions
retrieve all data as text...

At least, the last time I checked on that, that's what it was...

Could be wrong or out of date.

Rarely worry about data type in PHP, once you understand the type juggling
and conversion rules.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP Memory limit exceeded

2005-02-03 Thread Richard Lynch
 At the other hand i did find some huge mistake at my side... only the
 download of the file require 28MB (god knows why! but i wont start to
 bother
 u folks about it now) the upload need 16MB so clearly u were correct but
 im
 sorry to admit that i didnt understand y its getting tripled... after all
 the result $res is a result of an INSERT not a SELECT therfore it doesnt
 return all the data but just an identification if the action went
 succesful
 or not... or maybe im wrong here also?

PHP probably has to create an extra big chunk of text somewhere in the
process of sending the data to PostgreSQL.

 About the mysql's function... well its mysql and im using postgresql... i
 tried to search for something that could help uploading files data to the
 server but didnt find anything useful.

Sorry.  I suspect they operate the same internally anyway, in terms of
transferring data to/from the database, and buffering the query.

 I think that i will go on the solution of Richard and just upload the
 files
 to the file system though i dont really like this solution cause ill lose
 the integrity of the database but then again apprantly i dont really
 have any option do i? :P

From a strictly utilitarian integrity stand-point, your database is more
safe with the files in the file system, as a single corrupt file in the
file system is less likely to bring the whole db down than a single
corrupt binary blob in the database.

If you are talking about the integrity of records matching up with files
uploaded and making sure that you don't have ghost files left from deleted
records, it's not that hard to write your business logic to be pretty
certain that things stay in sync, and then to add a cron job to check
every once in a while, with a frequent random selection of records and an
occasional full complete scan to be really certain.

It's amazinng how simple things can be when you automate them with cron :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Credit card storing, for processing

2005-02-03 Thread Brian Dunning
Source for these statistics?
I pulled them from the MYASS database.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Using SSL with PHP5's socket_* functions

2005-02-03 Thread Richard Lynch
dan wrote:
 I am a bit new to PHP, especially sockets, so what I am asking may very
 well be comparing apples to oranges.

 I am writing a function to interact with an SSL server, but I see no way
 of how I can communicate over SSL.  I expected to be able to enter an
 address such as https://10.10.10.10 into socket_connect(), but it fails.
   Maybe because this isn't even a supported/allowed argument.

 Is it possible to use SSL with any of the socket_* functions in PHP5?

 Again, I feel like a real tool asking this.  I'm just trying to
 understand as best I can.

http://php.net/curl

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Problem solved!

2005-02-03 Thread Jerry Miller
I didn't want to give up entirely on the
flexibility of writing my scripts in C, so
I thought some more about how to get
a CGI script to use PHP without having
to spend a lot of time on PHP logic.

My first attempt was to see whether I
could substitute the extension .php
for the usual .cgi extension.  I could,
but it made no difference, i.e., PHP
didn't intercept the output.

I did some searching in /usr/local/lib/php
to no avail, but then I brought up the
phpinfo page and studied it.  Under the
Environment heading, I found the
variable SCRIPT_FILENAME and
passed it a test PHP filename as a
command-line argument.  Voila!  I
got a HTTP header and the expected
PHP-processed output!

Now all I have to do is use popen from
the C program that will become my CGI
script, and I'll be able to let C handle the
GET and/or POST query strings, create
the MySQL queries, and pass a more
manageable amount of PHP code to
access the tables.  Using HTTPS should
also be more straightforward that way.

I knew there had to be a better way!

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



RE: [PHP] Clear POST variables on page refresh

2005-02-03 Thread Chris W. Parker
Richard Morley mailto:[EMAIL PROTECTED]
on Thursday, February 03, 2005 9:57 AM said:

 I'm not sure if this is specifically a PHP problem, but here we go. Is
 there a way to clear the POST variables when the user refreshes a
 page?

[snip]

 I read something somewhere that seemed to imply this could be done
 with PHP sessions? Is this the way to go? If so, how?

Don't know about the sessions bit but the regular way around this is to
POST your form to a processing page that redirects back to the form
page.

form.php - processor.php - form.php

When the users presses Refresh they will simply refresh the form page
and nothing else.



hth,
Chris.

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



[PHP] mcrypt public and private key

2005-02-03 Thread Daniel Bowett
Hi,
I have been reading up on the mcrypt function. Is it possible to use it 
with a public and private key pair or just with a single key?

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


RE: [PHP] String - Number Automatic Conversion

2005-02-03 Thread Ford, Mike
On 03 February 2005 16:07, Nuzzo Art-CINT116 wrote:

 I am not sure if this is a bug or I am just doing something
 dumb but I am having a problem with automatic converting of
 strings to a number between 0 and -1. For example:
 
   1 = -.15 + 0,

 [1] = 0
 
 Is this a bug or am I missing something.

It's a bug -- see http://bugs.php.net/bug.php?id=30726

Reported fixed on 18-Jan-2005, so I guess you're looking at 4.3.11/5.0.4 to
actually contain the fix.

Cheers!

Mike

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


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

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



RE: [PHP] How to make binary strings useful?

2005-02-03 Thread Mikey
 I need to convert binary
 dumps of data structures into database table rows, and MySQL on my 
 server doesn't support queries from C.

Errr, how can that be?  AFAIK the mySQL extension of PHP is ostensibly a
wrapper for the mySQL C libraries.  If you have mySQL and PHP installed then
I can't see any reason why you shouldn't be able to write these queries in C

HTH,

Mikey

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



Re: [PHP] Clear POST variables on page refresh

2005-02-03 Thread Richard Lynch
Richard Morley wrote:
 I'm not sure if this is specifically a PHP problem, but here we go. Is
 there a way to clear the POST variables when the user refreshes a page?
 Specifically, my webpage POSTs a form to update or delete a record from
 the database -- it POSTs to itself, however. But if the user then clicks
 the browser's refresh button, it will try to delete or modify a
 non-existent record. I would like, if the users presses the refresh
 button, that PHP processes the page as no POST variables are set. I have a
 button on the page entitled Reload that executes a short Javascript:
 onclick=window.location=? echo PHP_SELF; ? which accomplishes the
 desired effect. But it tries to resend the POST information if the browser
 refresh button is clicked.

A simple thing to do is to put an md5 hash into the POST data, then only
do the insert if that md5 hash isn't already used when they hit refresh.

This avoids the hassle of re-direct headers and trying to follow
programming logic bouncing from script to script.

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] $_SERVER['REQUEST_URI'] being trimmed

2005-02-03 Thread Verdon Vaillancourt
Hi :)
I am trying to build a simple mechanism to allow visitors to set a site  
preference (stored in a cookie) by clicking on a link. I want the  
cookie set and the original page reloaded with the new cookie set, when  
a visitor clicks on the link.

My link looks like this...
a href=/switch.php?userLangChoice=framp;sender=?php echo  
$_SERVER['REQUEST_URI']; ?French/a

My file switch.php looks like this...
?php
setcookie(userLang, $userLangChoice);
if ($sender == )
$sender = index.php;
else
$sender = $sender;

 header(location:.$sender);
?
Now, for the most part this works fine, but in some cases, my referring  
URL ($sender) is being truncated. Simple URLs such as  
'/listingsearch.php?Category%5B%5D=Hunting' work fine, although it is  
being returned as '/listingsearch.php?Category[]=Hunting'. More complex  
URLs like  
'/listingsearch.php? 
Accommodation%5B%5D=OutpostCategory%5B%5D=FishingRegion%5B%5D=North- 
West' are being truncated at the first variable down to  
'/listingsearch.php?Accommodation[]=Outpost'

Is there something I can do to make sure the referring URL is not  
truncated and it would also be nice if it was left alone and not  
encoded or decoded.

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


RE: [PHP] String - Number Automatic Conversion

2005-02-03 Thread Nuzzo Art-CINT116
  
  Is this a bug or am I missing something.
 
 It's a bug -- see http://bugs.php.net/bug.php?id=30726
 
 Reported fixed on 18-Jan-2005, so I guess you're looking at 
 4.3.11/5.0.4 to actually contain the fix.
 
 Cheers!
 
 Mike
 
 -
 Mike Ford,  Electronic Information Services Adviser,
 Learning Support Services, Learning  Information Services, 
 JG125, James Graham Building, Leeds Metropolitan University, 
 Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
 Email: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 
 


Are there patches available that I can apply to my existing PHP (4.3.9) or is 
my only alternate is to put a work around in place until 4.3.11 is released?

Do you know when 4.3.11 might be released?



Thanks,



Art Nuzzo

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



RE: [PHP] Clear POST variables on page refresh

2005-02-03 Thread Chris W. Parker
Richard Lynch mailto:[EMAIL PROTECTED]
on Thursday, February 03, 2005 11:26 AM said:

 A simple thing to do is to put an md5 hash into the POST data, then
 only do the insert if that md5 hash isn't already used when they
 hit refresh. 
 
 This avoids the hassle of re-direct headers and trying to follow
 programming logic bouncing from script to script.

Come now, let's not be so dramatic. :P

hassle of re-direct:

?php

  header(Location: http://fq.dn/page.ext;);

?

programming logic bouncing from script to script:

It would be the same logic/handling of the form, just split across two
pages. Not really much changing is necessary. Except of course that you
will have to send data back to the form page via the querystring should
you have the need (i.e. form errors).


Not trying to knock you or the MD5 solution you offered. Just thought
you made the two page solution sound scarier than it really is.



Chris.

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



Re: [PHP] $_SERVER['REQUEST_URI'] being trimmed

2005-02-03 Thread Verdon Vaillancourt
Thanks for the input Mikey...
I guess I'm just not sure how to, and I had already hit on this method 
that is almost doing the trick :)

salut,
verdon
On 3-Feb-05, at 2:46 PM, Mikey wrote:
Any thoughts? Thanks,
verdon
Why don't you just use JavaScript to set the cookie and then reload 
the page
that you are on?

HTH,
Mikey

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


Re: [PHP] Credit card storing, for processing

2005-02-03 Thread John Nichel
Brian Dunning wrote:
Source for these statistics?

I pulled them from the MYASS database.
Now that's priceless.  Thanks Brian, you've made my day!
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Credit card storing, for processing

2005-02-03 Thread Brian Dunning
Source for these statistics?
I pulled them from the MYASS database.
Now that's priceless.  Thanks Brian, you've made my day!
I wish I could take credit. Many versions of this have gone around, but 
here's one:

http://www.crapco.com/badads/myass.html
So much for my earlier post about keeping this thread relevant and 
helpful.  :)

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


Re: [PHP] Premature end of script headers: php

2005-02-03 Thread Marek Kilimajer
My guess cli binary is executed instead of cgi.
Claudio wrote:
Hi,
Im trying to use PHP4 and PHP5 at the same time. PHP4 as CGI and PHP5 as
module.
PHP5 ist actually not present and not installed
PHP4 runs find as module, when I try to use it as CGI I receive the error
message:
Premature end of script headers: php
Can someone help me?
Here my used configurations:
Testfile: ?php phpinfo(); ?
Webserver: Apache 2.0.50 (Linux/Suse) installed as RPM
PHP4 version 4.3.10 self compiled from downloaded tar
   ./configure \
--with-apxs2=/usr/sbin/apxs2-prefork \
--prefix=/usr/local/php-4.3.10 \
--with-mysql --with-ldap
httpd.conf:
#
# If PHP4 is loaded as module
#
#IfModule sapi_apache2.c
IfModule mod_php4.c
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php
DirectoryIndex index.php3
DirectoryIndex index.php4
/IfModule
#
# To load PHP4 as CGI
#
IfDefine PHP4_CGI
ScriptAlias /php4/ /usr/local/php-4.3.10/bin/
Directory /usr/local/php-4.3.10/bin/
AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from 192.168.11
/Directory
AddType application/x-httpd-php4 .php
AddType application/x-httpd-php4 .php3
AddType application/x-httpd-php4 .php4
AddType application/x-httpd-php-source .phps
Action application/x-httpd-php4 /php4/php
DirectoryIndex index.php
DirectoryIndex index.php3
DirectoryIndex index.php4
/IfDefine
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Premature end of script headers: php

2005-02-03 Thread Claudio
Maybe... What is the diference?

In /usr/local/php-4.3.10/ I have 5 files after make install

(pear php php-config phpextdist phpsize)

What should I do? How can I make the cgi-executable?

Marek Kilimajer wrote:
 My guess cli binary is executed instead of cgi.

 Claudio wrote:
 Hi,
 Im trying to use PHP4 and PHP5 at the same time. PHP4 as CGI and PHP5 as
 module.
 PHP5 ist actually not present and not installed
 PHP4 runs find as module, when I try to use it as CGI I receive the error
 message:
 Premature end of script headers: php

 Can someone help me?


 Here my used configurations:

 Testfile: ?php phpinfo(); ?

 Webserver: Apache 2.0.50 (Linux/Suse) installed as RPM

 PHP4 version 4.3.10 self compiled from downloaded tar
./configure \
 --with-apxs2=/usr/sbin/apxs2-prefork \
 --prefix=/usr/local/php-4.3.10 \
 --with-mysql --with-ldap

 httpd.conf:
 #
 # If PHP4 is loaded as module
 #
 #IfModule sapi_apache2.c
 IfModule mod_php4.c
 AddType application/x-httpd-php .php
 AddType application/x-httpd-php .php3
 AddType application/x-httpd-php .php4
 AddType application/x-httpd-php-source .phps
 DirectoryIndex index.php
 DirectoryIndex index.php3
 DirectoryIndex index.php4
 /IfModule

 #
 # To load PHP4 as CGI
 #
 IfDefine PHP4_CGI
 ScriptAlias /php4/ /usr/local/php-4.3.10/bin/
 Directory /usr/local/php-4.3.10/bin/
 AllowOverride None
 Options +ExecCGI -Includes
 Order allow,deny
 Allow from 192.168.11
 /Directory
 AddType application/x-httpd-php4 .php
 AddType application/x-httpd-php4 .php3
 AddType application/x-httpd-php4 .php4
 AddType application/x-httpd-php-source .phps

 Action application/x-httpd-php4 /php4/php

 DirectoryIndex index.php
 DirectoryIndex index.php3
 DirectoryIndex index.php4
 /IfDefine
 

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



Re: [PHP] Premature end of script headers: php

2005-02-03 Thread Marek Kilimajer
Claudio wrote:
Maybe... What is the diference?
In /usr/local/php-4.3.10/ I have 5 files after make install
(pear php php-config phpextdist phpsize)
What should I do? How can I make the cgi-executable?
Marek Kilimajer wrote:
My guess cli binary is executed instead of cgi.
Try
$ /usr/local/php-4.3.10/php -v
If the output is
PHP 4.3.10 (cli) (built: .
^^^
it's CLI and CGI version was installed somewhere else. Try to locate it, 
or check the output of make install. cgi version is installed by default 
unless you include --disable-cgi in ./configure arguments

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


Re: [PHP] Clear POST variables on page refresh

2005-02-03 Thread Ricky Morley
Richard Lynch mailto:[EMAIL PROTECTED]
on Thursday, February 03, 2005 11:26 AM said:
A simple thing to do is to put an md5 hash into the POST data, then
only do the insert if that md5 hash isn't already used when they
hit refresh.
Thank you for your responses. One question: If I were to use the md5 hash  
method, what would be the best way to store used hashes? In a database? In  
a temporary file kinda thing? Thanks again.

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


RE: [PHP] Clear POST variables on page refresh

2005-02-03 Thread Richard Lynch
Chris W. Parker wrote:
 Richard Lynch mailto:[EMAIL PROTECTED]
 on Thursday, February 03, 2005 11:26 AM said:

 A simple thing to do is to put an md5 hash into the POST data, then
 only do the insert if that md5 hash isn't already used when they
 hit refresh.

 This avoids the hassle of re-direct headers and trying to follow
 programming logic bouncing from script to script.

 Come now, let's not be so dramatic. :P

 hassle of re-direct:

 ?php

   header(Location: http://fq.dn/page.ext;);

 ?

Except if you start using sessions, but then need to not use cookies
because they're now off by default in browsers, so you use trans-sid,
will that PHPSESSID get tacked on to the end of the re-location header?

I think not.

So then you have a *TON* of code to fix, because somebody put all these
header(Location:) in the code and you need the PHPSESSID on the end of
every one of them.

 programming logic bouncing from script to script:

 It would be the same logic/handling of the form, just split across two
 pages. Not really much changing is necessary. Except of course that you
 will have to send data back to the form page via the querystring should
 you have the need (i.e. form errors).

Months later, when trying to track down what is happening, you end up
opening up a file that matches the URL to find out what's going on, only
to find out it's not in that file because you did a header redirect to
another file, so then you open up that other file but then you find
another header redirect so then you open up another file, ...

You end up with 20 files open, with a snarled mess of header re-directs
bouncing you back and forth from file to file, for the very very very
common act of filling out a form.

No, thanks.

I'll stick to structuring my code so I don't need the re-direct.

 Not trying to knock you or the MD5 solution you offered. Just thought
 you made the two page solution sound scarier than it really is.

If it was only two pages, and there was only one header() re-direct, fine.

But what ends up happening is you get in the habit of doing this all over
the place, and you have a mess of spaghetti logic spread over a hundred
files.

At least, that's been my experience in trying to debug the mess people
have made with this header re-direct.

They can't use just one.

Perhaps you've had better luck with better programmers and header
re-direct usage -- All I know is, every time I find a header(Location:)
in somebody's PHP source code, I just know it's going to bite me in the
ass some day.

YMMV

Plus, the user can *STILL* use the pull-down menu of some browsers to go
back two pages and re-submit the form with the same data, or they can
click back fast enough to get there (on some browsers) and end up
re-loading the form that way.

If you need to be sure they don't do that, the md5 method will ALWAYS
work, not just sometimes work.

You want ALWAYS works or SOMETIMES works?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] $_SERVER['REQUEST_URI'] being trimmed

2005-02-03 Thread Richard Lynch
Verdon Vaillancourt wrote:
 I am trying to build a simple mechanism to allow visitors to set a site
 preference (stored in a cookie) by clicking on a link. I want the
 cookie set and the original page reloaded with the new cookie set, when
 a visitor clicks on the link.

 My link looks like this...

 a href=/switch.php?userLangChoice=framp;sender=?php echo
 $_SERVER['REQUEST_URI']; ?French/a

 My file switch.php looks like this...

 ?php

   setcookie(userLang, $userLangChoice);

  if ($sender == )
   $sender = index.php;
  else
   $sender = $sender;

   header(location:.$sender);

 ?

 Now, for the most part this works fine, but in some cases, my referring
 URL ($sender) is being truncated. Simple URLs such as
 '/listingsearch.php?Category%5B%5D=Hunting' work fine, although it is
 being returned as '/listingsearch.php?Category[]=Hunting'. More complex
 URLs like
 '/listingsearch.php?
 Accommodation%5B%5D=OutpostCategory%5B%5D=FishingRegion%5B%5D=North-
 West' are being truncated at the first variable down to
 '/listingsearch.php?Accommodation[]=Outpost'

 Is there something I can do to make sure the referring URL is not
 truncated and it would also be nice if it was left alone and not
 encoded or decoded.

Your very problem is that you are NOT encoding the URL data, so the
browser is trying to do it for you, only it can't be sure whether  is
supposed to be data or is supposed to separate your URL arguments.

http://php.net/urlencode

You may also want to just include the switch.php whenever userLangChoice
is set in the URL:

--- langchoic.inc -
?php
  if (isset($_GET['userLangChoice'])){
setCookie($_GET['userLangChoice']);
  }
?

You can simply: ?php include 'langchoice.inc'? on every page or in a
globals file you already include, and then you're not wasting a bunch of
HTTP connections bouncing around with the header or worrying about your
URL getting munged.

?php
  include 'langchoice.inc';
  echo a href=\$_SERVER[PHP_SELF]?userLangChoice=fr\French/a;
  echo a href=\$_SERVER[PHP_SELF]?userLangChoice=en\English/a;
?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Premature end of script headers: php

2005-02-03 Thread Richard Lynch
Claudio wrote:
 Maybe... What is the diference?

 In /usr/local/php-4.3.10/ I have 5 files after make install

Leave off the --with-apxs2 in your ./configure should make the CGI binary.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Clear POST variables on page refresh

2005-02-03 Thread Richard Lynch
Ricky Morley wrote:
 Richard Lynch mailto:[EMAIL PROTECTED]
 on Thursday, February 03, 2005 11:26 AM said:

 A simple thing to do is to put an md5 hash into the POST data, then
 only do the insert if that md5 hash isn't already used when they
 hit refresh.

 Thank you for your responses. One question: If I were to use the md5 hash
 method, what would be the best way to store used hashes? In a database? In
 a temporary file kinda thing? Thanks again.

In a database with a datetime field.

Clear out anything older than a day or whatever in a cron job.

For a super busy site, you'd want to clear them out more often.

Or, to simplify matters, if you already have sessions, then do this:

?php
  session_start();

  //Check their FORM freshness, and only process fresh input, not re-loaded:
  $fresh = $_POST['fresh'];
  $used = isset($_SESSION['used']) ? $_SESSION['used'] : array();
  if (isset($used[$fresh])){
echo Ignoring re-posted data: $freshbr /\n;
  }
  else{
echo INSERT INTO whatever (duplicate) VALUES ('$_POST[duplicate]');
$used[$fresh] = TRUE;
$_SESSION['used'] = $used;
  }

?
form action=?php echo $_SERVER['PHP_SELF']? method=post
  input type=hidden name=fresh value=[?php echo md5(uniqid())?]
  input name=duplicatebr /
  input type=submit value=Duplicate?
/form

Make sure any test for a session time-out occurs BEFORE this test for
'fresh' data -- so they can't wait for the session to time-out, and then
re-load, and get their duplicate in that way.

You could put most of the code to check for freshness in an include file,
and use it on a zillion forms.

Just put the INPUT HIDDEN with NAME='fresh' and an MD5 in every form and
be sure to: include 'freshness.inc'; before processing.

Or put it in a function you define in your globals.inc (or whatever gets
loaded every page).

It's simple and browser-independent, so it doesn't matter if they hit back
or not or re-load or their browser sends or doesn't send the signal needed
for ignore_user_abort to work or...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Premature end of script headers: php

2005-02-03 Thread Claudio
gw:/usr/local/php-4.3.10/bin # ./php -v
PHP 4.3.10 (cli) (built: Feb  3 2005 17:58:19)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

Your guess was correct...

after a new configure without axp2s...

gw:/usr/local/php-4.3.10/bin # ./php -v
PHP 4.3.10 (cgi) (built: Feb  3 2005 22:59:02)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

now it runs... PHP4 as CGI and PHP5 as module
Thanks!!

Marek Kilimajer [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
 Claudio wrote:
 Maybe... What is the diference?

 In /usr/local/php-4.3.10/ I have 5 files after make install

 (pear php php-config phpextdist phpsize)

 What should I do? How can I make the cgi-executable?

 Marek Kilimajer wrote:

My guess cli binary is executed instead of cgi.

 Try

 $ /usr/local/php-4.3.10/php -v

 If the output is

 PHP 4.3.10 (cli) (built: .
 ^^^

 it's CLI and CGI version was installed somewhere else. Try to locate it, 
 or check the output of make install. cgi version is installed by default 
 unless you include --disable-cgi in ./configure arguments 

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



Re: [PHP] I need to create a search that will search partial filesnames of images and display the images. Basically, I have a folder on theinternet that has security camera images dumped into it with a file namelike this:

2005-02-03 Thread Vin
Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Vin wrote:
  I need to create a search that will search partial files names of images
and
  display the images.  Basically, I have a folder on the internet that has
  security camera images dumped into it with a file name like this:
 
  MDcameraname20050109104846001N38B.jpg
  MDcameranameMMDDHHMMSS001N38B
 
  So what I would like to create is a search that will allow a user to
input
  the year, month, day, and hour, and have the website display the images
from
  that hour. Could someone help me with this?
 
  Thanks in advance,
  Vinny
 

 http://sk2.php.net/manual/en/function.glob.php


thanks, that is perfect. Now I have a follow up question if you don't mind.
How can I take $filename and break it apart to display the time/date the
picture was taken in a nice readable format?

here is my code:

?php
$x = 0;
$count = 0;
$matches = glob(*$y$m$d$h*.JPG);
if ( is_array ( $matches ) )
 {
 foreach ( $matches as $filename)
   {
   if ($x  4)
{
echo td;
echo a href=javascript:pop(';
echo $filename;
echo ');;
echo img src=';
echo $filename;
echo ' border=0 width=240 height=180/a;
$count = $count+1;
echo br;
echo $filename;
echo /td;
$x = $x + 1;
} else {
echo /trtr;
$x = 0;
}
   }
 }

echo brbr;
echo $count .  images found;
?

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



Re: [PHP] Clear POST variables on page refresh

2005-02-03 Thread Ricky Morley
You're wonderful. Thank you very much.

On Thu, 3 Feb 2005 13:02:14 -0800 (PST), Richard Lynch [EMAIL PROTECTED]  
wrote:

Ricky Morley wrote:
Richard Lynch mailto:[EMAIL PROTECTED]
on Thursday, February 03, 2005 11:26 AM said:
A simple thing to do is to put an md5 hash into the POST data, then
only do the insert if that md5 hash isn't already used when they
hit refresh.
Thank you for your responses. One question: If I were to use the md5  
hash
method, what would be the best way to store used hashes? In a database?  
In
a temporary file kinda thing? Thanks again.
In a database with a datetime field.
Clear out anything older than a day or whatever in a cron job.
For a super busy site, you'd want to clear them out more often.
Or, to simplify matters, if you already have sessions, then do this:
?php
  session_start();
  //Check their FORM freshness, and only process fresh input, not  
re-loaded:
  $fresh = $_POST['fresh'];
  $used = isset($_SESSION['used']) ? $_SESSION['used'] : array();
  if (isset($used[$fresh])){
echo Ignoring re-posted data: $freshbr /\n;
  }
  else{
echo INSERT INTO whatever (duplicate) VALUES ('$_POST[duplicate]');
$used[$fresh] = TRUE;
$_SESSION['used'] = $used;
  }

?
form action=?php echo $_SERVER['PHP_SELF']? method=post
  input type=hidden name=fresh value=[?php echo md5(uniqid())?]
  input name=duplicatebr /
  input type=submit value=Duplicate?
/form
Make sure any test for a session time-out occurs BEFORE this test for
'fresh' data -- so they can't wait for the session to time-out, and then
re-load, and get their duplicate in that way.
You could put most of the code to check for freshness in an include file,
and use it on a zillion forms.
Just put the INPUT HIDDEN with NAME='fresh' and an MD5 in every form and
be sure to: include 'freshness.inc'; before processing.
Or put it in a function you define in your globals.inc (or whatever gets
loaded every page).
It's simple and browser-independent, so it doesn't matter if they hit  
back
or not or re-load or their browser sends or doesn't send the signal  
needed
for ignore_user_abort to work or...

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


Re: [PHP] PHP Memory limit exceeded

2005-02-03 Thread Marek Kilimajer
Richard Lynch wrote:
At the other hand i did find some huge mistake at my side... only the
download of the file require 28MB (god knows why! but i wont start to
bother
u folks about it now) the upload need 16MB so clearly u were correct but
im
sorry to admit that i didnt understand y its getting tripled... after all
the result $res is a result of an INSERT not a SELECT therfore it doesnt
return all the data but just an identification if the action went
succesful
or not... or maybe im wrong here also?

PHP probably has to create an extra big chunk of text somewhere in the
process of sending the data to PostgreSQL.
or it was simpler to write :)

About the mysql's function... well its mysql and im using postgresql... i
tried to search for something that could help uploading files data to the
server but didnt find anything useful.

Sorry.  I suspect they operate the same internally anyway, in terms of
transferring data to/from the database, and buffering the query.
no, load_file() is mysql internal function. the file is read by mysql 
server, so it completely bypass php and also client libraries. you need 
to have file priviledge.

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


[PHP] sending set NUMBERFORMAT

2005-02-03 Thread Nuzzo Art-CINT116
Hopefully this is an easy question.  I need to set the default numeric data 
format when selecting data from an oracle database using PHP OCI interface.
 
 
The SQLPLUS command is:
 
SET NUMBERFORMAT 0.999
 
How would I send this from PHP? I need to do the format at the datebase server 
instead of reformatting in PHP to work around PHP bug 30726.
 
 
HP-UX 11.11
PHP 4.3.9
 
 
Thanks for any help,
 
 
 
Art Nuzzo

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



Re: [PHP] I need to create a search that will search partial filesnames of images and display the images. Basically, I have a folder on theinternet that has security camera images dumped into it with a file namelike this:

2005-02-03 Thread Vin

Vin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Marek Kilimajer [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Vin wrote:
   I need to create a search that will search partial files names of
images
 and
   display the images.  Basically, I have a folder on the internet that
has
   security camera images dumped into it with a file name like this:
  
   MDcameraname20050109104846001N38B.jpg
   MDcameranameMMDDHHMMSS001N38B
  
   So what I would like to create is a search that will allow a user to
 input
   the year, month, day, and hour, and have the website display the
images
 from
   that hour. Could someone help me with this?
  
   Thanks in advance,
   Vinny
  
 
  http://sk2.php.net/manual/en/function.glob.php


 thanks, that is perfect. Now I have a follow up question if you don't
mind.
 How can I take $filename and break it apart to display the time/date the
 picture was taken in a nice readable format?

 here is my code:

 ?php
 $x = 0;
 $count = 0;
 $matches = glob(*$y$m$d$h*.JPG);
 if ( is_array ( $matches ) )
  {
  foreach ( $matches as $filename)
{
if ($x  4)
 {
 echo td;
 echo a href=javascript:pop(';
 echo $filename;
 echo ');;
 echo img src=';
 echo $filename;
 echo ' border=0 width=240 height=180/a;
 $count = $count+1;
 echo br;
 echo $filename;
 echo /td;
 $x = $x + 1;
 } else {
 echo /trtr;
 $x = 0;
 }
}
  }

 echo brbr;
 echo $count .  images found;
 ?


Here is an example of what I'm talking about:

Filename looks like this: MDcameraname20050108124537001A.JPG
I would like the output to look like this: 01/08/2005 12:45:37

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



Re: [PHP] I need to create a search that will search partial filesnames of images and display the images. Basically, I have a folder on theinternet that has security camera images dumped into it with a file namelike this:

2005-02-03 Thread Marek Kilimajer
Vin wrote:
Here is an example of what I'm talking about:
Filename looks like this: MDcameraname20050108124537001A.JPG
I would like the output to look like this: 01/08/2005 12:45:37
preg_match('/MDcameraname([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', 
$filename, $m);

$m[1] - year
$m[2] - month
 etc.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] I need to create a search that will search partial filesnamesof images and display the images. Basically, I have a folder on theinternetthat has security camera images dumped into it with a file namelike this:

2005-02-03 Thread Vin
Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Vin wrote:
 
  Here is an example of what I'm talking about:
 
  Filename looks like this: MDcameraname20050108124537001A.JPG
  I would like the output to look like this: 01/08/2005 12:45:37
 


preg_match('/MDcameraname([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/
',
 $filename, $m);

 $m[1] - year
 $m[2] - month
  etc.

Thank you all for your help.

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



[PHP] Escaping using htmlentities

2005-02-03 Thread W Luke
Hi.

htmlentities has worked pretty well so far for me...except when it
comes across something like ñw or ñ0w in an RSS feed (v2)

It tries to convert the ntilde - and it does, but because the ñ
doesn't have a space next to the w or the 0w, it breaks the XML and it
comes out as ntilde;0w which, I think, is bad XML

I thought ampersands were my biggest worry, but this has got me really
stumped!  I'm not even sure if I'm *right* in thinking the problem is
the lack of spaces between the special characters.  Can anyone shed
any light on this?

Thanks

-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



Re: [PHP] How to make binary strings useful?

2005-02-03 Thread M. Sokolewicz
Richard Lynch wrote:
Jerry Miller wrote:
Is there an example of the UNIX od utility written
in PHP?

I dunno.  Goodle for PHP octal dump

Is such a useful task even possible??

Certainly it's possible, though I'm not sure why you wouldn't just USE the
existing 'od' utility.

From what I've seen of strings, they're completely
opaque, so what good does it do to be able to read
binary-safe strings from a file???

Strings are strings in PHP.
They're not bytes thinly disguised as strings by some declarative fiat of
the programmer.
If you want to convert a string to an integer, then you have to use the
http://php.net/ord function to do that.
You can then use functions to convert to binary, hex, octal etc.

Even the deprecated
(why) $str{$inx} notation apparently results in

You'd have to read the PHP-Developer list to find out what the rationale
for deprecating that feature was.
Perhaps the confusion that arose from people thinking strings where
arrays, since the syntax for array indexing was the same wasn't worth
the benefit of being able to use [] on a string.

I have no idea why everyone here believes that syntax is deprecated, 
since I don't believe it actually is! The deprecated syntax was the one 
with *square* brackets $string[3] instead of $string{3} etc.

another string, because trying to printf it with the
%02x format always comes out with 00.  (Maybe
that's why -- it's useless!)

Actually, I've always found [] access to a string quite useful.
But since I read the manual, I knew I just got a string which happened to
be one character in length from that.

As an experienced C
programmer, I'm finding PHP to be as counter-intuitive
for low-level work as Perl is.

So write your utility in C. [shrug]

I need to convert binary
dumps of data structures into database table rows, and
MySQL on my server doesn't support queries from C.

Okay, but don't wade into PHP programming pretending that it's C just
because the syntax has a surface resemblance to C.

I thought about writing a CGI script (in C) that
would generate the hard-coded PHP output for
each instance, but a URL that ends in .cgi is
never intercepted by the PHP interpreter.  Worse

Then your web server PHP CGI configuration is borked.
Fix it.

yet, the SCRIPT LANGUAGE= SRC=
that works perfectly well with JavaScript is
likewise ignored if the language is PHP!  Finally,

Actually, you can use SCRIPT LANGUAGE=PHP on the server to have it
parse PHP, but PHP is always parsed on the SERVER, never on the client, so
the browser is not going to be able to do much intelligent with SCRIPT
LAGNGUAGE=PHP SRC=xxx
I'm not aware of a Content-type such as text/php.
What exactly was the purpose of designing yet
another inflexible language?!

If you want to send PHP source code to the browser, you'd send it as
text/plain
Other than that, PHP is SERVER-SIDE and sending text/php would be silly,
as browsers don't have PHP interpreters (and likely never will).
Basically, as far as I can tell, you've waded into PHP pretending that
it's C and now are pissed off because it's not C.  Well duh!
Why not spend a little time to read the [bleep] manual?!
http://php.net/manual/
Just focus on the first few sections, up to the point where it starts
listing all the extensions and functions.
An experienced C programmer could probably read through all that in, what,
an hour or two?
You would have saved yourself a GREAT DEAL of frustration, and wouldn't
have wasted so much time on your rant and the replies.
Good Luck!
http://php.net/manual/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to make binary strings useful?

2005-02-03 Thread M. Sokolewicz
actually, ignore that... I didn't read carefuly enough
*sighs*
M. Sokolewicz wrote:
Richard Lynch wrote:
Jerry Miller wrote:
Is there an example of the UNIX od utility written
in PHP?

I dunno.  Goodle for PHP octal dump

Is such a useful task even possible??

Certainly it's possible, though I'm not sure why you wouldn't just USE 
the
existing 'od' utility.


From what I've seen of strings, they're completely
opaque, so what good does it do to be able to read
binary-safe strings from a file???

Strings are strings in PHP.
They're not bytes thinly disguised as strings by some declarative fiat of
the programmer.
If you want to convert a string to an integer, then you have to use the
http://php.net/ord function to do that.
You can then use functions to convert to binary, hex, octal etc.

Even the deprecated
(why) $str{$inx} notation apparently results in

You'd have to read the PHP-Developer list to find out what the rationale
for deprecating that feature was.
Perhaps the confusion that arose from people thinking strings where
arrays, since the syntax for array indexing was the same wasn't worth
the benefit of being able to use [] on a string.

I have no idea why everyone here believes that syntax is deprecated, 
since I don't believe it actually is! The deprecated syntax was the one 
with *square* brackets $string[3] instead of $string{3} etc.

another string, because trying to printf it with the
%02x format always comes out with 00.  (Maybe
that's why -- it's useless!)

Actually, I've always found [] access to a string quite useful.
But since I read the manual, I knew I just got a string which happened to
be one character in length from that.

As an experienced C
programmer, I'm finding PHP to be as counter-intuitive
for low-level work as Perl is.

So write your utility in C. [shrug]

I need to convert binary
dumps of data structures into database table rows, and
MySQL on my server doesn't support queries from C.

Okay, but don't wade into PHP programming pretending that it's C just
because the syntax has a surface resemblance to C.

I thought about writing a CGI script (in C) that
would generate the hard-coded PHP output for
each instance, but a URL that ends in .cgi is
never intercepted by the PHP interpreter.  Worse

Then your web server PHP CGI configuration is borked.
Fix it.

yet, the SCRIPT LANGUAGE= SRC=
that works perfectly well with JavaScript is
likewise ignored if the language is PHP!  Finally,

Actually, you can use SCRIPT LANGUAGE=PHP on the server to have it
parse PHP, but PHP is always parsed on the SERVER, never on the 
client, so
the browser is not going to be able to do much intelligent with SCRIPT
LAGNGUAGE=PHP SRC=xxx

I'm not aware of a Content-type such as text/php.
What exactly was the purpose of designing yet
another inflexible language?!

If you want to send PHP source code to the browser, you'd send it as
text/plain
Other than that, PHP is SERVER-SIDE and sending text/php would be silly,
as browsers don't have PHP interpreters (and likely never will).
Basically, as far as I can tell, you've waded into PHP pretending that
it's C and now are pissed off because it's not C.  Well duh!
Why not spend a little time to read the [bleep] manual?!
http://php.net/manual/
Just focus on the first few sections, up to the point where it starts
listing all the extensions and functions.
An experienced C programmer could probably read through all that in, 
what,
an hour or two?

You would have saved yourself a GREAT DEAL of frustration, and wouldn't
have wasted so much time on your rant and the replies.
Good Luck!
http://php.net/manual/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] General question: packaging in PHP

2005-02-03 Thread Terje Sletteb
From: Vivian Steller [EMAIL PROTECTED]

  Are there any thoughts about that in future releases?
  What do other developers think about this issue?
  How do organize multiple used classnames?
 
  The common answer is: Use a prefix...

 but i really dislike using cryptic and long prefixes to ensure
uniqueness...

You're not alone...

Regards,

Terje

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



[PHP] newbie question regarding forms and drop down list

2005-02-03 Thread Max Krone
I am pretty new to php, so if I am asking a poor question, please forgive me.

I have a few input forms using html and php that will take input from
text boxes and then put that input into a MySql database. All of the
information for the form is put in between a form method element.

When I try to add code for a drop donw inside the form method
element, the code doesn't work, and I get a parse error. The code will
work outside the element.

I assume I am just missing something dumb. Could someone please
enlighten me. I can post my code if it will help.

Thanks,
Max Krone

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



Re: [PHP] newbie question regarding forms and drop down list

2005-02-03 Thread W Luke
On Thu, 3 Feb 2005 15:45:51 -0800, Max Krone [EMAIL PROTECTED] wrote:

 I assume I am just missing something dumb. Could someone please
 enlighten me. I can post my code if it will help.

Code please, Max!

-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

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



Re: [PHP] Re: Script stuck on final ?

2005-02-03 Thread Alp
Thanks for pointing it out James. That was it! At least now I do not end up
with a blank browser page, but unfortunately I can not achieve what I am
trying to do though which is inserting the user input to the relevant
tables.

I'll keep on trying my luck/witts until I get it... somehow...

Alp

AND thanks to all of you who persistently tried to get me to check my
brackets, etc for consistency! I should have looked closer to the code.

James Kaufman [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Thu, Feb 03, 2005 at 08:25:43PM +0800, Alp wrote:
  Thanks to both of you. Unfortunately I have found out it was due to
another
  reason: in one function I am trying to insert 3 sets of data into 3
seperate
  tables. In trying to accomplish that I am using a 'for' loop. The minute
I
  write in the second 'for' loop I loose the page in browser and receive
this
  parse error pointing to the last line of code.
 
  Any ideas to how I can overcome this? The loop I am using is given
below.
 
  Thanks in advance.
 
  Alp
  Code:
   for ($c=0;$ccount($_POST['inctourid']);$c++) {
if ($_POST['inctourid'][$c]!=  $_POST['included'][$c]!=){
 $sql = INSERT INTO tour_includes (tour_id, included) VALUES
  ('{$_POST['inctourid'][$c]}', '{$_POST['included'][$c]}')\n;
}
if (! mysql_query($sql, $link))
 {
 $dberror = mysql_error();
 return false;
 }
  // for ($i=0;$icount($_POST['extourid']);$i++) {
  //  if ($_POST['extourid'][$c]!=  $_POST['excluded'][$c]!=){
  //   $sql = INSERT INTO tour_excludes (tour_id, excluded) VALUES
  ('{$_POST['extourid'][$c]}', '{$_POST['excluded'][$c]}')\n;
  //  }
  //  if (! mysql_query($sql, $link))
  //   {
  //   $dberror = mysql_error();
  //   return false;
  //   }

 }   // Add closing brace here

 -- 
 Jim Kaufman
 Linux Evangelist
 public key 0x6D802619, CISSP# 65668
 http://www.linuxforbusiness.net
 ---
 The most merciful thing in the world ... is the inability of the human
mind to
 correlate all its contents.
 -- H. P. Lovecraft

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



Re: [PHP] Script stuck on final ?

2005-02-03 Thread Alp
Thanks Richard,

I thought I wasn't missing one, that is until James pinpointed it!

I'm using TextPad which does have syntax dependent text coloring, but
unfortunately it does not point out what you are missing such as a closing
bracket (unlike Dreamweaver).

Alp

Richard Lynch [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Alp wrote:
  Why would a php script get stuck at the ver last line of code in
php/mysql
  combination? I'm getting a parse error at the very last line.

 It may help you (now and in the future) to remember that PHP is just a
 program, that reads your script, line by line, and then tries to convert
 what you typed into an action for it to take.

 If it's complaining on the last line, then, most likely, it expecting
 something *MORE* from you, based on what you already have typed.

 So you're missing the ending part of something, like an ending  mark, or
 an ending ' or an ending } or an ending ) or an ending ] or something of
 that nature.

 It's also a good idea to be FANATIC about your alignment of beginning and
 ending { } markers -- There are religious arguments about where exactly
 they should be placed, but pick whatever seems most reasonable to you and
 stick to it, and ALWAYS line them up the same with CONSISTENT indentation.

 Otherwise, you'll spend the rest of your programming life looking for
 missing }

 You may also want to get a good color-coding editor.  A quick Google for
 PHP Editors should turn up tons of them.

 -- 
 Like Music?
 http://l-i-e.com/artists.htm

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



Re: [PHP] Script stuck on final ?

2005-02-03 Thread Jochem Maas
Alp wrote:
Thanks Richard,
I thought I wasn't missing one, that is until James pinpointed it!
I'm using TextPad which does have syntax dependent text coloring, but
put your cursor next to a brace - hit CRTL+M, look what happens. :-)
unfortunately it does not point out what you are missing such as a closing
bracket (unlike Dreamweaver).
(Table)Nightmareweaver.

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


Re: [PHP] mcrypt public and private key

2005-02-03 Thread Marek Kilimajer
Daniel Bowett wrote:
Hi,
I have been reading up on the mcrypt function. Is it possible to use it 
with a public and private key pair or just with a single key?

Cheers.
mcrypt supports only single key
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Connecting To Multiple MySQL Databases

2005-02-03 Thread NathanielGuy#21
I know this may be slightly off topic for a PHP listserv but I cant
find my answer anywhere else.  I start off generating a page connected
to one database as a certain user and I call a script that requires a
connection to a second database as a different user.  Is there any way
I could open that connection while maintaining the current one aswell?
 The connection of the script is opend and closed before any more of
the other page is generated.  Im not sure how to go about solving this
problem other than rewriting my script.  Any ideas?

--nathan

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



Re: [PHP] Connecting To Multiple MySQL Databases

2005-02-03 Thread John Holmes
NathanielGuy#21 wrote:
I know this may be slightly off topic for a PHP listserv but I cant
find my answer anywhere else.  I start off generating a page connected
to one database as a certain user and I call a script that requires a
connection to a second database as a different user.  Is there any way
I could open that connection while maintaining the current one aswell?
 The connection of the script is opend and closed before any more of
the other page is generated.  Im not sure how to go about solving this
problem other than rewriting my script.  Any ideas?
Yes, it's possible. That's why mysql_connect() returns a connection 
resource. So assign the result of each mysql_connect() to a different 
variable so you can keep them apart. It's also why mysql_query() accepts 
a connection parameter, so you can designate which connection the query 
is being sent to.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Connecting To Multiple MySQL Databases

2005-02-03 Thread Dan Trainor
NathanielGuy#21 wrote:
I know this may be slightly off topic for a PHP listserv but I cant
find my answer anywhere else.  I start off generating a page connected
to one database as a certain user and I call a script that requires a
connection to a second database as a different user.  Is there any way
I could open that connection while maintaining the current one aswell?
 The connection of the script is opend and closed before any more of
the other page is generated.  Im not sure how to go about solving this
problem other than rewriting my script.  Any ideas?
--nathan
I'm a bit new myself, but why not call the resources seperate names?
$sql1 = mysql_connect($host1, $user1, $pass1);
$sql2 = mysql_connect($host2, $user2, $pass2);
Hope that helps
-dant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Clear POST variables on page refresh

2005-02-03 Thread trlists
On 3 Feb 2005 Richard Lynch wrote:

 If it was only two pages, and there was only one header() re-direct, fine.
 
 But what ends up happening is you get in the habit of doing this all over
 the place, and you have a mess of spaghetti logic spread over a hundred
 files.

That is a problem with coding practices, not with the method used.

All you need to do is write a redirect() function used in all pages and 
call it instead of header().  Then you have one point to change if you 
need to make a change as you describe.  The fact that someone did not 
do this does not mean the underlying method is a poor idea.  It just 
means they didn't anticipate the need for application-specific code as 
part of the redirect operation.

Put another way, it's a common error to fail to build an abstraction 
layer for this type of low-level operation, but it doesn't mean using 
the low-level operation is a mistake.  The error, if there is one (and 
I'd say there is in the scenario you describe) is in not noticing the 
need for an abstraction layer.

--
Tom

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



[PHP] Udp.pl scare

2005-02-03 Thread Mike

Hello all,

I have been hit twice now with the udp.pl exploit found in phpbb

I thought that upgrading to php 4.3.10 would stop this? Was I wrong?

Here is what it does...

 The attacker installed a UDP flood tool that ran for 2 hours before buzz
was blocked by Network Services.  Remote shell programs were also uploaded
and run to give the attackers easier access to the webservers user account.


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



[PHP] Date Update

2005-02-03 Thread Adi Pramadi
Dear Friends,

I'm new in PHP programing, and i need a way to add date in php.

here is the sample

If today is 29/01/2005 (dd/mm/yy)
and i need to make an apointment for another 10 days
the date recorded sould be 08/02/2005 and not 39/01/2005

is there a way to do it in just like in asp (add date) ?

Regards,

Adi

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



RE: [PHP] Headers already sent error

2005-02-03 Thread yangshiqi
Pls Make sure that outside your ?php and ? tags, these is no any
blankspace or sth else.

 
Best regards,
Yang Shiqi
 
 
 
-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 03, 2005 3:44 PM
To: [php] PHP General List
Subject: Re: [PHP] Headers already sent error

Tim Burgan wrote:

 Hello,


 I'm receiving an error Cannot modify header information - headers 
 already sent by XXX.

 In my php, I have a heap of code, then use header(Location: 
 blah.php); to redirect the user. I get this error on the webhost, but 
 not on my local host.

 I've searched and found that this can be caused by spaces after the 
 closing php tag, but I don't have any.

 What could this be?


 Tim

Rest assured, *something* is getting output before you try that header() 
call. Anything outside of PHP tags (carriage rturns/line feeds/spaces) 
any echo or print.

To help you figure it out, try doing something like exit('STARTOFBODY'); 
instead of the header call. Then view the source of the ouput and see 
what precedes that

Chris

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

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