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 10 Feb 2004 17:55:08 -0000 Issue 2582

php-general-digest-helplists.php.net
Date: Tue Feb 10 2004 - 11:55:08 CST


php-general Digest 10 Feb 2004 17:55:08 -0000 Issue 2582

Topics (messages 177252 through 177300):

SESSION VARIABLES
        177252 by: Ronald Ramos
        177253 by: Adam Bregenzer
        177259 by: Adam Bregenzer
        177261 by: Adam Bregenzer

Linked Table Structure
        177254 by: Sajid
        177268 by: Eric Bolikowski
        177283 by: Sajid
        177294 by: Adam Bregenzer
        177296 by: Sajid

Zero Sized Reply
        177255 by: Deependra b. Tandukar
        177266 by: Eric Bolikowski

speeding up PHP
        177256 by: merlin
        177258 by: Manuel Lemos
        177260 by: Galen
        177276 by: Paul Furman

Re: mnoGoSearch on Windows?
        177257 by: David Robley

reading remote page content
        177262 by: Hamid Hossain
        177269 by: Eric Bolikowski

mysql functions
        177263 by: Angelo Zanetti
        177264 by: Hamid Hossain
        177265 by: Eric Bolikowski
        177279 by: John W. Holmes

Poor error handling in Postgres API?
        177267 by: Geoff Caplan

PHPINIDir in Apache 1.x, extension/zend_extension in php_admin_value
        177270 by: David Garamond
        177273 by: David Garamond

unset Fuction
        177271 by: JohnT
        177274 by: Paul Furman
        177275 by: Oschlies Dirk (Praktikant FV/SLH)

adduser.exe
        177272 by: Christian Jancso
        177278 by: Raditha Dissanayake
        177280 by: Stuart
        177284 by: Christian Jancso
        177289 by: Stuart
        177290 by: Christian Jancso

Re: file downloads using header problem
        177277 by: memoimyself.yahoo.com.br

counting downloaded files
        177281 by: Adriaan Nel
        177288 by: Marek Kilimajer
        177291 by: Adriaan Nel
        177297 by: Marek Kilimajer

Re: writing a manual
        177282 by: David T-G

Re: CURL and Cookies
        177285 by: jon roig

parse error, unexpected $
        177286 by: Bruno Mattarollo
        177287 by: Raditha Dissanayake

Re: Using exceptions to write more perfect software ...
        177292 by: Markus Fischer

Re: XML and Excel
        177293 by: Phillip Jackson

Re: excel output question
        177295 by: Phillip Jackson

Working with a Front Page developer
        177298 by: Chris de Vidal

PHP and binding to Port as a certain user
        177299 by: Dan Aloma

ereg_replace
        177300 by: Nicole Lallande

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:


Hi All,

I've created 3 sample scripts, pls see below.
My problem is that page3.php can't display the value $username and
$password
Or is it because it the variables were not importe to that page, that's
why
$username and $password has no value? If it is, how can I import it?

Thank you

--------- login.php -------------

<html>

<body>

<form method="POST" action="auth.php">
  <p>
  USERNAME: <input type="text" name="uname" size="20"></p>
  <p>PASSWORD: <input type="password" name="passwd" size="20"></p>
  <p><input type="submit" value="Login" name="login"></p>
</form>
</body>

</html>

---------- auth.php -------------

<?php

$username = $_POST[uname];
$password = $_POST[passwd];

session_start();

if ($username == "ronald" AND $password == "ronald") {

session_register("username");
session_register("password");

echo"<html>

<head>
<script language=\"javascript\">

function bukas() {
window.open(\"page3.php\",\"_new\");
};
</script>
</head>
<body onload=\"bukas();\">
<p>$username
</body>
</html>";
}

else {
        echo "INVALID, TRY AGAIN";
};
?>

--------------- page3.php --------------------------

<?php

echo "$username";
echo "#password";

?>

attached mail follows:


On Tue, 2004-02-10 at 00:43, Ronald Ramos wrote:
> Hi All,
>
> I've created 3 sample scripts, pls see below.
> My problem is that page3.php can't display the value $username and
> $password
> Or is it because it the variables were not importe to that page, that's
> why
> $username and $password has no value? If it is, how can I import it?

You need to have session_start() at the top of the third script as
well. Also you have a typo:
> echo "#password";

should be:
echo "$password";

Consider using $_SESSION[1] instead of session_register[2].

[1] http://www.php.net/reserved.variables#reserved.variables.session
[2] http://www.php.net/session_register

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

attached mail follows:


On Tue, 2004-02-10 at 02:45, Ronald Ramos wrote:
> $_SESSION['username'];
> $_SESSION['password'];

Close, try this instead:
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;

> I edited page3.php but it still shows me nothing.

It looks great, now you just need to clear up your use of the $_SESSION
variable in page2.php.

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

attached mail follows:


On Tue, 2004-02-10 at 03:13, Ronald Ramos wrote:
> It Worked. Thanks Man!
> So I can use this to any other page?

Awesome! You have access to the $_SESSION variables on any php page on
the same server. Just make sure you call session_start() before you
access the $_SESSION array.

> Let's say I have two users, first one logged in, using ronald as
> username, while user ronald is still logged-in
> User nhadie also logged-in from somewhere, will the value of $username
> of user ronald be changed to nhadie?

No, with sessions there will essentially be multiple values for the
variables, one for each session. When a user requests a page their
session id will be used to set the correct values in the $_SESSION
array. For example, when ronald loads the page $_SESSION['username']
will be ronald. When nhadie loads the page the $_SESSION['username']
variable will be nahdie.

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

attached mail follows:


HI,

I have a problem.

I dont know how to create tables for this in PHPMYADMIN, the situation is
like this:

I have to display lot of items on the screen.

There are three Datagrids on the screen (I am using Flash for this so if i
get the database structure right, i will be able to take care of the rest of
the scripting to returning data from database.).

Lets say the three DataGrids are called:

DG1, DG2 and DG3

DG1 displays the list of CONTINENTS like (Norht America, Asia, South
America, Australia etc.)

If you click any region in DG1, DG2 gets populated with list of countries
(like USA, Canada, Mexico... etc.)

At the same time, when i have clicked a CONTINENT in DG1, an image of the
CONTINENT is displayed on the screen.

Now, If i click on any Country in DG2, DG3 is getting populated with a ist
of Clubs (like Club1, Club2, Club3 etc.)

At the same time, An image of the country and a description of the country
are displayed on the screen.

again, if i click on any CLUB, it displays a Image, description and URL of
the CLUB.

I dont know what the DATABASE STRUCTURE shold look like for this. I know
there has to be some kind of LINKING between the tables but i dont know
HOW..... :(

I have been trying few things but without any success :(

-------------------------------------------------------
The DG1 field will be:
Continent_Name | Continent_Image | Continent_Text

The DG2 fields will be:
Country_Name | Country_Image | Country_Text

The DG3 fields will be:
Club_Name | Club_Image | Club_Text | Club_Url
-------------------------------------------------------

Can anyone show me the Sql for such a table structure?

attached mail follows:


"Sajid" <sajidsdigitalthink.com> wrote in message
news:20040210055812.67303.qmailpb1.pair.com...
> HI,
>
> I have a problem.
>
> I dont know how to create tables for this in PHPMYADMIN, the situation is
> like this:
>
> I have to display lot of items on the screen.
>
> There are three Datagrids on the screen (I am using Flash for this so if i
> get the database structure right, i will be able to take care of the rest
of
> the scripting to returning data from database.).
>
> Lets say the three DataGrids are called:
>
> DG1, DG2 and DG3
>
> DG1 displays the list of CONTINENTS like (Norht America, Asia, South
> America, Australia etc.)
>
> If you click any region in DG1, DG2 gets populated with list of countries
> (like USA, Canada, Mexico... etc.)
>
> At the same time, when i have clicked a CONTINENT in DG1, an image of the
> CONTINENT is displayed on the screen.
>
> Now, If i click on any Country in DG2, DG3 is getting populated with a ist
> of Clubs (like Club1, Club2, Club3 etc.)
>
> At the same time, An image of the country and a description of the country
> are displayed on the screen.
>
> again, if i click on any CLUB, it displays a Image, description and URL of
> the CLUB.
>
> I dont know what the DATABASE STRUCTURE shold look like for this. I know
> there has to be some kind of LINKING between the tables but i dont know
> HOW..... :(
>
> I have been trying few things but without any success :(
>
> -------------------------------------------------------
> The DG1 field will be:
> Continent_Name | Continent_Image | Continent_Text
>
> The DG2 fields will be:
> Country_Name | Country_Image | Country_Text
>
> The DG3 fields will be:
> Club_Name | Club_Image | Club_Text | Club_Url
> -------------------------------------------------------
>
> Can anyone show me the Sql for such a table structure?

Hi Sajid

It seems like the Country in some manner has to be a undercategory for the
continent, and the club a undercategory for the Country.

A way you could do this, is to set up the tables like this:

DG1:
Continent_Id | Continent_Name | Continent_Image | Continent_Text

DG2: Country_Id | Continent_Id | Country_Name | Country_Image | Country_Text

DG3: Club_Id | Country_Id | Club_Name | Club_Image | Club_Text | Club_Url

The id fields should be datatype INT, name and Url something like
varchar(100), the text tinytext, and the images BLOB.

What you could do is when the user first comes you run this query: "SELECT
Continent_Id, Continent_Name FROM DG1". If you want to grab the text too you
could just add Continent_Text in the query. To get the image, I would
recommend some kind of file that gets the Content_Id and, gets the image,
and prints it out.
Now, when you display all of your continents(up to you), you should make
them a link to the same file, but now giving a Continent_Id to the the file.
Now, let's simulate someone clicked Europa, and that has a Continent_Id of
4.
Then we go to the following file: foo.php?op=continent&id=4.

Here we can run this query: "SELECT Continent_Name, Country_Id, Country_Name
FROM DG2 WHERE Continent_Id = {$_GET['id']}".
What we simply get here, is all the countries that are in the continent
Europa, with the id 4 in DG1.

Now we get the list, and you display that too.
What you can do now, is too display links to the next step: showing the
clubs.

Let's say we want to take a look at France, and that country has 9 as a
Country_Id.
Now let's say we're at the following file: foo.php?op=clubs&id=9

Now we can run the following query: "SELECT Club_Id, Club_Name, Club_Url
FROM DG3 WHERE Country_Id = {$_GET['id']}".
Here we get all the clubs in France.

I hope this was something helpful.
Would be glad too demonstrate how to get the Country name and the Continent
name while showing the club, but i think you're albe to sort this out now!

Eric

attached mail follows:


Hi,
Thanks for your help.
But what i feel is that this is a more tedious process to achieve what i
want to.
What will happen in this is that i have to enter proper Continent ID and
Country ID in both Country and Club tables respectively.
For that i have to go and check that these ID's are in the other tables.

I was looking for something to do with Linked Tables.
Can anyone show me an example of how this can be done using Linked Tables?

Thanks
sajid

"Eric Bolikowski" <ericexonite.com> wrote in message
news:20040210113855.80294.qmailpb1.pair.com...
> "Sajid" <sajidsdigitalthink.com> wrote in message
> news:20040210055812.67303.qmailpb1.pair.com...
> > HI,
> >
> > I have a problem.
> >
> > I dont know how to create tables for this in PHPMYADMIN, the situation
is
> > like this:
> >
> > I have to display lot of items on the screen.
> >
> > There are three Datagrids on the screen (I am using Flash for this so if
i
> > get the database structure right, i will be able to take care of the
rest
> of
> > the scripting to returning data from database.).
> >
> > Lets say the three DataGrids are called:
> >
> > DG1, DG2 and DG3
> >
> > DG1 displays the list of CONTINENTS like (Norht America, Asia, South
> > America, Australia etc.)
> >
> > If you click any region in DG1, DG2 gets populated with list of
countries
> > (like USA, Canada, Mexico... etc.)
> >
> > At the same time, when i have clicked a CONTINENT in DG1, an image of
the
> > CONTINENT is displayed on the screen.
> >
> > Now, If i click on any Country in DG2, DG3 is getting populated with a
ist
> > of Clubs (like Club1, Club2, Club3 etc.)
> >
> > At the same time, An image of the country and a description of the
country
> > are displayed on the screen.
> >
> > again, if i click on any CLUB, it displays a Image, description and URL
of
> > the CLUB.
> >
> > I dont know what the DATABASE STRUCTURE shold look like for this. I know
> > there has to be some kind of LINKING between the tables but i dont know
> > HOW..... :(
> >
> > I have been trying few things but without any success :(
> >
> > -------------------------------------------------------
> > The DG1 field will be:
> > Continent_Name | Continent_Image | Continent_Text
> >
> > The DG2 fields will be:
> > Country_Name | Country_Image | Country_Text
> >
> > The DG3 fields will be:
> > Club_Name | Club_Image | Club_Text | Club_Url
> > -------------------------------------------------------
> >
> > Can anyone show me the Sql for such a table structure?
>
> Hi Sajid
>
> It seems like the Country in some manner has to be a undercategory for the
> continent, and the club a undercategory for the Country.
>
> A way you could do this, is to set up the tables like this:
>
> DG1:
> Continent_Id | Continent_Name | Continent_Image | Continent_Text
>
> DG2: Country_Id | Continent_Id | Country_Name | Country_Image |
Country_Text
>
> DG3: Club_Id | Country_Id | Club_Name | Club_Image | Club_Text | Club_Url
>
> The id fields should be datatype INT, name and Url something like
> varchar(100), the text tinytext, and the images BLOB.
>
> What you could do is when the user first comes you run this query: "SELECT
> Continent_Id, Continent_Name FROM DG1". If you want to grab the text too
you
> could just add Continent_Text in the query. To get the image, I would
> recommend some kind of file that gets the Content_Id and, gets the image,
> and prints it out.
> Now, when you display all of your continents(up to you), you should make
> them a link to the same file, but now giving a Continent_Id to the the
file.
> Now, let's simulate someone clicked Europa, and that has a Continent_Id of
> 4.
> Then we go to the following file: foo.php?op=continent&id=4.
>
> Here we can run this query: "SELECT Continent_Name, Country_Id,
Country_Name
> FROM DG2 WHERE Continent_Id = {$_GET['id']}".
> What we simply get here, is all the countries that are in the continent
> Europa, with the id 4 in DG1.
>
> Now we get the list, and you display that too.
> What you can do now, is too display links to the next step: showing the
> clubs.
>
> Let's say we want to take a look at France, and that country has 9 as a
> Country_Id.
> Now let's say we're at the following file: foo.php?op=clubs&id=9
>
> Now we can run the following query: "SELECT Club_Id, Club_Name, Club_Url
> FROM DG3 WHERE Country_Id = {$_GET['id']}".
> Here we get all the clubs in France.
>
> I hope this was something helpful.
> Would be glad too demonstrate how to get the Country name and the
Continent
> name while showing the club, but i think you're albe to sort this out now!
>
> Eric
>
>

attached mail follows:


On Tue, 2004-02-10 at 09:49, Sajid wrote:
> > A way you could do this, is to set up the tables like this:
> >
> > DG1:
> > Continent_Id | Continent_Name | Continent_Image | Continent_Text
> >
> > DG2: Country_Id | Continent_Id | Country_Name | Country_Image |
> Country_Text
> >
> > DG3: Club_Id | Country_Id | Club_Name | Club_Image | Club_Text | Club_Url
>
> Thanks for your help.
> But what i feel is that this is a more tedious process to achieve what i
> want to.
> What will happen in this is that i have to enter proper Continent ID and
> Country ID in both Country and Club tables respectively.
> For that i have to go and check that these ID's are in the other tables.
>
> I was looking for something to do with Linked Tables.
> Can anyone show me an example of how this can be done using Linked Tables?

You can write an admin interface to manage adding the rows to your
tables if you don't want to do it manually. This seems like as close to
a linked list as you are going to get: each item in the child table has
a link (id column) to it's parent. You reference that to find
children/parents. This is generally the way relational databases are
structured. Maybe if you expand on what you mean by a linked list we
can provide a different answer.

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

attached mail follows:


I am not aware of linked tables too much, is this what is called linked
table?

Do i have to enter values on both tables to link them? Or can some columns
of one table be linked with columns of another table in some other way?

If no, then thanks for all who helped me :)

--sajid

"Adam Bregenzer" <adambregenzer.net> wrote in message
news:1076431365.2365.243.camelarcon...
> On Tue, 2004-02-10 at 09:49, Sajid wrote:
> > > A way you could do this, is to set up the tables like this:
> > >
> > > DG1:
> > > Continent_Id | Continent_Name | Continent_Image | Continent_Text
> > >
> > > DG2: Country_Id | Continent_Id | Country_Name | Country_Image |
> > Country_Text
> > >
> > > DG3: Club_Id | Country_Id | Club_Name | Club_Image | Club_Text |
Club_Url
> >
> > Thanks for your help.
> > But what i feel is that this is a more tedious process to achieve what i
> > want to.
> > What will happen in this is that i have to enter proper Continent ID and
> > Country ID in both Country and Club tables respectively.
> > For that i have to go and check that these ID's are in the other tables.
> >
> > I was looking for something to do with Linked Tables.
> > Can anyone show me an example of how this can be done using Linked
Tables?
>
> You can write an admin interface to manage adding the rows to your
> tables if you don't want to do it manually. This seems like as close to
> a linked list as you are going to get: each item in the child table has
> a link (id column) to it's parent. You reference that to find
> children/parents. This is generally the way relational databases are
> structured. Maybe if you expand on what you mean by a linked list we
> can provide a different answer.
>
> --
> Adam Bregenzer
> adambregenzer.net
> http://adam.bregenzer.net/

attached mail follows:


Dear all,

The script was working perfectly, but all of the sudden since last week
stopped working, gives Zero Sized Reply. The site is
http://coremag.net/corex/feedback/feedback.htm

Can anybody tell me what is the problem. Below is the page I get when
submit the form:

ERROR
The requested URL could not be retrieved

While trying to retrieve the URL:
http://coremag.net/corex/feedback/feedback.php

The following error was encountered:
Zero Sized Reply

Squid did not receive any data for this request.

Your cache administrator is webmaster.

Generated Tue, 10 Feb 2004 06:05:32 GMT by cache3.mos.com.np
(squid/2.5.STABLE3)

Regards,
DT

attached mail follows:


Some source code would help....

"Deependra B. Tandukar" <deepndraicimod.org.np> wrote in message
news:5.1.0.14.2.20040210114818.036b8ba8menris1.icimod.org.np...
> Dear all,
>
> The script was working perfectly, but all of the sudden since last week
> stopped working, gives Zero Sized Reply. The site is
> http://coremag.net/corex/feedback/feedback.htm
>
> Can anybody tell me what is the problem. Below is the page I get when
> submit the form:
>
> ERROR
> The requested URL could not be retrieved
>
> While trying to retrieve the URL:
> http://coremag.net/corex/feedback/feedback.php
>
> The following error was encountered:
> Zero Sized Reply
>
> Squid did not receive any data for this request.
>
> Your cache administrator is webmaster.
>
> Generated Tue, 10 Feb 2004 06:05:32 GMT by cache3.mos.com.np
> (squid/2.5.STABLE3)
>
> Regards,
> DT

attached mail follows:


Hi there,

I do have a performance question regarding php processing. There are
some sites on the net like google, heise and others which are incredible
fast in response time. Of course companies like google are running
totally other systems, but there are smaller sites and companies doing
almost the same verry fast page delivery.

Now I am wondering how this is possible on a LAMP application. My site
is not slow, but also not fast. I was reading about php accellerator.
Can anybody recommend this tool, is it complicated to install and
configure? Are there any speed gains and are ther tools to messure the
page delivery times?

Thank you for any information on that.

regards,

merlin

attached mail follows:


Hello,

On 02/09/2004 11:36 PM, Merlin wrote:
> I do have a performance question regarding php processing. There are
> some sites on the net like google, heise and others which are incredible
> fast in response time. Of course companies like google are running
> totally other systems, but there are smaller sites and companies doing
> almost the same verry fast page delivery.
>
> Now I am wondering how this is possible on a LAMP application. My site
> is not slow, but also not fast. I was reading about php accellerator.
> Can anybody recommend this tool, is it complicated to install and
> configure? Are there any speed gains and are ther tools to messure the
> page delivery times?

Most details about Google and other sites speed do not have much to do
the actual code that generates the pages. For instance, they use
distributed data centers and DNS around the world to make the servers
that you actually access be closer to you and start serving pages sooner.

They also use compressed pages to reduce the actual size of the
information that is transferred. You can use compression of pages in PHP
too, but in my experience it is much simpler to use a module of your Web
server that does that job transparently, like for instance mod_gzip for
Apache.

Search engines also do not use SQL databases. Usually they just lookup
static indexes to speedup lookup.

Sites like Google also avoid using many images. Images can make a site
look nicer but they are often irrelevant and retard the site loading.

--

Regards,
Manuel Lemos

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

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

attached mail follows:


Yes, compression is key. Faster servers with HUGE internet connections
serving COMPRESSED content make sites feel snappy. Look under
microtime() in the php manual for an example that will benchmark how
much time your page actually takes to produce... you'll probably find
it incredibly small... like 0.02 seconds or something if it's a decent
shared host like mine. The rest is compression (reduces data transfer),
page complexity (simpler HTML shows up faster, fewer images make the
page load faster), and internet latency/bandwidth (fast, fat pipes are
way better than a site hosted off DSL - latency in packet delievery
alone could cost 1/2 second in some situations).

So before you look into PHP accelerators, benchmark your code. It's not
likely your PHP, it's more likely your too complex HTML and/or no
compression and/or a slow (either bandwidth or latency) internet
connection.

Even 1/4 second script parsing feels peppy with a big, low-latency
pipe, simple HTML formatting, and on-the-fly compression. Just look at
Google.

-Galen

On Feb 10, 2004, at 5:46 AM, Manuel Lemos wrote:

> Hello,
>
> On 02/09/2004 11:36 PM, Merlin wrote:
>> I do have a performance question regarding php processing. There are
>> some sites on the net like google, heise and others which are
>> incredible fast in response time. Of course companies like google are
>> running totally other systems, but there are smaller sites and
>> companies doing almost the same verry fast page delivery.
>> Now I am wondering how this is possible on a LAMP application. My
>> site is not slow, but also not fast. I was reading about php
>> accellerator. Can anybody recommend this tool, is it complicated to
>> install and configure? Are there any speed gains and are ther tools
>> to messure the page delivery times?
>
> Most details about Google and other sites speed do not have much to do
> the actual code that generates the pages. For instance, they use
> distributed data centers and DNS around the world to make the servers
> that you actually access be closer to you and start serving pages
> sooner.
>
> They also use compressed pages to reduce the actual size of the
> information that is transferred. You can use compression of pages in
> PHP too, but in my experience it is much simpler to use a module of
> your Web server that does that job transparently, like for instance
> mod_gzip for Apache.
>
> Search engines also do not use SQL databases. Usually they just lookup
> static indexes to speedup lookup.
>
> Sites like Google also avoid using many images. Images can make a site
> look nicer but they are often irrelevant and retard the site loading.
>
>
> --
>
> Regards,
> Manuel Lemos
>
> Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>
> Metastorage - Data object relational mapping layer generator
> http://www.meta-language.net/metastorage.html
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

attached mail follows:


When I started looking into this I was told ASP was slow at processing
very large databases (and I think also large numbers of users) but I
don't think this becomes a problem unless the site is extremely large or
gets an awful lot of traffic.

Merlin wrote:

> Hi there,
>
> I do have a performance question regarding php processing. There are
> some sites on the net like google, heise and others which are incredible
> fast in response time. Of course companies like google are running
> totally other systems, but there are smaller sites and companies doing
> almost the same verry fast page delivery.
>
> Now I am wondering how this is possible on a LAMP application. My site
> is not slow, but also not fast. I was reading about php accellerator.
> Can anybody recommend this tool, is it complicated to install and
> configure? Are there any speed gains and are ther tools to messure the
> page delivery times?
>
> Thank you for any information on that.
>
> regards,
>
> merlin

attached mail follows:


In article <20040209172247.95101.qmailpb1.pair.com>, brbenandliz.com
says...
> According to the PHP manual, the mnoGoSearch extension is not available
> on the Windows platform. I had considered installing mnoGoSearch on our
> Windows box running PHP (even though I will have to pay for the Windows
> version of mnoGoSearch). However, now that I've seen this in the
> manual, I want to know what my other search engine options may be (for
> preferably free, open-source software).
>
> The search engine must index the site like a regular spider, and it
> should include have the ability to include PDF docs, Word docs, etc. and
> be configurable enough to exclude certain folders, etc. I would also
> like the ability to access the engine through PHP, if possible.
>
> Any suggestions or favorites out there? I would prefer not to write one
> on my own.
>
> Thanks.
> -Ben
>
You will probably find something here that meets your needs:

http://www.searchtools.com/tools/tools-win.html

or try http://www.google.com/search?q=windows+search+engine

Cheers
--
Quod subigo farinam

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

attached mail follows:


I wants to read some pages throug http call. Then, I am going to parse the
returned string and do some process.

For example: I want to get the latest news from CNN.com daily. So, I want to
call http://www.cnn.com and retrieve CNN's homepage content in a variable as
a string. After that, I will apply some RegExp to extract what I want.

Regards,
Hamid Hossain

-----------------------
Check Amazon.com Latest PHP books:
http://www.amazon.com/exec/obidos/redirect?tag=zawraqclassif-20&path=tg/browse/-/295223

Start Accepting CreditCard at your site in minutes:
http://www.2checkout.com/cgi-bin/aff.2c?affid=106720

Download Alexa Tool Bar to stop Pop-ups for FREE:
http://download.alexa.com/?amzn_id=zawraqclassif-20

Download Ready-Made Templates for your site:
http://www.aplustemplates.com/cgi/affiliates/c1.cgi/zawraq_ad

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail

attached mail follows:


"Hamid Hossain" <hamidhossainhotmail.com> wrote in message
news:Law11-F88zwLsnvJ7du0003355ahotmail.com...
> I wants to read some pages throug http call. Then, I am going to parse the
> returned string and do some process.
>
> For example: I want to get the latest news from CNN.com daily. So, I want
to
> call http://www.cnn.com and retrieve CNN's homepage content in a variable
as
> a string. After that, I will apply some RegExp to extract what I want.
>
>
> Regards,
> Hamid Hossain
>
> -----------------------
> Check Amazon.com Latest PHP books:
>
http://www.amazon.com/exec/obidos/redirect?tag=zawraqclassif-20&path=tg/browse/-/295223
>
> Start Accepting CreditCard at your site in minutes:
> http://www.2checkout.com/cgi-bin/aff.2c?affid=106720
>
> Download Alexa Tool Bar to stop Pop-ups for FREE:
> http://download.alexa.com/?amzn_id=zawraqclassif-20
>
> Download Ready-Made Templates for your site:
> http://www.aplustemplates.com/cgi/affiliates/c1.cgi/zawraq_ad
>
>

<?php

$fp = fopen('http://www.cnn.com/', 'r');
while($cnn .= fread($fp, 100));
fclose($fp);

print $cnn;

?>

attached mail follows:


I have a query which returns only 1 row, which of the following would be the
best to get the value from the resultset:

mysql_result()
mysql_fetch_field()
mysql_fetch_row()

the resultset only returns 1 column, so basically its only 1 field i get
from the resultset.

thanx in advance.
angelo

--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Technikon or the sender
of this e-mail be liable to any party for any direct, indirect,
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

attached mail follows:


Use mysql_result and u can use mysql_fetch_object, mysql_fetch_array also.

The following example will show u how to do it with mysql_result which will
retrive one row only.

From PHP Manual:

<?php
    $link = mysql_connect("localhost", "mysql_user", "mysql_password")
            or die("Could not connect: " . mysql_error());

    $result = mysql_query("SELECT name FROM work.employee")
            or die("Could not query: . mysql_error());

    echo mysql_result($result,0); // outputs first employee's name

    mysql_close($link);
?>

Regards,
Hamid Hossain

-----------------------
Check Amazon.com Latest PHP books:
http://www.amazon.com/exec/obidos/redirect?tag=zawraqclassif-20&path=tg/browse/-/295223

Start Accepting CreditCard at your site in minutes:
http://www.2checkout.com/cgi-bin/aff.2c?affid=106720

Download Alexa Tool Bar to stop Pop-ups for FREE:
http://download.alexa.com/?amzn_id=zawraqclassif-20

Download Ready-Made Templates for your site:
http://www.aplustemplates.com/cgi/affiliates/c1.cgi/zawraq_ad

----Original Message Follows----
From: "Angelo Zanetti" <binc2ctech.ac.za>
Reply-To: <binc2ctech.ac.za>
To: "Php-GeneralLists.Php.Net" <php-generallists.php.net>
Subject: [PHP] mysql functions
Date: Tue, 10 Feb 2004 11:44:47 +0200

I have a query which returns only 1 row, which of the following would be the
best to get the value from the resultset:

mysql_result()
mysql_fetch_field()
mysql_fetch_row()

the resultset only returns 1 column, so basically its only 1 field i get
from the resultset.

thanx in advance.
angelo

--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Technikon or the sender
of this e-mail be liable to any party for any direct, indirect,
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail

attached mail follows:


Would advise mysql_fetch_row()

"Angelo Zanetti" <binc2ctech.ac.za> wrote in message
news:BPEOIJEFGCBLOABOGLIDOEDPDHAA.binc2ctech.ac.za...
> I have a query which returns only 1 row, which of the following would be
the
> best to get the value from the resultset:
>
> mysql_result()
> mysql_fetch_field()
> mysql_fetch_row()
>
> the resultset only returns 1 column, so basically its only 1 field i get
> from the resultset.
>
> thanx in advance.
> angelo
>
> --------------------------------------------------------------------
> Disclaimer
> This e-mail transmission contains confidential information,
> which is the property of the sender.
> The information in this e-mail or attachments thereto is
> intended for the attention and use only of the addressee.
> Should you have received this e-mail in error, please delete
> and destroy it and any attachments thereto immediately.
> Under no circumstances will the Cape Technikon or the sender
> of this e-mail be liable to any party for any direct, indirect,
> special or other consequential damages for any use of this e-mail.
> For the detailed e-mail disclaimer please refer to
> http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

attached mail follows:


From: "Angelo Zanetti" <binc2ctech.ac.za>

> I have a query which returns only 1 row, which of the following would be
the
> best to get the value from the resultset:
>
> mysql_result()
> mysql_fetch_field()
> mysql_fetch_row()
>
> the resultset only returns 1 column, so basically its only 1 field i get
> from the resultset.

mysql_result($result,0)

---John Holmes...

attached mail follows:


Hi folks,

Using the Postgres extension for the first time, and am somewhat taken
aback by the approach to error handling.

First: error numbers

With the MySQL api, you can get an error number. With the Postgres
extension, it seems you can only get a message string. So to test for
a particular error, you have to run a regex and hope the developers
don't change the error message. Is this the situation, or am I missing
something?

Second: pg_result_error( $result_resource )

The manual recommends this over pg_last_error( ) but I'm baffled by
how to use it. pg_query() returns FALSE on failure, not a result
resource. So when there's an error there is no resource for
pg_result_error( ) to use. What's going on here??

Finally: system error handling

On failure, pg_query() throws a PHP SYSTEM_WARNING. This seems odd:
why should PHP react to something happening internally inside
Postgres? The MySQL extension behaves as you would expect, and throws
no PHP error at all. On most systems, ours included, this is going to
screw up the error handling. So you have to wrap every Postgres query
with:

$level = error_reporting( 0 ); // Errors off
pg_query( ... ) ;
error_reporting( $level ); // Back to default errors

Not a major issue for us as we have an abstraction api and only have
to do this in one place, but still an unnecessary resource hit. There
doesn't seem to be a configuration option to change this odd
behaviour. Again, is this really the situation or am I missing
something?

--

Geoff Caplan

attached mail follows:


1. Why does the Apache 1.x SAPI doesn't provide the PHPINIDir directive?
Is it due to some kind of limitation in Apache 1.x?

2. Can we load extension with php_admin_value, e.g.:

  php_admin_value extension /usr/lib/php4/imap.so
  php_admin_value zend_extension /usr/lib/php4/php_accelerator_1.3.3r2.so

I can't seem to do this. I want to setup several different Apache
running on a different port and different Unix user. Each mod_php4 in
this Apache is differently tuned. What's the best way to do this (I
don't want to have to configure + build mod_php4 for each of these
Apache instances, just so that I can specify php.ini path for each;
that's silly).

--
dave

attached mail follows:


David Garamond wrote:
> 1. Why does the Apache 1.x SAPI doesn't provide the PHPINIDir directive?
> Is it due to some kind of limitation in Apache 1.x?
>
> 2. Can we load extension with php_admin_value, e.g.:
>
> php_admin_value extension /usr/lib/php4/imap.so
> php_admin_value zend_extension /usr/lib/php4/php_accelerator_1.3.3r2.so
>
> I can't seem to do this. I want to setup several different Apache
> running on a different port and different Unix user. Each mod_php4 in
> this Apache is differently tuned. What's the best way to do this (I
> don't want to have to configure + build mod_php4 for each of these
> Apache instances, just so that I can specify php.ini path for each;
> that's silly).

I've found a solution to my problem, using PHPRC environment variable.

--
dave

attached mail follows:


Hello,

mind explain a little bit further cause i'm confused and not sure if the
fuction really work or something

On 1st example.... using unset() in a function
/////////////// CODE /////////////////
function foo() {
    static $a;
    $a++;
    echo "$a<BR>";
 unset($a);
}

foo();
foo();
foo();
///////////////////////////////////////////////

******* RESULT ********
1
2
3
************************

On 2nd example.... removing unset() in a function, result is same as with
unset() on it. Should it be all 1's at this time?
/////////////// CODE /////////////////
function foo() {
    static $a;
    $a++;
    echo "$a<BR>";
}

foo();
foo();
foo();
///////////////////////////////////////////////

******* RESULT ********
1
2
3
************************

Is it the code, function, or my php setup..any idea ???

attached mail follows:


Johnt wrote:
> function foo() {
> static $a;
> $a++;
> echo "$a<BR>";
> unset($a);
> }
>
> foo();
> foo();
> foo();
> ///////////////////////////////////////////////
>
> ******* RESULT ********
> 1
> 2
> 3
> ************************
> Should it be all 1's at this time?
>
> Is it the code, function, or my php setup..any idea ???

I thought the purpose of unset was to remove positions inside arrays.
Not sure if it was intended for simple variables. I've used it for
checking isset like this:

unset ($_POST[...
isset ($_POST[...

attached mail follows:


Hello John,

> From: JohnT [mailto:johntamareshotmail.com]
> Sent: Tuesday, February 10, 2004 4:54 AM
>
> Hello,
>
> mind explain a little bit further cause i'm confused and not
> sure if the
> fuction really work or something
>
> [some Code]

As far as I know (or understand), unset() will only destroy the reference to a variable.

That's why you get sometimes a bit confusing results when unset variables insinde functions, because they are often just a reference or even a copy of another variable.
(for example using global $a; is equal to $a =& $GLOBALS['a'])

See:
  Chapter References Explained
   -> Unsetting References
  and Function Reference of unset()
of the php Manual.

Now I guess that a static variable is only available via reference in a function call.
Otherwise it would be unseted if the function call is finished, what's not the use of a static var.

How to fix this problem:
The purpose of your code was to reset the value of the static variable.
So just do this reseting by assigning the value you wanted, e.g.

/////////////// CODE /////////////////
function foo() {
    static $a;
    $a++;
    echo "$a<BR>";
    $a = 0;
}

foo();
foo();
foo();
///////////////////////////////////////////////

Now it outputs:
1
1
1

Regards,
Dirk Oschlies

attached mail follows:


Hi there,

I have to write a PHP code for adding users to an email server.
For this I use an application called adduser.exe from Ipswitch IMail
Server 8.04.
Can anyone tell me how I can use this file with a PHP code?

Please note that the PHP runs on a different machine than the email
software.
So the function exec and shell_exec won't work. I have to execute the
file on the
mail server not on the web server.

I tried it like this:

<html>
<form action="http:\\server-url\cgi-bin\adduser.exe method="post">
<input type="text" name="firstname"></input>
<input>.....
</form>
</html>

Should this work? If yes, how can I post the values to adduser.exe file?
Are there other/better solutions?

TIA
Christian

attached mail follows:


hi,
This is something very dangerous. And you can't just post to an exe file
just like that.
Your best bet would be to map the network drive and invoke it from
there. However this might cause other complications with mising dls etc.

Since this is a commercial product oyu might want to ask the company
that sells it for their help as well.

all the best

Christian Jancso wrote:

>Hi there,
>
>I have to write a PHP code for adding users to an email server.
>For this I use an application called adduser.exe from Ipswitch IMail
>Server 8.04.
>Can anyone tell me how I can use this file with a PHP code?
>
>Please note that the PHP runs on a different machine than the email
>software.
>So the function exec and shell_exec won't work. I have to execute the
>file on the
>mail server not on the web server.
>
>I tried it like this:
>
><html>
><form action="http:\\server-url\cgi-bin\adduser.exe method="post">
><input type="text" name="firstname"></input>
><input>.....
></form>
></html>
>
>Should this work? If yes, how can I post the values to adduser.exe file?
>Are there other/better solutions?
>
>TIA
>Christian
>
>
>

--
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 150 KB | with progress bar.

attached mail follows:


Christian Jancso wrote:
> I have to write a PHP code for adding users to an email server.
> For this I use an application called adduser.exe from Ipswitch IMail
> Server 8.04.
> Can anyone tell me how I can use this file with a PHP code?

You can't simply post to adduser.exe - it's not a CGI application. What
you'll need to do is wrap the exe in a CGI script (in perl, php,
whatever). I had to do this with a much older version of IMail a while
ago and it worked fine once I had it working.

--
Stuart

attached mail follows:


ok do you have an example how this should work?

attached mail follows:


Christian Jancso wrote:
> ok do you have an example how this should work?

No I don't - it was a while ago, but it's quite simple. You just need to
write a CGI script (you could use PHP if it's installed on the IMail
server) to shell out to the adduser utility passing parameters made up
from the query string. I would be very surprised if there weren't
examples of doing this with IMail's adduser on the net somewhere. Google
is your friend.

--
Stuart

attached mail follows:


ok tx for your help I will try this :-)

attached mail follows:


Hello Joshua,

On 9 Feb 2004 at 15:45, Joshua Minnie wrote:

> Does anybody have any idea to allow for multiple downloads while another
> one was going on. Maybe some additional headers? I have tried adding
> headers before and after where I open the file for HTTP/1.1 200 OK and the
> corresponding headers. I have also tried using a simple meta refresh, but
> that doesn't work because it won't refresh until the page is entirely
> loaded.
>
> I am at a loss, I can't seem to find answer when I google it either.
> Maybe I'm just missing something. I don't know.

The same script can only send headers to the browser once each time it's loaded. In
other words, after a script has been parsed and the page has been loaded, it cannot
send more headers to the browser unless you reload it. Since in your case the same
script (i.e. same page) does everything, it can only handle one download at a time;
that's basically what I think you're missing.

A simple solution is to have each download link call a *separate* script (i.e. another
page) whose sole purpose is to take care of generating the download, i.e. sending the
headers and the file to the user's browser. Think about how ZDNet or Tucows, for
example, work: first you choose the file you want to download from a menu (the main
download page, which doesn't actually generate the downloads), and then when you
click on the download link you're taken to a new page (the one that actually takes care
of the download) that tells you to wait a few seconds until the download starts.

If you're concerned about security (i.e. unauthorized users downloading files by
accessing the actual download script directly without going through the page where
they see the file list etc.), you can use some kind of random authorization code that is
sent by the main download script via a GET string to the actual download page. That
way, if the right authorization code is not received by the script on the page that
generates the headers and sends the file to the browser, the download will fail. (Note
that I suggested a GET string because you cannot normally start sessions before
sending headers to the browser, as session_start() will itself send headers. But you can
always play with output buffering if you like.)

Hope this helps,

Erik

attached mail follows:


Hi,

I am using the following piece of code, to download files, but the files are
allways corrupt...what am I doing wrong?

if ($submit) {
 $full_filename = $_POST[full_filename];
 $filename = $_POST[filename];
 $dir = $_POST['dir'];
 $size = $_POST[size];
 $id = $_POST[id];

 if((file_exists($full_filename)) && (substr(decoct(fileperms($dir)),-1) >=
4)) {
  header("Content-type: ". "application/exe");
  header("Content-Disposition: " . "attachment" . ";
filename=\"".$filename)."\"";
  header("Content-Length: ".$size);
  $fp = readfile($full_filename, "r");
  mysql_query ("INSERT INTO files_downloaded
VALUES('$id','$ip',NOW())",$db_connection) or die (mysql_error());
  return $fp;
 }
}

I need to use some kind of form element to initiate the download, as I need
to keep track of the number of downloads...

Thanks for you help in advance
Adriaan Nel

attached mail follows:


Adriaan Nel wrote:

> Hi,
>
> I am using the following piece of code, to download files, but the files are
> allways corrupt...what am I doing wrong?
>
>
> if ($submit) {
> $full_filename = $_POST[full_filename];
> $filename = $_POST[filename];
> $dir = $_POST['dir'];
> $size = $_POST[size];
> $id = $_POST[id];
>
> if((file_exists($full_filename)) && (substr(decoct(fileperms($dir)),-1) >=
> 4)) {
> header("Content-type: ". "application/exe");
> header("Content-Disposition: " . "attachment" . ";
> filename=\"".$filename)."\"";
> header("Content-Length: ".$size);
> $fp = readfile($full_filename, "r");
> mysql_query ("INSERT INTO files_downloaded
> VALUES('$id','$ip',NOW())",$db_connection) or die (mysql_error());
> return $fp;
> }
> }
>

You might have a php warning in the downloaded file, it will be either
at the beginning or at the end, just open a text editor and view it.

Also you don't check $full_filename, users can submit enything, e.g.
/etc/shadow or includes/config.php, and the script sends it.

attached mail follows:


The variables I submit, are retrieved from a database...so users can't enter
anything,

I do have a warning inserted at the beginning of the file, how do I remove
this warning?

"Marek Kilimajer" <kilimajerwebglobe.sk> wrote in message
news:4028F6CE.4090000webglobe.sk...
> Adriaan Nel wrote:
>
> > Hi,
> >
> > I am using the following piece of code, to download files, but the files
are
> > allways corrupt...what am I doing wrong?
> >
> >
> > if ($submit) {
> > $full_filename = $_POST[full_filename];
> > $filename = $_POST[filename];
> > $dir = $_POST['dir'];
> > $size = $_POST[size];
> > $id = $_POST[id];
> >
> > if((file_exists($full_filename)) && (substr(decoct(fileperms($dir)),-1)
>=
> > 4)) {
> > header("Content-type: ". "application/exe");
> > header("Content-Disposition: " . "attachment" . ";
> > filename=\"".$filename)."\"";
> > header("Content-Length: ".$size);
> > $fp = readfile($full_filename, "r");
> > mysql_query ("INSERT INTO files_downloaded
> > VALUES('$id','$ip',NOW())",$db_connection) or die (mysql_error());
> > return $fp;
> > }
> > }
> >
>
> You might have a php warning in the downloaded file, it will be either
> at the beginning or at the end, just open a text editor and view it.
>
> Also you don't check $full_filename, users can submit enything, e.g.
> /etc/shadow or includes/config.php, and the script sends it.

attached mail follows:


Adriaan Nel wrote:

> The variables I submit, are retrieved from a database...so users can't enter
> anything,
>

What do you mean? Even if the variables are in a hidden input field,
anyone can change them. For example one can save the page and change
them in html source.

> I do have a warning inserted at the beginning of the file, how do I remove
> this warning?

I won't tell you unless you tell what warning it is. But I'm sure if you
think about the warning a little you will figure it out.

>
>
> "Marek Kilimajer" <kilimajerwebglobe.sk> wrote in message
> news:4028F6CE.4090000webglobe.sk...
>
>>Adriaan Nel wrote:
>>
>>
>>>Hi,
>>>
>>>I am using the following piece of code, to download files, but the files
>
> are
>
>>>allways corrupt...what am I doing wrong?
>>>
>>>
>>>if ($submit) {
>>> $full_filename = $_POST[full_filename];
>>> $filename = $_POST[filename];
>>> $dir = $_POST['dir'];
>>> $size = $_POST[size];
>>> $id = $_POST[id];
>>>
>>> if((file_exists($full_filename)) && (substr(decoct(fileperms($dir)),-1)
>>
>>=
>>
>>>4)) {
>>> header("Content-type: ". "application/exe");
>>> header("Content-Disposition: " . "attachment" . ";
>>>filename=\"".$filename)."\"";
>>> header("Content-Length: ".$size);
>>> $fp = readfile($full_filename, "r");
>>> mysql_query ("INSERT INTO files_downloaded
>>>VALUES('$id','$ip',NOW())",$db_connection) or die (mysql_error());
>>> return $fp;
>>> }
>>>}
>>>
>>
>>You might have a php warning in the downloaded file, it will be either
>>at the beginning or at the end, just open a text editor and view it.
>>
>>Also you don't check $full_filename, users can submit enything, e.g.
>>/etc/shadow or includes/config.php, and the script sends it.
>
>

attached mail follows:


Tim --

...and then Tim Thorburn said...
%
% Hi,

Hiya!

%
% Sorry for the slightly off-topic post, but I've just had a client ask me to
% create a manual for the site management tool I wrote for them last

Interesting... You mean the tool isn't self-documenting? ;-)

% fall. Since I've never had to do one before I'm a bit lost on what would
% be a reasonable amount to charge and whether or not I should put any

Technical writers charge plenty of money, too, so don't feel that this
work shouldn't cost much. If I were you I'd set an hourly rate, perhaps
the same as your usual programming rate, and then spend an hour or two
sketching out an outline and perhaps an introduction. This will give you
a better idea of how long it will take to do the whole thing and also
give the client something to see when he sees your quote (or estimate).

% restrictions on how many copies they receive or if I'm ok with them
% photocopying and handing them out all over the organization.

Personally I wouldn't worry about this. Deliver it in soft copy anyway
and then let them print as many copies as they like. You're already
making money from the app (right? :-)

Once you get the hang of it, you may even integrate documentation into
your coding process (and, therefore, the price) so that a basic manual is
done when the code is and then you need only charge for fleshing it out.

%
...
% PHP/MySQL stuff, though last time I tried to put a manual together it
% quickly got to be over 40 pages and that client decided they didn't want it
% in the end.

This is another reason you want to charge for your initial development
and show them where you're going. There's no need to spend hours and
hours on the project only to not get paid for any of it.

%
% Thanks
% -Tim

HTH & HAND & please let us know what you find and how you go

:-D
--
David T-G * There is too much animal courage in
(play) davidtgjustpickone.org * society and not sufficient moral courage.
(work) davidtgworkjustpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQFAKO0PGb7uCXufRwARAgH6AJ4qJSJPzPBGc9bPlBAQeL+eSVWJhQCdEC3B
S9Mh6sLvvllg1z3Or5AwUMM=
=TRVp
-----END PGP SIGNATURE-----

attached mail follows:


What about taking advantage of curl's built in cookie functions?

In particular, you should look at doing this with a two step process
utilizing the CURLOPT_COOKIEJAR and CURLOPT_COOKIEFILE functions. First,
log in... Then grab the article itself, once the session has begun.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.yoursite.com"); // set url to
post to
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_REFERER, "http://www.wsj.com");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 50); // times out after 4s
curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies.txt"); //initiates
cookie file
curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies.txt"); // Uses
previous session cookies
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt ($ch, CURLOPT_USERAGENT, "mozilla/5.0 (x11; u; linux i686;
en-us; rv:1.5a) gecko/20030728 mozilla firebird/0.6.1");

        -- jon

-------------------
jon roig
web developer
email: jontrafficdesigns.com
phone: 888.230.7557

-----Original Message-----
From: Richard Miller [mailto:richardmillerbyu.edu]
Sent: Monday, February 09, 2004 6:29 PM
To: php-generallists.php.net
Subject: [PHP] CURL and Cookies

I would appreciate any help you can give me about a problem I am having
with PHP's CURL functions.

I want to use CURL to download news from Wall Street Journal Online.
When you visit the WSJ home page, you're forwarded to an authentication
page to enter your name and password, and then forwarded back to the
home page. I want my CURL command to send the authentication cookie so
when it's forwarded to the authentication page it forwards right back
to the home page without having to enter the name and password.

I can get the following CURL command to run fine at the command prompt,
but not in PHP:

THIS WORKS
        curl --cookie "WSJIE_LOGIN=blahblahblah" -L -O
"http://online.wsj.com/home/us"

THIS DOESN'T WORK
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "http://online.wsj.com/home/us");
        curl_setopt($ch, CURLOPT_COOKIE, "WSJIE_LOGIN=blahblahblah");
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $content = curl_exec($ch);
        curl_close($ch);

I used a packet sniffer to see how this works. When I request the home
page (above) and send the WSJIE_LOGIN cookie, the home page redirects
to the authentication page. The authentication page uses the
WSJIE_LOGIN cookie to generate more cookies. Then these 5-6 cookies
are sent back to the home page and give the user access to the content.
  The WSJIE_LOGIN cookie is my own personal authentication cookie; the
other cookies change from time to time. But I noticed that the PHP
CURL isn't perpetuating these other cookies when it forwards back to
the home page, like the command-line CURL does. Here are blocks from
the package capture:

CLI CURL
        ...
        192.168.001.100.63745-206.157.193.068.00080: GET /home/us
HTTP/1.1
        User-Agent: curl/7.10.2 (powerpc-apple-darwin7.0) libcurl/7.10.2

OpenSSL/0.9.7b zlib/1.1.4
        Cookie: WSJIE_LOGIN=abc
        Host: online.wsj.com
        Pragma: no-cache
        Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
        Cookie: fastlogin=xyz; wsjproducts=xyz; user_type=xyz;
REMOTE_USER=xyz; UBID=xyz
        ...

PHP CURL
        ...
        192.168.001.100.63750-206.157.193.068.00080: GET /home/us
HTTP/1.1
        Cookie: WSJIE_LOGIN=abc
        Host: online.wsj.com
        Pragma: no-cache
        Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
        ...

PHP's curl doesn't forward the cookies that it is given at the previous
page, so, of course, I don't get my content. Any ideas why?

Richard Miller

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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date: 1/27/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date: 1/27/2004
 

attached mail follows:


Hello,

I am having a strange problem with PHP and I can't really find a proper
answer, maybe someone have seen this before and can give me a hint.

I have a series of files (originally developed by another colleague)
installed on a server with PHP 4.2.2 and I get this error:

Parse error: parse error, unexpected $ in
/var/www/html/donation/installations/gpi/form.inc on line 528

Line 528 is actually the last line on that file, it's an empty line.
Tried removing, adding spaces, and the number of lines change, always
pointing to the last line. Checking online, I get similar comments from
people when braces are unbalanced, i.e. a "while" loop that doesn't
have a closing "}". I have checked this file with Zend Studio for
correctness and there is no problem, checked every block, all closed.
Checked all the included files as well ...

The strange thing as well is that this runs on my laptop, running PHP
4.3.4 and doesn't return any errors. Has anyone seen this? Where can I
find the differences in syntax between these two PHP versions, maybe
that's the cause...? I also looked at the possibility that it's the
"short_open_tag" in the configuration file but it seems like the option
is properly set in the httpd.conf file on pluto.greenpeace.com ... I am
a bit lost now, any suggestions?

/B

--
Bruno Mattarollo <bruno.mattarollodiala.greenpeace.org>
Head of IT - Greenpeace International
[ http://www.greenpeace.org/ ]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iEYEARECAAYFAkAo9TUACgkQkmxbmUVwE0NFnACfew0JsNLbZteAcQiuLXp3rMkA
2EwAoLZTeSScKrtZDkyhMrQf7yDN7/gs
=4whi
-----END PGP SIGNATURE-----

attached mail follows:


Hi Bruno,

The line number is misleading the error is generally above the line
that's reffered to. try commenting out sections of the code. If you have
an IDE it will be able to point out the error. If you don't have an IDE
some text editor that is capable of syntax highlighting will also help.

Bruno Mattarollo wrote:

> Hello,
>
> I am having a strange problem with PHP and I can't really find a
> proper answer, maybe someone have seen this before and can give me a
> hint.
>
> I have a series of files (originally developed by another colleague)
> installed on a server with PHP 4.2.2 and I get this error:
>
> Parse error: parse error, unexpected $ in
> /var/www/html/donation/installations/gpi/form.inc on line 528
>
> Line 528 is actually the last line on that file, it's an empty line.
> Tried removing, adding spaces, and the number of lines change, always
> pointing
> /B
>

--
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 150 KB | with progress bar.

attached mail follows:


Hello Adam,

Adam Bregenzer wrote:
> On Mon, 2004-02-09 at 15:58, Markus Fischer wrote:
>
>> But doing this now for every internal function call I don't want to
>> lead my program into an unwanted state isn't very appealing.
>
> <snip>

> Ultimately I decided to wrap my necessary function calls in error
> checking wherever they are in my files. This gives me more
> granularity in the application of the error at the cost of some code
> bloat. It's not an optimal solution but I have found I use little
> functions calls in the first place that would generate an exception
> in return.

        Isn't this the same thing I started doing anyway? I however didn't
integrated those functions in my application directly but put them in a
file of its own so I can (hopefully ;) reuse them.

> Also, I have started using code generation for handling the data
> side.

        This sounds very interesting. Can you elaborate how and what you
actually did for generating the code (what was your input and how did
you transform it)?

>
> Ultimately I think it would be nice to have an object hierarchy of
> the function calls in php. However I don't see php supporting it
> natively and PEAR is still trying to sort itself out. Being a 'third
> party' project it is too much for one person but would be quite
> useful. Maybe when php5 becomes more popular we can all band together
> and standardize this.

        I think such a real hierarchy of classes will never exist. That's too
much for PHP; none of the developers want to break BC and also follow
the KISS credo (which is good, imho).

        But it sounds interesting in re-creating the globbered global function
table of PHP in a well thought class framework and make it
exception-proof. But that would be a step back either if this wrapping
would only occur in PHP side -> for every PHP function there would need
to be called a userland PHP code before. I even don't want to think
about the performance implications. But well, since this is effectively
what I started with with my "System" class, there my be needs where this
trade off is accecptable (compensating longer execution time with caches
and more hardware power/ram/whatever).

        I think for the current issue I will just continue recreating the PHP
functions inside an exception-proof class if I don't find a better way.
Only creating them on-demand isn't a real problem (at the moment).

- Markus

attached mail follows:


Please post your solution to the group for reference.

~phillip

"Jake McHenry" <linuxnittanytravel.com> wrote in message
news:00de01c3ef49$fcba6170$7fa1e518JS...
> ----- Original Message -----
> From: "Marek Kilimajer" <kilimajerwebglobe.sk>
> To: "Jake McHenry" <linuxnittanytravel.com>
> Cc: <php-generallists.php.net>
> Sent: Monday, February 09, 2004 12:42 PM
> Subject: Re: [PHP] XML and Excel
>
>
> > Create native xls files, there are at least two classes that can help
> > you, here is one:
> > http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/
> >
> > Jake McHenry wrote:
> > > Hi everyone. Since my last post of outputing to excel, I have
converted
> my output to XML, quite happy with myself. It looks perfect. Perfect on my
> set that is. I have win xp with office xp. Excel with office xp recognizes
> XML. Office 2000, which the rest of my company is using, doesn't. Does
> anyone know of a way I can take the XML I have now and have office 2000
> recognize it? I feel kinda stupid... lol Sent out an email to my
accounting
> department saying it was ready for them and all they get is garbage on
their
> screen.
> > >
> > > Anyone know of anything I can do?
> > >
> > > Thanks,
> > > Jake
> >
>
> sweet.. thanks a lot.. took me about 3 hours, but I got it all converted.
> works great!
>
> Thanks again,
> Jake

attached mail follows:


<table border=1>

"Jake McHenry" <linuxnittanytravel.com> wrote in message
news:007a01c3eec6$802b9120$7fa1e518JS...
> ----- Original Message -----
> From: "Phillip Jackson" <tzmguitaristhotmail.com>
> To: <php-generallists.php.net>
> Sent: Saturday, February 07, 2004 4:37 AM
> Subject: Re: [PHP] Re: excel output question
>
>
> > I would do it like this:
> >
> > $build = " '%s','%s','%s','%s'\n";
> > $build = sprintf($build,$field1,$field2,$field3,$fieldN);
> >
> > you could also try escaping the comma. if this doesn't work you can
always
> > just dump to html tables and save the file as *.xls (excel spreadsheet);
> > excel understands html tables and simple markup as spreadsheet data.
> >
> > ie:
> >
> > <html>
> > <table>
> > <tr>
> > <td>field1</td><td>field2</td><td>field3</td><td>field4</td>
> > </tr>
> > <tr>
> > <td>value1</td><td>value2</td><td>value3</td><td>value4</td>
> > </tr>
> > </table>
> > </html>
> >
> >
> > ~phillip
> > "Jake McHenry" <linuxnittanytravel.com> wrote in message
> > news:006001c3ed4c$39c057f0$7fa1e518JS...
> > > ----- Original Message -----
> > > From: "Paul Furman" <pauledgehill.net>
> > > To: <php-generallists.php.net>
> > > Sent: Saturday, February 07, 2004 1:56 AM
> > > Subject: [PHP] Re: excel output question
> > >
> > >
> > > > Single quote everything should work.
> > > >
> > > > Jake McHenry wrote:
> > > >
> > > > > Hi everyone. I'm outputing payroll information to an excel csv
file,
> > and
> > > when anyone get's paid over 1k, the amount is split into two fields
> > because
> > > of the comma in the amount. Is there anyway I can tell excel that this
> > > particular comma is not a deliminator?
> > > > >
> > > > > Thanks,
> > > > > Jake
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > >
> > >
> > > like this?
> > >
> > > output =
> > >
> >
>
"'$fullname',,'$location',,'$regularhours','$vachours','$sickhours','$compho
> > >
> >
>
urs','$mischours','$wopyhours','$sefahours','$biweekly[0]','$adjustedtime',,
> > > ,,,'$sub401k
> > > ','$payrate','$gross5'\n";
> > >
> > > That just filled my spreadshit with quotes around everything... still
> the
> > > amounts larger than 1k are in 2 columns......
> > >
> > > did I do something wrong?
> > >
> > > Thanks,
> > > Jake
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> This is in a simple while loop, data is coming from a mysql database.
> Creating a seperate function would too time consuming changing all of the
> existing code for what this page is doing. It orignally was in html form
in
> an xls file, but when the file was opened, there were no cell borders
> anymore. If anyone can tell me how to turn on the cell boarders in an xls
> html outputted file, that would also work. This is the only reason I went
> back to a csv file.
>
> Thanks,
> Jake
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


I've got a design developer who only knows Front Page. Despite my general
hatred for Microsoft I can work around it :-)

She's installed a Front Page PHP plugin (I think it's called Rocket PHP).
However, the plugin is buggy; it's got problems that would be best fixed
if I could completely separate code from design. Separating code from
design is a snap when using HTML forms to call PHP programs (using FORM's
ACTION= attribute), but when the code MUST to be embedded in the HTML (as
I've had to do), it's tricky.

One thought: I could use templates. She can design a normal HTML pages
with template entries like [email_address] and [database_records] and
such. Then I could use PHP to parse those templates and replace the
template entries with real data.

Can anyone recommend some template engines? Or tips on using PHP to parse
an HTML doc, replacing it with real data?

Any other tips? Books/websites on this subject?

Thanks in advance!
/dev/idal

attached mail follows:


I'm trying to use PHP 4.3.4 with the -b switch, which should bind a port to
be used for parsing php files. When I do that, I want it to run as a
different user than the one feeding it the command (webserver). Is there any
way to do that? Thanks so much for the help.

_________________________________________________________________
Create your own personal Web page with the info you use most, at My MSN.
http://click.atdmt.com/AVE/go/onm00200364ave/direct/01/

attached mail follows:


Can anyone tell me why this does not work:

$str1=ereg_replace("index.php?src=","index/",$url);

is there another way to do this?

Thanks,

Nicole

--
########################
Nicole Lallande
nicolenmlconsulting.com
760.753.6766
########################