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 17 Jul 2004 05:19:56 -0000 Issue 2881

php-general-digest-helplists.php.net
Date: Sat Jul 17 2004 - 00:19:56 CDT


php-general Digest 17 Jul 2004 05:19:56 -0000 Issue 2881

Topics (messages 190731 through 190811):

Re: Trouble with include/require
        190731 by: raditha dissanayake
        190797 by: Curt Zirzow

Re: quotes in text.
        190732 by: Ed Curtis
        190748 by: Justin Patrin
        190751 by: Ed Curtis
        190756 by: John W. Holmes
        190761 by: Ed Curtis
        190762 by: Matt M.

Re: Echoing Results in a Table
        190733 by: rush
        190741 by: Harlequin

mysqli prepapred SELECT statement
        190734 by: Support
        190801 by: Curt Zirzow

Security vulerability, any more detail info than this???
        190735 by: Scott Fletcher
        190736 by: Scott Fletcher
        190755 by: John W. Holmes

load data infile
        190737 by: Hull, Douglas D
        190740 by: Jay Blanchard

Putting $_POST into string to send to ASP
        190738 by: Jeff Oien
        190739 by: Matt M.
        190745 by: Lars Torben Wilson
        190746 by: Vail, Warren
        190747 by: Lars Torben Wilson
        190749 by: Jeff Oien
        190750 by: Vail, Warren
        190752 by: Matt M.
        190754 by: Vail, Warren
        190757 by: Lars Torben Wilson
        190760 by: Lars Torben Wilson
        190763 by: Vail, Warren
        190766 by: Jeff Oien
        190767 by: Justin Patrin

Populating a Dropdown Menu From a Query
        190742 by: Harlequin
        190743 by: Matt M.
        190744 by: Arnout Boks

PHP5 Install Version (Win32)
        190753 by: Ron Stiemer
        190765 by: Lester Caine

Problem with calculate
        190758 by: Rosen
        190759 by: John W. Holmes
        190764 by: Rosen

convert degrees to heading
        190768 by: Ren Fournier
        190769 by: Tim Van Wassenhove
        190770 by: Tularis
        190771 by: Ren Fournier
        190772 by: Vail, Warren
        190781 by: Tim Van Wassenhove

Re: PHPEclipse?
        190773 by: robert mena

Tiff to Jpeg conversion
        190774 by: Hardik Doshi

Re: SNMP traps generation
        190775 by: franck

PHP5 and pass by reference bug.
        190776 by: Daevid Vincent
        190786 by: Red Wingate
        190787 by: Red Wingate
        190794 by: Daevid Vincent
        190796 by: Justin Patrin

using PHP script to simulate a login
        190777 by: Alex Shi
        190782 by: Justin Patrin
        190788 by: Alex Shi
        190795 by: Justin Patrin

Uploading a directory of files
        190778 by: Ryan Schefke
        190780 by: John W. Holmes
        190807 by: raditha dissanayake
        190810 by: xin

php5.0.0(cli) + loose STDIN when using pcntl_alarm
        190779 by: franck

finding a substring
        190783 by: C.F. Scheidecker Antunes
        190784 by: Justin Patrin
        190785 by: John W. Holmes
        190811 by: Jason Barnett

Help on copying part of a text file
        190789 by: C.F. Scheidecker Antunes
        190791 by: John W. Holmes

What happen to JAVA support in PHP5
        190790 by: Alawi albaity

Re: upload an image and store it in mysql
        190792 by: Five
        190793 by: John W. Holmes
        190805 by: raditha dissanayake
        190808 by: Five

Re: Embedded Email Directives
        190798 by: Curt Zirzow
        190799 by: Jordi Canals
        190802 by: Manuel Lemos

Re: Getting the primary key from a MySQL insert
        190800 by: Curt Zirzow

Re: Checking for character absence with regular expressions
        190803 by: Jason Wong

imagecreatefromjpeg fails on large files
        190804 by: tmp1000.fastmail.fm
        190806 by: raditha dissanayake

"sendmail_from" not set in php.ini or custom "From:" header missing
        190809 by: Wudi

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:


Jason Barnett wrote:

>>
>> I would not suggest using ini_set() inside you're scripts to
>> adjust your paths.
>>
>>
>
> Hey Curt, why do you suggest we don't use ini_set to adjust paths?
> I'm using it as part of my library autoloader - it may not be as
> efficient as changing the path directly but it seems to work well.
>
Donno about Curt, but i have found ini_set does not seem reliable,
perhaps I may not have been doing something right but never found
chaning php setting wtih .htaccess and ini_set to be particularly
usefull. By reliable i mean work across many installations of PHP.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


* Thus wrote Jason Barnett:
> >That will try and find a file in these locations in order:
> > /var/www/html/projects/include/db.inc
> > ./db.inc
> > /php/includes/db.inc
> >
> >And will use the first one found.
> >
> >I would not suggest using ini_set() inside you're scripts to
> >adjust your paths.
> >
> >
> >
> >Curt
>
> Hey Curt, why do you suggest we don't use ini_set to adjust paths? I'm
> using it as part of my library autoloader - it may not be as efficient
> as changing the path directly but it seems to work well.

The main reason I dont suggest it is that it is really unneccessary
code to have inside ones application.

Although your code is very well designed and efficient, If i strip
out all the code that calculates and sets the include path, and
plop the file in my include_path, everything will work just fine.

The only time I'll use ini_set() is when debugging something, I'll
never use it in a production environment.

> ...
> if (!class_exists($class)) {

btw, you might want use class_exists($class, false), class_exists()
will try to use __autoload() by default if the class wasn't
defined, causing some wierd side effects.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


On Fri, 16 Jul 2004, John W. Holmes wrote:

> Let's say you have $_POST['text'] from the user.
>
> To display the value back to the user with magic_quotes_enabled, you'd
> do this:
>
> echo htmlentities(stripslashes($_POST['text']));
>
> To put the value into a hidden form element, you'd do this:
>
> <input type="hidden" name="text"
> value="<?=htmlentities(stripslashes($_POST['text']))?>">
>
> Now, $_POST['text'] will come out correctly on Page 3. Since you seem to
> have magic_quotes_gpc enabled, you can put the value directly into your
> query.

Actually when I tried the above example nothing was entered into the
database. This worked.. htmlentities($_POST['text']).

Thanks,

Ed

attached mail follows:


On Fri, 16 Jul 2004 11:58:55 -0500 (EST), Ed Curtis <edhomes2see.com> wrote:
>
>
>
> On Fri, 16 Jul 2004, John W. Holmes wrote:
>
> > Let's say you have $_POST['text'] from the user.
> >
> > To display the value back to the user with magic_quotes_enabled, you'd
> > do this:
> >
> > echo htmlentities(stripslashes($_POST['text']));
> >
> > To put the value into a hidden form element, you'd do this:
> >
> > <input type="hidden" name="text"
> > value="<?=htmlentities(stripslashes($_POST['text']))?>">
> >
> > Now, $_POST['text'] will come out correctly on Page 3. Since you seem to
> > have magic_quotes_gpc enabled, you can put the value directly into your
> > query.
>
> Actually when I tried the above example nothing was entered into the
> database. This worked.. htmlentities($_POST['text']).
>

This is why he said: "Since you seem to have magic_quotes_gpc enabled,
you can put the value directly into your query."

You shouldn't use htmlentities when putting it into the DB. Use it
when displaying the text.

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


On Fri, 16 Jul 2004, Justin Patrin wrote:

> This is why he said: "Since you seem to have magic_quotes_gpc enabled,
> you can put the value directly into your query."
>
> You shouldn't use htmlentities when putting it into the DB. Use it
> when displaying the text.

 I tried it both ways and it only works correctly when I do use
htmlentities($_POST['text']) in my insert query. I'm not showing the text
to the user on page 3 at all.

Ed

attached mail follows:


Ed Curtis wrote:
> On Fri, 16 Jul 2004, Justin Patrin wrote:
>>This is why he said: "Since you seem to have magic_quotes_gpc enabled,
>>you can put the value directly into your query."
>>
>>You shouldn't use htmlentities when putting it into the DB. Use it
>>when displaying the text.
>
> I tried it both ways and it only works correctly when I do use
> htmlentities($_POST['text']) in my insert query. I'm not showing the text
> to the user on page 3 at all.

Well, if you're happy with it "just working" and not knowing why or how
it's going to break in the future... have fun.

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals www.phparch.com

attached mail follows:


On Fri, 16 Jul 2004, John W. Holmes wrote:

> Ed Curtis wrote:
> > On Fri, 16 Jul 2004, Justin Patrin wrote:
> >>This is why he said: "Since you seem to have magic_quotes_gpc enabled,
> >>you can put the value directly into your query."
> >>
> >>You shouldn't use htmlentities when putting it into the DB. Use it
> >>when displaying the text.
> >
> > I tried it both ways and it only works correctly when I do use
> > htmlentities($_POST['text']) in my insert query. I'm not showing the text
> > to the user on page 3 at all.
>
> Well, if you're happy with it "just working" and not knowing why or how
> it's going to break in the future... have fun.
>

Ok then, I want to know how to do it the right way but just using
$_POST['text'], as stated before, in my query still cuts off the text at
the quote.

While passing this field between pages I don't do anything to it but when
I want to show it to the user I would use stripslashes($_POST['text']). Is
this the correct way to make sure my quotes get passed into the database?

Ed

attached mail follows:


> Ok then, I want to know how to do it the right way but just using
> $_POST['text'], as stated before, in my query still cuts off the text at
> the quote.
>
> While passing this field between pages I don't do anything to it but when
> I want to show it to the user I would use stripslashes($_POST['text']). Is
> this the correct way to make sure my quotes get passed into the database?

First I would turn off magic_quotes_gpc. I would use sessions to pass
the data from step 1 to the end, much easier imho than messing around
with hidden fields. When you store the data in the database use make
sure you escape it, when you redisplay it, use the htmlentities
function.

attached mail follows:


"Harlequin" <michael.masonarraspeople.co.uk> wrote in message
news:20040716160747.28030.qmailpb1.pair.com...
> I've managed to develop a query which pulls a finite number of records
from
> a table based on a query.
>
> What commends do I now use to present these results in a table...?

There are plenty of such advices, I assume google will find them nicely.
Here are few from TT site:

http://www.templatetamer.org/index.php?SimpleMySqlRowList
http://www.templatetamer.org/index.php?MySqlRowList
http://www.templatetamer.org/index.php?AlternatingListExample

rush
--
http://www.templatetamer.com/

attached mail follows:


Thanks John.

I managed to get what I wanted. Now I have a very neat table showing my
results. Nice.

Next conundrum is stuffing a dropdown menu with results. I'll post a new
thread but have a dig around the Internet, many thanks John.

--
-----------------------------
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-----------------------------
"John W. Holmes" <holmes072000charter.net> wrote in message
news:40F7FF56.8010505charter.net...
> Harlequin wrote:
>
> > I've managed to develop a query which pulls a finite number of records
from
> > a table based on a query.
> >
> > What commends do I now use to present these results in a table...?
>
> How would you show a table now with a single record? Start there. Now,
> what areas would need repeating with a "finite number" of records? Those
> elements should be in a loop, either FOR, FOREACH or WHILE, more than
> likely.
>
> If you don't know how to run your query and extract the results, then
> you've got some reading to do. Check the PHP manual; there are user
> comments that walk you through everything.
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals www.phparch.com

attached mail follows:


Anyone working with php5/mysql 4.1 yet with the new ext/mysqli?

This has me stumped:

$stmt = $mysqli->prepare('SELECT * FROM users WHERE userid=?');

$stmt->bind_param('i', $userID);

$stmt->execute();

...now how to get the results??? I can't use bind_result() since I have no
clue how many columns `*' will retreive. I have been reading the docs now
for over two hours and need to get back to work :-)

$stmt->close();

Jim Grill

attached mail follows:


* Thus wrote Support:
> Anyone working with php5/mysql 4.1 yet with the new ext/mysqli?
>
> This has me stumped:
>
> $stmt = $mysqli->prepare('SELECT * FROM users WHERE userid=?');
>
> $stmt->bind_param('i', $userID);
>
> $stmt->execute();
>
> ...now how to get the results??? I can't use bind_result() since I have no
> clue how many columns `*' will retreive. I have been reading the docs now
> for over two hours and need to get back to work :-)

The documentation might be a bit in error. In normal, prepare,
bind, execute method of doing queries usually returns true/false or
a result handle.

true/false if it is an action query ie insert, update, delete
or a result handle when using select or a stored procedure that
returns a resultset.

So going by that logic you should be able to do something like:

$result = $stmt->execute();

which should be a mysqli_result class if the query executed
properly.

I havn't touched mysqli stuff but hopefully that will help with
something.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


Saw a website about security vulerability and there's no info on php.net
that can describe more about it. So, anyone know?

http://pcworld.co.nz/news.nsf/0/4D6AE0157B37ACDCCC256ED200693BB3?OpenDocument

FletchSOD

attached mail follows:


Except that 4.3.8 cover the 4.3.7 issues....

"Scott Fletcher" <scottabcoa.com> wrote in message
news:20040716180604.72165.qmailpb1.pair.com...
> Saw a website about security vulerability and there's no info on php.net
> that can describe more about it. So, anyone know?
>
>
http://pcworld.co.nz/news.nsf/0/4D6AE0157B37ACDCCC256ED200693BB3?OpenDocument
>
> FletchSOD

attached mail follows:


Scott Fletcher wrote:

> Saw a website about security vulerability and there's no info on php.net
> that can describe more about it. So, anyone know?
>
> http://pcworld.co.nz/news.nsf/0/4D6AE0157B37ACDCCC256ED200693BB3?OpenDocument

One more reason to not use strip_tags... like I really needed another,
though.

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals www.phparch.com

attached mail follows:


I have a tab delimited file I am trying to load in my database using:

LOAD DATA INFILE '/users/dbs/sites/phpmyadmin/gus/exptab.txt' INTO TABLE datable;

But all it will load is the first record and I have about 2000 records. There are 20 columns of data in my 'exptab.txt' file I am loading and there are 20 fields in datable.

Any ideas, if you could email me directly I would appreciate it, thanks,
Doug

attached mail follows:


[snip]
I have a tab delimited file I am trying to load in my database using:

LOAD DATA INFILE '/users/dbs/sites/phpmyadmin/gus/exptab.txt' INTO TABLE
datable;

But all it will load is the first record and I have about 2000 records.
There are 20 columns of data in my 'exptab.txt' file I am loading and
there are 20 fields in datable.
[/snip]

Have you, by any chance, consulted the MySQL list?
http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html ?

attached mail follows:


Dumb question, sorry if it's a repeat. I will use PHP for a form with
error checking. When there are no errors I need to send all the
variables thru something like this:

$URL = "https://example.com/script.asp?First=Jim&Last=Smith";
urlencode($URL);
header("Location: $URL\n");

How do I gather up all the variables in $_POST and attach them as a
string after the question mark? Thanks.
Jeff

attached mail follows:


> How do I gather up all the variables in $_POST and attach them as a
> string after the question mark? Thanks.

this is untested:

$arr = array();

foreach($_POST as $key => $value) {
        $arr[] = $key.'='.urlencode($value);
}

$URL = "https://example.com/script.asp?".implode('&',$arr);
header("Location: $URL\n");

attached mail follows:


Jeff Oien wrote:

> Dumb question, sorry if it's a repeat. I will use PHP for a form with
> error checking. When there are no errors I need to send all the
> variables thru something like this:
>
> $URL = "https://example.com/script.asp?First=Jim&Last=Smith";
> urlencode($URL);
> header("Location: $URL\n");
>
> How do I gather up all the variables in $_POST and attach them as a
> string after the question mark? Thanks.
> Jeff

Try the http_build_query() function. If you don't have PHP 5, look in
the user notes--someone appears to have written one for PHP 4 as well
(the user note 21-Jun-2004 from 'brooklynphil'). I haven't tested
either one.

   http://www.php.net/manual/en/function.http-build-query.php

Using this, you could just do something like:

   $query_string = http_build_query($_POST);

Hope this helps,

Torben <torbenphp.net>

attached mail follows:


How about (probably one of fifty solutions;

Foreach($_POST as $k => $v) $vals[] = $k."=".$v;
$strvals = urlencode(implode("&",$vals));
Header("Location: https://example.com/script.asp?".$strvals);

One thing to think about, URL's are limited in length, and one reason for
using method=post is that they won't fit in a URL, for this you'll need to
make sure they fit.

Warren Vail

-----Original Message-----
From: Lars Torben Wilson [mailto:torbenphp.net]
Sent: Friday, July 16, 2004 12:32 PM
To: Jeff Oien
Cc: PHP
Subject: [PHP] Re: Putting $_POST into string to send to ASP

Jeff Oien wrote:

> Dumb question, sorry if it's a repeat. I will use PHP for a form with
> error checking. When there are no errors I need to send all the
> variables thru something like this:
>
> $URL = "https://example.com/script.asp?First=Jim&Last=Smith";
> urlencode($URL);
> header("Location: $URL\n");
>
> How do I gather up all the variables in $_POST and attach them as a
> string after the question mark? Thanks.
> Jeff

Try the http_build_query() function. If you don't have PHP 5, look in the
user notes--someone appears to have written one for PHP 4 as well (the user
note 21-Jun-2004 from 'brooklynphil'). I haven't tested either one.

   http://www.php.net/manual/en/function.http-build-query.php

Using this, you could just do something like:

   $query_string = http_build_query($_POST);

Hope this helps,

Torben <torbenphp.net>

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

attached mail follows:


Vail, Warren wrote:

> How about (probably one of fifty solutions;
>
> Foreach($_POST as $k => $v) $vals[] = $k."=".$v;
> $strvals = urlencode(implode("&",$vals));
> Header("Location: https://example.com/script.asp?".$strvals);
>
> One thing to think about, URL's are limited in length, and one reason for
> using method=post is that they won't fit in a URL, for this you'll need to
> make sure they fit.
>
> Warren Vail

You could do that, but for one thing, it doesn't handle arrays. The code
snippet in the user notes does.

--
Torben Wilson <torbenwilsonshaw.ca>

attached mail follows:


Thanks for the helpful examples. One other question. Is there an
advantage to sending the URL via a header as opposed to doing http_post
like this?
http://shiflett.org/hacks/php/http_post
Jeff

attached mail follows:


> You could do that, but for one thing, it doesn't handle
> arrays. The code snippet in the user notes does.

You are absolutely correct, but I'm not sure that ASP could handle arrays
either.

On the other side Matt M.s processing should work better than mine;

>foreach($_POST as $key => $value) {
> $arr[] = $key.'='.urlencode($value);
>}

I believe my loop may change the & character to something it shouldn't?

Warren Vail

> -----Original Message-----
> From: Lars Torben Wilson [mailto:torbenwilsonshaw.ca]
> Sent: Friday, July 16, 2004 12:55 PM
> To: Vail, Warren
> Cc: 'Lars Torben Wilson'; Jeff Oien; PHP
> Subject: Re: [PHP] Re: Putting $_POST into string to send to ASP
>
>
> Vail, Warren wrote:
>
> > How about (probably one of fifty solutions;
> >
> > Foreach($_POST as $k => $v) $vals[] = $k."=".$v;
> > $strvals = urlencode(implode("&",$vals));
> > Header("Location: https://example.com/script.asp?".$strvals);
> >
> > One thing to think about, URL's are limited in length, and
> one reason
> > for using method=post is that they won't fit in a URL, for
> this you'll
> > need to make sure they fit.
> >
> > Warren Vail
>
> You could do that, but for one thing, it doesn't handle
> arrays. The code snippet in the user notes does.
>
>
>
> --
> Torben Wilson <torbenwilsonshaw.ca>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


> Thanks for the helpful examples. One other question. Is there an
> advantage to sending the URL via a header as opposed to doing http_post
> like this?
> http://shiflett.org/hacks/php/http_post
> Jeff

Like someone mentioned earlier. URL's have length limits. That would
be one reason to do a post.

attached mail follows:


If the hack works, it should get around the length limitation of the URL,
but I would be more tempted to use CURL for that.

http://www.php.net/manual/en/ref.curl.php

Warren Vail

Warren Vail
(415) 667-0240
SF211-07-434
 

-----Original Message-----
From: Jeff Oien [mailto:jeffwebdesigns1.com]
Sent: Friday, July 16, 2004 1:12 PM
To: PHP
Subject: Re: [PHP] Re: Putting $_POST into string to send to ASP

Thanks for the helpful examples. One other question. Is there an
advantage to sending the URL via a header as opposed to doing http_post
like this?
http://shiflett.org/hacks/php/http_post
Jeff

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

attached mail follows:


Jeff Oien wrote:

> Thanks for the helpful examples. One other question. Is there an
> advantage to sending the URL via a header as opposed to doing http_post
> like this?
> http://shiflett.org/hacks/php/http_post
> Jeff

As mentioned a couple of times, size is one. But you still need to
url-encode the data if you're going to send it via post.

  <?php
  $data = array('item1' => 'value1', 'item2' => 'value2');
  $query_string = http_build_query($data);

  // Now, you can send the data either via post:
  $response = http_post('www.example.com', '/form.php', $data);

  // ...or via get:
  header('http://www.example.com?form.php?' . $data);
  ?>

The first lets your script grab the output of the form to which
you're submitting (it's in $response after the http_post() call);
the second actually loads and displays the target form.

Another option is cURL, which is designed for exactly this sort
of thing:

   http://www.php.net/curl

...but it may or may not be overkill for what you need. However,
cURL pretty much rules the data posting/fetching game as far as
configurability etc.

Cheers,

Torben <torbenphp.net>

attached mail follows:


Jeff Oien wrote:

> Thanks for the helpful examples. One other question. Is there an
> advantage to sending the URL via a header as opposed to doing http_post
> like this?
> http://shiflett.org/hacks/php/http_post
> Jeff

As mentioned a couple of times, size is one. But you still need to
url-encode the data if you're going to send it via post.

  <?php
  $data = array('item1' => 'value1', 'item2' => 'value2');
  $query_string = http_build_query($data);

  // Now, you can send the data either via post:
  $response = http_post('www.example.com', '/form.php', $data);

  // ...or via get:
  header('http://www.example.com?form.php?' . $data);
  ?>

The first lets your script grab the output of the form to which
you're submitting (it's in $response after the http_post() call);
the second actually loads and displays the target form.

Another option is cURL, which is designed for exactly this sort
of thing:

   http://www.php.net/curl

...but it may or may not be overkill for what you need. However,
cURL pretty much rules the data posting/fetching game as far as
configurability etc.

Cheers,

Torben <torbenphp.net>

attached mail follows:


I believe we all missed something important here, but I've been wrong
before.

Notice his URL below, specifically the "https" part.

I believe this means that the data not only needs to be URL encoded but SSL
encrypted. I believe this makes a stronger case for using CURL, does it
not? I also would mean that his hack code would not work.

Correct me if I'm wrong?

Warren Vail

-----Original Message-----
From: Lars Torben Wilson [mailto:torbenphp.net]
Sent: Friday, July 16, 2004 12:32 PM
To: Jeff Oien
Cc: PHP
Subject: [PHP] Re: Putting $_POST into string to send to ASP

Jeff Oien wrote:

> Dumb question, sorry if it's a repeat. I will use PHP for a form with
> error checking. When there are no errors I need to send all the
> variables thru something like this:
>
> $URL = "https://example.com/script.asp?First=Jim&Last=Smith";
> urlencode($URL);
> header("Location: $URL\n");
>
> How do I gather up all the variables in $_POST and attach them as a
> string after the question mark? Thanks.
> Jeff

Try the http_build_query() function. If you don't have PHP 5, look in the
user notes--someone appears to have written one for PHP 4 as well (the user
note 21-Jun-2004 from 'brooklynphil'). I haven't tested either one.

   http://www.php.net/manual/en/function.http-build-query.php

Using this, you could just do something like:

   $query_string = http_build_query($_POST);

Hope this helps,

Torben <torbenphp.net>

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

attached mail follows:


The client's vendor only specifies that it's <field>=<data> pairs and
that it's URL encoded so I don't think that's an issue. But don't let
that squelch any discussion. :)
Jeff Oien

Vail, Warren wrote:

> I believe we all missed something important here, but I've been wrong
> before.
>
> Notice his URL below, specifically the "https" part.
>
> I believe this means that the data not only needs to be URL encoded but SSL
> encrypted. I believe this makes a stronger case for using CURL, does it
> not? I also would mean that his hack code would not work.
>
> Correct me if I'm wrong?
>
> Warren Vail

> Jeff Oien wrote:
>
>>Dumb question, sorry if it's a repeat. I will use PHP for a form with
>>error checking. When there are no errors I need to send all the
>>variables thru something like this:
>>
>>$URL = "https://example.com/script.asp?First=Jim&Last=Smith";
>>urlencode($URL);
>>header("Location: $URL\n");
>>
>>How do I gather up all the variables in $_POST and attach them as a
>>string after the question mark? Thanks.
>>Jeff
>
>
> Try the http_build_query() function. If you don't have PHP 5, look in the
> user notes--someone appears to have written one for PHP 4 as well (the user
> note 21-Jun-2004 from 'brooklynphil'). I haven't tested either one.
>
> http://www.php.net/manual/en/function.http-build-query.php
>
> Using this, you could just do something like:
>
> $query_string = http_build_query($_POST);
>
>
> Hope this helps,
>
> Torben <torbenphp.net>
>

attached mail follows:


Thee is a PEAR package to do posts, gets, etc.

http://pear.php.net/package/HTTP_Request

On Fri, 16 Jul 2004 14:00:02 -0700, Vail, Warren <warren.vailschwab.com> wrote:
> I believe we all missed something important here, but I've been wrong
> before.
>
> Notice his URL below, specifically the "https" part.
>
> I believe this means that the data not only needs to be URL encoded but SSL
> encrypted. I believe this makes a stronger case for using CURL, does it
> not? I also would mean that his hack code would not work.
>
> Correct me if I'm wrong?
>
> Warren Vail
>
> -----Original Message-----
> From: Lars Torben Wilson [mailto:torbenphp.net]
> Sent: Friday, July 16, 2004 12:32 PM
> To: Jeff Oien
> Cc: PHP
> Subject: [PHP] Re: Putting $_POST into string to send to ASP
>
> Jeff Oien wrote:
>
> > Dumb question, sorry if it's a repeat. I will use PHP for a form with
> > error checking. When there are no errors I need to send all the
> > variables thru something like this:
> >
> > $URL = "https://example.com/script.asp?First=Jim&Last=Smith";
> > urlencode($URL);
> > header("Location: $URL\n");
> >
> > How do I gather up all the variables in $_POST and attach them as a
> > string after the question mark? Thanks.
> > Jeff
>
> Try the http_build_query() function. If you don't have PHP 5, look in the
> user notes--someone appears to have written one for PHP 4 as well (the user
> note 21-Jun-2004 from 'brooklynphil'). I haven't tested either one.
>
> http://www.php.net/manual/en/function.http-build-query.php
>
> Using this, you could just do something like:
>
> $query_string = http_build_query($_POST);
>
> Hope this helps,
>
> Torben <torbenphp.net>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> !DSPAM:40f8402e320211411112355!
>
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


Another day another conundrum.

I have a form where one option is a dropdown menu. I'd like that menu to
only have items in it that are actually available. Selecting the items with
a query is easy enough but I wondered if anyone could tell me where to start
wit the code.

Am I using a for each again . . . ?

Any help greatly appreciated.

--
-----------------------------
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-----------------------------

attached mail follows:


> I have a form where one option is a dropdown menu. I'd like that menu to
> only have items in it that are actually available. Selecting the items with
> a query is easy enough but I wondered if anyone could tell me where to start
> wit the code.

I dont know what kind of db so I will just use mysql, this comes
almost straight from the manual http://us3.php.net/mysql:

$query = "SELECT * FROM my_table WHERE available";
$result = mysql_query($query) or die("Query failed : " . mysql_error());

/* Printing results in HTML */
echo "<select name=\"yourDropdownName\">\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
   echo "<option value=\"$line[itemnum]\">$line[itemname]</option>\n";
}
echo "</select>\n";

attached mail follows:


The exact implementation differs with your database system, but as an
example for MySQL:

 <select name="select" size="1">
<?php
    $result = mysql_query($query);
    while($row = mysql_fetch_assoc){
            echo("<option
value=\"{$row['name_of_value_field']}\">{$row['name_of_description_field']}<
/option>");
     }
?>
</select>

greetz,
Arnout

"Harlequin" <michael.masonarraspeople.co.uk> schreef in bericht
news:20040716191823.30635.qmailpb1.pair.com...
> Another day another conundrum.
>
> I have a form where one option is a dropdown menu. I'd like that menu to
> only have items in it that are actually available. Selecting the items
with
> a query is easy enough but I wondered if anyone could tell me where to
start
> wit the code.
>
> Am I using a for each again . . . ?
>
> Any help greatly appreciated.
>
> --
> -----------------------------
> Michael Mason
> Arras People
> www.arraspeople.co.uk
> -----------------------------

attached mail follows:


Hello List,

Does anybody got some information if there will be a Win32 Install Version
of PHP5 like it exists for 4.3.8 ?

Kind Regards,
-Ron

**Disclaimer: everything I post, will post and have posted, is subject to
change without reason; any errors in logic, math or spelling is to assumed
to be on purpose. By flaming me, you admit you are wrong.
The poster of this message takes no responsibility for any deaths,
sicknesses, annoyences, pains or pregnancies as a result of this post.**

attached mail follows:


Ron Stiemer wrote:

> Does anybody got some information if there will be a Win32 Install Version
> of PHP5 like it exists for 4.3.8 ?

Personally I simply don't see the point :)
Unzip the zip, tweak Apache and php.ini and I have what *I* want running
in minutes.
I don't want MySQL, I do use Apache2 so the installer is simply a waste
of effort ;)
No doubt someone who prefers a knobled version will do it though :)

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services

attached mail follows:


Hi,
I have following problem:
I use some numbers from mysql table and other local vars to calculate one
number.
But on one calc I receive thath $value=4.5474735088646E-013;
This must be zero (0) - I see all vars and calc then with calculator. I use
function number_format($value, 2, ".", "" ) and it return me -0.00

Can someone help me ?

Thanks in advance!
Rosen

attached mail follows:


Rosen wrote:

> I use some numbers from mysql table and other local vars to calculate one
> number.
> But on one calc I receive thath $value=4.5474735088646E-013;
> This must be zero (0) - I see all vars and calc then with calculator. I use
> function number_format($value, 2, ".", "" ) and it return me -0.00

When you use floating point numbers, you can get small errors like this.
To the computer, 4.54E-13 is about the same as zero. number_format()
returns the correct result... well, the negative sign may throw you off.
You can use abs() and round() to get what you want, more than likely.

The thing to remember and react accordingly to is that for floating
point numbers, 2.0 - 1.5 can equal 0.4999999999999999 and be "correct"
because of the precision.

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals www.phparch.com

attached mail follows:


Thanks !
abs() will not work for me, because I may have na negative numbers, but with
round() it worked !

10x

"John W. Holmes" <holmes072000charter.net> wrote in message
news:40F83F0A.6000501charter.net...
> Rosen wrote:
>
> > I use some numbers from mysql table and other local vars to calculate
one
> > number.
> > But on one calc I receive thath $value=4.5474735088646E-013;
> > This must be zero (0) - I see all vars and calc then with calculator. I
use
> > function number_format($value, 2, ".", "" ) and it return me -0.00
>
> When you use floating point numbers, you can get small errors like this.
> To the computer, 4.54E-13 is about the same as zero. number_format()
> returns the correct result... well, the negative sign may throw you off.
> You can use abs() and round() to get what you want, more than likely.
>
> The thing to remember and react accordingly to is that for floating
> point numbers, 2.0 - 1.5 can equal 0.4999999999999999 and be "correct"
> because of the precision.
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals www.phparch.com

attached mail follows:


I have to write a little function to convert a direction from degrees
to a compass -type heading. 0 = West. 90 = North. E.g.:

from:
135 degrees

to:
NW

Now, I was planning to write a series of if statements to evaluate e.g.,

if ($heading_degrees < 112.5 && $heading_degrees > 67.5) {
        $heading_compass = "N";
        }

The works, but it will require

N, NNW, NNE, NE, NW, ENE, NWW... many IF statements.

Can anyone think of a programatically more elegant and efficient way of
converting this type of data? (I suppose this is not really a problem,
just a curiosity.)

...Rene

attached mail follows:


In article <56B29E34-D776-11D8-BB8A-0003931DAC94renefournier.com>, Ren fournier wrote:
> I have to write a little function to convert a direction from degrees
> to a compass -type heading. 0 = West. 90 = North. E.g.:
>
> from:
> 135 degrees
>
> to:
> NW
>
> Now, I was planning to write a series of if statements to evaluate e.g.,
>
> if ($heading_degrees < 112.5 && $heading_degrees > 67.5) {
> $heading_compass = "N";
> }
>
> The works, but it will require
>
> N, NNW, NNE, NE, NW, ENE, NWW... many IF statements.
>
> Can anyone think of a programatically more elegant and efficient way of
> converting this type of data? (I suppose this is not really a problem,
> just a curiosity.)

Might need some corrections, but the idea should be clear:

function degrees2compass($degrees)
{
    $compass = array('N', 'NNW', 'NNE', 'NE', ...);
    $index = $heading_degrees / sizeof($compass);
    return $compass[$index];
}

Or you could use a switch

--
Tim Van Wassenhove <http://home.mysth.be/~timvw>

attached mail follows:


Here's a quick script I wrote for it:
<?php

$deg = $_GET['deg']; // get from URL, for testing atm

$deg %= 360; // make sure it doesn't break on eg 560 degrees

$deg = ((ceil(($deg-22.5)/45))*45+22.5); // break it up into parts we
know, there might be an easier way though, just too tired to see it.

switch($deg) {
     case 22.5:
         echo 'W';
         break;

     case 67.5:
         echo 'NW';
         break;

     case 112.5:
         echo 'N';
         break;

     case 157.5:
         echo 'NE';
         break;

     case 202.5:
         echo 'E';
         break;

     case 247.5:
         echo 'SE';
         break;

     case 292.5:
         echo 'S';
         break;

     case 337.5:
         echo 'SW';
         break;

     default:
         echo 'W';
         break;
}
?>
Ren fournier wrote:

> I have to write a little function to convert a direction from degrees to
> a compass -type heading. 0 = West. 90 = North. E.g.:
>
> from:
> 135 degrees
>
> to:
> NW
>
> Now, I was planning to write a series of if statements to evaluate e.g.,
>
> if ($heading_degrees < 112.5 && $heading_degrees > 67.5) {
> $heading_compass = "N";
> }
>
> The works, but it will require
>
> N, NNW, NNE, NE, NW, ENE, NWW... many IF statements.
>
> Can anyone think of a programatically more elegant and efficient way of
> converting this type of data? (I suppose this is not really a problem,
> just a curiosity.)
>
> ...Rene

attached mail follows:


Works beautifully. Thanks!

...Rene

On Friday, July 16, 2004, at 04:36 PM, Tim Van Wassenhove wrote:

> function degrees2compass($degrees)
> {
> $compass = array('N', 'NNW', 'NNE', 'NE', ...);
> $index = $heading_degrees / sizeof($compass);
> return $compass[$index];
> }

attached mail follows:


Well, isn't north really about 340 to 020 degrees? Looks like if you threw
in a factor.....

Warren Vail

-----Original Message-----
From: Ren Fournier [mailto:m5renefournier.com]
Sent: Friday, July 16, 2004 3:59 PM
To: Tim Van Wassenhove
Cc: php
Subject: Re: [PHP] Re: convert degrees to heading

Works beautifully. Thanks!

.Rene

On Friday, July 16, 2004, at 04:36 PM, Tim Van Wassenhove wrote:

> function degrees2compass($degrees)
> {
> $compass = array('N', 'NNW', 'NNE', 'NE', ...);
> $index = $heading_degrees / sizeof($compass);
> return $compass[$index];
> }

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

attached mail follows:


In article <72138202E59CD6118E960002A52CD9D211FAAB88n1025smx.nt.schwab.com>, Warren Vail wrote:
> Well, isn't north really about 340 to 020 degrees? Looks like if you threw
> in a factor.....

Well, modulo is a nice function. But i'm not the homework service :)

>
> Warren Vail
>
> -----Original Message-----
> From: Ren Fournier [mailto:m5renefournier.com]
> Sent: Friday, July 16, 2004 3:59 PM
> To: Tim Van Wassenhove
> Cc: php
> Subject: Re: [PHP] Re: convert degrees to heading
>
>
> Works beautifully. Thanks!
>
> .Rene
>
> On Friday, July 16, 2004, at 04:36 PM, Tim Van Wassenhove wrote:
>
>> function degrees2compass($degrees)
>> {
>> $compass = array('N', 'NNW', 'NNE', 'NE', ...);
>> $index = $heading_degrees / sizeof($compass);
>> return $compass[$index];
>> }
>

--
Tim Van Wassenhove <http://home.mysth.be/~timvw>

attached mail follows:


I have downloaded the latest .zip from source forge but it keeps
giving me "an error has occured when activating this view.." and hsow
the php browser.

eclipse 3.0, linux fedora core2, java 1.4.2_04-fcs

attached mail follows:


Hi Group,

Can anyone suggest me a tool for converting Tiff image
to JPEG image? Currently i am using the GD library for
manipulating images and i didn't see any function
which converts Tiff image to JPEG image. I notice
Imagmagic support this feature.

Please let me know if anyone has any idea about
selecting the proper tool.

Thanks,
Hardik

                
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/

attached mail follows:


If you find something, it's interesting me !!

Because of ASN1 encryption, it's hard to send a simple SNMP Trap
with somes lines of code.

"Alessandro Vitale" <avitaletiscali.com> a crit dans le message de
news:GMEMJFGPOBMNNAFALACFMEAKCLAA.avitaletiscali.com...
> Hi all,
> does anybody know any good library (class|script) for generating SNMP
traps
> wirtten in PHP?
> thanks in advance,
>
> A.
>
>
> ***************************************
> Alessandro Vitale
> Jr. Software Engineer
> Tiscali International Network Spa
> +39 070 4601678
> avitaletiscali.com
> ***************************************

attached mail follows:


So, I'm getting all these errors/warnings in PHP5 now saying that I have to
put the & on the function and not in the passing (which sorta makes sense
and puts the burden on the function rather than the user, which I like too).
So I spend the time to go and fix several thousand lines of code.

Then I start to see these other errors...

Maybe I'm missing something, but this seems like a glaring bug in passing by
reference that nobody caught...

say you have

        function foo(&$bar)
        {
        }

well that works great as long as you use it like

        foo($x);

but if you try

        foo("something here");
Or
        foo( array('a','b','c') );

it shits the bed. :-(

attached mail follows:


Maybe you recheck the dokumentation on what exactly referenzes are. Do
you expect the function to alter the string "something here" and every-
time you later print the string within your script you get the altered one?

ONLY variables can be passed by referenze !

  -- red

Daevid Vincent wrote:
> So, I'm getting all these errors/warnings in PHP5 now saying that I have to
> put the & on the function and not in the passing (which sorta makes sense
> and puts the burden on the function rather than the user, which I like too).
> So I spend the time to go and fix several thousand lines of code.
>
> Then I start to see these other errors...
>
> Maybe I'm missing something, but this seems like a glaring bug in passing by
> reference that nobody caught...
>
> say you have
>
> function foo(&$bar)
> {
> }
>
> well that works great as long as you use it like
>
> foo($x);
>
> but if you try
>
> foo("something here");
> Or
> foo( array('a','b','c') );
>
> it shits the bed. :-(

attached mail follows:


Maybe you recheck the dokumentation on what exactly referenzes are. Do
you expect the function to alter the string "something here" and every-
time you later print the string within your script you get the altered one?

ONLY variables can be passed by referenze !

  -- red

Daevid Vincent wrote:
> So, I'm getting all these errors/warnings in PHP5 now saying that I have to
> put the & on the function and not in the passing (which sorta makes sense
> and puts the burden on the function rather than the user, which I like too).
> So I spend the time to go and fix several thousand lines of code.
>
> Then I start to see these other errors...
>
> Maybe I'm missing something, but this seems like a glaring bug in passing by
> reference that nobody caught...
>
> say you have
>
> function foo(&$bar)
> {
> }
>
> well that works great as long as you use it like
>
> foo($x);
>
> but if you try
>
> foo("something here");
> Or
> foo( array('a','b','c') );
>
> it shits the bed. :-(

attached mail follows:


Yeah, I get what references are. The point is that when it was on the user
to decide, they could do it. Now that PHP5 makes you put the & in the
function declaration instead of the passing parameter, you don't know what
the user is going to send. Therefore it renders the & in the function
declaration a useless thing.

I could have this function

        Function add (&$a, &$b)
        {
           return ($a + $b);
        }

And as a user I could use it like so:

        $x = 5;
        $y = 10;
        add($x, $y);

Or I could also use it like this:

        add(5,10);

But since the function is now responsible in PHP5 to use the & [since
passing add(&$x, &$y); is now invalid], it makes my function add basically
useless.

> -----Original Message-----
> From: Red Wingate [mailto:redeyeerisx.de]
> Sent: Friday, July 16, 2004 5:35 PM
> To: php-generallists.php.net
> Subject: [PHP] Re: PHP5 and pass by reference bug.
>
> Maybe you recheck the dokumentation on what exactly
> referenzes are. Do
> you expect the function to alter the string "something here"
> and every-
> time you later print the string within your script you get
> the altered one?
>
> ONLY variables can be passed by referenze !
>
> -- red
>
> Daevid Vincent wrote:
> > So, I'm getting all these errors/warnings in PHP5 now
> saying that I have to
> > put the & on the function and not in the passing (which
> sorta makes sense
> > and puts the burden on the function rather than the user,
> which I like too).
> > So I spend the time to go and fix several thousand lines of code.
> >
> > Then I start to see these other errors...
> >
> > Maybe I'm missing something, but this seems like a glaring
> bug in passing by
> > reference that nobody caught...
> >
> > say you have
> >
> > function foo(&$bar)
> > {
> > }
> >
> > well that works great as long as you use it like
> >
> > foo($x);
> >
> > but if you try
> >
> > foo("something here");
> > Or
> > foo( array('a','b','c') );
> >
> > it shits the bed. :-(
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


But that function doesn't need to pass by reference. If you have a
function that has a parameter that is passed by ref, it should always
be a variable that is passed in. You should only be using pass by ref
when the function changes the value and it simply doesn't make sense
to change a "constant".

On Fri, 16 Jul 2004 18:03:08 -0700, Daevid Vincent <daeviddaevid.com> wrote:
> Yeah, I get what references are. The point is that when it was on the user
> to decide, they could do it. Now that PHP5 makes you put the & in the
> function declaration instead of the passing parameter, you don't know what
> the user is going to send. Therefore it renders the & in the function
> declaration a useless thing.
>
> I could have this function
>
> Function add (&$a, &$b)
> {
> return ($a + $b);
> }
>
> And as a user I could use it like so:
>
> $x = 5;
> $y = 10;
> add($x, $y);
>
> Or I could also use it like this:
>
> add(5,10);
>
> But since the function is now responsible in PHP5 to use the & [since
> passing add(&$x, &$y); is now invalid], it makes my function add basically
> useless.
>
>
>
>
> > -----Original Message-----
> > From: Red Wingate [mailto:redeyeerisx.de]
> > Sent: Friday, July 16, 2004 5:35 PM
> > To: php-generallists.php.net
> > Subject: [PHP] Re: PHP5 and pass by reference bug.
> >
> > Maybe you recheck the dokumentation on what exactly
> > referenzes are. Do
> > you expect the function to alter the string "something here"
> > and every-
> > time you later print the string within your script you get
> > the altered one?
> >
> > ONLY variables can be passed by referenze !
> >
> > -- red
> >
> > Daevid Vincent wrote:
> > > So, I'm getting all these errors/warnings in PHP5 now
> > saying that I have to
> > > put the & on the function and not in the passing (which
> > sorta makes sense
> > > and puts the burden on the function rather than the user,
> > which I like too).
> > > So I spend the time to go and fix several thousand lines of code.
> > >
> > > Then I start to see these other errors...
> > >
> > > Maybe I'm missing something, but this seems like a glaring
> > bug in passing by
> > > reference that nobody caught...
> > >
> > > say you have
> > >
> > > function foo(&$bar)
> > > {
> > > }
> > >
> > > well that works great as long as you use it like
> > >
> > > foo($x);
> > >
> > > but if you try
> > >
> > > foo("something here");
> > > Or
> > > foo( array('a','b','c') );
> > >
> > > it shits the bed. :-(
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> !DSPAM:40f878c7129391185556252!
>
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


Hi,

We have a web interface to do following:
1. login
2. check phone number (maybe thousands of)
3. logout.

I am just wondering is it possible to use a php script to simulate
the three steps? I understand that after login the web server will
send a cookie to browser, so in that way a session can be kept
at the visiter's end in correspondance to the web server. However
I have no idea is it possible for a script to simulate browser's
session handling?

Alex

attached mail follows:


On Fri, 16 Jul 2004 19:23:30 -0400, Alex Shi <chpshistonix.com> wrote:
> Hi,
>
> We have a web interface to do following:
> 1. login
> 2. check phone number (maybe thousands of)
> 3. logout.
>
> I am just wondering is it possible to use a php script to simulate
> the three steps? I understand that after login the web server will
> send a cookie to browser, so in that way a session can be kept
> at the visiter's end in correspondance to the web server. However
> I have no idea is it possible for a script to simulate browser's
> session handling?
>

Yep.
http://pear.php.net/package/HTTP_Client

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


> On Fri, 16 Jul 2004 19:23:30 -0400, Alex Shi <chpshistonix.com> wrote:
> > Hi,
> >
> > We have a web interface to do following:
> > 1. login
> > 2. check phone number (maybe thousands of)
> > 3. logout.
> >
> > I am just wondering is it possible to use a php script to simulate
> > the three steps? I understand that after login the web server will
> > send a cookie to browser, so in that way a session can be kept
> > at the visiter's end in correspondance to the web server. However
> > I have no idea is it possible for a script to simulate browser's
> > session handling?
> >
>
> Yep.
> http://pear.php.net/package/HTTP_Client
>
Thanks!
I downloaded the package and all its required dependencies.
But I'm still wondering that is it required to install pear to run
all these packages? We have PHP 4.3.0 and PHP 4.3.2.
Thanks in advance!

Alex

attached mail follows:


On Fri, 16 Jul 2004 20:38:22 -0400, Alex Shi <chpshistonix.com> wrote:
> > On Fri, 16 Jul 2004 19:23:30 -0400, Alex Shi <chpshistonix.com> wrote:
> > > Hi,
> > >
> > > We have a web interface to do following:
> > > 1. login
> > > 2. check phone number (maybe thousands of)
> > > 3. logout.
> > >
> > > I am just wondering is it possible to use a php script to simulate
> > > the three steps? I understand that after login the web server will
> > > send a cookie to browser, so in that way a session can be kept
> > > at the visiter's end in correspondance to the web server. However
> > > I have no idea is it possible for a script to simulate browser's
> > > session handling?
> > >
> >
> > Yep.
> > http://pear.php.net/package/HTTP_Client
> >
> Thanks!
> I downloaded the package and all its required dependencies.
> But I'm still wondering that is it required to install pear to run
> all these packages? We have PHP 4.3.0 and PHP 4.3.2.
> Thanks in advance!
>

Well, PEAR is generally installed with PHP. Try running:

pear install HTTP_Client

on the command-line.

Also:

pear upgrade-all

You don't *have* to "install" PEAR, you can just put everything in the
right directories manually. I do that at work. It's a pain....

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


Does anyone have a script to upload a directory full of files?

 

.something like a recursive upload.

 

Thanks,

Ryan

attached mail follows:


Ryan Schefke wrote:

> Does anyone have a script to upload a directory full of files?
>
> .something like a recursive upload.

Not going to happen with PHP and an HTML interface. If you have PHP
running on two machines and want to do this, then say so.

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals www.phparch.com

attached mail follows:


Ryan Schefke wrote:

>Does anyone have a script to upload a directory full of files?
>
>
>
Shameless plug: Rad Upload - http://www.radinks.com/upload/

>
>
>.something like a recursive upload.
>
>
yep.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


Ryan Schefke wrote:

>Does anyone have a script to upload a directory full of files?
>
>
>
>.something like a recursive upload.
>
>
>
>Thanks,
>
>Ryan
>
>
>
>
You can use a JavaApplet and php script to upload as many files as you
want. We have used one in our project.

yours,
xin

attached mail follows:


My goal is to parse apache log into a php piped program.

I need pcntl_alarm to launch some function, while reading stdin.

When exiting of pcntl_alarm function handler, i loose STDIN,
php say it's a valid resource, but feof found, since data continu
to be send into the pipe.

With php5-rc1 it was working, using fopen("php://stdin","r");
With php5-rc2,rc3,0.0.0, it doesn't work, using STDIN

I think it's a bug but i'm not sure, please correct me if a make
a nonsense.

- You will find php sample code at http://exeprod.com/test_cli_signal.txt

- To use it you just make something like that :
 while :; do date; sleep 1; done | /usr/local/bin/php test_cli_signal.php

- It will give you output like :
sam jui 17 01:29:48 CEST 2004
sam jui 17 01:29:49 CEST 2004
sam jui 17 01:29:50 CEST 2004
je passe dans sig_handler (14) <-- sig_handler() function
Already reading from stdin <-- read_stdin() function
exiting read_stdin()
STDIN: Resource id #1
is_resource(STDIN)=1

Any help will be very appreciated.
Critical for me

Thanks in advanced.

attached mail follows:


Hello all,

I need to read lines within a text file that might have a "
value='somevalue' " string the position of "value=" varies from line to
line but there's only one "value=" in each line.

So what I need to do is to parse the file and find the "value=" and put
their values in an array.

Suposse I have the following text file with 3 lines :

snLADEFEFfdgvalue="1234"rwgjngrgj
value="23456"gkerlgwg
132fngdhbvalue="5678"bfl928

I would like to get an array like this:

array[0] = 1234;
array[1] = 23456;
array[2] = 5678;

The value is delimited always by double quotes but its position on the
line varies. I need to extract these values and put them on a string.

Any ideas or help is appreciated.

Thanks in advance.

attached mail follows:


preg_match_all('/value="(.*?)"/', file_get_contents('textFile.txt'), $matches);

print_r($matches[1]);

On Fri, 16 Jul 2004 18:08:12 -0600, C.F. Scheidecker Antunes
<nandoantunes.eti.br> wrote:
> Hello all,
>
> I need to read lines within a text file that might have a "
> value='somevalue' " string the position of "value=" varies from line to
> line but there's only one "value=" in each line.
>
> So what I need to do is to parse the file and find the "value=" and put
> their values in an array.
>
> Suposse I have the following text file with 3 lines :
>
> snLADEFEFfdgvalue="1234"rwgjngrgj
> value="23456"gkerlgwg
> 132fngdhbvalue="5678"bfl928
>
> I would like to get an array like this:
>
> array[0] = 1234;
> array[1] = 23456;
> array[2] = 5678;
>
> The value is delimited always by double quotes but its position on the
> line varies. I need to extract these values and put them on a string.
>
> Any ideas or help is appreciated.
>
> Thanks in advance.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> !DSPAM:40f86d1f101301866793913!
>
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


C.F. Scheidecker Antunes wrote:

> Hello all,
>
> I need to read lines within a text file that might have a "
> value='somevalue' " string the position of "value=" varies from line to
> line but there's only one "value=" in each line.
>
> So what I need to do is to parse the file and find the "value=" and put
> their values in an array.
>
> Suposse I have the following text file with 3 lines :
>
> snLADEFEFfdgvalue="1234"rwgjngrgj
> value="23456"gkerlgwg
> 132fngdhbvalue="5678"bfl928
>
> I would like to get an array like this:
>
> array[0] = 1234;
> array[1] = 23456;
> array[2] = 5678;
>
> The value is delimited always by double quotes but its position on the
> line varies. I need to extract these values and put them on a string.

$file = file_get_contents('yourfile.txt');
preg_match_all('/value="([^"]*)"/',$file,$matches);

Now $matches[1] will have what you're after.

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals www.phparch.com

attached mail follows:


C.F. Scheidecker Antunes wrote:
> Hello all,
>
> I need to read lines within a text file that might have a "
> value='somevalue' " string the position of "value=" varies from line to
> line but there's only one "value=" in each line.
>
> So what I need to do is to parse the file and find the "value=" and put
> their values in an array.

http://www.php.net/parse_ini_file

Not sure if this is what you're doing exactly, but if this is a settings / ini
file you're creating then you can also use parse_ini_file. It'll allow you to
create files like the php.ini and parse the values, in your case:

-----------test.ini----------

; I am a comment to tell you what snLADEFEFfdgvalue means
snLADEFEFfdgvalue="1234"rwgjngrgj
value="23456"gkerlgwg
132fngdhbvalue="5678"bfl928

-----------test.php----------
<?php

$settings = parse_ini_file('test.ini');

?>

attached mail follows:


Hello all,

I need some help on the following:

I need to extract a paragraph from a text file that is delimited with a
--start-paragraph-- and --end-paragraph-- However, after
--start-paragraph-- there's a blank line that I need to remove.

The delimiter --start-paragraph-- might be one the first line or it
might be on any middle line of the line. That is, --start-paragraph line
starts at some point on the file.

Here's na example:

--start-paragraph--

This is a paragraph that I need to extract with a php function and
return just
the string of it.
--end-paragraph--

After I run the function extract_paragraph($content) I should get the
string:

"This is a paragraph that I need to extract with a php function and
return just
the string of it."

Thanks for the help.

attached mail follows:


C.F. Scheidecker Antunes wrote:

> Hello all,
>
> I need some help on the following:
>
> I need to extract a paragraph from a text file that is delimited with a
> --start-paragraph-- and --end-paragraph-- However, after
> --start-paragraph-- there's a blank line that I need to remove.
>
> The delimiter --start-paragraph-- might be one the first line or it
> might be on any middle line of the line. That is, --start-paragraph line
> starts at some point on the file.
>
> Here's na example:
>
> --start-paragraph--
>
> This is a paragraph that I need to extract with a php function and
> return just
> the string of it.
> --end-paragraph--
>
> After I run the function extract_paragraph($content) I should get the
> string:

function extract_paragraph($content)
{
   $start = '--start-paragraph--';
   $end = '--end-paragraph--';
   preg_match("/$start(.*)$end/s",$content,$matches);
   return trim($matches[1]);
}

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals www.phparch.com

attached mail follows:


the setting is removed from php.ini , How can we integrate them in PHP5 ?

attached mail follows:


"Ed Lazor" <Ed.Lazord20News.com> wrote in message news:php.general-190561news.php.net...
> You're seeing raw data and need to specify the mime type with headers. Search the mailing list archive, there's a few example
scripts in there. Just keep in mine that you need to create a separate script that handles the display of images.
>
>
>
> > Thanks, that seems to work. Although trying to retrieve them and show them
> > in a browser shows characters / symbols instead. This
> > kind of stuff:
> >
> > jw4ܭqHQI'?e""D[?A\ `*[#?j q6"]Q.b O(YO:9-"Ҫ(K\'
> > ZEbXW(e
> > 9>pEXZal˵m8=~{xf Lye(Z5O PP?<3>a -
> > ?o XSD ~J
> > VиܶF&7s c[3b"C&E 
>

I've been playing with this for two days and am wondering if there's a way to retrieve and display the images in a browser using
only php or is it necessary to use a graphics library like GD?

attached mail follows:


Five wrote:

> I've been playing with this for two days and am wondering if there's a way to retrieve and display the images in a browser using
> only php or is it necessary to use a graphics library like GD?

You don't need GD unless you want to modify the image (and even then
there are other options).

--
---John Holmes...

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

php|architect: The Magazine for PHP Professionals www.phparch.com

attached mail follows:


>
>
>
>I've been playing with this for two days and am wondering if there's a way to retrieve and display the images in a browser using
>only php or is it necessary to use a graphics library like GD?
>
>
The approach that an overwhelming majority of PHP developers (and other
developers for that matter) use is to simply store the image on the
file system. If these images are part of a web application you can then
store a reference to the image in the database (ie: the filename only).
Then all you need to do is to query the database and use the result in
an <img src='...'> nothing could be simpler.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


"Raditha Dissanayake" <jabberraditha.com> wrote in message news:40F894B4.2030001raditha.com...

> The approach that an overwhelming majority of PHP developers (and other
> developers for that matter) use is to simply store the image on the
> file system. If these images are part of a web application you can then
> store a reference to the image in the database (ie: the filename only).

Yes, I understand that, but for some reason I want to learn both ways : )
Anyhow, it's finally working (woohoo!) so thanks again everyone for your help.

Dale

attached mail follows:


* Thus wrote Manuel Lemos:
> Hello,
>
> On 07/15/2004 10:25 PM, Jordi Canals wrote:
> >Dennis Gearon wrote:
> >
> > > remove carriage returns to prevent embedded email directives
> >
> >In an other thread, I readed that sentence. I'm interested to find more
> >information about that. I have some mail forms and want to make them as
> >secure and possible, but do not know about what and where should I filter.
> >
> >Should I filter all CR and LF Just in headers or also I should do that
> >in the message body? (Which is sent in the SMTP DATA section).
>
> For SMTP, all lines should be ended with CR+LF, or else messages may be
> discarded by spam filters or other programs. However, if you use the
> mail() function it may do some filtering on its own.

The mail() function does not do any filtering.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


Manuel Lemos wrote:
> Hello,
>
> On 07/15/2004 10:25 PM, Jordi Canals wrote:
>
>> > remove carriage returns to prevent embedded email directives
>>
>> Should I filter all CR and LF Just in headers or also I should do that
>> in the message body? (Which is sent in the SMTP DATA section).
>
> Anyway, you may want to take a look at this SMTP class to check how it
> filters message lines sent by SMTP:
>
> http://www.phpclasses.org/smtpclass
>
Thanks, Really this class will be really usefull.
Jordi.

attached mail follows:


Hello,

On 07/16/2004 10:49 PM, Curt Zirzow wrote:
>>>>remove carriage returns to prevent embedded email directives
>>>
>>>In an other thread, I readed that sentence. I'm interested to find more
>>>information about that. I have some mail forms and want to make them as
>>>secure and possible, but do not know about what and where should I filter.
>>>
>>>Should I filter all CR and LF Just in headers or also I should do that
>>>in the message body? (Which is sent in the SMTP DATA section).
>>
>>For SMTP, all lines should be ended with CR+LF, or else messages may be
>>discarded by spam filters or other programs. However, if you use the
>>mail() function it may do some filtering on its own.
>
>
> The mail() function does not do any filtering.

Read the source first to learn more about it.

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

attached mail follows:


* Thus wrote John W. Holmes:
> Andrew Wood wrote:
> >Thanks. When it says 'the last insert' is that just the last insert my
> >PHP script did, or the last insert on the DB as a whole?
>
> Read the links Daniel just sent out.
 
And take care in reading the part about it returning the 'last
insert id' on the last successful insert.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


On Friday 16 July 2004 20:21, Rory McKinley wrote:

> I am currently trying to check for the absence of certain substrings
> within larger strings using
> regular expressions. I know that I could use on of the string functions,
> but in the interests of
> flexibility I must use a regexp match of some shape or variety. Up until
> now,

Could you explain why you need flexibility?

> An example of my problem:
>
> I need to check that the substring " R" (that's a space followed by an
> uppercase R) is not contained within my haystack.

A simple strpos() would suffice.

> E.g. Whatever pattern I match, if I match it against the following
> haystacks:
>
> "Blah Blah R 99.99" or "Blah Blah R99.99" it should return negative
> (i.e. the substring is contained within the haystack)
>
> while
>
> "Blah Blah 99.99CR" should return positive (i.e. the substring is not
> within the haystack).

TRUE/FALSE can easily be reversed using !.

--
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
------------------------------------------
/*
All of a sudden, I want to THROW OVER my promising ACTING CAREER, grow
a LONG BLACK BEARD and wear a BASEBALL HAT!! ... Although I don't know WHY!!
*/

attached mail follows:


I'm running into a problem where imagecreatefromjpeg fails and gives me
a warning like this:

Warning: imagecreatefromjpeg(): 'albums/userpics/10001/dave_sharath.jpg'
is not a valid JPEG file in
/homepages/32/d91926016/htdocs/photos/include/picmgmt.inc.php on line
202

The file in question is a valid jpeg, I've loaded it without problems in
a number of viewers.

I've checked phpinfo for GD support and its there, version 2.0 or
higher. PHP version is 4.3.6. To see phpinfo visit
http://yogadex.org/test.php

The code in question works on images whose file size is below some
threshold but I'm not certain what the threshold is. That is, it works
on small files, fails on all large files. The file in my example above
is 815384 bytes.

I'm using Coppermine 1.3.0. So I didn't write the code myself, but
Coppermine is open source so I'm able to see what's going on. And like
I said everything works fine when the images are smaller, so I'm
confident the issue is somehow related to image file size.

Thanks in advance for any help.

-Dave
--
  
  tmp1000fastmail.fm

attached mail follows:


tmp1000fastmail.fm wrote:

>I'm running into a problem where imagecreatefromjpeg fails and gives me
>a warning like this:
>
>Warning: imagecreatefromjpeg(): 'albums/userpics/10001/dave_sharath.jpg'
>is not a valid JPEG file in
>/homepages/32/d91926016/htdocs/photos/include/picmgmt.inc.php on line
>202
>
>
>
Hav you had luck running the script from the command line? if that works
for you it could be that you are hitting the memory limits for your php
scripts. A JPEG when loaded in memory could take up more memory than
the size of the file.

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.

attached mail follows:


Script:
<?php
mail('wudicgihotmail.com', 'Subject', 'Message', "From: wudicgiseoul.com");
?>

Result:
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in D:\ApacheData\htdocs\downloader\mail.php on line 2

Why does the mail() not work?
How can I send a e-mail without SMTP?
------------------------------------------------------------------------
Comment: English is not my first language.
Wudi <wudicgiseoul.com>