OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 24 Feb 2004 05:17:16 -0000 Issue 2608

php-general-digest-helplists.php.net
Date: Mon Feb 23 2004 - 23:17:16 CST


php-general Digest 24 Feb 2004 05:17:16 -0000 Issue 2608

Topics (messages 178541 through 178638):

Re: Can anyone tell me why this code doesn't insert anything?
        178541 by: Sam Masiello
        178542 by: pete M
        178543 by: BAO RuiXian
        178544 by: Adam Voigt
        178545 by: Jason Wong
        178547 by: Nicole
        178550 by: BAO RuiXian
        178551 by: Richard Davey

PHP Alternative to IFRAME?
        178546 by: Nicole
        178548 by: Richard Davey
        178563 by: Nicole
        178564 by: Chris W. Parker
        178565 by: Richard Davey
        178578 by: Robert Sossomon
        178588 by: Nicole
        178590 by: Chris W. Parker
        178621 by: Tom Rogers

Re: hello
        178549 by: Ben Ramsey
        178555 by: BAO RuiXian
        178571 by: Duncan Hill
        178574 by: John Nichel
        178596 by: Nathan Torkington

Re: [PEAR] Re: PEAR DB 1.6.0 has been released
        178552 by: Justin Patrin
        178553 by: Richard Davey

passthru and GET parameters
        178554 by: Guillouet Nicolas
        178556 by: Marek Kilimajer

E-Commerce Advice? Squirrelcart?
        178557 by: Matt Hedges
        178560 by: Adam Voigt
        178561 by: Elliott Mina
        178562 by: Richard Baskett

Re: Search Engines || Dynamic Content || Apache Mod_Rewrite....
        178558 by: CF High

preg_guru
        178559 by: pete M
        178611 by: André Cerqueira

saving form data
        178566 by: Charlie Fiskeaux II
        178567 by: Sam Masiello
        178595 by: Charlie Fiskeaux II
        178597 by: Richard Davey
        178599 by: Charlie Fiskeaux II
        178601 by: Richard Davey
        178603 by: Charlie Fiskeaux II
        178609 by: Gary Sanders
        178613 by: Evan Nemerson

Re: Php and GpG
        178568 by: Adam Bregenzer
        178591 by: Evan Nemerson

Re: Possible to write CRC/MD5 to the file?
        178569 by: Adam Bregenzer
        178580 by: Sean McCarthy

Re: Detecting Binaries
        178570 by: Axel IS Main
        178572 by: Adam Voigt
        178573 by: Axel IS Main
        178575 by: Jas
        178576 by: Richard Davey
        178577 by: Adam Voigt
        178582 by: Adam Bregenzer
        178583 by: Marek Kilimajer
        178586 by: Richard Davey
        178587 by: Axel IS Main
        178592 by: Evan Nemerson
        178598 by: Richard Davey
        178600 by: Shane Nelson
        178605 by: Axel IS Main
        178614 by: Evan Nemerson
        178620 by: Lucas Gonze

PHP 5
        178579 by: Karl Timmermann
        178584 by: Adam Bregenzer

Send mail with attached
        178581 by: francesco.automationsoft.biz
        178594 by: janet.valade.com

Re: preg guru again.....
        178585 by: Adam Bregenzer

Re: delete a function
        178589 by: Adam Bregenzer

Re: XSLT in php v5 beta 4
        178593 by: Ryan C. Creasey

To Separate, or Not to Separate
        178602 by: Monty
        178606 by: Chris W. Parker
        178607 by: André Cerqueira

Problem deleting a cookie...
        178604 by: Dave O
        178608 by: André Cerqueira
        178612 by: Dave O

system / exec Question...
        178610 by: Gary Sanders
        178615 by: Evan Nemerson

Constants in class definitions
        178616 by: Toro Hill
        178622 by: Richard Davey
        178623 by: Adam Bregenzer
        178625 by: Toro Hill
        178626 by: Adam Bregenzer

Finding out the local path to a file.
        178617 by: Simon Fredriksson
        178618 by: Evan Nemerson
        178619 by: Chris W. Parker
        178624 by: Michal Migurski

Getting Record Counts
        178627 by: Mark Roberts
        178628 by: Jason Wong

Re: Record Counts
        178629 by: Mark Roberts

enum('part1','...')
        178630 by: John Taylor-Johnston
        178634 by: Adam Bregenzer
        178635 by: Jason Wong
        178636 by: Chris

Re: [PHP-DB] Embedded MySQL server (libmysqld)?
        178631 by: user.domain.invalid
        178633 by: Adam Bregenzer

Re: confirm subscribe to php-generallists.php.net
        178632 by: php.cybertechaustralia.org

GZIP Question
        178637 by: Karl Timmermann

beginners question
        178638 by: Steve

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


What happens if you echo out $query to the browser window and try to
copy and paste the query into a command line mysql session (be sure to
connect to the database using the same authentication credentials that
you have in the script)? Does it work?

--Sam

Brian Dunning wrote:
> This inserts nothing into the database, but returns no error that I
> can see. How come? What's wrong with it?
>
> $dbname = "my_database";
> $dbconnection =
> mysql_connect("mysql05.powweb.com","my_user","my_pass");
> mysql_select_db($dbname, $dbconnection); $query = "INSERT INTO
> invoices
> ('ip','total','creation','first_name','email','session','last_name')
> VALUES
> ('0.0.0.0','0.00',NOW(),'Bob','namedomain.com','12345','Smith')";
> $result = mysql_query($query);

attached mail follows:


Brian Dunning wrote:

> This inserts nothing into the database, but returns no error that I can
> see. How come? What's wrong with it?
>
> $dbname = "my_database";
> $dbconnection = mysql_connect("mysql05.powweb.com","my_user","my_pass");
> mysql_select_db($dbname, $dbconnection);
$query = "INSERT INTO invoices
(ip,total,creation,first_name,email,session,last_nam')
VALUES ('0.0.0.0','0.00',NOW(),'Bob','namedomain.com','12345','Smith')";
$result = mysql_query($query);

also need to chack if there are add magic quotes and add slashes

pete

attached mail follows:


Brian Dunning wrote:

> This inserts nothing into the database, but returns no error that I
> can see. How come? What's wrong with it?
>
> $dbname = "my_database";
> $dbconnection = mysql_connect("mysql05.powweb.com","my_user","my_pass");
> mysql_select_db($dbname, $dbconnection);
> $query = "INSERT INTO invoices
> ('ip','total','creation','first_name','email','session','last_name')
> VALUES ('0.0.0.0','0.00',NOW(),'Bob','namedomain.com','12345','Smith')";
> $result = mysql_query($query);

Have you tried to insert the same SQL statement manually, i.e., not via
your php scirpt?

Best

Bao

attached mail follows:


Change your query line to this:

$result = mysql_query($query) or die(mysql_error());

What does it output?

On Mon, 2004-02-23 at 12:11, Brian Dunning wrote:
> This inserts nothing into the database, but returns no error that I can
> see. How come? What's wrong with it?
>
> $dbname = "my_database";
> $dbconnection = mysql_connect("mysql05.powweb.com","my_user","my_pass");
> mysql_select_db($dbname, $dbconnection);
> $query = "INSERT INTO invoices
> ('ip','total','creation','first_name','email','session','last_name')
> VALUES
> ('0.0.0.0','0.00',NOW(),'Bob','namedomain.com','12345','Smith')";
> $result = mysql_query($query);
--

Adam Voigt
adamkotisprop.com

attached mail follows:


On Tuesday 24 February 2004 01:11, Brian Dunning wrote:
> This inserts nothing into the database, but returns no error that I can
> see. How come? What's wrong with it?

mysql_error()

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Some scholars are like donkeys, they merely carry a lot of books.
                -- Folk saying
*/

attached mail follows:


I don't know if this will help, but I always do:

$result = mysql_query($query,$dbconnection);

Nicole

"Brian Dunning" <brianbriandunning.com> wrote in message
news:61E5E95C-6623-11D8-BDB2-003065B5CB62briandunning.com...
> This inserts nothing into the database, but returns no error that I can
> see. How come? What's wrong with it?
>
> $dbname = "my_database";
> $dbconnection = mysql_connect("mysql05.powweb.com","my_user","my_pass");
> mysql_select_db($dbname, $dbconnection);
> $query = "INSERT INTO invoices
> ('ip','total','creation','first_name','email','session','last_name')
> VALUES
> ('0.0.0.0','0.00',NOW(),'Bob','namedomain.com','12345','Smith')";
> $result = mysql_query($query);

attached mail follows:


Brian Dunning wrote:

> On Feb 23, 2004, at 9:18 AM, BAO RuiXian wrote:
>
>> Have you tried to insert the same SQL statement manually, i.e., not
>> via your php scirpt?
>
>
> I did the insert in phpmyadmin & copied & pasted the SQL that it
> generated, and it's the same, so I'm left scratching my head big time.

How about from command line?

Please keep the discussion on the list.

Best

Bao

>
> - Brian
>
>
>

attached mail follows:


Hello Brian,

Monday, February 23, 2004, 5:11:55 PM, you wrote:

BD> $query = "INSERT INTO invoices
BD> ('ip','total','creation','first_name','email','session','last_name')
BD> VALUES
BD> ('0.0.0.0','0.00',NOW(),'Bob','namedomain.com','12345','Smith')";

You shouldn't wrap the column names in quotes. Try:

$query = "INSERT INTO invoices (ip, total, creation, first_name,
email, session, last_name) VALUES ...

If that doesn't work there is probably an error between the query, the
query data and the SQL table structure. Post the SQL table layout so
the values can be checked.

--
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

attached mail follows:


Is there a PHP alternative to an IFRAME? Here's what I mean.

Is there a way to include a file in my php document that will be positioned
where I want it, like an IFRAME? I want to have it aligned right with text
wrapping around it and I know IFRAME is not compatible with Netscape
browsers.

Thanks

attached mail follows:


Hello Nicole,

Monday, February 23, 2004, 5:21:11 PM, you wrote:

N> Is there a PHP alternative to an IFRAME? Here's what I mean.

No, of course not. PHP is a server-side language. IFRAME's (and
anything related to page construction/display) is client-side.

N> Is there a way to include a file in my php document that will be positioned
N> where I want it, like an IFRAME? I want to have it aligned right with text
N> wrapping around it and I know IFRAME is not compatible with Netscape
N> browsers.

You're mixing technologies. If Netscape won't display something, there
is nothing PHP can do about it. You need to think of another layout
technique that it can display.

--
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

attached mail follows:


Your right I was mixing up what I wanted.

What I wanted to know I guess was if I use an include and include a file can
I format where that file will display.

So what I have is a little box with some info in it. I want it to display
to the right of the body text and have the body text wrap around it.

Nicole

"Richard Davey" <richlaunchcode.co.uk> wrote in message
news:1394868728.20040223172526launchcode.co.uk...
> Hello Nicole,
>
> Monday, February 23, 2004, 5:21:11 PM, you wrote:
>
> N> Is there a PHP alternative to an IFRAME? Here's what I mean.
>
> No, of course not. PHP is a server-side language. IFRAME's (and
> anything related to page construction/display) is client-side.
>
> N> Is there a way to include a file in my php document that will be
positioned
> N> where I want it, like an IFRAME? I want to have it aligned right with
text
> N> wrapping around it and I know IFRAME is not compatible with Netscape
> N> browsers.
>
> You're mixing technologies. If Netscape won't display something, there
> is nothing PHP can do about it. You need to think of another layout
> technique that it can display.
>
> --
> Best regards,
> Richard Davey
> http://www.phpcommunity.org/wiki/296.html

attached mail follows:


Nicole <mailto:ndiratojenkinslaw.org>
    on Monday, February 23, 2004 10:26 AM said:

> What I wanted to know I guess was if I use an include and include a
> file can I format where that file will display.
>
> So what I have is a little box with some info in it. I want it to
> display to the right of the body text and have the body text wrap
> around it.

again, you're mixing things up. php doesn't have anything to do with
this EXCEPT that it sends html to the client. you have to decide what
html should be sent to the client.

you should join a list such as webdesign-l or thelist to ask this kind
of question.

chris.

attached mail follows:


Hello Nicole,

Monday, February 23, 2004, 6:26:24 PM, you wrote:

N> What I wanted to know I guess was if I use an include and include a file can
N> I format where that file will display.

Yes absolutely, but again this is still an HTML issue.

N> So what I have is a little box with some info in it. I want it to display
N> to the right of the body text and have the body text wrap around it.

Say you've got a PHP file that has all of the HTML in it that you
want, other than this little box. At the place where you want the
content of that box to appear you need to use something like this:

<?php
  include "litle_box.php";
?>

Whatever is contained in the "little_box.php" script will then appear
in exactly that place in the final page.

Of course you're going to need to arrange the HTML in both files to
make this work, but I think it's what you are after.

--
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

attached mail follows:


Just place

<?php
  include "box_info.php";
?>

In your web page in the location where the little box is. Word wrap
typically only happens with images though, so you may have to turn your
text into an image, in which case you could just use a javascript
commands to change the image as needed. If you are including the text
into a table it would be something like:

<table border=0>
<tr><td>some text that keeps running and running</td></tr>
<tr><td><?php
  include "box_info.php";
?>
</td></tr>

HTH,
Robert

attached mail follows:


I'm not having much luck explaining what I want here ... a drawback of
emailing. I know how to include files, I just wanted to include it in such
a way that my body text still wrapped around it.

I think I need to tackle this using HTML.

"Robert Sossomon" <robertgcnorris.com> wrote in message
news:061601c3fa42$aa0a67a0$6601010aroot2...
> Just place
>
> <?php
> include "box_info.php";
> ?>
>
> In your web page in the location where the little box is. Word wrap
> typically only happens with images though, so you may have to turn your
> text into an image, in which case you could just use a javascript
> commands to change the image as needed. If you are including the text
> into a table it would be something like:
>
> <table border=0>
> <tr><td>some text that keeps running and running</td></tr>
> <tr><td><?php
> include "box_info.php";
> ?>
> </td></tr>
>
> HTH,
> Robert

attached mail follows:


Nicole <mailto:ndiratojenkinslaw.org>
    on Monday, February 23, 2004 12:06 PM said:

> I'm not having much luck explaining what I want here ... a drawback of
> emailing. I know how to include files, I just wanted to include it
> in such a way that my body text still wrapped around it.

myfile.php:
<?php

echo "<p>here is some more body text.</p>\n";

?>

main.php:
<?php

echo "here is some body text. here is some body text. here is some body
text.\n";
echo "here is some body text. here is some body text. here is some body
text.\n";

include "myfile.php";

echo "here is some body text. here is some body text. here is some body
text.\n";
echo "here is some body text. here is some body text. here is some body
text.\n";

?>

that will output:

here is some body text. here is some body text. here is some body text.
here is some body text. here is some body text. here is some body text.
<p>here is some more body text.</p>
here is some body text. here is some body text. here is some body text.
here is some body text. here is some body text. here is some body text.

hth,
chris.

attached mail follows:


Hi,

Tuesday, February 24, 2004, 3:21:11 AM, you wrote:
N> Is there a PHP alternative to an IFRAME? Here's what I mean.

N> Is there a way to include a file in my php document that will be positioned
N> where I want it, like an IFRAME? I want to have it aligned right with text
N> wrapping around it and I know IFRAME is not compatible with Netscape
N> browsers.

N> Thanks

here is a bit of code I use to do a progress bar that works in ie and
ns4.7 though php has little to do with it :)

<table border="0" height="100" width="370">
  <tr>
    <td>
      <iframe id="obj1" name="obj1" src="progress.php?UPLOAD_WAIT=wait" type="text/html" frameborder="0" height="100" width="370">
      <ilayer id="ilayer1" left="1" height="100" width="370"><layer left="1" id="layer1" name="layer1" src="progress.php?UPLOAD_WAIT=wait"></layer>
      </ilayer></iframe>
    </td>
  </tr>
</table>

--
regards,
Tom

attached mail follows:


I would advise against sending attachments to the list with the message
"read it immediately." Chances are, it won't be opened or looked at.
Please include a description of the problem you are facing, as well as
the code you are using in your message body--not in an attachment.

gnatfrii.com wrote:
> read it immediately!

attached mail follows:


Based on the style of message body (short and shout), and the subject
line, and the zip attachment, I conclude it as a virus. It may or may
not a virus in face, I immediately delete it anyway:)

Best

Bao

Ben Ramsey wrote:

> I would advise against sending attachments to the list with the
> message "read it immediately." Chances are, it won't be opened or
> looked at. Please include a description of the problem you are facing,
> as well as the code you are using in your message body--not in an
> attachment.
>
>
> gnatfrii.com wrote:
>
>> read it immediately!
>
>

attached mail follows:


On Monday 23 February 2004 17:27, Ben Ramsey wrote:
> I would advise against sending attachments to the list with the message
> "read it immediately." Chances are, it won't be opened or looked at.
> Please include a description of the problem you are facing, as well as
> the code you are using in your message body--not in an attachment.

Even better chances that that was a neutered virus.

attached mail follows:


Ben Ramsey wrote:

> I would advise against sending attachments to the list with the message
> "read it immediately." Chances are, it won't be opened or looked at.
> Please include a description of the problem you are facing, as well as
> the code you are using in your message body--not in an attachment.
>
>
> gnatfrii.com wrote:
>
>> read it immediately!
>
>

Eh, I'm going to say that the email was sent by an infected computer,
unknown to the comptuer's owner. ie, It's a virius spawned email. ;)

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

attached mail follows:


On Feb 24, 2004, at 6:45 AM, BAO RuiXian wrote:
> Based on the style of message body (short and shout), and the subject
> line, and the zip attachment, I conclude it as a virus. It may or may
> not a virus in face, I immediately delete it anyway:)

Yeah, that's a bloody virus on someone else's machine, using my e-mail
address. The curse of a long-lived address ....

Nat
(aka gnat AT frii.com)

attached mail follows:


Richard Davey wrote:

> Hello Justin,
>
> Monday, February 23, 2004, 4:11:40 PM, you wrote:
>
> JP> 3) A unified architecture for mysql and Oracle. You don't have to
> JP> remember different functions for use with different databases.
>
> That abstraction only abstracts the functions to connect to, select and
> query the database, surely? Oracle/SQL Server/MySQL all use slightly
> different SQL syntax - so if the query you pass in has to be unique
> depending on the database in hand - you're already having to remember
> a stack of system specific SQL and will have to code your application
> to take into consideration all of those different syntax.
>
> What I'm trying to say is that abstracting the connection to the
> database is the easy part, writing an application that will support
> them all is another matter.
>

Very true. In that case, you can use a package such as DB_DataObject or
DB_QueryTool to abstract the SQL as well.

Or you can use fairly simple SQL with just a few rules and you should be
fine. For instance, always select columns as upper case (for Oracle
compatibility) or always convert them to lower case
(DB_PORTABILITY_LOWERCASE), always use DB::quoteSmart() for values and
DB::quoteIdentifier() for table / column names, etc.

The real hairy part is dealing with joins as the syntax is very
different across the DBs. This can be solved by simply not doing them or
using a syntax that most use. Or you can try to use DB_DataObject, but
I'm not sure it works for all DBs yet.

--
paperCrane <Justin Patrin>

attached mail follows:


Hello Justin,

Monday, February 23, 2004, 5:30:16 PM, you wrote:

JP> The real hairy part is dealing with joins as the syntax is very
JP> different across the DBs. This can be solved by simply not doing them or

I wish :)

JP> using a syntax that most use. Or you can try to use DB_DataObject, but
JP> I'm not sure it works for all DBs yet.

Yeah, I thought as much. I think if I was creating an application to
be distributed open-source on the Internet it'd make life easier
for other developers if it used something like the PEAR-DB class, but
when you're building your own/companies site and know the environment
it lessens the value somewhat.

--
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

attached mail follows:


Hi all,

I am trying to use htmldoc with passthru function :

passthru("htmldoc -t html --quiet --jpeg --webpage --footer --bottom
0.2cm --left 1.78cm --right 1cm --top 0.2cm '' $options $filename");

where $filename is urls, it works fine but not with GET pamameters :
 if $filename is like
'http://host/file.php?PHPSESSID=**************&value=1', passthru is
waiting for the command.

I think the trouble comes from the char '&', I have the same result on
command line except if I use quote for the filename. And when I watch
the process created by apache, the command is send without quote or
quotation mark even if I put some in the filename.

How can I do ?

Thanks

Nicolas

attached mail follows:


put quotes around:

passthru("htmldoc -t html --quiet --jpeg --webpage --footer --bottom
> 0.2cm --left 1.78cm --right 1cm --top 0.2cm '' $options '$filename'");

Guillouet Nicolas wrote:
> Hi all,
>
> I am trying to use htmldoc with passthru function :
>
> passthru("htmldoc -t html --quiet --jpeg --webpage --footer --bottom
> 0.2cm --left 1.78cm --right 1cm --top 0.2cm '' $options $filename");
>
> where $filename is urls, it works fine but not with GET pamameters :
> if $filename is like
> 'http://host/file.php?PHPSESSID=**************&value=1', passthru is
> waiting for the command.
>
> I think the trouble comes from the char '&', I have the same result on
> command line except if I use quote for the filename. And when I watch
> the process created by apache, the command is send without quote or
> quotation mark even if I put some in the filename.
>
> How can I do ?
>
> Thanks
>
> Nicolas
>

attached mail follows:


Hello,

I am working on using PHP to build a web store.
http://www.squirrelcart.com/ looks to be pretty good for a shopping cart-
does anyone have any experience with this or others?

Also, what suggestions do ya'll have for a payment gateway?

thanks
matt

attached mail follows:


PayPal has some pretty impressive inter-active programming API's. Other
then that, the only suggestion I could make is try and steer clear of
AuthorizeNET.

On Mon, 2004-02-23 at 12:53, Matt Hedges wrote:
> Hello,
>
> I am working on using PHP to build a web store.
> http://www.squirrelcart.com/ looks to be pretty good for a shopping cart-
> does anyone have any experience with this or others?
>
> Also, what suggestions do ya'll have for a payment gateway?
>
>
> thanks
> matt
--

Adam Voigt
adamkotisprop.com

attached mail follows:


I have used OsCommerce, and not had any problems.

----Original Message Follows----
From: "Matt Hedges" <m_hedgesbellsouth.net>
To: php-generallists.php.net
Subject: [PHP] E-Commerce Advice? Squirrelcart?
Date: Mon, 23 Feb 2004 11:53:14 -0600

Hello,

I am working on using PHP to build a web store.
http://www.squirrelcart.com/ looks to be pretty good for a shopping cart-
does anyone have any experience with this or others?

Also, what suggestions do ya'll have for a payment gateway?

thanks
matt

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

_________________________________________________________________
Take off on a romantic weekend or a family adventure to these great U.S.
locations. http://special.msn.com/local/hotdestinations.armx

attached mail follows:


on 2/23/04 9:53, Matt Hedges at m_hedgesbellsouth.net wrote:

> Hello,
>
> I am working on using PHP to build a web store.
> http://www.squirrelcart.com/ looks to be pretty good for a shopping cart-
> does anyone have any experience with this or others?
>
> Also, what suggestions do ya'll have for a payment gateway?
>
>
> thanks
> matt

I have not used squirrelcart, but I do really like eShox
(http://www.eshox.com) most of my clients use it and it has great
configurability.

Most of my clients use either Authorize.net or 2checkout.com, both seem to
work quite well, especially with eshox.

Cheers!

Rick

attached mail follows:


Hey all.

I've got a PHP-MySql database driven site setup in a shared hosting
environment that does NOT support apache mod_rewrite.

Is there a workaround for getting dynamic pages (e.g.
index.php?display=contact) indexed in major search engines without using
mod_rewrite?

Any clues very much appreciated.

TIA,

--Noah

--

attached mail follows:


I'm trying to group matches..
the string is (all one line)
:2002020720020208: defaulthttp://www.azlyrics.com __ continued...
/s/springsteen.html?dsd=sadsa&etc=tec

here the first bit I'm trying to match
:2002020720020208:
preg_match("(:[0-9]{16}:)", $contents, $match);

and then the default with
preg_match("([a-z]{1,20})", $contents, $match);

and then a combination of the two
preg_match("(:[0-9]{16}:)([a-z]{1,20})", $contents, $match);

get the error
Warning: Unknown modifier '(' in
/home/incase/public_html/History.IE5/imp.php on line 36

I've trien all sort of stuff to no avail..

tia

Pete

attached mail follows:


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

delimiters?
ex: preg_match("/(:[0-9]{16}:)/", $contents, $match);
or something like that...

http://br2.php.net/manual/en/function.preg-match.php
http://br2.php.net/manual/en/ref.pcre.php

welcome to php manual hehe

btw, are you actually running those 3 preg_match's? or just the last one?

Pete M wrote:

> I'm trying to group matches..
> the string is (all one line)
> :2002020720020208: defaulthttp://www.azlyrics.com __ continued...
> /s/springsteen.html?dsd=sadsa&etc=tec
>
> here the first bit I'm trying to match
> :2002020720020208:
> preg_match("(:[0-9]{16}:)", $contents, $match);
>
> and then the default with
> preg_match("([a-z]{1,20})", $contents, $match);
>
> and then a combination of the two
> preg_match("(:[0-9]{16}:)([a-z]{1,20})", $contents, $match);
>
> get the error
> Warning: Unknown modifier '(' in
> /home/incase/public_html/History.IE5/imp.php on line 36
>
> I've trien all sort of stuff to no avail..
>
> tia
>
> Pete
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAOpKFaxdA/5C8vH8RAuB3AJ9j72HyG9yKNCwsWD5ue23DCuPfQQCgjPoY
/EqpZqwq9+mXCOk2LyAMdlI=
=kOjq
-----END PGP SIGNATURE-----

attached mail follows:


I'm using a prebuilt Perl form mailer script for a project,
but because the form is so long, my client would like to
give the user the ability to save the data and come back to
finish it later. I was hoping to be able to code this part
in PHP (because I don't know Perl), but I'm fairly new to
PHP and don't know how to get one form to go to two
different places. Because the target of the form is the Perl
script (for emailing the submitted form), how can I grab the
data from the form with PHP?

--

Charlie Fiskeaux II
Media Designer
Cre8tive Group
cre8tivegroup.com

attached mail follows:


If the PHP configuration doesn't have "register_globals" turned on in
the php.ini file, you will be able to access the form variables via the
_POST array like this:

$_POST["my_form_var"]

Of course, substitute my_form_var with the correct variable from the
form that you are submitting.

If the server does have register_globals turned on you can access the
variables just as they are named in the form. For example, if you have
a text input field named "lastname", you can access the value in that
text box using the variable $lastname.

HTH!

--Sam

Charlie Fiskeaux II wrote:
> I'm using a prebuilt Perl form mailer script for a project,
> but because the form is so long, my client would like to
> give the user the ability to save the data and come back to
> finish it later. I was hoping to be able to code this part
> in PHP (because I don't know Perl), but I'm fairly new to
> PHP and don't know how to get one form to go to two
> different places. Because the target of the form is the Perl
> script (for emailing the submitted form), how can I grab the
> data from the form with PHP?
>
> --
>
> Charlie Fiskeaux II
> Media Designer
> Cre8tive Group
> cre8tivegroup.com

attached mail follows:


Sam Masiello wrote:

> If the PHP configuration doesn't have "register_globals" turned on in
> the php.ini file, you will be able to access the form variables via the
> _POST array like this:
>
> $_POST["my_form_var"]
>
> Of course, substitute my_form_var with the correct variable from the
> form that you are submitting.
>
> If the server does have register_globals turned on you can access the
> variables just as they are named in the form. For example, if you have
> a text input field named "lastname", you can access the value in that
> text box using the variable $lastname.

Thanks, but how do I get the info submitted to the PHP
script to access the data in the first place? Since the
target of the form is the Perl script, the submit button
submits the form to the Perl script; can I add a second
button of some type to submit the form to a different
location (the PHP script)? Or can I use the DOM (ie
document.formname.fieldname.value) to grab the data straight
from the fields and then pass it on somehow?

--

Charlie Fiskeaux II
Media Designer
Cre8tive Group
cre8tivegroup.com

attached mail follows:


Hello Charlie,

Monday, February 23, 2004, 9:27:07 PM, you wrote:

CFI> Thanks, but how do I get the info submitted to the PHP
CFI> script to access the data in the first place? Since the
CFI> target of the form is the Perl script, the submit button
CFI> submits the form to the Perl script; can I add a second
CFI> button of some type to submit the form to a different
CFI> location (the PHP script)? Or can I use the DOM (ie
CFI> document.formname.fieldname.value) to grab the data straight
CFI> from the fields and then pass it on somehow?

You can't make one form submit to two different scripts sadly, but to
be honest if you're going to write a PHP script to capture this
information - why not make it do what the Perl formmail script does
too? (i.e. send the email) and remove the Perl script from the
equation?

--
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

attached mail follows:


Richard Davey wrote:

> You can't make one form submit to two different scripts sadly, but to
> be honest if you're going to write a PHP script to capture this
> information - why not make it do what the Perl formmail script does
> too? (i.e. send the email) and remove the Perl script from the
> equation?
>

It's just a matter of development time; if there's a way to
use the Perl mail script with a PHP data saving script, it
would save time. If I do have to rewrite the whole thing in
PHP, how would I accept uploaded file attachments and attach
them to the emailed form results?

--

Charlie Fiskeaux II
Media Designer
Cre8tive Group
cre8tivegroup.com

attached mail follows:


Hello Charlie,

Monday, February 23, 2004, 10:15:17 PM, you wrote:

CFI> It's just a matter of development time; if there's a way to
CFI> use the Perl mail script with a PHP data saving script, it
CFI> would save time. If I do have to rewrite the whole thing in
CFI> PHP, how would I accept uploaded file attachments and attach
CFI> them to the emailed form results?

Then how about in reverse? Add something to the end of the Perl script
that passes the values to a PHP script? It could even do it via the
query string, maybe also passing an md5 encoded password that only
your two scripts know (in order to stop someone spoofing your script).

--
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

attached mail follows:


Richard Davey wrote:

> CFI> It's just a matter of development time; if there's a way to
> CFI> use the Perl mail script with a PHP data saving script, it
> CFI> would save time. If I do have to rewrite the whole thing in
> CFI> PHP, how would I accept uploaded file attachments and attach
> CFI> them to the emailed form results?
>
> Then how about in reverse? Add something to the end of the Perl script
> that passes the values to a PHP script? It could even do it via the
> query string, maybe also passing an md5 encoded password that only
> your two scripts know (in order to stop someone spoofing your script).

I don't think that would work because they will need to save
without sending the form. But I had thought about the
reverse: a PHP script that saves the data and then possibly
passes it on to the Perl script.

Do you or anyone else know how to pass on form results in
PHP to another script? (Like I said, I'm pretty new to PHP...)

Thanks!

--

Charlie Fiskeaux II
Media Designer
Cre8tive Group
cre8tivegroup.com
859/858-9054x29
cell: 859/608-9194

attached mail follows:


Charlie,

Can you make the submit target be the PHP script and have the PHP script
call the Perl script to send the email?

Gary

> -----Original Message-----
> From: Charlie Fiskeaux II [mailto:charliecre8tivegroup.com]
> Sent: Monday, February 23, 2004 2:15 PM
> To: PHP General
> Subject: Re: [PHP] saving form data
>
>
> Richard Davey wrote:
>
> > You can't make one form submit to two different scripts
> sadly, but to
> > be honest if you're going to write a PHP script to capture this
> > information - why not make it do what the Perl formmail script does
> > too? (i.e. send the email) and remove the Perl script from the
> > equation?
> >
>
> It's just a matter of development time; if there's a way to
> use the Perl mail script with a PHP data saving script, it
> would save time. If I do have to rewrite the whole thing in
> PHP, how would I accept uploaded file attachments and attach
> them to the emailed form results?
>
> --
>
> Charlie Fiskeaux II
> Media Designer
> Cre8tive Group
> cre8tivegroup.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


On Monday 23 February 2004 02:51 pm, Charlie Fiskeaux II wrote:
> Richard Davey wrote:
> > CFI> It's just a matter of development time; if there's a way to
> > CFI> use the Perl mail script with a PHP data saving script, it
> > CFI> would save time. If I do have to rewrite the whole thing in
> > CFI> PHP, how would I accept uploaded file attachments and attach
> > CFI> them to the emailed form results?
> >
> > Then how about in reverse? Add something to the end of the Perl script
> > that passes the values to a PHP script? It could even do it via the
> > query string, maybe also passing an md5 encoded password that only
> > your two scripts know (in order to stop someone spoofing your script).
>
> I don't think that would work because they will need to save
> without sending the form. But I had thought about the
> reverse: a PHP script that saves the data and then possibly
> passes it on to the Perl script.
>
> Do you or anyone else know how to pass on form results in
> PHP to another script? (Like I said, I'm pretty new to PHP...)

Well you could try using an HTTP 302 Found or 307 Temporary Redirect, but IIRC
clients must not redirect the request unless the response is received in
response to a GET or HEAD request, so you'd have to use GET. I seem to
remember reading something about uploading files, which is kinda difficult
with GET...

Possibly your best option would be to send a POST request through the HTTPD
via a socket- there are libraries out there to help you do this easily, try
PEAR, hotscripts, phpclasses, etc.
>
> Thanks!
>
> --
>
> Charlie Fiskeaux II
> Media Designer
> Cre8tive Group
> cre8tivegroup.com
> 859/858-9054x29
> cell: 859/608-9194

--
Evan Nemerson
evancoeus-group.com
http://coeusgroup.com/en

attached mail follows:


On Mon, 2004-02-23 at 08:35, Paul Marinas wrote:
> Those anyone know hoh to use php with gpg. I've tryed gpgext, but doesn't
> seems to work maybe my php is not compiled with some kind of support.

You will need to call gpg from your script using either a socket
connection[1], something from the exec family[2], or backticks[3].

[1] http://www.php.net/popen
[2] http://www.php.net/ref.exec
[3] http://www.php.net/operators.execution

--
Adam Bregenzer
adambregenzer.net
http://adam.bregenzer.net/

attached mail follows:


On Monday 23 February 2004 10:49 am, Adam Bregenzer wrote:
> On Mon, 2004-02-23 at 08:35, Paul Marinas wrote:
> > Those anyone know hoh to use php with gpg. I've tryed gpgext, but doesn't
> > seems to work maybe my php is not compiled with some kind of support.
>
> You will need to call gpg from your script using either a socket
> connection[1], something from the exec family[2], or backticks[3].

I seem to remember someone writing an extension using GPGME, but IIRC GPGME is
GPL'd so there may be some licensing issues... worth a look, though
>
> [1] http://www.php.net/popen
> [2] http://www.php.net/ref.exec
> [3] http://www.php.net/operators.execution
>
> --
> Adam Bregenzer
> adambregenzer.net
> http://adam.bregenzer.net/

--
Evan Nemerson
evancoeus-group.com
http://coeusgroup.com/en

attached mail follows:


On Mon, 2004-02-23 at 00:01, Evan Nemerson wrote:
> What you would have to do is find a collision, which is thankfully difficult
> to do- if it were easy, MD5 would be useless. Theoretically, you could modify
> say John The Ripper and have it brute force something, but you may end up
> waiting a few lifetimes :)

Just as a note, check out www.md5crk.com. They aim to do just this and
imho have a good plan of attack. I have already moved to sha1 for
passwords, this is only further support of why it's time to move on.

> I'd recommend PGP/GPG signing instead- anyone can create a valid MD5 checksum,
> but only you can cryptographically sign your files (theoretically- if someone
> else can, you've got serious problems)
>
> Everyone seems happy enough with detached signatures. Also, you could use the
> OpenPGP specification to do what you want, just like when you send a
> PGP-signed e-mail the signature and the message are all in a single
> container. You may have to hack GPG a bit (not as difficult as you'd think)
> to have the PGP stuff in PHP comments, but i think you could do it... Sorry,
> I'm rambling.

Here, here, PGP adds more benefits as long as you don't leak your
private key. You could always try and wrap everything as a mime message
or zip the two together. Also, place a link to the pgp signature in the
README file. Not that anyone ever reads those though. ;)

--
Adam Bregenzer
adambregenzer.net
http://adam.bregenzer.net/

attached mail follows:


Hi,

At 04:20 23/02/2004, Simon Fredriksson wrote:
>I wonder if it's possible to write the MD5 or CRC checksum of my
>scriptfile to the scriptfile. I know that if I change it, the value will
>change, but is there any way to calculate what it will be?

There's no way you can add the CRC after calculating it without modifing
the CRC for that file. If you add the CRC after you have calculated it, you
are indeed modifing the file, so the CRC would change.

If you want to just check the script file itself, you can create a custom
CRC calculation for your scripts that calculates it just for a section of it:

<?php
         $thisScriptCRC = 'XXXXXX';

         //{CRC-START}
         ... your script stuff here
         //{CRC-END}
?>

Just calculate the CRC between the tags and add it. Be sure you don't
modify the contents between the tags (carriage returns, etc), since it will
change the CRC of the file.

Also remember that the CRC will change if you upload the file through FTP
in ASCII mode between Windows/Linux, so the CRC check will also fail.

         Sean McCarthy

attached mail follows:


Guys, this isn't THAT stupid of a question is it? From my perspective,
the way PHP seems to see it is that I should already know what kind of
file I'm looking at. In most cases that's not an unreasonable
assumption. Unfortunately, that's only good for most cases. PHP is rich
in ways to work with the HTTP protocol, but has no way of detecting
whether it's opening a text file or a binary file. To me this is a
glaring omission. There has to be a way to do it, even if it's a
round-a-bout or backdoor kind of way. Nothing is impossible.

Nick

Axel IS Main wrote:

> I'm using file_get_contents() to open URLs. Does anyone know if there
> is a way to look at the result and determine if the file is binary?
> I'd like to be able to block binaries from being processed without
> having to try to think of all the possible binary extensions and omit
> them with a function that looks for these extensions.
>
> Nick
>

attached mail follows:


Couldn't you just check the extension on the file?

On Mon, 2004-02-23 at 14:03, Axel IS Main wrote:
> Guys, this isn't THAT stupid of a question is it? From my perspective,
> the way PHP seems to see it is that I should already know what kind of
> file I'm looking at. In most cases that's not an unreasonable
> assumption. Unfortunately, that's only good for most cases. PHP is rich
> in ways to work with the HTTP protocol, but has no way of detecting
> whether it's opening a text file or a binary file. To me this is a
> glaring omission. There has to be a way to do it, even if it's a
> round-a-bout or backdoor kind of way. Nothing is impossible.
>
> Nick
>
> Axel IS Main wrote:
>
> > I'm using file_get_contents() to open URLs. Does anyone know if there
> > is a way to look at the result and determine if the file is binary?
> > I'd like to be able to block binaries from being processed without
> > having to try to think of all the possible binary extensions and omit
> > them with a function that looks for these extensions.
> >
> > Nick
> >
--

Adam Voigt
adamkotisprop.com

attached mail follows:


Yes, and in fact that is what I am doing now. This is a spider bot
though, so I'm having to think of every single type of binary file that
could be linked to on the web. So far I'm up to 28 with no end in sight.
What about a .com file? I can't omit links that end in .com can I? That
would be counterproductive to say the least. Also, the function that
does the checking just keep getting longer and longer, which makes the
spider go slower and slower. Granted, the thing is pretty fast if it has
enough BW to work with, but still. This could eventually turn into a
script killer. Detecting whether the stream from file_get_contents(), or
fopen() for that matter, is binary or not and going with that result is
the elegant solution to this problem. There has to be a way to do it.

Nick

Adam Voigt wrote:

>Couldn't you just check the extension on the file?
>
>
>On Mon, 2004-02-23 at 14:03, Axel IS Main wrote:
>
>
>>Guys, this isn't THAT stupid of a question is it? From my perspective,
>>the way PHP seems to see it is that I should already know what kind of
>>file I'm looking at. In most cases that's not an unreasonable
>>assumption. Unfortunately, that's only good for most cases. PHP is rich
>>in ways to work with the HTTP protocol, but has no way of detecting
>>whether it's opening a text file or a binary file. To me this is a
>>glaring omission. There has to be a way to do it, even if it's a
>>round-a-bout or backdoor kind of way. Nothing is impossible.
>>
>>Nick
>>
>>Axel IS Main wrote:
>>
>>
>>
>>>I'm using file_get_contents() to open URLs. Does anyone know if there
>>>is a way to look at the result and determine if the file is binary?
>>>I'd like to be able to block binaries from being processed without
>>>having to try to think of all the possible binary extensions and omit
>>>them with a function that looks for these extensions.
>>>
>>>Nick
>>>
>>>
>>>

attached mail follows:


Well you can do a check on the mime type of the file. eg.

$mimes = array("1" => "application/octet-stream",
                "2: => "image/jpeg",
etc.

For more info...
http://us4.php.net/manual/en/ref.filesystem.php

Just like the upload file function you can check for the mime types...
http://us4.php.net/manual/en/features.file-upload.php

Just a thought, might not be a comlete solution however.
HTH
Jas

Axel Is Main wrote:
> Guys, this isn't THAT stupid of a question is it? From my perspective,
> the way PHP seems to see it is that I should already know what kind of
> file I'm looking at. In most cases that's not an unreasonable
> assumption. Unfortunately, that's only good for most cases. PHP is rich
> in ways to work with the HTTP protocol, but has no way of detecting
> whether it's opening a text file or a binary file. To me this is a
> glaring omission. There has to be a way to do it, even if it's a
> round-a-bout or backdoor kind of way. Nothing is impossible.
>
> Nick
>
> Axel IS Main wrote:
>
>> I'm using file_get_contents() to open URLs. Does anyone know if there
>> is a way to look at the result and determine if the file is binary?
>> I'd like to be able to block binaries from being processed without
>> having to try to think of all the possible binary extensions and omit
>> them with a function that looks for these extensions.
>>
>> Nick
>>

attached mail follows:


Hello Axel,

Monday, February 23, 2004, 7:03:38 PM, you wrote:

AIM> Guys, this isn't THAT stupid of a question is it? From my perspective,
AIM> the way PHP seems to see it is that I should already know what kind of
AIM> file I'm looking at. In most cases that's not an unreasonable
AIM> assumption. Unfortunately, that's only good for most cases. PHP is rich

Even Windows doesn't *know* what type of file you've got until you
actually try and open it. You could rename a jpg to mp3 and you won't
know about it until Winamp moans at you as you open it.

AIM> in ways to work with the HTTP protocol, but has no way of detecting
AIM> whether it's opening a text file or a binary file. To me this is a
AIM> glaring omission. There has to be a way to do it, even if it's a
AIM> round-a-bout or backdoor kind of way. Nothing is impossible.

You could say it's a glaring omission from operating systems too,
because most succumb to this. The only way to tell for sure is to read
in the header of the file and parse it. If you are blanket rejecting
all binaries - good luck, it'll take ages. Another solution might be
to just treat the file as text regardless and strip out every byte
that is above the standard ASCII value. Hello CPU upgrade requirement.

--
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

attached mail follows:


Well actually to check .com, just make sure it contains a / then the
.com, that will filter yahoo.com, but keep yahoo.com/downloadme.com

On Mon, 2004-02-23 at 14:19, Axel IS Main wrote:
> Yes, and in fact that is what I am doing now. This is a spider bot
> though, so I'm having to think of every single type of binary file that
> could be linked to on the web. So far I'm up to 28 with no end in sight.
> What about a .com file? I can't omit links that end in .com can I? That
> would be counterproductive to say the least. Also, the function that
> does the checking just keep getting longer and longer, which makes the
> spider go slower and slower. Granted, the thing is pretty fast if it has
> enough BW to work with, but still. This could eventually turn into a
> script killer. Detecting whether the stream from file_get_contents(), or
> fopen() for that matter, is binary or not and going with that result is
> the elegant solution to this problem. There has to be a way to do it.
>
> Nick
>
> Adam Voigt wrote:
>
> >Couldn't you just check the extension on the file?
> >
> >
> >On Mon, 2004-02-23 at 14:03, Axel IS Main wrote:
> >
> >
> >>Guys, this isn't THAT stupid of a question is it? From my perspective,
> >>the way PHP seems to see it is that I should already know what kind of
> >>file I'm looking at. In most cases that's not an unreasonable
> >>assumption. Unfortunately, that's only good for most cases. PHP is rich
> >>in ways to work with the HTTP protocol, but has no way of detecting
> >>whether it's opening a text file or a binary file. To me this is a
> >>glaring omission. There has to be a way to do it, even if it's a
> >>round-a-bout or backdoor kind of way. Nothing is impossible.
> >>
> >>Nick
> >>
> >>Axel IS Main wrote:
> >>
> >>
> >>
> >>>I'm using file_get_contents() to open URLs. Does anyone know if there
> >>>is a way to look at the result and determine if the file is binary?
> >>>I'd like to be able to block binaries from being processed without
> >>>having to try to think of all the possible binary extensions and omit
> >>>them with a function that looks for these extensions.
> >>>
> >>>Nick
> >>>
> >>>
> >>>
--

Adam Voigt
adamkotisprop.com

attached mail follows:


On Mon, 2004-02-23 at 14:19, Axel IS Main wrote:
> Yes, and in fact that is what I am doing now. This is a spider bot
> though, so I'm having to think of every single type of binary file that
> could be linked to on the web. So far I'm up to 28 with no end in sight.
> What about a .com file? I can't omit links that end in .com can I? That
> would be counterproductive to say the least. Also, the function that
> does the checking just keep getting longer and longer, which makes the
> spider go slower and slower. Granted, the thing is pretty fast if it has
> enough BW to work with, but still. This could eventually turn into a
> script killer. Detecting whether the stream from file_get_contents(), or
> fopen() for that matter, is binary or not and going with that result is
> the elegant solution to this problem. There has to be a way to do it.

You could trying writing a script to check the first several bytes of
the file for control characters. If the first 1kb is >= 20% (randomly
pulled from my head) control characters it's a safe bet it is a binary
file. This is not 100% accurate, but it's something to play with that
doesn't rely on mime types or file extensions, both of which can easily
be inaccurate.

--
Adam Bregenzer
adambregenzer.net
http://adam.bregenzer.net/

attached mail follows:


Generally, binaries have \0 in them, but it is not necessery.

Axel IS Main wrote:
> Guys, this isn't THAT stupid of a question is it? From my perspective,
> the way PHP seems to see it is that I should already know what kind of
> file I'm looking at. In most cases that's not an unreasonable
> assumption. Unfortunately, that's only good for most cases. PHP is rich
> in ways to work with the HTTP protocol, but has no way of detecting
> whether it's opening a text file or a binary file. To me this is a
> glaring omission. There has to be a way to do it, even if it's a
> round-a-bout or backdoor kind of way. Nothing is impossible.
>
> Nick
>
> Axel IS Main wrote:
>
>> I'm using file_get_contents() to open URLs. Does anyone know if there
>> is a way to look at the result and determine if the file is binary?
>> I'd like to be able to block binaries from being processed without
>> having to try to think of all the possible binary extensions and omit
>> them with a function that looks for these extensions.
>>
>> Nick
>>
>

attached mail follows:


Hello Axel,

Monday, February 23, 2004, 7:38:25 PM, you wrote:

AIM> Thanks, you just gave me the solution, I think. I don't have to strip
AIM> out every character above standard ascii, I just have to look for them.
AIM> If one is there, then just get rid of it. It's true that an OS can't
AIM> tell the difference between a jpg and an exe file, but that's to be
AIM> expected. But the file_get_contents() function DOES open the file. Since
AIM> there is a definite difference between a text file and a binary file, it
AIM> should be able to detect that.

The difference isn't as obvious as you might think. Opening a binary
file into a hex editor will show you this. Your brain can determine if
the codes in-front of you are "English" or not, but from a pure logic
point of view that's a little harder.

Also bear in mind that on Unix ALL files are binary files. It is up to
you to determine the type of the file contents as you see fit. For
example you can check for line-terminated data.

It would be wise to check for characters from 0 to 31, if they appear
then it's almost certainly (but not guaranteed) binary.

--
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

attached mail follows:


Thanks, that's very helpful. It beats the heck out of doing it the way
I've been doing it.

Richard Davey wrote:

>Hello Axel,
>
>Monday, February 23, 2004, 7:38:25 PM, you wrote:
>
>AIM> Thanks, you just gave me the solution, I think. I don't have to strip
>AIM> out every character above standard ascii, I just have to look for them.
>AIM> If one is there, then just get rid of it. It's true that an OS can't
>AIM> tell the difference between a jpg and an exe file, but that's to be
>AIM> expected. But the file_get_contents() function DOES open the file. Since
>AIM> there is a definite difference between a text file and a binary file, it
>AIM> should be able to detect that.
>
>The difference isn't as obvious as you might think. Opening a binary
>file into a hex editor will show you this. Your brain can determine if
>the codes in-front of you are "English" or not, but from a pure logic
>point of view that's a little harder.
>
>Also bear in mind that on Unix ALL files are binary files. It is up to
>you to determine the type of the file contents as you see fit. For
>example you can check for line-terminated data.
>
>It would be wise to check for characters from 0 to 31, if they appear
>then it's almost certainly (but not guaranteed) binary.
>
>
>

attached mail follows:


On Monday 23 February 2004 11:55 am, Richard Davey wrote:
> Hello Axel,
>
> Monday, February 23, 2004, 7:38:25 PM, you wrote:
>
> AIM> Thanks, you just gave me the solution, I think. I don't have to strip
> AIM> out every character above standard ascii, I just have to look for
> them. AIM> If one is there, then just get rid of it. It's true that an OS
> can't AIM> tell the difference between a jpg and an exe file, but that's to
> be AIM> expected. But the file_get_contents() function DOES open the file.
> Since AIM> there is a definite difference between a text file and a binary
> file, it AIM> should be able to detect that.
>
> The difference isn't as obvious as you might think. Opening a binary
> file into a hex editor will show you this. Your brain can determine if
> the codes in-front of you are "English" or not, but from a pure logic
> point of view that's a little harder.
>
> Also bear in mind that on Unix ALL files are binary files. It is up to
> you to determine the type of the file contents as you see fit. For
> example you can check for line-terminated data.
>
> It would be wise to check for characters from 0 to 31, if they appear
> then it's almost certainly (but not guaranteed) binary.

Assuming that's decimal, you're including 0x09 0x0a and 0x0d which are,
respectively, tab, line feed, and carriage return. That's off the top of my
head, which means two things: (1) i may be forgetting something, and (2) I
need a life ;)

I'm not up to speed on this thread, but perhaps you could (ab)use some
techniques from natural language processing? May be overkill, though ;)

>
> --
> Best regards,
> Richard Davey
> http://www.phpcommunity.org/wiki/296.html

--
Evan Nemerson
evancoeus-group.com
http://coeusgroup.com/en

attached mail follows:


Hello Evan,

Monday, February 23, 2004, 8:57:43 PM, you wrote:

>> It would be wise to check for characters from 0 to 31, if they appear
>> then it's almost certainly (but not guaranteed) binary.

EN> Assuming that's decimal, you're including 0x09 0x0a and 0x0d which are,
EN> respectively, tab, line feed, and carriage return. That's off the top of my
EN> head, which means two things: (1) i may be forgetting something, and (2) I
EN> need a life ;)

Let me rephrase - check for the existence of characters 0 through 31
and count how many there are. Set a percentage weight yourself and
figure out in your script if you deem the quantity too many or too
few.

The count_chars() function will be absolutely ideal for this.

--
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

attached mail follows:


Richard Davey wrote:

> Hello Axel,
>
> Monday, February 23, 2004, 7:03:38 PM, you wrote:
>
> AIM> Guys, this isn't THAT stupid of a question is it? From my perspective,
> AIM> the way PHP seems to see it is that I should already know what kind of
> AIM> file I'm looking at. In most cases that's not an unreasonable
> AIM> assumption. Unfortunately, that's only good for most cases. PHP is rich
>
> Even Windows doesn't *know* what type of file you've got until you
> actually try and open it. You could rename a jpg to mp3 and you won't
> know about it until Winamp moans at you as you open it.

FTP programs seem to know what kind of file you are transferring. Hence
the ability to switch the transfer between AUTO, BINARY and ASCII modes.
  I usually leave mine in AUTO mode and it seems to figure it out OK.
I'd suggest looking at the source to an FTP client to see how they do
it. filezilla is opensource:

   http://filezilla.sourceforge.net/

Good luck.

Shane

attached mail follows:


That's not bad, but I found a way to do it simply using chr() and
passing it a value. It turns out the if I go 0-31 Almost nothing will
get through. Even the simples html has something in there from that
list. However, by just looking between 14 and 26, one more than carriage
return, and one less than escape, it worked really well. I crawled a
site with a large number of jpg, gif, mp3, wav, and pdf files. Of the
100's of binaries there only one pdf got through. Not a bad record. I
also found that in order for this to work I have to process the URLs.
This makes things really slow so I'm going to have to use both this and
the "check for extension" function together. Still, I can worry a lot
less about getting my index weighted down by binary files. The code is
pretty basic at this point, but here it is:

    // Check for binaries
        $ckbin = 14;
        while($ckbin <= 26){
            $ck = chr($ckbin);
            $cbin = substr_count($read, $ck);
            if($cbin > 0){
                echo "Killing off binary file URL: $url\n";
                $kill = mysql_unbuffered_query("DELETE FROM search WHERE
url_id='$url_id'");
                continue 2;
            }
        ++$ckbin;
        }
I know it looks kind of funky out of context, but it works really great.

Nick

Richard Davey wrote:

>Hello Evan,
>
>Monday, February 23, 2004, 8:57:43 PM, you wrote:
>
>
>
>>>It would be wise to check for characters from 0 to 31, if they appear
>>>then it's almost certainly (but not guaranteed) binary.
>>>
>>>
>
>EN> Assuming that's decimal, you're including 0x09 0x0a and 0x0d which are,
>EN> respectively, tab, line feed, and carriage return. That's off the top of my
>EN> head, which means two things: (1) i may be forgetting something, and (2) I
>EN> need a life ;)
>
>Let me rephrase - check for the existence of characters 0 through 31
>and count how many there are. Set a percentage weight yourself and
>figure out in your script if you deem the quantity too many or too
>few.
>
>The count_chars() function will be absolutely ideal for this.
>
>
>

attached mail follows:


On Monday 23 February 2004 03:02 pm, Axel IS Main wrote:
> That's not bad, but I found a way to do it simply using chr() and
> passing it a value. It turns out the if I go 0-31 Almost nothing will
> get through. Even the simples html has something in there from that
> list. However, by just looking between 14 and 26, one more than carriage
> return, and one less than escape, it worked really well. I crawled a
> site with a large number of jpg, gif, mp3, wav, and pdf files. Of the
> 100's of binaries there only one pdf got through. Not a bad record. I

It should be noted that PDF isn't necessarily a binary. It's just most people
like to use compression, and embed images, sounds, etc. But if you want to,
you can fire up emacs and create a PDF from scratch. So really the record is
better than you think ;)

> also found that in order for this to work I have to process the URLs.
> This makes things really slow so I'm going to have to use both this and
> the "check for extension" function together. Still, I can worry a lot
> less about getting my index weighted down by binary files. The code is
> pretty basic at this point, but here it is:
>
> // Check for binaries
> $ckbin = 14;
> while($ckbin <= 26){
> $ck = chr($ckbin);
> $cbin = substr_count($read, $ck);
> if($cbin > 0){
> echo "Killing off binary file URL: $url\n";
> $kill = mysql_unbuffered_query("DELETE FROM search WHERE
> url_id='$url_id'");
> continue 2;
> }
> ++$ckbin;
> }
> I know it looks kind of funky out of context, but it works really great.
>
> Nick
>
> Richard Davey wrote:
> >Hello Evan,
> >
> >Monday, February 23, 2004, 8:57:43 PM, you wrote:
> >>>It would be wise to check for characters from 0 to 31, if they appear
> >>>then it's almost certainly (but not guaranteed) binary.
> >
> >EN> Assuming that's decimal, you're including 0x09 0x0a and 0x0d which
> > are, EN> respectively, tab, line feed, and carriage return. That's off
> > the top of my EN> head, which means two things: (1) i may be forgetting
> > something, and (2) I EN> need a life ;)
> >
> >Let me rephrase - check for the existence of characters 0 through 31
> >and count how many there are. Set a percentage weight yourself and
> >figure out in your script if you deem the quantity too many or too
> >few.
> >
> >The count_chars() function will be absolutely ideal for this.

--
Evan Nemerson
evancoeus-group.com
http://coeusgroup.com/en

attached mail follows:


Alternatively, count unigrams in the first 1000 characters and get the
euclidean distance to a sample from e.g. an english text, a french
text, a chinese text, etc.

- Lucas

attached mail follows:


Hi,

I am new to the list, so sorry if this has been asked before. I was
wondering if anyone knew of an approx. date for the final release of
PHP 5.0? I ask because I have a project to do semi-soon that uses XML
and I would rather wait for PHP 5 and use the SimpleXML extension to
make things easier. My client does not want to put beta software on
their server, which is why I can't use B4.

Thanks!

Karl

attached mail follows:


On Mon, 2004-02-23 at 14:25, Karl Timmermann wrote:
> I am new to the list, so sorry if this has been asked before. I was
> wondering if anyone knew of an approx. date for the final release of
> PHP 5.0? I ask because I have a project to do semi-soon that uses XML
> and I would rather wait for PHP 5 and use the SimpleXML extension to
> make things easier. My client does not want to put beta software on
> their server, which is why I can't use B4.

It will be released when it is done. AFAIK there is not a release date
yet at all. It will be released when enough bugs are fixed and enough
people do not complain about it not working right when they use it. If
you want to shorten the time to release you can always go and fix some
bugs. :)

--
Adam Bregenzer
adambregenzer.net
http://adam.bregenzer.net/

attached mail follows:


Hi all,
is possible to send an email, with mail() function, with an attached?
I see on www.php.net but there isn't nothing about this.
If someone have the solution please send the solution.
Thanks in advance.
Frank
francescoautomationsoft.biz
www.automationsoft.biz
 

attached mail follows:


In a message dated 2/23/2004 11:41:00 AM Pacific Standard Time,
francescoautomationsoft.biz writes:

>is possible to send an email, with mail() function, with an attached?
>I see on www.php.net but there isn't nothing about this.
>If someone have the solution please send the solution.
>Thanks in advance.
>Frank

You do it by including an email header that instructs that the message be
sent as an attachment, like the following:

$to = "someonesomeplace.com";
$subj = "Testing an attachment";
$mess = "This is the test message.";
$headers = "Content-disposition: attachment; filename=test.txt\n";
$mailsend = mail($to,$subj,$mess,$headers);

This will send the message in $mess as an attachment with the filename
test.txt.

Good Luck,

Janet

-----------------------------------
Janet Valade,
Author, PHP & MySQL for Dummies
Author, PHP 5 for Dummies
 

attached mail follows:


On Mon, 2004-02-23 at 11:36, pete M wrote:
> Here is a snippet
> đ­ :2002020720020208:defaulthttp://www.lyricsworld.com/cgi-bin/search.cgi?q=Bruce
> +Springsteen&m=phrase&ps=20&o=0&wm=wrd&ul=&wf=22221đ­đ­đ­đ­
>
> it breaks down in the following elements
> the :date: in the format yyyymmddyyyymmdd
> The expression I'm using is
> (":16[0-9]:")
> ie matching the : with 16 digits :

here's a start:
/:(\d+):([^]+)([\w&=+\/:\\%-]+)/i

--
Adam Bregenzer
adambregenzer.net
http://adam.bregenzer.net/

attached mail follows:


On Sun, 2004-02-22 at 07:25, Sztankó Demeter wrote:
> I'm not sure that I want to start OOP-ing in my php code, but I will if
> necessary.

Ok, I have below a non-OO response. Personally, while I enjoy the OO
methodology, I don't think it is the "one true way." I adhere to the
philosophy that anything that can be done using OO can also be done
without it.

> I'l tell the problem I want to solve. It also will help me to understand the
> problem:
>
> There are two (or more) different functions on my web site, that have the
> same name (an action). They are called depending on the permittions of the
> end user. (for example, if it is an unregistered user, then it is redirected
> to registration form, if it is a registered user, some table is generated
> from database, if it a administrator user, some additional controls a shown
> that allow to change the table). I want to have the code clean so I don't
> want to put the switch or if operators to it. I will call the wrapper that
> will check the grant of the user and call apropriate function. (For example:
> Load_action("List"))
>
> So there is a set of grant properties assigned to each function and a list
> (array, whatever) of such functions is assigned to the action. The wrapper
> walks through the list and finds the first function which grant properties
> match the user grant properties.
>
> The second side is that I want to make the coding very easy and simple. So
> if I want don't want to bother with the name of the functions a write for
> the action. I want to write the function, and call some method that accepts
> action name and a permission set as an argument (permission set will be a
> string that will be evaluted by the wrapper), for example :
> Add_function_to_container("List","(P_READ AND P_WRITE) OR P_ADMIN","Some
> kind of description of this function");
> This method adds the copy of function to array then deletes the original
> function, so I can use the same function name next time. (For simplicity,
> the function names is always the same as the action name, so it always knows
> which function to add)
>
> This will also simplify the process of writing developers documentation.

I like your approach, I am glad to see someone wanting to use some
design forethought to save time down the road. Just make sure you stay
flexible.

> 1.
> I wouldn't be so lazy and will make another function name. For example if
> there is an action called List, then there will be following functions:
> function Action_List_1()
> function Action_List_2()
> function Action_List_3()
> The wrapper then looks up for the new function with the help of
> get_defined_functions() and adds the Action_List_...() function that is
> still not in the list.

One spin off on this design would be to setup a naming convention to
your functions. Action_List() could become:
Action_List_nouser()
Action_List_user()
Action_List_admin()

You could have a function that pairs a "List" call with the user's state
and generates the function call:
$func = 'Action_' . $func_name . '_' . $user_state;
$output = $func($args);

> 2.
> I will make same kind of an abstract class called the same way as action and
> there will be derived classes that implement the functions.
> This sounds nice but a little bit cumbersome. There will be 200 actions and
> I don't want to write an abstract class for each of them.This contradicts my
> philosophy of lazyness.

You can aggregate this with the Command pattern Michal mentioned
earlier. I would recommend using a variation of the Command pattern to
collect your actions, then use the Factory pattern to manage your user
states and select the appropriate set of actions. This will give you a
lot of flexibility down the road at the expense of some additional
programming now. You should not need to create abstract classes for
each action, however you will need classes to handle creation,
execution, etc. of these classes. IMHO laziness is a boon to
programming, over implementation will be the death of us all. :)

> 3.
> Some great idea that You will provide. Maybe based on OOP, maybe not, but
> it is easy to code and perfect.

Here's another non-OO solution. You could define these functions in
their own files. For example, hold all the admin versions of these
functions in an admin include, do the same for user, etc. Then include
the appropriate file based in the user's state and proceed from there.
You will not need to worry about having duplicate function names, though
the implementation will be somewhat unique. Also, if a user changes
state you will have to issue an HTTP redirect to reload the correct
functions. Fortunately, I would guess that would rarely, if ever,
happen in the middle of a script's execution.

In looking for a non-OO solution, my opinion is that option 1 would be
the best. It is easy to implement and documentation/code reading will
be easier as time passes. Having multiple functions with the same name
performing different tasks presents a rather steep learning curve to
someone who has to maintain your code.

Regards,
Adam

--
Adam Bregenzer
adambregenzer.net
http://adam.bregenzer.net/

attached mail follows:


Steve Dieke wrote:
| I am guesing that I have installed something incorrectly. I am trying to
| use the function xslt_create(). I installed php v5 Beta 4 successfully.
| but when I try to use the function xslt_create() I get the following
| error:
|
| Fatal Error: Call to undefined function xslt_create()

I too am having difficulty getting this up on our development boxes. I've
installed php5a5 via FreeBSD ports, and get the same error. My
configuration options are here:

http://hastur.p11.com/phpinfo.php

From my understanding, I know that there are major changes to XML/XSL in
php5, but is there anywhere documenting their changes explicitly? I've
just read a bunch of lip service saying that it's changing, but I have no
idea how it'll affect my xml/xhtml apps when php5 goes release. I'd love
to get a head start on it now, but have to get this working right.

Are the XSL functions used with php4/sablotron going to be supported in the
php5/libxml implementations? Or am I going to have to re-code a bunch of
my xsl functions?

--
Ryan C. Creasey
Network Engineer
p11creative, inc.

attached mail follows:


I have a member DB table that has about 50 fields in it for each record. It
holds things like username, password, mailing address, and general site
preferences.

I'm wondering if I will see any noticeable speed increase if I were to split
the 20+ fields that hold preferences (nearly all are single-digit 1/0
fields) out from the other fields that hold general member data, and put
them into their own table? Or maybe there's some other good reason for doing
this that I'm not aware of?

I'd actually prefer to keep it all together, because it's a lot easier to
update a single table in MySQL than several if a member makes changes to
their account or preferences.

What do you think?

Monty.

attached mail follows:


Monty <mailto:monty3hotmail.com>
    on Monday, February 23, 2004 2:35 PM said:

> I'm wondering if I will see any noticeable speed increase if I were
> to split the 20+ fields that hold preferences (nearly all are
> single-digit 1/0 fields) out from the other fields that hold general
> member data, and put them into their own table? Or maybe there's some
> other good reason for doing this that I'm not aware of?
>
> I'd actually prefer to keep it all together, because it's a lot
> easier to update a single table in MySQL than several if a member
> makes changes to their account or preferences.
>
> What do you think?

what do *i* think?? well, i'll tell you.

i'd say you should definitely keep them in the same table. once you move
them to another table you'll need some way of keeping track of each
users corresponding settings and the way to do that is to have some kind
of unique identifying field that is the same between both tables. this
is usually done with an auto-incrementing ID field.

you will likely not see any performance increase if you split the
tables. in fact you'll probably see a decrase as you'll have to do a
join to get data from two tables at once.

and just to let you know (in case you don't already):

1. don't select the entire table with "SELECT * FROM user_data". instead
you should explicitly list each and every field you want to grab (even
if it's all of them).

2. in case you are not meaning to select the entire table but you are
still doing SELECT *, you'd be much better off following tip #1 because
the database won't be doing as much work.

hth,
chris.

attached mail follows:


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

i think if the most accessed fields are much smaller than the hole
thing, you can consider splitting it
whats the average size of your records?
whats the size of the fields you access the most? (check your sql's for
that one...)
amount of records would influence that decision too

btw, if they are all 0/1 preferences, maybe you could put them all in a
single field using set or some int type with 1 bit for each preference
(int would be enough for 32 preferences flags)

Monty wrote:
> I have a member DB table that has about 50 fields in it for each record. It
> holds things like username, password, mailing address, and general site
> preferences.
>
> I'm wondering if I will see any noticeable speed increase if I were to split
> the 20+ fields that hold preferences (nearly all are single-digit 1/0
> fields) out from the other fields that hold general member data, and put
> them into their own table? Or maybe there's some other good reason for doing
> this that I'm not aware of?
>
> I'd actually prefer to keep it all together, because it's a lot easier to
> update a single table in MySQL than several if a member makes changes to
> their account or preferences.
>
> What do you think?
>
> Monty.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAOo/WaxdA/5C8vH8RAq6mAJ49bHhJbFDxPvwU16HSc2DiLRjLJwCaAhoi
SyJaWOebs87TP+eDC53foNc=
=5Rhw
-----END PGP SIGNATURE-----

attached mail follows:


Hi all. I'm currently experiencing a problem deleting cookies on a test
server. Before I go on, here's the server info:

Server 1
----------
Apache 1.3.29
PHP Version 4.3.4

Server 2
----------
Apache 2.0.48
PHP Version 4.3.4
Previously running PHP 5.0.0.a4

I've got a technical support app running on Server 1. Well I wanted to
add some features and started playing around with PHP 5 and Apache 2 on
Server 2. So, I tried out some of my scripts that used the following
for using cookies.

Here's what I use to set the cookie.
$value=(time() + 9000) . ":$uid:$username:$gid:$fullname";
SetCookie("Trackookie", $value, 0, "", "server.mssystems.com" );

Here's what I use to delete the cookie.
SetCookie("Trackookie", "", time()-3600, "", "support.mssystems.com" );

Now, creating the cookie is no problem. Deleting the cookie is where I
started having problems on Server 2. At first, I thought it was PHP5 so
I went to PHP4. However, I still kept having the same problem.

Looking at the headers using Mozilla Live-Headers I was able to see that
this was sent from both servers:

Set-Cookie: Trackookie=deleted; expires=Sun, 23-Feb-2003 22:47:22 GMT;
domain=server.mssystems.com

However, if I look at the Mozilla cookie manager, I still see the cookie
there for Server 2. If I try the same thing on Server 1, the cookie
gets deleted without any problems.

I suspect it may be due to my using Apache 2 and downgrading won't be a
problem, but I wanted to check first if anyone had been experiencing the
same problems.

I should add, though, that I was a little overzealous and added quite a
few extensions on Server 2 in order to experiment with them. Have there
been any reports of extensions causing confllicts with cookies.

Thanks and I appreciate any general comments or advice about this.

do

attache