php-general Digest 1 Jun 2003 00:43:06 -0000 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]


----------------------------------------------------------------------
--- Begin Message ---
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 ---
--- Begin Message ---
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 ---
--- Begin Message ---
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.



--- End Message ---
--- Begin Message ---
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
>
>


--- End Message ---
--- Begin Message ---
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


--- End Message ---
--- Begin Message ---
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


--- End Message ---
--- Begin Message ---
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
> 



--- End Message ---
--- Begin Message ---
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










-- 




--- End Message ---
--- Begin Message ---
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/YYYY format.

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

Thanks!
Vicky

--- End Message ---
--- Begin Message ---
$EnteredDate = $date . "/" . $month . "/" . $year;

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

-----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/YYYY format.

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

Thanks!
Vicky



--- End Message ---
--- Begin Message ---
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/YYYY format.

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

Thanks!
Vicky


--- End Message ---
--- Begin Message ---
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 YYYY-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/YYYY format.
> 
> How can I acheive this, in simple language as I'm a newbie to this stuff ^_~
> 
> Thanks!
> Vicky


--- End Message ---
--- Begin Message ---
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){echo"offline";}
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 :)



--- End Message ---
--- Begin Message ---
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 "<p><h1>Mailboxes</h1>\n";
$folders = imap_listmailbox ($mbox, "{your.imap.host:143}", "*");
if ($folders == false)
    echo "Call failed<br>\n";
else
    while (list ($key, $val) = each ($folders))
        echo $val . "<br>\n";

echo "<p><h1>Headers in INBOX</h1>\n";
$headers = imap_headers ($mbox);
if ($headers == false)
    echo "Call failed<br>\n";
else
    while (list ($key, $val) = each ($headers))
        echo $val . "<br>n";

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){echo"offline";}
> 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 :)
>
>



--- End Message ---
--- Begin Message --- 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


--- End Message ---
--- Begin Message --- 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



--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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



--- End Message ---
--- Begin Message ---
> 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


--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
> 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

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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


--- End Message ---
--- Begin Message ---
I had no idea their was a is_numeric function().  Ill check it out.  Its
probably a lot better to use then trying to preg_match()/

Many thanks
----- Original Message ----- 
From: "Monty" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, May 31, 2003 3:21 PM
Subject: [PHP] Re: regex problem


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


--- End Message ---
--- Begin Message ---
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


--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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
> 




--- End Message ---
--- Begin Message ---
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


--- End Message ---
--- Begin Message ---
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...

--- End Message ---
--- Begin Message ---
/* 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


--- End Message ---
--- Begin Message ---
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



--- End Message ---
--- Begin Message ---
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


--- End Message ---
--- Begin Message ---
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
>



--- End Message ---
--- Begin Message ---
/* 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


--- End Message ---
--- Begin Message ---
I am getting

NTERRUPT_DURATION

or similar text between the values..

this binary reading thing is dahm jard..



--- End Message ---
--- Begin Message --- 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



--- End Message ---
--- Begin Message ---
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..??


--- End Message ---
--- Begin Message ---
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=163&cp=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.



--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message --- 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



--- End Message ---
--- Begin Message ---
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




--- End Message ---
--- Begin Message ---
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.
>
>



--- End Message ---
--- Begin Message ---
On Sat, 31 May 2003 13:18:13 +0000, 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 
PHP    4.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
>> 
>> --

--

--- End Message ---

Reply via email to