Re: [PHP] Using Cookies Securely

2003-06-01 Thread Dustin Mitchell
On Fri, May 30, 2003 at 11:01:26PM -0700, Evan Nemerson wrote:
 Send a session ID to the user in a cookie, then lookup that ID in a database 
 on the server. It's extremely difficult to guess random session ID's (don't 
 just increment them!), and if you have a session timeout, you're pretty much 
 set.

That's true, and it is what most people do, but if you think about it the
session ID is then functionally equivalent to a crypt'd password for the
duration of your session; that is, either one allows you access to the site.
So if you were worried about folks sniffing an encrypted password and using
it to log in, you should be equally worried about folks sniffing a session ID
and using *it* to log in.

Dustin

-- 

  Dustin Mitchell
  [EMAIL PROTECTED]/[EMAIL PROTECTED]
  http://people.cs.uchicago.edu/~dustin/

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



[PHP] Compile 4.3.2 Errors.

2003-06-01 Thread Alberto Ferrer
Im compiling the last vercion of PHP 4.3.2 and says this after finish of
compile.
The system is a Redhat 7.3, Apache 1.3.27.

ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam':
/root/php-4.3.2/ext/mysql/libmysql/my_tempnam.c:115: the use of `tempnam' is
dangerous, better use `mkstemp'



--
--
Alberto Ferrer
[EMAIL PROTECTED]
  http://www.barrahome.org
--
Syntax Error in KITCHEN.H: COFFEE not found.



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



Re: [PHP] Compile 4.3.2 Errors.

2003-06-01 Thread Volker Augustin
hi,
this sounds like a warning not like an error, your php is successfully
compiled...(most software i know an compile got this message.)
can you post a little bit more debug information?

volker

- Original Message -
From: Alberto Ferrer [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, May 31, 2003 3:16 PM
Subject: [PHP] Compile 4.3.2 Errors.


 Im compiling the last vercion of PHP 4.3.2 and says this after finish of
 compile.
 The system is a Redhat 7.3, Apache 1.3.27.

 ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam':
 /root/php-4.3.2/ext/mysql/libmysql/my_tempnam.c:115: the use of `tempnam'
is
 dangerous, better use `mkstemp'



 --
 --
 Alberto Ferrer
 [EMAIL PROTECTED]
   http://www.barrahome.org
 --
 Syntax Error in KITCHEN.H: COFFEE not found.



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




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



Re: [PHP] Re: Adding graphics library

2003-06-01 Thread Martin Helie
This is what I used that is relevant:

 --with-png-dir=../libpng-1.2.5/ --with-zlib-dir=../zlib-1.1.4/ --with-jpeg-
dir=../jpeg-6b/ --with-gd

of course, the paths for libpng, zlib and jpeg will probably be different
for you.

Todd Cary [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]


You'll probably
still want to get libjpeg and libpng, and link against them with the proper
configure options.


What is the correct syntax to do all of the suggestions?

Todd



Martin Helie wrote:

Well, not necessarily, since gd is included with php 4.3.x. You'll probably
still want to get libjpeg and libpng, and link against them with the proper
configure options.



Ef [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

--with-gd and of oucrce you need the GD library.

Todd Cary [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]

I am new to Linux so I need some help for installing the graphics
library.  This is what I did to get PHP to inlcude Interbase.

   !! Configure PHP with Interbase with apxs
   34  ./configure --with-apxs=/usr/sbin --with-interbase=/opt/interbase
   35  ./configure --with-interbase=/opt/interbase --with-apxs=/usr/sbin
   36  ./configure --with-interbase=/opt/interbase
--with-apxs=/usr/sbin/apxs

What do I need to add to this to include the graphics library?

Many thanks...

Todd










-- 




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



[PHP] 3 entries going into 1 field

2003-06-01 Thread Vicky
Hi,

I have a registration form, but I would like to add a Date of Birth section. Now, 
because of the different formats of writing it I want to have 3 seperate drop down 
boxes, Date, Month and Year.

However, I then want those 3 dropdowns to go into one field in a mySQL database, in 
DD/MM/ format.

How can I acheive this, in simple language as I'm a newbie to this stuff ^_~

Thanks!
Vicky

RE: [PHP] 3 entries going into 1 field

2003-06-01 Thread Randum Ian
$EnteredDate = $date . / . $month . / . $year;

This would output DD/MM/ if $date = DD, $month = MM and $year =
.

-Original Message-
From: Vicky [mailto:[EMAIL PROTECTED] 
Sent: 31 May 2003 15:06
To: PHP List
Subject: [PHP] 3 entries going into 1 field

Hi,

I have a registration form, but I would like to add a Date of Birth
section. Now, because of the different formats of writing it I want to
have 3 seperate drop down boxes, Date, Month and Year.

However, I then want those 3 dropdowns to go into one field in a mySQL
database, in DD/MM/ format.

How can I acheive this, in simple language as I'm a newbie to this stuff
^_~

Thanks!
Vicky



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



Re: [PHP] 3 entries going into 1 field

2003-06-01 Thread Cal Evans
have 3 select boxes bdMonth, bdDay, bdYear.

Then when processing the $_POST, simply contact them in the format you want.

$bdString = $_POST['bsMonth'].'/'.$_POST['bsDay'].'/'.$_POST['bsYear'];

HTH,
=C=
* Cal Evans
* http://www.christianperformer.com
* Stay plugged into your audience
* The measure of a programmer is not the number of lines of code he writes
but the number of lines he does not have to write.
*

- Original Message -
From: Vicky [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Sent: Saturday, May 31, 2003 9:05 AM
Subject: [PHP] 3 entries going into 1 field


Hi,

I have a registration form, but I would like to add a Date of Birth section.
Now, because of the different formats of writing it I want to have 3
seperate drop down boxes, Date, Month and Year.

However, I then want those 3 dropdowns to go into one field in a mySQL
database, in DD/MM/ format.

How can I acheive this, in simple language as I'm a newbie to this stuff ^_~

Thanks!
Vicky


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



Re: [PHP] Compile 4.3.2 Errors.

2003-06-01 Thread Philip Olson

On Sat, 31 May 2003, Alberto Ferrer wrote:

 Im compiling the last vercion of PHP 4.3.2 and says this after finish of
 compile.
 The system is a Redhat 7.3, Apache 1.3.27.
 
 ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam':
 /root/php-4.3.2/ext/mysql/libmysql/my_tempnam.c:115: the use of `tempnam' is
 dangerous, better use `mkstemp'

And about two lines down from that warning you'll see this:

  Build complete.
  (It is safe to ignore warnings about tempnam and tmpnam).

As this build note was added in PHP 4.3.2 because too many bogus 
bug reports and support questions were coming up about this 
warning.  There is also a faq about this warning:

  http://www.php.net/manual/en/faq.build.php#faq.build.mysql.tempnam

Regards,
Philip


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



[PHP] problem with pop3 check

2003-06-01 Thread joe111
Hi
I have been trying to get to know the imap functions for checking pop3 email
account with php. i have had absolutely no luck. just cant get the script to
connect to the server.
here is a sample:

?php
$mbox = imap_open ({mail.hot.ee:110}, pop3testing, testing);

if(!$mbox){echooffline;}
else{echo online;}

imap_close($mbox);
?

it just loads and loads doesnt even give an error. could somebody please
look into it and see whats wrong. the account on hot.ee actually exists
(un:pop3testing, pw:testing). it is an estonian free e-mail service
provider. supports pop3 and the server should be mail.hot.ee, because
outlook checks e-mails from mail.hot.ee without any problems.
help please :)



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



[PHP] Re: problem with pop3 check

2003-06-01 Thread Alberto Ferrer
My english is bad, but see the code:

$mbox = imap_open ({localhost/pop3:110}INBOX, user_id, password);
The only way I could open a IMAP or POP3 conection into my server is, I hope
it helps  you$MAILSERVER={mail.midominio.cl:110/pop3/notls}; //Para POP3
$MAILSERVER={mail.midomino.cl:143/imap/notls}; //Para IMAP$mbox =
@imap_open ($MAILSERVER,$user,$pass) or die (No abrio);
- Other Complete Example For Imap --
$mbox = imap_open ({localhost:143}, username, password);

echo ph1Mailboxes/h1\n;
$folders = imap_listmailbox ($mbox, {your.imap.host:143}, *);
if ($folders == false)
echo Call failedbr\n;
else
while (list ($key, $val) = each ($folders))
echo $val . br\n;

echo ph1Headers in INBOX/h1\n;
$headers = imap_headers ($mbox);
if ($headers == false)
echo Call failedbr\n;
else
while (list ($key, $val) = each ($headers))
echo $val . brn;

imap_close ($mbox);

And you can look the manual, but this code is from the manual, have a loot
of examples ;)
--Alberto Ferrer
[EMAIL PROTECTED]
http://www.barrahome.org--Syntax
Error in KITCHEN.H: COFFEE not found.
Joe111 [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 Hi
 I have been trying to get to know the imap functions for checking pop3
email
 account with php. i have had absolutely no luck. just cant get the script
to
 connect to the server.
 here is a sample:

 ?php
 $mbox = imap_open ({mail.hot.ee:110}, pop3testing, testing);

 if(!$mbox){echooffline;}
 else{echo online;}

 imap_close($mbox);
 ?

 it just loads and loads doesnt even give an error. could somebody
please
 look into it and see whats wrong. the account on hot.ee actually exists
 (un:pop3testing, pw:testing). it is an estonian free e-mail service
 provider. supports pop3 and the server should be mail.hot.ee, because
 outlook checks e-mails from mail.hot.ee without any problems.
 help please :)





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



Re: [PHP] [MySQL] Code Help Please

2003-06-01 Thread Frappy John
Monfort--

   There lies my problem.
   How do I get mysql to translate:
... where table.username =
 'table2.domain/table2.username' into

See:

http://lists.mysql.com/mysql?sub=1

--Frappy

On Friday 30 May 2003 08:35 pm, [-^-!-%- wrote:
 Hello all !

 Need a little help here. Is there a way to translate
 variables/field names in an SQL statement?

 I need to compare the content of two database fields
 that are in different tables. The trick, though, is that
 I need to join two fields together (as a string) before I
 compare it.

 For example:

 Table 1 has a field named username, with the following
 values:

   id | username | first_name | last_name
   1  | prgn/jason   | jason  | x
   2  | falcon/paul  | pual   | wood

   *The username in table is composed of the user's domain
 name and login name. Those fields are separated in table
 2. Like

 Table 2
   id | username | domain | first_name | last_name
   1  | paul | falcon | paul   | wood
   2  | jason| prgn   | jason  | x


   * the data is rearranged, but it's the same.


   Now, I need to compare the values from table 2 to table
 1. That is, I need to find if table1.username =
 table2.domain/table2.username  is true.

   There lies my problem.
   How do I get mysql to translate:
... where table.username =
 'table2.domain/table2.username' into
...where  'prgn/jason' = 'prgn/jason'
and not into
...where 'prgn/jason' = 'prgn' / 'jason'//
 division.

   That is, I need it to compare 'prgn/jason' (from
 table1.username) to the string representation, of the
 values of table2.domain/table2.username (i.e. prgn/jason)
 and not read it as 'table2.prgn' divided by
 'table2.username' ?




  I have the following code:

  select * from table1 t1, table 2 t2 where t1.username =
 't2.domain/t2.username' 


 ** how do I concatenate the two values, to compare it to
 that of table 1. i.e.  prgn/jason = prgn/jason   and not
 'prgn/jason' = 'prgn' divided by 'jason'?


 Please help.

 -john

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



[PHP] FTP DLL

2003-06-01 Thread Canadaka
Me and a friend have been trying to make a php ftp client, it works fine on
*nix systems, but not on Windows. We looked at everything, until i finaly
noticed that php 4.2.3 is missing in the php.ini the extension=php_ftp.dll
line. The actualy file in the extensions dir is missing as well.

So where did it go? and where can i get it? can anyone send it too me? I was
unable to find one on google. Or is there a reason its gone?

Thanks



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



Re: [PHP] FTP DLL

2003-06-01 Thread Philip Olson
 Me and a friend have been trying to make a php ftp client, it works fine on
 *nix systems, but not on Windows. We looked at everything, until i finaly
 noticed that php 4.2.3 is missing in the php.ini the extension=php_ftp.dll
 line. The actualy file in the extensions dir is missing as well.
 
 So where did it go? and where can i get it? can anyone send it too me? I was
 unable to find one on google. Or is there a reason its gone?

From the manual (php.net/ftp):

 The windows version of PHP has built in support for this extension. 
 You do not need to load any additional extension in order to use 
 these functions.

Also, consider using PHP 4.3.2

Regards,
Philip


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



Re: [PHP] How to secure a download ?

2003-06-01 Thread Alex Earl
 header(Content-type: application/zip);
 header(Content-Disposition: attachment; filename=yourfilename.zip);
 readfile(/path/to/yourfilename.zip);


I have found that to make sure it works with all browsers you want to put
quotes around the filename in the content-disposition header.

header( Content-tpye: application/zip );
header( Content-Disposition: attachment; filename=\yourfile.zip\ );
readfile( /path/to/yourfilname.zip );

the reason I say this is because without the quotes, some browsers insert
a [1] or something similar without them.

Alex

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



Re: [PHP] FTP DLL

2003-06-01 Thread Frappy John
On Saturday 31 May 2003 07:41 am, Canadaka wrote:
 Me and a friend have been trying to make a php ftp
 client, 

I'm confused. Do you literally mean an FTP client that is 
written in PHP (thus requiring PHP to be installed on each 
client machine)?

Or do you mean a PHP generated HTML-based page, delivered 
to the client's browser, that interfaces with an FTP server?

Or maybe you mean a PHP page, delivered to the client's 
browser, that triggers FTP transactions between your PHP 
server and a remote FTP server and then passes the result 
on to the client. (That would be termed a proxy, I presume.)

--Frappy

 it works fine on *nix systems, but not on
 Windows. We looked at everything, until i finaly noticed
 that php 4.2.3 is missing in the php.ini the
 extension=php_ftp.dll line. The actualy file in the
 extensions dir is missing as well.

 So where did it go? and where can i get it? can anyone
 send it too me? I was unable to find one on google. Or is
 there a reason its gone?

 Thanks

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



Re: [PHP] problem with pop3 check

2003-06-01 Thread Jason k Larson
Shouldn't the correct suntax for pop3 be:

$mbox = imap_open ({mail.hot.ee:110/pop3}, pop3testing, testing);

http://us2.php.net/imap_open

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


[PHP] regex problem

2003-06-01 Thread Daniel J. Rychlik
Hello,,

I have a preg_match issue matching numbers.  I am currently using 

!preg_match ('/([0-9\-\.\#:])/', $_POST['nums1']
throw error[]

This fails if you use something like ' asdf ' but if you use ' asdf789 ' it passes 
false and does not throw an error.  
This is not the obvious solution  I know its a problem in my regular expression.  
Should I ONLY be using

' /([0-9])/ ' ,  ?

Thanks in advance.
Daniel

Re: [PHP] problem with pop3 check

2003-06-01 Thread Jason k Larson
To correct myself ...

I believe you actually require the INBOX attribute as well.

$mbox = imap_open ({mail.hot.ee:110/pop3}INBOX, pop3testing, testing);

if you still have problems you might also try (explictly request non-SSL connection):

$mbox = imap_open ({mail.hot.ee:110/pop3/notls}INBOX, pop3testing, testing);

Hope that helps.

--
Jason k Larson


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


[PHP] Re: 3 entries going into 1 field

2003-06-01 Thread Monty
I'll add to what the others have already said. As was already mentioned, you
need to create three dropdown fields for the birthdate: year, month and day.
I do this by setting up arrays for each field that offers valid date
choices. 

$year[2000] = 2000;
$year[2001] = 2001;
$year[2002] = 2002;
etc...

$month['January']   = 01;
$month['February']  = 02;
$month['March'] = 03;
etc...

$day[1] = 01;
$day[2] = 02;
$day[3] = 03;
etc...

I use these arrays with a simple function to set up the dropdown form
elements that stores the selected results in another array: $realdate. When
the form is submitted, I simply stitch the date together into a valid MySQL
DateTime format of -MM-DD using the values stored in the $realdate
variable...

$realdate['year'].-.$realdate['month'].-.$realdate['day'];

This would insert the date as: 2003-05-21

Monty


 From: [EMAIL PROTECTED] (Vicky)
 Newsgroups: php.general
 Date: Sat, 31 May 2003 15:05:43 +0100
 To: PHP List [EMAIL PROTECTED]
 Subject: 3 entries going into 1 field
 
 Hi,
 
 I have a registration form, but I would like to add a Date of Birth section.
 Now, because of the different formats of writing it I want to have 3 seperate
 drop down boxes, Date, Month and Year.
 
 However, I then want those 3 dropdowns to go into one field in a mySQL
 database, in DD/MM/ format.
 
 How can I acheive this, in simple language as I'm a newbie to this stuff ^_~
 
 Thanks!
 Vicky


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



[PHP] PHP getting values from XML

2003-06-01 Thread MivaDudePB
Hello All and Thanks in advance.

I'm developing a site PHP site.

I would like to define HTML code in XML and be able to get the HTML code using PHP.

I was hoping for a simple example.

I will not be able to update the version of PHP with any modules as my hosting 
company (hostway.com) admins the PHP environment.

Cheers,

Ray

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



[PHP] Cookies and Sessions: What's the Best Recipe?

2003-06-01 Thread Monty
I have a member site that uses sessions. People who have their browser
cookies turned off, however, cannot use our site. I read somewhere that to
avoid this, I'd have to manually append the PHPSESSID var to every URL when
redirecting in a script.

Is this really the best or only way to avoid this problem? Or, is it simply
unavoidable? Right now, I tell users that the site will only work with
browsers that have cookies turned on, but, I'd rather the site was
accessible to all. However, I also don't like passing session IDs via the
URL because of the security risk.

Any suggestions??

Monty


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



[PHP] get modification date of remote page

2003-06-01 Thread chris
I have a database full of links. I need to write a script to go to each one 
and check the modification date of the file.  My plan is, once that is 
logged, to do this every week and indicate which pages have changed.

What is the simplest approach to this? Do I need to use CURL functions or 
remotely open the page with fopen? A pointer to the right place in the 
manual would be great...

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



[PHP] reading binary data

2003-06-01 Thread Ferhat BINGOL
Hi,

I have binary data. I know the format but I do not know how to read it with
PHP. I saw some articles and comments on the manual but it seems taht it is
not enough for me.

Anyone to haelp, please?

I just nedd a good documentation about it.

TIA



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



Re: [PHP] Using Cookies Securely

2003-06-01 Thread Evan Nemerson
Again, It's not perfect, but I don't think anyone has come up with a better 
way.

It's called session hijacking, and it is a great reason to use SSL. However, 
there's still the issue of cross-site scripting, which can really only be 
prevented by smarter coding.

Even then there are issues. For example, holes in ie's SSL capabilities 
(including a current, unpatched vulnerability- well okay it was patched but 
M$ managed to re-introduce it in more recent patches...), permit undeteted 
MITM attacks.


On Saturday 31 May 2003 05:56 am, Dustin Mitchell wrote:
 On Fri, May 30, 2003 at 11:01:26PM -0700, Evan Nemerson wrote:
  Send a session ID to the user in a cookie, then lookup that ID in a
  database on the server. It's extremely difficult to guess random session
  ID's (don't just increment them!), and if you have a session timeout,
  you're pretty much set.

 That's true, and it is what most people do, but if you think about it the
 session ID is then functionally equivalent to a crypt'd password for the
 duration of your session; that is, either one allows you access to the
 site. So if you were worried about folks sniffing an encrypted password and
 using it to log in, you should be equally worried about folks sniffing a
 session ID and using *it* to log in.

 Dustin


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



Re: [PHP] Compile 4.3.2 Errors.

2003-06-01 Thread Evan Nemerson
Don't know about 4.3.2, but at the end of 5.0-dev make, the following message 
is output:

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).




On Saturday 31 May 2003 06:29 am, Volker Augustin wrote:
 hi,
 this sounds like a warning not like an error, your php is successfully
 compiled...(most software i know an compile got this message.)
 can you post a little bit more debug information?

 volker

 - Original Message -
 From: Alberto Ferrer [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, May 31, 2003 3:16 PM
 Subject: [PHP] Compile 4.3.2 Errors.

  Im compiling the last vercion of PHP 4.3.2 and says this after finish of
  compile.
  The system is a Redhat 7.3, Apache 1.3.27.
 
  ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam':
  /root/php-4.3.2/ext/mysql/libmysql/my_tempnam.c:115: the use of `tempnam'

 is

  dangerous, better use `mkstemp'
 
 
 
  --
  --
  Alberto Ferrer
  [EMAIL PROTECTED]
http://www.barrahome.org
  --
  Syntax Error in KITCHEN.H: COFFEE not found.
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

-- 

Know me? Know me??? What the hell does that mean, know me, you want to know 
me? Well you don't know me, and you'll never know me. Nobody knows me, or 
you, or eachother. Nobody in this world knows anybody else. You'll never know 
me. Ever.

-Rules of Attraction


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



Re: [PHP] PHP getting values from XML

2003-06-01 Thread Yann Larrivee
Hi there are a couple projects done in php to go around these problemes
however it will cost you on performance.

Here are a couple projects you might want to look into (I never used
them, but since the book XML and PHP talk about them i guess they are
good proejcts)

eZXML (an alternative to PHP/Dom) 
PHP.XPATH http://sourceforge.net/projects/phpxpath/
PHP XML RPC http://sourceforge.net/projects/phpxmlrpc/
NuSOAP http://dietrich.ganx4.com/nusoap/index.php (befor it was named
SOAPx4)

There must be other projects also but i dont know them.

Yann Larrivée
www.phpquebec.org
www.protonicdesign.com


On Sat, 2003-05-31 at 22:52, [EMAIL PROTECTED] wrote:
 Hello All and Thanks in advance.
 
 I'm developing a site PHP site.
 
 I would like to define HTML code in XML and be able to get the HTML code using PHP.
 
 I was hoping for a simple example.
 
 I will not be able to update the version of PHP with any modules as my hosting 
 company (hostway.com) admins the PHP environment.
 
 Cheers,
 
 Ray
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 




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



[PHP] Re: Decrypting data with GnuPG

2003-06-01 Thread Pierre-Luc Soucy
Just for the record, adding the --batch argument to the GnuPG command 
solved the problem.

Regards,

Pierre-Luc

Pierre-Luc Soucy wrote:
Hi,

I would like to decrypt data encoded with GnuPG without including the 
private key passphrase in the command to prevent people from viewing it 
with ps.

Here is the code I wrote:


$command = /usr/bin/gpg --homedir=/path/to/.gnupg --no-secmem-warning 
--always-trust --yes --output /path/to/output.txt --decrypt 
/path/to/testtext.asc;
$passphrase = '***';

$fp = popen($command, 'w+');
fputs($fp, $passphrase);
pclose($fp);
print Done;
exit;
==
I assumed that the fputs() function would write the passphrase at the 
prompt, but that doesn't seem to be the case - the command does not 
create the output.txt file when ran by the PHP program (which is running 
as a CGI under my user BTW) while it works when ran from the shell.

Any idea why?

Thanks!

Pierre-Luc Soucy



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


Re: [PHP] reading binary data

2003-06-01 Thread Evan Nemerson
file_get_contents() is binary safe.

$binary_data = file_get_contents(/path/to/file);

php.net/file_get_contents


On Saturday 31 May 2003 12:42 pm, Ferhat BINGOL wrote:
 Hi,

 I have binary data. I know the format but I do not know how to read it with
 PHP. I saw some articles and comments on the manual but it seems taht it is
 not enough for me.

 Anyone to haelp, please?

 I just nedd a good documentation about it.

 TIA

-- 

Everything has a natural explanation. The moon is not a god but a great rock 
and the sun a hot rock.

-Anaxagorus


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



[PHP] Re: regex problem

2003-06-01 Thread Monty
I don't understand what it is you're trying to accomplish, so, it's hard to
offer a solution. If you just want to verify whether or not a variable
contains numeric data, why not just use the is_numeric() function:

http://us4.php.net/manual/en/function.is-numeric.php

preg_match() will return TRUE if it finds the pattern ANYWHERE in the
string, so, that's why asdf789 passes the test because it contains digits,
whereas 'asdf' won't pass the test because the numbers 0-9 can't be found
anywhere in that string.

If you want the entire string to be tested for digits, you need to add the
length of the string to the regex pattern:

$length = strlen($data);
preg_match([0-9]{$length}, $data);

Monty

 From: [EMAIL PROTECTED] (Daniel J. Rychlik)
 Newsgroups: php.general
 Date: Sat, 31 May 2003 13:46:44 -0500
 To: [EMAIL PROTECTED]
 Subject: regex problem
 
 Hello,,
 
 I have a preg_match issue matching numbers.  I am currently using
 
 !preg_match ('/([0-9\-\.\#:])/', $_POST['nums1']
 throw error[]
 
 This fails if you use something like ' asdf ' but if you use ' asdf789 ' it
 passes false and does not throw an error.
 This is not the obvious solution  I know its a problem in my regular
 expression.  Should I ONLY be using
 
 ' /([0-9])/ ' ,  ?
 
 Thanks in advance.
 Daniel


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



Re: [PHP] reading binary data

2003-06-01 Thread Ferhat BINGOL
I do not understand how to use this one from the manual but thanks I am
working on it. Meanwhile I was trying to open the binary with fopen and
unpack 154 bytes from it (it is the firs line accordint to my structure
format.) I got the first letter but afterwords it just gives stupid
characters.

Do you have any comment on this?

And can you point me an example for file_read_contents???

regards



Evan Nemerson [EMAIL PROTECTED], iletide sunu yazdi
news:[EMAIL PROTECTED]
 file_get_contents() is binary safe.

 $binary_data = file_get_contents(/path/to/file);

 php.net/file_get_contents


 On Saturday 31 May 2003 12:42 pm, Ferhat BINGOL wrote:
  Hi,
 
  I have binary data. I know the format but I do not know how to read it
with
  PHP. I saw some articles and comments on the manual but it seems taht it
is
  not enough for me.
 
  Anyone to haelp, please?
 
  I just nedd a good documentation about it.
 
  TIA

 -- 

 Everything has a natural explanation. The moon is not a god but a great
rock
 and the sun a hot rock.

 -Anaxagorus




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



Re: [PHP] get modification date of remote page

2003-06-01 Thread Evan Nemerson
/* UNTESTED. */
function get_http_lm_date($url) {
$d = parse_url($url);
if ( !$fp = fsockopen ($d['host'], (isset($d['port'])) ? $d['port'] : '80') )
return FALSE;
fputs($fp, HEAD .$d['path']. HTTP/1.0\r\n\r\n);
while ( !feof($fp) ) {
if (  ereg (^Last-Modified: , $buf = fgets($fp, 256)) ) {
$retval = substr($buf, 15);
fclose($fp);
}
}
if ( !isset($retval) )
return FALSE;
else
return $retval
}


On Saturday 31 May 2003 12:09 pm, chris wrote:
 I have a database full of links. I need to write a script to go to each one
 and check the modification date of the file.  My plan is, once that is
 logged, to do this every week and indicate which pages have changed.

 What is the simplest approach to this? Do I need to use CURL functions or
 remotely open the page with fopen? A pointer to the right place in the
 manual would be great...

-- 

The world holds two classes of men -- intelligent men without religion, and 
religious men without intelligence.

-Abu'l-Ala-Al-Ma'arri


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



Re: [PHP] reading binary data

2003-06-01 Thread Evan Nemerson
/* This example will echo the first 154 bytes of a file
 * (/path/to/file in the example). */
$binary_data = file_get_contents(/path/to/file):
echo substr($binary_data, 0, 154);



On Saturday 31 May 2003 01:29 pm, Ferhat BINGOL wrote:
 I do not understand how to use this one from the manual but thanks I am
 working on it. Meanwhile I was trying to open the binary with fopen and
 unpack 154 bytes from it (it is the firs line accordint to my structure
 format.) I got the first letter but afterwords it just gives stupid
 characters.

 Do you have any comment on this?

 And can you point me an example for file_read_contents???

 regards



 Evan Nemerson [EMAIL PROTECTED], iletide sunu yazdi
 news:[EMAIL PROTECTED]

  file_get_contents() is binary safe.
 
  $binary_data = file_get_contents(/path/to/file);
 
  php.net/file_get_contents
 
  On Saturday 31 May 2003 12:42 pm, Ferhat BINGOL wrote:
   Hi,
  
   I have binary data. I know the format but I do not know how to read it

 with

   PHP. I saw some articles and comments on the manual but it seems taht
   it

 is

   not enough for me.
  
   Anyone to haelp, please?
  
   I just nedd a good documentation about it.
  
   TIA
 
  --
 
  Everything has a natural explanation. The moon is not a god but a great

 rock

  and the sun a hot rock.
 
  -Anaxagorus

-- 

Science has done more for the development of western civilization in one 
hundred years than Christianity did in eighteen hundred years.

-John Burroughs


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



Re: [PHP] reading binary data

2003-06-01 Thread Ferhat BINGOL
I am getting

NTERRUPT_DURATION

or similar text between the values..

this binary reading thing is dahm jard..



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



Re: [PHP] Any POSTNUKER, reading from two DB

2003-06-01 Thread Brian V Bonini
On Sat, 2003-05-31 at 07:41, nabil wrote:
 Greeting,
 
 I have a postnuke site and I want to connect it to two databases in order to
 verify users from these databases.


and..??


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



[PHP] String Manipulation

2003-06-01 Thread S. Cole
Hello all,

I'm currently working on a site for my brother-in-law.  I have written a
script that will access a website
(http://www.remax.nf.ca/listings.asp?a=163cp=1) and pull the page into a
variable ($var).  I have striped the page down to include only the listings
(still in HTML and table format).

Sample...

HTML FORMAT: (view source for html code)
http://205.251.209.142/temp/listing.html

HTML STRIPPED:
276A Conception Bay Highway   $260,000.00 0 Bedrooms, 0 Bathrooms View
Details 170 Salmon Cove Road   $185,000.00 3 Bedrooms, 2 Bathrooms View
Details + Interior Photos Main Road, Bristols Hope   $109,000.00 3 Bedrooms,
2 Bathrooms View Details 14 Mercers Cove, Bay Roberts   $99,900.00 3
Bedrooms, 2 Bathrooms View Details 83-85 Seymours Road   $94,500.00 4
Bedrooms, 2 Bathrooms View Details + Interior Photos 208 A Neck Road
$69,900.00 3 Bedrooms, 1 Bathrooms View Details 165 Water Street
$69,900.00 3 Bedrooms, 2 Bathrooms View Details 384 Water Street, Harbour
Grace   SALE PENDING $67,000.00 3 Bedrooms, 1 Bathrooms View Details +
Interior Photos 95-97 Conception Bay Highway   $65,000.00 3 Bedrooms, 1
Bathrooms View Details Old Track Road   $59,500.00 0 Bedrooms, 0 Bathrooms
View Details   Page 1 of 3 Previous | Next


What I want to do, is to be able to work with this data.  I don't want to
keep it in the same format as it's on the original site.

I would like to be able to pull the listings and it's components separately
so that I can change the layout, color, size, font, etc, etc, etc.

Also, under the html format, there are links to other sites and pictures
that I would like to be able to pull as well.  I would need to be able to
know which listing the link and/or picture was for as not all listings will
have a picture.

If anyone can help, It would be greatly appreciated.  I have been pulling my
hair out trying to find a way to do this.  I've been studying regular
expressions, however am not familiar enough with them to be able to get it
to work.

Thanks in advance,
S. Cole

ANTI-SPAM: to reply, delete REMOVE from email address.

ps. I know I posted the same question in alt.php, found this newsgroup after
and there's more activity.



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



[PHP] Installation problem

2003-06-01 Thread Ron Dyck
I'm currently attempting to upgrade to the latest version of php. 

When I run:
./configure --with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local

I get the following message:
Cannot find header files under /usr/local

Why is this?

ron

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



[PHP] INTERRUPT DURATION

2003-06-01 Thread Ferhat BINGOL
Have you ever get INTERRUPT DURATION string while you are trying to read a
binary file.

I am getting something like this.

ferhat NTERRUPT_DURATIO | Nbingol RUPT_DURAT

there is 65 characters dummy at the beginning afterwards 24 byte string 16
byte string...

I am using this

$record_format = 'A65dummy/A24name/A16surname';
$a= (unpack ($record_format, $data));
print $a[name] | $a[surname]

result is,like above...



TIA




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



Re: [PHP] regex problem

2003-06-01 Thread Jim Lucas
Are you wanting the $_POST['nums1'] to have only numbers, -, ., #, : 

Is this what you are trying to match.  if so, try this.

if ( preg_match(/[^0-9\#\:\.\-]/, $_POST['nums1']) ) {
  throw error()
}

This will match anything that is not a number or one of the other special
chars that are in the pattern to be matched.

Therefor, if it does find anything that is not in the pattern to be matched
it will return true and then it will enter the if statement instead of
skipping over it.

Jim Lucas
- Original Message -
From: Daniel J. Rychlik [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, May 31, 2003 11:46 AM
Subject: [PHP] regex problem


Hello,,

I have a preg_match issue matching numbers.  I am currently using

!preg_match ('/([0-9\-\.\#:])/', $_POST['nums1']
throw error[]

This fails if you use something like ' asdf ' but if you use ' asdf789 ' it
passes false and does not throw an error.
This is not the obvious solution  I know its a problem in my regular
expression.  Should I ONLY be using

' /([0-9])/ ' ,  ?

Thanks in advance.
Daniel


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



[PHP] Re: Getting the parsing time of a script

2003-06-01 Thread Bix
Thanks guys ;o)

Bix [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Is there any way getting the time taken to parse a script?

 IE:

 This page took 0.13 seconds to generate.

 Is it a predefined variable anywhere?

 Thanks ;o)

 Bix.





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



Re: [PHP] Installation problem

2003-06-01 Thread Jason k Larson
Call it a hunch ...

./configure --with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql
--
Jason k Larson


Ron Dyck wrote:
I'm currently attempting to upgrade to the latest version of php. 

When I run:
./configure --with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local
I get the following message:
Cannot find header files under /usr/local
Why is this?

ron



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


Re: [PHP] Compile 4.3.2 Errors.

2003-06-01 Thread Thomas Seifert
the same is given for 4.3.2, just compiled it today :).


Thomas

On Sat, 31 May 2003 12:50:38 -0700 [EMAIL PROTECTED] (Evan Nemerson) wrote:

 Don't know about 4.3.2, but at the end of 5.0-dev make, the following message 
 is output:
 
 Build complete.
 (It is safe to ignore warnings about tempnam and tmpnam).
 
 
 
 
 On Saturday 31 May 2003 06:29 am, Volker Augustin wrote:
  hi,
  this sounds like a warning not like an error, your php is successfully
  compiled...(most software i know an compile got this message.)
  can you post a little bit more debug information?
 
  volker
 
  - Original Message -
  From: Alberto Ferrer [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Saturday, May 31, 2003 3:16 PM
  Subject: [PHP] Compile 4.3.2 Errors.
 
   Im compiling the last vercion of PHP 4.3.2 and says this after finish of
   compile.
   The system is a Redhat 7.3, Apache 1.3.27.
  
   ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam':
   /root/php-4.3.2/ext/mysql/libmysql/my_tempnam.c:115: the use of `tempnam'
 
  is
 
   dangerous, better use `mkstemp'
  
  
  
   --
   --
   Alberto Ferrer
   [EMAIL PROTECTED]
 http://www.barrahome.org
   --
   Syntax Error in KITCHEN.H: COFFEE not found.
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
 -- 
 
 Know me? Know me??? What the hell does that mean, know me, you want to know 
 me? Well you don't know me, and you'll never know me. Nobody knows me, or 
 you, or eachother. Nobody in this world knows anybody else. You'll never know 
 me. Ever.
 
 -Rules of Attraction
 



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



Re: [PHP] Re: Long screen display cut short.

2003-06-01 Thread Floyd Baker
On Sat, 31 May 2003 13:18:13 +, you wrote:

what is the online-version?
I mean which webserver-software in which version?


Thomas

Linux  RH 7.3
Apache 1.3.24
mySql  3.23.55 
PHP4.2.0  

Also, this is an httpS connection if it makes a difference in some
way.

Floyd





On Fri, 30 May 2003 20:45:08 -0400 [EMAIL PROTECTED] (Floyd Baker) wrote:

 
 Hello...
 
 I have a routine that works fine on local win98 but when it runs on
 linux online, the screen output is cut short.  I have lengthened the
 30 second script time max to 45 but that made no difference at all.  
 
 Depending on the particulars, the routine stops at a certain spot.  If
 it is rerun, it stops at the very same spot again.  Putting in other
 particulars cause it to stop at a different point, further down.  It
 seems that changes which affect the number of mysql calculations, make
 some difference in the length of the screen display, but it's only a
 minor amount.  It cuts off somewhere around 4 pages.
 
 Any ideas please. 
 
 Floyd
 
 --

--

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



php-general Digest 1 Jun 2003 00:43:06 -0000 Issue 2090

2003-06-01 Thread php-general-digest-help

php-general Digest 1 Jun 2003 00:43:06 - Issue 2090

Topics (messages 149647 through 149689):

Re: Using Cookies Securely
149647 by: Dustin Mitchell
149670 by: Evan Nemerson

Compile 4.3.2 Errors.
149648 by: Alberto Ferrer
149649 by: Volker Augustin
149654 by: Philip Olson
149671 by: Evan Nemerson
149688 by: Thomas Seifert

Re: Adding graphics library
149650 by: Martin Helie

3 entries going into 1 field
149651 by: Vicky
149652 by: Randum Ian
149653 by: Cal Evans
149665 by: Monty

problem with pop3 check
149655 by: joe111
149656 by: Alberto Ferrer
149662 by: Jason k Larson
149664 by: Jason k Larson

Re: [MySQL] Code Help Please
149657 by: Frappy John

FTP DLL
149658 by: Canadaka
149659 by: Philip Olson
149661 by: Frappy John

Re: How to secure a download ?
149660 by: Alex Earl

regex problem
149663 by: Daniel J. Rychlik
149675 by: Monty
149677 by: Daniel J. Rychlik
149685 by: Jim Lucas

PHP getting values from XML
149666 by: MivaDudePB.aol.com
149672 by: Yann Larrivee

Cookies and Sessions: What's the Best Recipe?
149667 by: Monty

get modification date of remote page
149668 by: chris
149678 by: Evan Nemerson

reading binary data
149669 by: Ferhat BINGOL
149674 by: Evan Nemerson
149676 by: Ferhat BINGOL
149679 by: Evan Nemerson
149680 by: Ferhat BINGOL

Re: Decrypting data with GnuPG
149673 by: Pierre-Luc Soucy

Re: Any POSTNUKER, reading from two DB
149681 by: Brian V Bonini

String Manipulation
149682 by: S. Cole

Installation problem
149683 by: Ron Dyck
149687 by: Jason k Larson

INTERRUPT DURATION
149684 by: Ferhat BINGOL

Re: Getting the parsing time of a script
149686 by: Bix

Re: Long screen display cut short.
149689 by: Floyd Baker

Administrivia:

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

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

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


--
---BeginMessage---
On Fri, May 30, 2003 at 11:01:26PM -0700, Evan Nemerson wrote:
 Send a session ID to the user in a cookie, then lookup that ID in a database 
 on the server. It's extremely difficult to guess random session ID's (don't 
 just increment them!), and if you have a session timeout, you're pretty much 
 set.

That's true, and it is what most people do, but if you think about it the
session ID is then functionally equivalent to a crypt'd password for the
duration of your session; that is, either one allows you access to the site.
So if you were worried about folks sniffing an encrypted password and using
it to log in, you should be equally worried about folks sniffing a session ID
and using *it* to log in.

Dustin

-- 

  Dustin Mitchell
  [EMAIL PROTECTED]/[EMAIL PROTECTED]
  http://people.cs.uchicago.edu/~dustin/
---End Message---
---BeginMessage---
Again, It's not perfect, but I don't think anyone has come up with a better 
way.

It's called session hijacking, and it is a great reason to use SSL. However, 
there's still the issue of cross-site scripting, which can really only be 
prevented by smarter coding.

Even then there are issues. For example, holes in ie's SSL capabilities 
(including a current, unpatched vulnerability- well okay it was patched but 
M$ managed to re-introduce it in more recent patches...), permit undeteted 
MITM attacks.


On Saturday 31 May 2003 05:56 am, Dustin Mitchell wrote:
 On Fri, May 30, 2003 at 11:01:26PM -0700, Evan Nemerson wrote:
  Send a session ID to the user in a cookie, then lookup that ID in a
  database on the server. It's extremely difficult to guess random session
  ID's (don't just increment them!), and if you have a session timeout,
  you're pretty much set.

 That's true, and it is what most people do, but if you think about it the
 session ID is then functionally equivalent to a crypt'd password for the
 duration of your session; that is, either one allows you access to the
 site. So if you were worried about folks sniffing an encrypted password and
 using it to log in, you should be equally worried about folks sniffing a
 session ID and using *it* to log in.

 Dustin

---End Message---
---BeginMessage---
Im compiling the last vercion of PHP 4.3.2 and says this after finish of
compile.
The system is a Redhat 7.3, Apache 1.3.27.

ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam':
/root/php-4.3.2/ext/mysql/libmysql/my_tempnam.c:115: the use of `tempnam' is
dangerous, better use `mkstemp'



--
--
Alberto Ferrer
[EMAIL PROTECTED]
  http://www.barrahome.org
--
Syntax Error in KITCHEN.H: 

Re: [PHP] Re: Long screen display cut short.

2003-06-01 Thread Floyd Baker



Yes, there are a bunch of arrays in the program.  

This is on a DSL line...  ??  Would the asynco thing be likely, or
possibly even standard, with DSL?  

Did you come up with a workaround?

Floyd








On Sat, 31 May 2003 14:38:05 +0200, you wrote:

On Fri, 30 May 2003 20:45:08 -0400 [EMAIL PROTECTED] (Floyd Baker) wrote:
[snip] 
 I have a routine that works fine on local win98 but when it runs on
 linux online, the screen output is cut short.  I have lengthened the
 30 second script time max to 45 but that made no difference at all.  
 
 Depending on the particulars, the routine stops at a certain spot.  If
 it is rerun, it stops at the very same spot again.  Putting in other
 particulars cause it to stop at a different point, further down.  It
 seems that changes which affect the number of mysql calculations, make
 some difference in the length of the screen display, but it's only a
 minor amount.  It cuts off somewhere around 4 pages.
[snip] 

I once had this effect on pages exceeding a total size of 8k when running a
test server on an asynchronoous line (ADSL, in 712kB, out 64kB). As long as
the page fits into a single IP packet (which usually equals 8kB) no
problems occur, however if more than one packet is needed to transmit the
page the webserver will only be able to send the first packet. All pages
went fine when using a synchronous connection (in == out).


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/

--

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



Re: [PHP] PHP getting values from XML

2003-06-01 Thread Jaap van Ganswijk
Hi,

At 2003-05-31 14:52 -0400, [EMAIL PROTECTED] wrote:
I'm developing a site PHP site.

I would like to define HTML code in XML and be able to get the HTML code using PHP.

I was hoping for a simple example.

I will not be able to update the version of PHP with any modules as my hosting 
company (hostway.com) admins the PHP environment.

I wrote a very compact stand-alone XML interpreter
for the Amazon.com XML webservices interface:

http://www.chipdir.nl/amazon/

The part that interprets the XML code is
only about 30 lines long. Please consider
that I can't guarantee that it's useable
as a general XML-interpreter, because it
was written with the quite neat Amazon
code in mind.

The code may also not be useable for big
source files. Furthermore the code reads
the XML code in such a way that the resulting
array stays as shallow as possible. To this
end certain information is not stored in the
array, and therefore it's not possible
to regenerate the XML code from the array
again.

I have also been busy expanding the script
code into a similar HTML interpreter (which
is much harder of course) but that means
that I don't have a very clear picture in
my head about what the quality of the XML
interpreter currently is. I think I have
found some serious improvements while
working on the HTML version.

One of the problems I encountered whilst trying
to keep the resulting tree shallow was, that
when you interpret something like:

a
  a_data_
  b_data_
  c_data_

(I'm leaving out the end-tags.)

You can't put the a,b,c in an associative array,
with a,b,c as index, because every index should
be unique and the sequence might as well be:

a
  a_data_
  b_data_
  b...
  c

This means that you have to put the elements in
an enumerated array.

But in the case of say:

author
  name   _data_
  street _data_
  city   _data_

One really would prefer to put them in an associative
array.

Of course one could check first if all the fields
are unique and decide then, but this might lead
to the fact that XML code like:

authors
  author_data_
  author_data_

authors
  author_data_

leads to arrays of different depth.

I haven't checked yet if interpreting the DTD
could help to resolve this issue.

Greetings,
Jaap


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



Re: [PHP] regex problem

2003-06-01 Thread Daniel J. Rychlik
If I wanted to remove script/script tags from my form as well as html
tags, would I use a preg_match function or is their another simple funtion
that does this ?

-Dan

- Original Message - 
From: Jim Lucas [EMAIL PROTECTED]
To: Daniel J. Rychlik [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Saturday, May 31, 2003 6:04 PM
Subject: Re: [PHP] regex problem


 Are you wanting the $_POST['nums1'] to have only numbers, -, ., #, : 

 Is this what you are trying to match.  if so, try this.

 if ( preg_match(/[^0-9\#\:\.\-]/, $_POST['nums1']) ) {
   throw error()
 }

 This will match anything that is not a number or one of the other special
 chars that are in the pattern to be matched.

 Therefor, if it does find anything that is not in the pattern to be
matched
 it will return true and then it will enter the if statement instead of
 skipping over it.

 Jim Lucas
 - Original Message -
 From: Daniel J. Rychlik [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, May 31, 2003 11:46 AM
 Subject: [PHP] regex problem


 Hello,,

 I have a preg_match issue matching numbers.  I am currently using

 !preg_match ('/([0-9\-\.\#:])/', $_POST['nums1']
 throw error[]

 This fails if you use something like ' asdf ' but if you use ' asdf789 '
it
 passes false and does not throw an error.
 This is not the obvious solution  I know its a problem in my regular
 expression.  Should I ONLY be using

 ' /([0-9])/ ' ,  ?

 Thanks in advance.
 Daniel


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



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



[PHP] trikky authentication question

2003-06-01 Thread daniel
hi guys i have an authentication class , there is one last big issue to
fix , i am trying to prevent multiple logins , it does this ok except , the
first login gets kicked instead of the second one , i have a last_login
date entry to work with , what else should i have so on the login check if
the user is logged in , there is an issue using the logged in feature , ok
u give it an interval of say 2 hours , this may prevent that person
reloggin in for two hours right ?? :| , or say its a few minutes , i can
log bak in after a few minutes and still kick the first login, what are my
options



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



Re: [PHP] trikky authentication question

2003-06-01 Thread Volker Augustin
hi,
this is only a very fast response :))
is solved this kind of problem like that:
(quick solution for a chatboard - user cannot login for x seconds -
maxidletime)
/***two functions:**/

function logoutMsgBoardUser($UserName)

 global $MessageBoardTable,$SiteID;
 $DB=new connectDB();
 $actDate= date(Y-m-d H:i:s);
 $newMessage=addslashes($UserName). logged out.;
 $host=System;
 $Query=update .$MessageBoardTable.
  set logged_out='1' where
   name='.addslashes($UserName).'
   and site_id='.$SiteID.'
   and logged_out!='1'
  ;
 $DB-Query($Query);
 $Query=insert into .$MessageBoardTable.
(site_id,name,msg,created,host,archiv,aktiv,logged_out)
 values

  '.$SiteID.',
  '',
  '.$newMessage.',
  '.$actDate.',
  '.$host.',
  '0',
  '1',
  '1'
 );
 $DB-Query($Query);
}

function getMsgBoardUserIdleTime($UserName)

 global $MessageBoardTable,$SiteID;
 $DB=new ConnectDB();
 $Query=select created from .$MessageBoardTable.  where
site_id='.$SiteID.' and logged_out='0' and
name='.addslashes($UserName).' and aktiv='1' order by id desc limit 1;
 $DB-Query($Query);
 if ($DB-next_record())

  $lastUserPost=$DB-Record['created'];
  $actDate= date(Y-m-d H:i:s);
  $Result=strtotime(date ($actDate))-strtotime($lastUserPost);
 } else

  $Result=0;
 }
 return $Result;
}
/***and the code... i think thats all**/
if ($msglogin=='1') {
 $newMessage= bentered the Messageboard/b;
 if (getMsgBoardUserIdleTime($MName) 0) {
  echo Eine User mit diesem Namen ist bereits Online, bitte waehle einen
anderen...;
  $logged_out=true;
  $MName=;
 }
}

if (isset($MName)  $MName!=) {
 $MyIdleTime=getMsgBoardUserIdleTime($MName);
 if ($MyIdleTime  $MaxIdleTime) {
  logoutMsgBoardUser($MName);
  $logged_out=true;
  $MName=;
  echo  logged out by system after .$MyIdleTime. seconds without saying
anything ;);
 }
}

volker


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, June 01, 2003 4:11 AM
Subject: [PHP] trikky authentication question


 hi guys i have an authentication class , there is one last big issue to
 fix , i am trying to prevent multiple logins , it does this ok except ,
the
 first login gets kicked instead of the second one , i have a last_login
 date entry to work with , what else should i have so on the login check if
 the user is logged in , there is an issue using the logged in feature , ok
 u give it an interval of say 2 hours , this may prevent that person
 reloggin in for two hours right ?? :| , or say its a few minutes , i can
 log bak in after a few minutes and still kick the first login, what are my
 options



 --
 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] trikky authentication question

2003-06-01 Thread daniel
doh silly me , i'll have to set a logged out flag , will help me in the
long run :D thanks dude

 hi,
 this is only a very fast response :))
 is solved this kind of problem like that:
 (quick solution for a chatboard - user cannot login for x seconds -
 maxidletime)
 /***two functions:**/

 function logoutMsgBoardUser($UserName)

 global $MessageBoardTable,$SiteID;
 $DB=new connectDB();
 $actDate= date(Y-m-d H:i:s);
 $newMessage=addslashes($UserName). logged out.;
 $host=System;
 $Query=update .$MessageBoardTable.
  set logged_out='1' where
   name='.addslashes($UserName).'
   and site_id='.$SiteID.'
   and logged_out!='1'
  ;
 $DB-Query($Query);
 $Query=insert into .$MessageBoardTable.
 (site_id,name,msg,created,host,archiv,aktiv,logged_out)
 values

  '.$SiteID.',
  '',
  '.$newMessage.',
  '.$actDate.',
  '.$host.',
  '0',
  '1',
  '1'
 );
 $DB-Query($Query);
 }

 function getMsgBoardUserIdleTime($UserName)

 global $MessageBoardTable,$SiteID;
 $DB=new ConnectDB();
 $Query=select created from .$MessageBoardTable.  where
 site_id='.$SiteID.' and logged_out='0' and
 name='.addslashes($UserName).' and aktiv='1' order by id desc limit
 1;
 $DB-Query($Query);
 if ($DB-next_record())

  $lastUserPost=$DB-Record['created'];
  $actDate= date(Y-m-d H:i:s);
  $Result=strtotime(date ($actDate))-strtotime($lastUserPost);
 } else

  $Result=0;
 }
 return $Result;
 }
 /***and the code... i think thats all**/
 if ($msglogin=='1') {
 $newMessage= bentered the Messageboard/b;
 if (getMsgBoardUserIdleTime($MName) 0) {
  echo Eine User mit diesem Namen ist bereits Online, bitte waehle
  einen
 anderen...;
  $logged_out=true;
  $MName=;
 }
 }

 if (isset($MName)  $MName!=) {
 $MyIdleTime=getMsgBoardUserIdleTime($MName);
 if ($MyIdleTime  $MaxIdleTime) {
  logoutMsgBoardUser($MName);
  $logged_out=true;
  $MName=;
  echo  logged out by system after .$MyIdleTime. seconds without
  saying
 anything ;);
 }
 }

 volker


 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Sunday, June 01, 2003 4:11 AM
 Subject: [PHP] trikky authentication question


 hi guys i have an authentication class , there is one last big issue
 to fix , i am trying to prevent multiple logins , it does this ok
 except ,
 the
 first login gets kicked instead of the second one , i have a
 last_login date entry to work with , what else should i have so on the
 login check if the user is logged in , there is an issue using the
 logged in feature , ok u give it an interval of say 2 hours , this may
 prevent that person reloggin in for two hours right ?? :| , or say its
 a few minutes , i can log bak in after a few minutes and still kick
 the first login, what are my options



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




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



Re: [PHP] Re: Long screen display cut short.

2003-06-01 Thread Tim Burden
I had same problem and it involved an array. In my case there was a typo,
and the array I was trying to do something with didn't even exist, but it
was hard to find because instead of dying with an error it would just sort
of sit there, not outputting anything further, until I clicked stop in the
browser.

Can't remember more details.

Haven't had problem since, we upgrade with releases.

- Original Message - 
From: Floyd Baker [EMAIL PROTECTED]
Newsgroups: php.general
To: Thomas Seifert [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, May 31, 2003 8:42 PM
Subject: Re: [PHP] Re: Long screen display cut short.


 On Sat, 31 May 2003 13:18:13 +, you wrote:

 what is the online-version?
 I mean which webserver-software in which version?
 
 
 Thomas

 Linux  RH 7.3
 Apache 1.3.24
 mySql  3.23.55
 PHP4.2.0

 Also, this is an httpS connection if it makes a difference in some
 way.

 Floyd





 On Fri, 30 May 2003 20:45:08 -0400 [EMAIL PROTECTED] (Floyd Baker) wrote:
 
 
  Hello...
 
  I have a routine that works fine on local win98 but when it runs on
  linux online, the screen output is cut short.  I have lengthened the
  30 second script time max to 45 but that made no difference at all.
 
  Depending on the particulars, the routine stops at a certain spot.  If
  it is rerun, it stops at the very same spot again.  Putting in other
  particulars cause it to stop at a different point, further down.  It
  seems that changes which affect the number of mysql calculations, make
  some difference in the length of the screen display, but it's only a
  minor amount.  It cuts off somewhere around 4 pages.
 
  Any ideas please.
 
  Floyd
 
  --

 --


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



RE: [PHP] trikky authentication question

2003-06-01 Thread John W. Holmes
 hi guys i have an authentication class , there is one last big issue
to
 fix , i am trying to prevent multiple logins , it does this ok except
,
 the
 first login gets kicked instead of the second one , i have a
last_login
 date entry to work with , what else should i have so on the login
check if
 the user is logged in , there is an issue using the logged in feature
, ok
 u give it an interval of say 2 hours , this may prevent that person
 reloggin in for two hours right ?? :| , or say its a few minutes , i
can
 log bak in after a few minutes and still kick the first login, what
are my
 options

I generally keep it like this, so that the first user is logged out.
This way the user is alerted that someone has hijacked their account
and they can act upon it. 

If you do it another way so that the first person remains logged on and
the second user is denied access, you'll just need some extra flags in
the database. Set a logged_on column when the user logs on and if
another user tries to use the same name and the logged_on column is
set, deny them. The issue you'll run into with this though, is how do
you know someone is logged off? Sure, some people may use the log off
button, but others will not. So you have to come up with a timeout
script. What if I accidentally close my browser and come back to log in?
The system will not let me because I'm still logged_in until X minutes
pass. Also with this method, you need to keep track of these attempted
log ins and somehow alert the first user.

Hope that helps. 

---John W. Holmes...

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

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



RE: [PHP] trikky authentication question

2003-06-01 Thread daniel
What if I accidentally close my browser and come back to log
 in? The system will not let me because I'm still logged_in until X
 minutes pass. Also with this method, you need to keep track of these
 attempted log ins and somehow alert the first user.

good question i'm checking this out atm :|



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



Re: [PHP] trikky authentication question

2003-06-01 Thread Volker Augustin
hmmm,
for me these few line are working well, user cannot login before
max-idletime is reached (i check the list every time an action is taken
on the board, if no user is online, i cant login forever and have to connect
as another user first ;)
thats all, you could check idletime for all users at the login window and
log them out if reached - before logging in 
volker

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, June 01, 2003 5:06 AM
Subject: RE: [PHP] trikky authentication question


 What if I accidentally close my browser and come back to log
  in? The system will not let me because I'm still logged_in until X
  minutes pass. Also with this method, you need to keep track of these
  attempted log ins and somehow alert the first user.

 good question i'm checking this out atm :|



 --
 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] trikky authentication question

2003-06-01 Thread daniel
so wot do i check upon , (NOW() - last_login)  max_idletime ? what do i do
with the other check for logged_in=0 ?
 hmmm,
 for me these few line are working well, user cannot login before
 max-idletime is reached (i check the list every time an action is
 taken on the board, if no user is online, i cant login forever and have
 to connect as another user first ;)
 thats all, you could check idletime for all users at the login window
 and log them out if reached - before logging in 
 volker

 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Sunday, June 01, 2003 5:06 AM
 Subject: RE: [PHP] trikky authentication question


 What if I accidentally close my browser and come back to log
  in? The system will not let me because I'm still logged_in until X
  minutes pass. Also with this method, you need to keep track of these
  attempted log ins and somehow alert the first user.

 good question i'm checking this out atm :|



 --
 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] trikky authentication question

2003-06-01 Thread John W. Holmes
 for me these few line are working well, user cannot login before
 max-idletime is reached (i check the list every time an action is
 taken
 on the board, if no user is online, i cant login forever and have to
 connect
 as another user first ;)

And you call that a viable solution? That's ridiculous. 

---John W. Holmes...

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

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



RE: [PHP] trikky authentication question

2003-06-01 Thread daniel
wots the best solution then ??

SELECT username FROM users WHERE logged_in=0 AND username='.$this-post
['username'].'

thats my current one but yes i get blocked out , what else can i add to it ?



 And you call that a viable solution? That's ridiculous.





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



RE: [PHP] trikky authentication question

2003-06-01 Thread daniel
ok here is the latest sql query

SELECT username FROM users WHERE (logged_in=0 OR (NOW()-last_login)  300
AND username='.$this-post['username'].'

there is the idle time added but what after the idle time they log bak in
and then kiks the first login out ? there must be a better solution ??





 And you call that a viable solution? That's ridiculous.

 ---John W. Holmes...




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



RE: [PHP] trikky authentication question

2003-06-01 Thread daniel
ok well i just noticed my sql statement is a bit flakey as its not a true
idle time to get a true idle i'd have to keep a record of the time every
request to the pages when logged in, this is checking when they lasted
logged in so the user may still be logged in 300 seconds later  , this isnt
really idle especially when the users will be fulltext searching a table of
100K + records :|, any suggestions ?

 for me these few line are working well, user cannot login before
 max-idletime is reached (i check the list every time an action is
 taken
 on the board, if no user is online, i cant login forever and have to
 connect
 as another user first ;)

 And you call that a viable solution? That's ridiculous.

 ---John W. Holmes...

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

 PHP Architect - A monthly magazine for PHP Professionals. Get your copy
 today. http://www.phparch.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] trikky authentication question

2003-06-01 Thread Volker Augustin
 i said that before!
 just a hint to think offany questions?
 volker
 - Original Message -
 From: John W. Holmes [EMAIL PROTECTED]
 To: 'Volker Augustin' [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Sunday, June 01, 2003 5:48 AM
 Subject: RE: [PHP] trikky authentication question
 
 
   for me these few line are working well, user cannot login before
   max-idletime is reached (i check the list every time an action is
   taken
   on the board, if no user is online, i cant login forever and have to
   connect
   as another user first ;)
 
  And you call that a viable solution? That's ridiculous.
 
  ---John W. Holmes...
 
  Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E
 
  PHP Architect - A monthly magazine for PHP Professionals. Get your copy
  today. http://www.phparch.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



[PHP] OOP question

2003-06-01 Thread Jackson Miller
Is it possible to reference two instances of an object at once with a
single variable name while retaining the ability to reference the
objects seperately?

I am using the PEAR Template IT package and need to generate two similar
but different results at the same time.  I am doing this with two
instances of the IT class ($tpl1 and $tpl2).

I have some code like this:

$tpl1-setVariable(var1,This);
$tpl2-setVariable(var1,This);

$tpl1-setVariable(var2,That);
$tpl2-setVariable(var2,That);

$tpl1-setVariable(var3,Something);
$tpl2-setVariable(var3,SomethingElse);

I would like for this to be:
$tpl3-setVariable(var1,This);

$tpl3-setVariable(var2,That);

$tpl1-setVariable(var3,Something);
$tpl2-setVariable(var3,SomethingElse);

Where $tpl3 is a reference to both $tpl1 and $tpl2.

Is this possible at all?  It seems to make for very clean code for me,
but I can't think of how it could be possible.

Thanks in advance.

-Jackson


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



[PHP] mirror search is going to google !!!

2003-06-01 Thread daniel
the idiot mirror search is going to google instead and not giving me results

http://www.google.com/search?q=manual%2Fen%2Ffunction.connection-
aborted.php+site:www.php.netl=en



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



[PHP] Add Up Prices in Array

2003-06-01 Thread Ralph
I'm querying prices off a database then storing these in an array, I
want to add these up to get the grand total, how would I go about adding
up all the prices stored in the array?

Thanks in advance.





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



Re: [PHP] Add Up Prices in Array

2003-06-01 Thread Rasmus Lerdorf
If they are coming out of your database, why not get your database to do
it for you by calling SUM() in your query?

On Sun, 1 Jun 2003, Ralph wrote:

 I'm querying prices off a database then storing these in an array, I
 want to add these up to get the grand total, how would I go about adding
 up all the prices stored in the array?

 Thanks in advance.





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


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



[PHP] RE: connection_aborted was [PHP] trikky authentication question

2003-06-01 Thread daniel
how can i get this to work ??

if (connection_aborted()) $this-db-query(UPDATE users SET logged_in=0
WHERE userID=$this-userID);

 ok well i just noticed my sql statement is a bit flakey as its not a
 true idle time to get a true idle i'd have to keep a record of the time
 every request to the pages when logged in, this is checking when they
 lasted logged in so the user may still be logged in 300 seconds later
 , this isnt really idle especially when the users will be fulltext
 searching a table of 100K + records :|, any suggestions ?

 for me these few line are working well, user cannot login before
 max-idletime is reached (i check the list every time an action is
 taken
 on the board, if no user is online, i cant login forever and have to
 connect
 as another user first ;)

 And you call that a viable solution? That's ridiculous.

 ---John W. Holmes...

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

 PHP Architect - A monthly magazine for PHP Professionals. Get your
 copy today. http://www.phparch.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




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



Re: [PHP] mirror search is going to google !!!

2003-06-01 Thread Rasmus Lerdorf
We are reworking our local search code.  It was killing the server.
Pointed it at Google temporarily.

-Rasmus

On Sun, 1 Jun 2003 [EMAIL PROTECTED] wrote:

 the idiot mirror search is going to google instead and not giving me results

 http://www.google.com/search?q=manual%2Fen%2Ffunction.connection-
 aborted.php+site:www.php.netl=en



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


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



Re: [PHP] RE: connection_aborted was [PHP] trikky authenticationquestion

2003-06-01 Thread Rasmus Lerdorf
On Sun, 1 Jun 2003 [EMAIL PROTECTED] wrote:
 how can i get this to work ??

 if (connection_aborted()) $this-db-query(UPDATE users SET logged_in=0
 WHERE userID=$this-userID);

Did you read the connection handling chapter in the manual?

http://www.php.net/manual/en/features.connection-handling.php

-Rasmus

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



Re: [PHP] OOP question

2003-06-01 Thread Rasmus Lerdorf
On Sat, 1 Jun 2003, Jackson Miller wrote:
 Is it possible to reference two instances of an object at once with a
 single variable name while retaining the ability to reference the
 objects seperately?

No chance.  Well, you could hack it with some really fancy object
overloading, but in general, no, you cannot have a single reference that
references two distinct objects.  References work the other way around.
Given a single distinct object, you can create multiple equivalent
references to it.

-Rasmus

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



RE: [PHP] Add Up Prices in Array

2003-06-01 Thread Ralph
Right... I never thought of this.

But can I use this if what I'm trying to get the (price * quantity).

-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 01, 2003 12:43 AM
To: Ralph
Cc: PHP General Mailing List
Subject: Re: [PHP] Add Up Prices in Array

If they are coming out of your database, why not get your database to do
it for you by calling SUM() in your query?

On Sun, 1 Jun 2003, Ralph wrote:

 I'm querying prices off a database then storing these in an array, I
 want to add these up to get the grand total, how would I go about
adding
 up all the prices stored in the array?

 Thanks in advance.





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




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



[PHP] mysql_connect() -- flags

2003-06-01 Thread Armand Turpel
Hi,
Is there any body who have experience with the flags in mysql_connect() in
php =  4.3 . Especially the MYSQL_CLIENT_COMPRESS flag.

I dont know if it works or not. I cant make any difference. Should php must
be compiled with a special flag to get work this?

Thanks
Armand


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



Re: [PHP] Cookies and Sessions: What's the Best Recipe?

2003-06-01 Thread Justin French
on 01/06/03 6:01 AM, Monty ([EMAIL PROTECTED]) wrote:

 I have a member site that uses sessions. People who have their browser
 cookies turned off, however, cannot use our site. I read somewhere that to
 avoid this, I'd have to manually append the PHPSESSID var to every URL when
 redirecting in a script.

Actually, the session ID has to appear in every URL... if you compile PHP
with enable-trans-sid, then PHP takes care of this for you in *most* cases.
As you say above, you need to append them manually to things like header()
redirects.

One way around this would be to write a simple wrapper function which does
this for you automatically:

?
// UNTESTED
function redirectWithSession($location)
{
$sid = session_id();
$sname = session_name();
header(Location: {$location}?{$sname}={$sid});
}
?

Then (after testing the above code thoroughly) you just need to do a batch
search and replace on your whole site source for 'header(Location: ' with
'redirectWithSession(', and everything should be cool I think.  Please
test all thoroughly :)

Or, just go through your code and patch it up :)


 Is this really the best or only way to avoid this problem? Or, is it simply
 unavoidable? Right now, I tell users that the site will only work with
 browsers that have cookies turned on, but, I'd rather the site was
 accessible to all. However, I also don't like passing session IDs via the
 URL because of the security risk.

There is no difference in the security risk between URL and cookies, if they
are sent in plain text.  SSL is a different story.

You have a choice:  make sure your site can be used without cookies (and
deal with the small effort during development), or be prepared to turn away
users.

I know which I picked :)


Justin


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



RE: [PHP] Add Up Prices in Array

2003-06-01 Thread Ralph
Disregard my last post, I went with what you suggested and I got it to
work.

Thanks again.

-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 01, 2003 12:43 AM
To: Ralph
Cc: PHP General Mailing List
Subject: Re: [PHP] Add Up Prices in Array

If they are coming out of your database, why not get your database to do
it for you by calling SUM() in your query?

On Sun, 1 Jun 2003, Ralph wrote:




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



[PHP] Shipping Rates

2003-06-01 Thread Ralph
Maybe it's just that it's late, but can't seem to figure this out. I
want to show a shipping price depending on the amount of purchase. I
thought about using a lot of if() statements, but I know this is not the
best way to go about this.

Can anybody enlighten me on this one and give me a better approach.

Here is an example of my shipping rates:

Less than $20.00 = $7.45 
$20.01-$35.00 = $8.45 
$35.01- $55.00 = $9.45 
$55.01-$80.00 = $10.45 
$80.01-$100.00 = $11.45 
$100.01-$150.00 = $13.45 
$150.01-$200.00 = $15.55 
$200.01 or more  = $19.45

Thanks.





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



RE: [PHP] Shipping Rates

2003-06-01 Thread Ralph
I thought about this but how would I go about performing greater than or
equal to without having to specify a CASE for every price range?

-Original Message-
From: Jason Paschal [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 01, 2003 1:47 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Shipping Rates

this, maybe?
http://www.php.net/switch


From: Ralph [EMAIL PROTECTED]
To: PHP General Mailing List [EMAIL PROTECTED]
Subject: [PHP] Shipping Rates
Date: Sun, 01 Jun 2003 01:48:30 -0700

Maybe it's just that it's late, but can't seem to figure this out. I
want to show a shipping price depending on the amount of purchase. I
thought about using a lot of if() statements, but I know this is not
the
best way to go about this.

Can anybody enlighten me on this one and give me a better approach.

Here is an example of my shipping rates:

Less than $20.00 = $7.45
$20.01-$35.00 = $8.45
$35.01- $55.00 = $9.45
$55.01-$80.00 = $10.45
$80.01-$100.00 = $11.45
$100.01-$150.00 = $13.45
$150.01-$200.00 = $15.55
$200.01 or more  = $19.45

Thanks.





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


_
Add photos to your messages with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail




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



RE: [PHP] RE: connection_aborted was [PHP] trikky authentication question

2003-06-01 Thread electroteque
of course thats where i got the example from but it doesnt work

ignore_user_abort(true);
if (connection_aborted()) $this-db-query(UPDATE users SET logged_in=0
WHERE userID=$this-userID);

if i close the browser its not setting the fiel to 0 meaning they are logged
out
-Original Message-
From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 01, 2003 5:46 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] RE: connection_aborted was [PHP] trikky
authentication question


On Sun, 1 Jun 2003 [EMAIL PROTECTED] wrote:
 how can i get this to work ??

 if (connection_aborted()) $this-db-query(UPDATE users SET logged_in=0
 WHERE userID=$this-userID);

Did you read the connection handling chapter in the manual?

http://www.php.net/manual/en/features.connection-handling.php

-Rasmus


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



Re: [PHP] Shipping Rates

2003-06-01 Thread Rasmus Lerdorf
Better approach in what sense?  From a performance perspective you are not
going to beat a specific set of if conditions unless there is an distinct
formula you can apply.  I will assume there is no simple mathematical
relationship for your full set of data and what you are really looking for
is a way to just feed the pricing structure into your code by some
mechanism and then have it just work, so your goal is to make it more
maintenable.  To that end, you could stick your pricing table into an
array of arrays and simple loop through it.  Something like this:

function find_rate($num) {
$rates = array(array('7.45'=20),
   array('8.45'=35),
   array('9.45'=55),
   array('10.45'=80),
   array('11.45'=100),
   array('13.45'=150),
   array('15.55'=200),
   array('19.45'=9));

foreach($rates as $i = $vals) {
if($num  current($vals)) continue;
else { $price = key($vals); break; }
}
return $price;
}

This should return the correct shipping price for whatever you pass into
find_rate().

-Rasmus

On Sun, 1 Jun 2003, Ralph wrote:

 Maybe it's just that it's late, but can't seem to figure this out. I
 want to show a shipping price depending on the amount of purchase. I
 thought about using a lot of if() statements, but I know this is not the
 best way to go about this.

 Can anybody enlighten me on this one and give me a better approach.

 Here is an example of my shipping rates:

 Less than $20.00 = $7.45
 $20.01-$35.00 = $8.45
 $35.01- $55.00 = $9.45
 $55.01-$80.00 = $10.45
 $80.01-$100.00 = $11.45
 $100.01-$150.00 = $13.45
 $150.01-$200.00 = $15.55
 $200.01 or more  = $19.45

 Thanks.





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


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



RE: [PHP] RE: connection_aborted was [PHP] trikky authenticationquestion

2003-06-01 Thread Rasmus Lerdorf
??  Are you reading that chapter at all?  Closing the browser has
absolutely nothing to do with aborted connections unless the browser is
closed while data is actually flowing across the wire.  You are completely
on the wrong track here.  HTTP is a simple stateless protocol.  Sessions
can be used to emulate state, but that doesn't mean you suddenly have a
stateful connection-oriented protocol.  Between clicks of your browser you
do not have an active connection from the browser to the web server (with
the minor exception of keep-alive connections, but they aren't what you
think anyway, so ignore those).  Since you don't have an active
connection, closing your browser could not possible abort a connection.

-Rasmus

On Sun, 1 Jun 2003, electroteque wrote:

 of course thats where i got the example from but it doesnt work

 ignore_user_abort(true);
 if (connection_aborted()) $this-db-query(UPDATE users SET logged_in=0
 WHERE userID=$this-userID);

 if i close the browser its not setting the fiel to 0 meaning they are logged
 out
 -Original Message-
 From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]
 Sent: Sunday, June 01, 2003 5:46 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] RE: connection_aborted was [PHP] trikky
 authentication question


 On Sun, 1 Jun 2003 [EMAIL PROTECTED] wrote:
  how can i get this to work ??
 
  if (connection_aborted()) $this-db-query(UPDATE users SET logged_in=0
  WHERE userID=$this-userID);

 Did you read the connection handling chapter in the manual?

 http://www.php.net/manual/en/features.connection-handling.php

 -Rasmus


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



Re: [PHP] OOP question

2003-06-01 Thread Ernest E Vogelsinger
At 08:39 01.06.2003, Jackson Miller said:
[snip]
Is it possible to reference two instances of an object at once with a
single variable name while retaining the ability to reference the
objects seperately?
[snip] 

Not using references.

I once built a small class that handles such stuff. Basically it's a
container for object references that are attached to it, and it will
execute any method to all objects simultaneously. Code plus testbed is
attached below.

The base implementation of CTeeObject checks if that all attached objects
are of the same class of the first attached object, or at least derived
from it. This is how I needed it but it's not mandatory, as the call agent
method or CTeeObject checks each attached object if the method exists. Upon
attaching objects, CTeeObject calls its check_object() method if the object
is ok to attach - you may override this method in a derived class to
perform less or additional checks.

For example you could provide a specialized CTeeObject-derived class that
doesn't use the generic call agent (for performance reasons) but calls
object methods directly (which would be quite feasible in your case). Use
the overridable check_object() to check if the object to attach has a
supported class.

?php

class CTeeObject {
var $arObj;
var $class;

function CTeeObject() {
// we do nothing in the constructor class
// use the attach() method
$this-arObj = array();
}

function attach($hObj) {
// if this is the first object, simply accept it.
// for all successive objects make sure they have
// the same class (or at least derived from).
if (!count($this-arObj)) {
if (is_object($hObj)) {
$this-arObj[] = $hObj;
$this-class = get_class($hObj);
}
}
else {
if (!$this-check_object($hObj))
return false;
$this-arObj[] = $hObj;
}
return true;
}

// override this method in your derived class
// for additional class checks
function check_object($hObj)
{
return is_a($hObj, $this-class);
}

// generic call agent
function call_method($method)
{
// accessing unlisted arguments will trigger a notice/warning
// this is unavoidable here so modify error reporting
$erep = error_reporting(E_ERROR);

// build a list of arguments to pass
$arglist = array();
for ($i = 1; $i  func_num_args(); ++$i)
$arglist[] = func_get_arg($i);

// build the method call
$cmd = null;
for ($i = 0; $i  count($arglist); ++$i)
$cmd .= ($cmd ? ',' : null) . \$arglist[$i];
$cmd = return \$hObj-$method($cmd);;

// error reporting to standard
// to have it available in the object implementation
error_reporting($erep);

// now walk all attached objects and execute the required
method
// but check if the object is still an object and that the
method exists
$result = array();
for ($i = 0; $i  count($this-arObj); ++$i) {
$hObj = $this-arObj[$i];
if (is_object($hObj)  method_exists($hObj, $method))
$result[] = eval($cmd);
else
$result[] = null;
}
return $result;
}
}


// Test Bed

class CBaseTest {
var $id;

function CBaseTest($id)
{
$this-id = $id;
}

function hello($hellostring)
{
echo sprintf('Hello from %s (%s): %sbr /',
get_class($this), $this-id, $hellostring);
return $this-id;
}
}

class CExtendedTest extends CBaseTest {

function say($what, $second)
{
echo sprintf('SayWhat from %s (%s): %s - %dbr /',
get_class($this), $this-id, $what, $second);
return $this-id;
}
}

$tee = new CTeeObject;
$tee-attach(new CBaseTest(1));
$tee-attach(new CExtendedTest(1));
$tee-attach(new CBaseTest(2));
$tee-attach(new CExtendedTest(2));
$tee-attach(new CBaseTest(3));
$tee-attach(new CExtendedTest(3));
$tee-attach(new CBaseTest(4));
$tee-attach(new CExtendedTest(4));

echo 'pre'; 

Re: [PHP] OOP question

2003-06-01 Thread Ernest E Vogelsinger
Just noticed a small glitch in the attach() method - check_object will not
be called for the first object. Use this attach() / check_object()
implementation instead. The var $class instance variable of CTeeObject
can be omitted.

function attach($hObj) {
if (!$this-check_object($hObj))
return false;
$this-arObj[] = $hObj;
return true;
}

// override this method in your derived class
// for additional class checks
function check_object($hObj)
{
// if this is the first object, simply accept it.
// for all successive objects make sure they have
// the same class (or at least derived from).
if (is_object($hObj))
return (!count($this-arObj) || is_a($hObj,
get_class($this-arObj[0])));
return false;
}




-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



[PHP] Re: cheap PHP+SQL WebHosting

2003-06-01 Thread Arcadius A.
Thanks!

Arcadius.

Nabil [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 www.spiderhosts.com

 i'v been for so long with them, and the service is good
 Nabil
 www.cabms.org
 www.d2ue.com


 Arcadius A. [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hello!
  Please, do you know of any cheap PHP+SQL web hosting company?
 
  I know we always get what we pay for, but I really need somethingk
cheap.
 
  Thanks in advance.
 
  Arcadius.
 
 





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



php-general Digest 1 Jun 2003 12:45:55 -0000 Issue 2091

2003-06-01 Thread php-general-digest-help

php-general Digest 1 Jun 2003 12:45:55 - Issue 2091

Topics (messages 149690 through 149725):

Re: Long screen display cut short.
149690 by: Floyd Baker
149696 by: Tim Burden

Re: PHP getting values from XML
149691 by: Jaap van Ganswijk

Re: regex problem
149692 by: Daniel J. Rychlik

trikky authentication question
149693 by: daniel.electroteque.org
149694 by: Volker Augustin
149695 by: daniel.electroteque.org
149697 by: John W. Holmes
149698 by: daniel.electroteque.org
149699 by: Volker Augustin
149700 by: daniel.electroteque.org
149701 by: John W. Holmes
149702 by: daniel.electroteque.org
149703 by: daniel.electroteque.org
149704 by: daniel.electroteque.org
149705 by: Volker Augustin

OOP question
149706 by: Jackson Miller
149713 by: Rasmus Lerdorf
149723 by: Ernest E Vogelsinger
149724 by: Ernest E Vogelsinger

mirror search is going to google !!!
149707 by: daniel.electroteque.org
149711 by: Rasmus Lerdorf

Add Up Prices  in Array
149708 by: Ralph
149709 by: Rasmus Lerdorf
149714 by: Ralph
149717 by: Ralph

Re: connection_aborted was [PHP] trikky authentication question
149710 by: daniel.electroteque.org
149712 by: Rasmus Lerdorf
149720 by: daniel.electroteque.org
149722 by: Rasmus Lerdorf

mysql_connect() -- flags
149715 by: Armand Turpel

Re: Cookies and Sessions: What's the Best Recipe?
149716 by: Justin French

Shipping Rates
149718 by: Ralph
149719 by: Ralph
149721 by: Rasmus Lerdorf

Re: cheap PHP+SQL WebHosting
149725 by: Arcadius A.

Administrivia:

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

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

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


--
---BeginMessage---



Yes, there are a bunch of arrays in the program.  

This is on a DSL line...  ??  Would the asynco thing be likely, or
possibly even standard, with DSL?  

Did you come up with a workaround?

Floyd








On Sat, 31 May 2003 14:38:05 +0200, you wrote:

On Fri, 30 May 2003 20:45:08 -0400 [EMAIL PROTECTED] (Floyd Baker) wrote:
[snip] 
 I have a routine that works fine on local win98 but when it runs on
 linux online, the screen output is cut short.  I have lengthened the
 30 second script time max to 45 but that made no difference at all.  
 
 Depending on the particulars, the routine stops at a certain spot.  If
 it is rerun, it stops at the very same spot again.  Putting in other
 particulars cause it to stop at a different point, further down.  It
 seems that changes which affect the number of mysql calculations, make
 some difference in the length of the screen display, but it's only a
 minor amount.  It cuts off somewhere around 4 pages.
[snip] 

I once had this effect on pages exceeding a total size of 8k when running a
test server on an asynchronoous line (ADSL, in 712kB, out 64kB). As long as
the page fits into a single IP packet (which usually equals 8kB) no
problems occur, however if more than one packet is needed to transmit the
page the webserver will only be able to send the first packet. All pages
went fine when using a synchronous connection (in == out).


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/

--
---End Message---
---BeginMessage---
I had same problem and it involved an array. In my case there was a typo,
and the array I was trying to do something with didn't even exist, but it
was hard to find because instead of dying with an error it would just sort
of sit there, not outputting anything further, until I clicked stop in the
browser.

Can't remember more details.

Haven't had problem since, we upgrade with releases.

- Original Message - 
From: Floyd Baker [EMAIL PROTECTED]
Newsgroups: php.general
To: Thomas Seifert [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, May 31, 2003 8:42 PM
Subject: Re: [PHP] Re: Long screen display cut short.


 On Sat, 31 May 2003 13:18:13 +, you wrote:

 what is the online-version?
 I mean which webserver-software in which version?
 
 
 Thomas

 Linux  RH 7.3
 Apache 1.3.24
 mySql  3.23.55
 PHP4.2.0

 Also, this is an httpS connection if it makes a difference in some
 way.

 Floyd





 On Fri, 30 May 2003 20:45:08 -0400 [EMAIL PROTECTED] (Floyd Baker) wrote:
 
 
  Hello...
 
  I have a routine that works fine on local win98 but when it runs on
  linux online, the screen output is cut short.  I have lengthened the
  30 second script time max to 45 but that made no difference at all.
 
  Depending on the particulars, the routine stops at a certain spot.  If
  it is rerun, it stops at