php-general Digest 8 Mar 2002 10:34:10 -0000 Issue 1214

Topics (messages 87696 through 87749):

Referer Is Empty
        87696 by: Steven Walker
        87726 by: Bogdan Stancescu

Re: Rasmus, O'Reilly, "Programming PHP"
        87697 by: Paul Roberts
        87707 by: Erik Price
        87717 by: DL Neil
        87722 by: Rasmus Lerdorf

bug???
        87698 by: Rodrigo Peres

Re: User accounts
        87699 by: David Johansen
        87712 by: Kevin Stone

Add associative element to an an array
        87700 by: Bradley Goldsmith
        87702 by: Matt Drake
        87703 by: Bradley Goldsmith
        87704 by: Mark
        87705 by: Erik Price

dealing with # in urls
        87701 by: Mark
        87743 by: CC Zona

Re: php, text file, and mysql
        87706 by: Erik Price
        87708 by: Jason Murray
        87709 by: Darren Gamble
        87710 by: Julio Nobrega

Re: A good PHP Shop
        87711 by: Matt

Re: Session_start()
        87713 by: Matthew Walker
        87716 by: Erik Price

Re: What is "->" mean in php?
        87714 by: Kearns, Terry
        87724 by: Stephano Mariani
        87727 by: Douglas Maclaine-cross
        87738 by: S.Murali Krishna

php questions about cookies
        87715 by: zhaoxd

Re: writing to a file
        87718 by: David Robley

Re: impossible to delete file after 'parse_ini_file'
        87719 by: David Robley

Re: REQUEST QUESTION
        87720 by: David Robley
        87730 by: karthikeyan

Re: Use an ini file
        87721 by: David Robley
        87725 by: jtjohnston
        87729 by: David Robley

Re: Alphabet
        87723 by: Angel Fenoy

Urgent - MySQL is not inserting the single quotes
        87728 by: Manisha
        87732 by: Analysis & Solutions
        87735 by: Manisha
        87740 by: Analysis & Solutions
        87742 by: Jason Wong

data to multi-dimensional array
        87731 by: Craig Westerman

Dbconnect
        87733 by: Josiah Wallingford
        87734 by: Michael Kimsal

A silly question. :P
        87736 by: GENESiS DESiGNS
        87737 by: Jason Murray

Re: Crontab
        87739 by: Uma Shankari T.
        87741 by: S.Murali Krishna

PDF generation
        87744 by: Jean-Arthur Silve

(htaccess) not letting php to parse
        87745 by: Lauri Vain

Re: using a variable to a function call
        87746 by: Matt Williams

Re: mail() & getenv() problems (after 4.1.2 update)...
        87747 by: Keith Waters

Number of Vars in session
        87748 by: Beta

General
        87749 by: Gunther E. Biernat

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message ---
Hello,

I'm having trouble getting the referring url. I have tried:
        $HTTP_REFERER
        getenv(HTTP_REFERER);
        $_SERVER[HTTP_REFERER];
... but they are all blank.

The referring page has a meta http-equiv=Refresh header. If the user 
waits for the page to automatically redirect, the referring url is 
empty. If on the other hand the user clicks the link to the new page, 
the referring url is fine. Is there a limitation here?

I'm familiar with using header(location..), but it doesn't allow a delay 
time to be specified. Any ideas?

Steven J. Walker
Walker Effects
www.walkereffects.com
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Javascript, if that's acceptable for the environment you're working in...

Bogdan

Steven Walker wrote:

> Hello,
>
> I'm having trouble getting the referring url. I have tried:
>     $HTTP_REFERER
>     getenv(HTTP_REFERER);
>     $_SERVER[HTTP_REFERER];
> ... but they are all blank.
>
> The referring page has a meta http-equiv=Refresh header. If the user 
> waits for the page to automatically redirect, the referring url is 
> empty. If on the other hand the user clicks the link to the new page, 
> the referring url is fine. Is there a limitation here?
>
> I'm familiar with using header(location..), but it doesn't allow a 
> delay time to be specified. Any ideas?
>
> Steven J. Walker
> Walker Effects
> www.walkereffects.com
> [EMAIL PROTECTED]
>
>



--- End Message ---
--- Begin Message ---

Amazon have it listed as folows.

http://www.amazon.com/exec/obidos/ASIN/1565926102/qid=1015539436/sr=2-3/ref=sr_2_3/104-7882944-0058305

List Price: $39.95
Our Price: $27.96
You Save: $11.99 (30%)

This item will be published in March 2002. You may order it now and we will ship it to 
you when it arrives. 

Paul Roberts
[EMAIL PROTECTED]
++++++++++++++++++++++++
----- Original Message ----- 
From: "Erik Price" <[EMAIL PROTECTED]>
To: "DL Neil" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, March 07, 2002 8:53 PM
Subject: Re: [PHP] Rasmus, O'Reilly, "Programming PHP"


> 
> On Thursday, March 7, 2002, at 06:05  AM, DL Neil wrote:
> 
> > Rasmus/others,
> >
> > O'Reilly are advertising the imminent release (Mar 2002) of "Programming
> > PHP" (http://www.oreilly.com/catalog/progphp/desc.html).
> > Is that still going ahead?
> > (I'll submit an advanced purchase order...)
> >
> 
> Hmmm... on the one hand, it's an O'Reilly book, and their books tend to 
> shine pretty brightly (though I'm extremely fond of two of my New Riders 
> books, "MySQL" by Paul DuBois and "Python Web Programming" by Steve 
> Holden, very well-written and well-made books).  But on the other hand, 
> the writeup at O'Reilly that you link to doesn't really entice me -- it 
> seems to offer the same topics as most other non-introductory PHP titles 
> out there.
> 
> I'd probably pick it up regardless, if only to demonstrate to O'Reilly 
> that there's a demand for more books on PHP.  To date, their PHP 
> selection is pathetic.
> 
> David, did you hear anything more about this?
> 
> 
> 
> 
> Erik
> 
> 
> 
> ----
> 
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

--- End Message ---
--- Begin Message ---

On Thursday, March 7, 2002, at 05:22  PM, Paul Roberts wrote:

> Amazon have it listed as folows.
>
> http://www.amazon.com/exec/obidos/ASIN/1565926102/qid=1015539436/sr=2-3/ref=
> sr_2_3/104-7882944-0058305

Hm.  Too bad they don't have that "read a sample chapter" set up yet.  
That's a feature I don't usually use (there's a Barnes and Noble and a 
Borders near me if I want to read), but in this case would be nice.



Erik




----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Hi Erik,

> > Rasmus/others,
> >
> > O'Reilly are advertising the imminent release (Mar 2002) of
"Programming
> > PHP" (http://www.oreilly.com/catalog/progphp/desc.html).
> > Is that still going ahead?
> > (I'll submit an advanced purchase order...)
> >
>
> Hmmm... on the one hand, it's an O'Reilly book, and their books tend
to
> shine pretty brightly (though I'm extremely fond of two of my New
Riders
> books, "MySQL" by Paul DuBois and "Python Web Programming" by Steve
> Holden, very well-written and well-made books).  But on the other
hand,
> the writeup at O'Reilly that you link to doesn't really entice me --
it
> seems to offer the same topics as most other non-introductory PHP
titles
> out there.
>
> I'd probably pick it up regardless, if only to demonstrate to O'Reilly
> that there's a demand for more books on PHP.  To date, their PHP
> selection is pathetic.
>
> David, did you hear anything more about this?

You pretty much summed up my viewpoint.

No I haven't heard any more, but Rasmus has been a bit busy having his
hand crushed and practicing baby noises, so he's probably in no shape to
respond just yet!

All I can find repeatedly says 'any day now', but there's no hard data
beyond what can be seen (your (IMHO valid) comment notwithstanding) at
the O'Reilly site.

Am not keen to put in an advanced order, sight-unseen; and the man is
usually right here, so ...

Regards,
=dn

--- End Message ---
--- Begin Message ---
The book will be coming out.  I have seen the galleys and the appendices 
have gone in.  

-Rasmus

On Fri, 8 Mar 2002, DL Neil wrote:

> Hi Erik,
> 
> > > Rasmus/others,
> > >
> > > O'Reilly are advertising the imminent release (Mar 2002) of
> "Programming
> > > PHP" (http://www.oreilly.com/catalog/progphp/desc.html).
> > > Is that still going ahead?
> > > (I'll submit an advanced purchase order...)
> > >
> >
> > Hmmm... on the one hand, it's an O'Reilly book, and their books tend
> to
> > shine pretty brightly (though I'm extremely fond of two of my New
> Riders
> > books, "MySQL" by Paul DuBois and "Python Web Programming" by Steve
> > Holden, very well-written and well-made books).  But on the other
> hand,
> > the writeup at O'Reilly that you link to doesn't really entice me --
> it
> > seems to offer the same topics as most other non-introductory PHP
> titles
> > out there.
> >
> > I'd probably pick it up regardless, if only to demonstrate to O'Reilly
> > that there's a demand for more books on PHP.  To date, their PHP
> > selection is pathetic.
> >
> > David, did you hear anything more about this?
> 
> You pretty much summed up my viewpoint.
> 
> No I haven't heard any more, but Rasmus has been a bit busy having his
> hand crushed and practicing baby noises, so he's probably in no shape to
> respond just yet!
> 
> All I can find repeatedly says 'any day now', but there's no hard data
> beyond what can be seen (your (IMHO valid) comment notwithstanding) at
> the O'Reilly site.
> 
> Am not keen to put in an advanced order, sight-unseen; and the man is
> usually right here, so ...
> 
> Regards,
> =dn
> 
> 
> 

--- End Message ---
--- Begin Message ---
Hi list,

I'm developing an CMS, and I started a session with PHP 4.1.1
With I use this in javascript "alert(document.forms[0].elements[0].name)"
it returns "PHPSESSID" and if i use
"alert(document.forms[0].elements[0].value)", it returns a number.

It's a bug???

I'm using IE5 in macos 9.2.2

Thank's in advance

Rodrigo
-- 



--- End Message ---
--- Begin Message ---
Here's a little piece of code that gives me a weird problem:

<?php
if (!$logout)
{
   if ($_SESSION['loggedin'])
   {
      unset($_SESSION['loggedin']);
   }
}
?>


I have the session started and everything, but it gives me the following
error.
Warning: Undefined variable: logout in c:\inetpub\wwwroot\uslogin.php on
line 13
I've seen this used on several examples. I know that if I just use
empty($logout) then it'll work ok, but I just wanted to know why it's used
in so many examples but doesn't work in my code. Is there some setting that
I have set wrong or something? Thanks,
Dave

"David Johansen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm new to this php thing and I would like to set up a web page were the
> users can login and edit their preferences and all that stuff. I have the
> basic login stuff worked out and I was passing the username and password
as
> a hidden input in the form, but then the password can be seen with view
> source. I know that there's a better way to do this, so could someone
point
> me to a good tutorial or example on how I could make it so that the user
> could login and logout and then I wouldn't need to be passing the password
> all around like this. Thanks,
> Dave
>
>


--- End Message ---
--- Begin Message ---
I understand your confusion.  The thing is that empty() and ! are two
completely different arguments.

if(empty($var)) is looking for: $var = '';

if(!$var) is looking for: $var = false; or $var = 0;

If $var is set to anything other than 0 or false then the ASCII value of
the string is (by definition) equivilant to an integer value of 1 or
more.  And thus is interpreted as true.

Hope that helps.

-Kevin

-----Original Message-----
From: David Johansen [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, March 07, 2002 3:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: User accounts

Here's a little piece of code that gives me a weird problem:

<?php
if (!$logout)
{
   if ($_SESSION['loggedin'])
   {
      unset($_SESSION['loggedin']);
   }
}
?>


I have the session started and everything, but it gives me the following
error.
Warning: Undefined variable: logout in c:\inetpub\wwwroot\uslogin.php on
line 13
I've seen this used on several examples. I know that if I just use
empty($logout) then it'll work ok, but I just wanted to know why it's
used
in so many examples but doesn't work in my code. Is there some setting
that
I have set wrong or something? Thanks,
Dave

"David Johansen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm new to this php thing and I would like to set up a web page were
the
> users can login and edit their preferences and all that stuff. I have
the
> basic login stuff worked out and I was passing the username and
password
as
> a hidden input in the form, but then the password can be seen with
view
> source. I know that there's a better way to do this, so could someone
point
> me to a good tutorial or example on how I could make it so that the
user
> could login and logout and then I wouldn't need to be passing the
password
> all around like this. Thanks,
> Dave
>
>



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



--- End Message ---
--- Begin Message ---
Hi,

        Ive got an array of associations like this:

        [1]=>2 [2]=>3 [3]=>4 etc

        I want to add a new element [8]=>6.

        How do I do this? I have tried several ways: pushing the element,
merging arrays, etc with no luck (it either increments the key or doesn't
work at all).

        Any ideas would be appreciated!

Cheers,
Brad
--- End Message ---
--- Begin Message ---
I'd think $arr['8'] = 6 would work...

Using a number (as in $arr[8] = 6) would possibly confuse things, though
I can't get to a PHP machine right now so I'm not sure.

M

On Fri, 8 Mar 2002, Bradley Goldsmith wrote:

> Hi,
>
>       Ive got an array of associations like this:
>
>       [1]=>2 [2]=>3 [3]=>4 etc
>
>       I want to add a new element [8]=>6.
>
>       How do I do this? I have tried several ways: pushing the element,
> merging arrays, etc with no luck (it either increments the key or doesn't
> work at all).
>
>       Any ideas would be appreciated!
>
> Cheers,
> Brad
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
I'll answer my own question.

$keyarray[$item[0]] = $node;

*duh*

How embarrasing is it that this thread will end up on google :)

-bcg



-----Original Message-----
From: Bradley Goldsmith [mailto:[EMAIL PROTECTED]]
Sent: Friday, 8 March 2002 9:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Add associative element to an an array


Hi,

        Ive got an array of associations like this:

        [1]=>2 [2]=>3 [3]=>4 etc

        I want to add a new element [8]=>6.

        How do I do this? I have tried several ways: pushing the element,
merging arrays, etc with no luck (it either increments the key or doesn't
work at all).

        Any ideas would be appreciated!

Cheers,
Brad

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
it sounds like you want:
$array[8]=6;

On Fri, 8 Mar 2002 09:50:24 +1100, Bradley Goldsmith wrote:
>Hi,
>
>    Ive got an array of associations like this:
>
>    [1]=>2 [2]=>3 [3]=>4 etc
>
>    I want to add a new element [8]=>6.
>
>    How do I do this? I have tried several ways: pushing the
element,
>merging arrays, etc with no luck (it either increments the key or
>doesn't
>work at all).
>
>    Any ideas would be appreciated!
>
>Cheers,
>Brad
>



--- End Message ---
--- Begin Message ---

On Thursday, March 7, 2002, at 05:50  PM, Bradley Goldsmith wrote:

>       Ive got an array of associations like this:
>
>       [1]=>2 [2]=>3 [3]=>4 etc
>
>       I want to add a new element [8]=>6.
>
>       How do I do this? I have tried several ways: pushing the element,
> merging arrays, etc with no luck (it either increments the key or 
> doesn't
> work at all).

Have you tried just directly setting this array element?  You don't say 
what your array is named, so I'll call it $array.

$array[8] = 6;

Is that what you are talking about?


Erik



----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Hi,
I'm having a problem dealing with #'s in my urls. Most browsers will
not send the # with the request because they know it's only for use
with a named anchor.

so when you type in: http://mysite.com/test.php?id=0#top
all that the browser will send as a request is
http://mysite.com/test.php?id=0

this is good. My problem is when a weird browser sends the #top as
part of the request. when this happens, the value of id is now
"0#top". I need to make sure this doesn't happen. I know I could do
some ereg_replace on all my variables, but I would have to do this on
every request and I'd rather avoid it.

in php.ini there is a variable called arg_separator.input that looks
like it can help but when I add the line:

arg_separator.input = "&#"

I still get $id = "0#top"

so it doesn't seem to be working. I have php 4.0.6

thanks for any ideas,
- Mark

--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Mark) wrote:

> in php.ini there is a variable called arg separator.input that looks 
> like it can help but when I add the line:
> 
> arg separator.input = "&#"
> 
> I still get $id = "0#top"

Did you restart the server after modifying php.ini?

As for "http://mysite.com/test.php?id=0#top"; sometimes resulting in id='0' 
and sometimes id='0#', perhaps this is a situation where letting PHP 
register the globals automatically is not the way to go.  You could instead 
extract the query string from the URL by using parse_url() 
<http://php.net/parse-url>, then turn that query string into variables by 
using parse_str() <http://php.net/parse-str>.

-- 
CC
--- End Message ---
--- Begin Message ---

On Thursday, March 7, 2002, at 07:16  PM, gregory hernandez wrote:

> can i insert the actual file (i.e. "document.txt", of course with it
> contents) into a mysql?
>
> in other words, i don't want to read the contents of the file and 
> insert the
> contents into a field in mysql.  i want to insert the actual file into 
> the
> database.  is this possible?

Yes you can, though it might be an inefficient way of doing it unless 
you have some reason to do it this way.  Look into the column type 
"BLOB" (binary large object), it lets you store binary large objects, 
such as images or files or anything, really.

Why inefficient?  Well, for one thing, BLOBs don't retrieve as quickly 
as regular fields, for reasons I don't altogether know.  Also, you won't 
be able to form a query to search for any characteristics of a BLOB, 
since MySQL will treat the BLOB as a BLOB and doesn't try to imagine 
what's inside it -- as opposed to, say, a VARCHAR column.  There is also 
a TEXT column type for very long text strings, and I forget whether or 
not the contents of these can be used in queries -- can someone please 
confirm this?  But basically, almost any other column type is valid 
subject matter for forming queries.

But for storing images and PDFs or other binary data, there's no other 
way.

Note that many MySQL wizards will recommend that instead of storing 
binary data in a database, use a filesystem to store the data and then 
use the database to create a sort of "directory" for quickly locating 
those files in the filesystem, remembering the path to the file or 
something.  I think this is how a lot of web sites incorporate graphic 
content in with their database (text) content (including mine).


Erik



----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
> But for storing images and PDFs or other binary data, there's 
> no other way.

Actually, after having some problems with BLOB columns when 
mysqldump'ing and moving the data into a new database, I did
find another way. I borrowed a trick from MIME mail handling,
and base64_encod'ed, then chunk_split'ed the data. This makes
it very text-field friendly.

> Note that many MySQL wizards will recommend that instead of 
> storing binary data in a database, use a filesystem to store 
> the data and then use the database to create a sort of 
> "directory" for quickly locating those files in the filesystem, 

There's a problem with this, it assumes that you only use one
filesystem for your site. In the case of Melbourne IT / INWW,
we have 5 or 6 web servers that load balance. If a user uploads 
data and we copy it to the filesystem, then it's only available
on 1 web server. This is why we put it in the database. :)

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
"Work now, freak later!"
--- End Message ---
--- Begin Message ---
Good day,

This isn't really on the topic of PHP.

But, to answer your question- yes, MySQL will let you do lots of neat things
with those large text fields, like looking for substrings and such.  If you
want to store some text information, even that which might have special
characters, line feeds and so forth, the "TEXT" field is definately the way
to go.

============================
Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-----Original Message-----
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 07, 2002 4:10 PM
To: gregory hernandez
Cc: PHP NEWS
Subject: Re: [PHP] php, text file, and mysql



On Thursday, March 7, 2002, at 07:16  PM, gregory hernandez wrote:

> can i insert the actual file (i.e. "document.txt", of course with it
> contents) into a mysql?
>
> in other words, i don't want to read the contents of the file and 
> insert the
> contents into a field in mysql.  i want to insert the actual file into 
> the
> database.  is this possible?

Yes you can, though it might be an inefficient way of doing it unless 
you have some reason to do it this way.  Look into the column type 
"BLOB" (binary large object), it lets you store binary large objects, 
such as images or files or anything, really.

Why inefficient?  Well, for one thing, BLOBs don't retrieve as quickly 
as regular fields, for reasons I don't altogether know.  Also, you won't 
be able to form a query to search for any characteristics of a BLOB, 
since MySQL will treat the BLOB as a BLOB and doesn't try to imagine 
what's inside it -- as opposed to, say, a VARCHAR column.  There is also 
a TEXT column type for very long text strings, and I forget whether or 
not the contents of these can be used in queries -- can someone please 
confirm this?  But basically, almost any other column type is valid 
subject matter for forming queries.

But for storing images and PDFs or other binary data, there's no other 
way.

Note that many MySQL wizards will recommend that instead of storing 
binary data in a database, use a filesystem to store the data and then 
use the database to create a sort of "directory" for quickly locating 
those files in the filesystem, remembering the path to the file or 
something.  I think this is how a lot of web sites incorporate graphic 
content in with their database (text) content (including mine).


Erik



----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
  Hi, just two quick notes:

About text and similar fields:

http://mysql.com/doc/S/t/String_types.html

About not storing images:

http://mysql.com/doc/T/i/Tips.html (close to the middle).

  That's it :-)

--
Julio Nobrega.

Um dia eu chego lá:
http://sourceforge.net/projects/toca



--- End Message ---
--- Begin Message ---
Don't forget The Exchange Project, which is now called osCommerce:
http://www.oscommerce.com/

--- End Message ---
--- Begin Message ---
You must place session_start() before any other /output/. It can come
after other code, as long as nothing will be output before it.
Alternately, you can turn on output buffering and just not worry about
it.

Matthew Walker
Ecommerce Project Manager
Mountain Top Herbs


-----Original Message-----
From: Team GotFusion [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, March 07, 2002 7:16 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Session_start()

Do I have to place a session_start() function at the top of a page
(.php) before the <headers>?

If I am creating  a login form with PHP_SELF, can I place the
session_start() at any point in the html where the user has been
validated and logged in?  

Thanks, Tami
Team GotFusion

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.325 / Virus Database: 182 - Release Date: 2/19/2002
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.325 / Virus Database: 182 - Release Date: 2/19/2002
 
--- End Message ---
--- Begin Message ---

On Thursday, March 7, 2002, at 07:25  PM, Matthew Walker wrote:

> Do I have to place a session_start() function at the top of a page
> (.php) before the <headers>?

When they say that you need to put session_start() before the headers, 
they're referring to the HTTP headers, not the <head> tag of the HTML 
document.  HTTP headers are information about the document that tell the 
client what to expect as it receives the document -- this helps the 
client decide how best to handle the document.  For instance, your 
client (web browser) might be configured to print any text files 
directly to the screen, but any XML files need to be parsed properly 
before being printed.  Or perhaps you're not even being sent a document, 
but rather an MP3 or a PDF.  Your browser might want to know a bit about 
the file that it is being served, before it goes ahead and displays the 
data on the screen -- in the case of an MP3 or PDF, it might wish to 
open up Windows media Player or Quicktime or Adobe Acrobat as a helper 
application (assuming your browser has been programmed to do this).

You can learn more about HTTP headers here:
http://www.jmarshall.com/easy/http/

NB I haven't read it, I just googled that (but I think I will read it 
later).


Erik



----

Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Because I'm not a hacker on the PHP engine, I don't really know but I also
saw this symbol when learning C++ recently. It is used in C++ as a shortcut
to dereferencing and accessing an objects properties/methods on objects
which are on the free store (heap). Normally C++ uses the dot operator to
access methods/properties (eg. "foo.do()"), but when the object needs to
first be dereferenced, then "foo->do()" can be used as a shortcut to
"(*foo).do()".

Of course, this doesn't help you at all does it :) But I thought it was an
interesting connection to C++ and maybe hints at how PHP internally manages
objects. Perhaps it's just a coincidence.

[TK] 

> -----Original Message-----
> From: S.Murali Krishna [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, 4 March 2002 9:48 PM
> To: Jack
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] What is "->" mean in php?
> 
> 
> 
> If you have any Object Oriented Programming experience, then 
> you may not had asked this. Its a operator to access methods, 
> and variables inside a instance of a class , in which the 
> variable before "->" is the instance of the  class and the 
> latter is a method or variable of that class. This is what I 
> know, if you have any explanatory docs, pls let me know.
> 
>       
> 
> On Mon, 4 Mar 2002, Jack wrote:
> 
> > Dear all
> > There is one symbol in PHP that i always see is "->", could 
> anyone pls 
> > tell me what is this, and what does that do? Here is the 
> statement i 
> > saw could some pls explain what it means?
> > 
> > if (!empty($row->usd_period)
> > 
> > Thx a lot
> > Jack
> > [EMAIL PROTECTED]
> > 
> > 
> > 
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> 
> <[EMAIL PROTECTED]>
> -------------------------------------------------------------------
> We must use time wisely and forever realize that the time is 
> always ripe to do right."
>             
>               -- Nelson Mandela
> -------------------------------------------------------------------
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
--- End Message ---
--- Begin Message ---
PHP uses -> as C++ uses ".", since PHP already uses "." for strings.

Stephano Mariani

> -----Original Message-----
> From: Kearns, Terry [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 8 March 2002 12:28 AM
> To: 'S.Murali Krishna'; Jack
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] What is "->" mean in php?
> 
> Because I'm not a hacker on the PHP engine, I don't really know but I
also
> saw this symbol when learning C++ recently. It is used in C++ as a
> shortcut
> to dereferencing and accessing an objects properties/methods on
objects
> which are on the free store (heap). Normally C++ uses the dot operator
to
> access methods/properties (eg. "foo.do()"), but when the object needs
to
> first be dereferenced, then "foo->do()" can be used as a shortcut to
> "(*foo).do()".
> 
> Of course, this doesn't help you at all does it :) But I thought it
was an
> interesting connection to C++ and maybe hints at how PHP internally
> manages
> objects. Perhaps it's just a coincidence.
> 
> [TK]
> 
> > -----Original Message-----
> > From: S.Murali Krishna [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, 4 March 2002 9:48 PM
> > To: Jack
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] What is "->" mean in php?
> >
> >
> >
> > If you have any Object Oriented Programming experience, then
> > you may not had asked this. Its a operator to access methods,
> > and variables inside a instance of a class , in which the
> > variable before "->" is the instance of the  class and the
> > latter is a method or variable of that class. This is what I
> > know, if you have any explanatory docs, pls let me know.
> >
> >
> >
> > On Mon, 4 Mar 2002, Jack wrote:
> >
> > > Dear all
> > > There is one symbol in PHP that i always see is "->", could
> > anyone pls
> > > tell me what is this, and what does that do? Here is the
> > statement i
> > > saw could some pls explain what it means?
> > >
> > > if (!empty($row->usd_period)
> > >
> > > Thx a lot
> > > Jack
> > > [EMAIL PROTECTED]
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> > <[EMAIL PROTECTED]>
> > -------------------------------------------------------------------
> > We must use time wisely and forever realize that the time is
> > always ripe to do right."
> >
> >             -- Nelson Mandela
> > -------------------------------------------------------------------
> >
> >
> > --
> > 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



--- End Message ---
--- Begin Message ---
Used in conjunction with classes.

class Foo
{
        var bar;

        function Foo($bar)
        {
                $this->bar = $bar;
        }
}

$foo = new Foo("foobar");

echo $foo->bar;  // "foobar"


For interests sake here's the same in C++ (correct me if I'm wrong it's been
a long time since I used C++ or pointers).

class Foo
{
        char *bar;

        function Foo(bar)
        {
                this.bar = bar;
        }
}

Foo *foo = new Foo("foobar");

cout << (*foo).bar;  // "foobar" 

// which also works as.

cout << foo->bar;  // "foobar"

-----Original Message-----
From: Stephano Mariani [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 08, 2002 12:57
To: 'Kearns, Terry'; 'S.Murali Krishna'; 'Jack'
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] What is "->" mean in php?


PHP uses -> as C++ uses ".", since PHP already uses "." for strings.

Stephano Mariani

> -----Original Message-----
> From: Kearns, Terry [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 8 March 2002 12:28 AM
> To: 'S.Murali Krishna'; Jack
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] What is "->" mean in php?
> 
> Because I'm not a hacker on the PHP engine, I don't really know but I
also
> saw this symbol when learning C++ recently. It is used in C++ as a
> shortcut
> to dereferencing and accessing an objects properties/methods on
objects
> which are on the free store (heap). Normally C++ uses the dot operator
to
> access methods/properties (eg. "foo.do()"), but when the object needs
to
> first be dereferenced, then "foo->do()" can be used as a shortcut to
> "(*foo).do()".
> 
> Of course, this doesn't help you at all does it :) But I thought it
was an
> interesting connection to C++ and maybe hints at how PHP internally
> manages
> objects. Perhaps it's just a coincidence.
> 
> [TK]
> 
> > -----Original Message-----
> > From: S.Murali Krishna [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, 4 March 2002 9:48 PM
> > To: Jack
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] What is "->" mean in php?
> >
> >
> >
> > If you have any Object Oriented Programming experience, then
> > you may not had asked this. Its a operator to access methods,
> > and variables inside a instance of a class , in which the
> > variable before "->" is the instance of the  class and the
> > latter is a method or variable of that class. This is what I
> > know, if you have any explanatory docs, pls let me know.
> >
> >
> >
> > On Mon, 4 Mar 2002, Jack wrote:
> >
> > > Dear all
> > > There is one symbol in PHP that i always see is "->", could
> > anyone pls
> > > tell me what is this, and what does that do? Here is the
> > statement i
> > > saw could some pls explain what it means?
> > >
> > > if (!empty($row->usd_period)
> > >
> > > Thx a lot
> > > Jack
> > > [EMAIL PROTECTED]
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> > <[EMAIL PROTECTED]>
> > -------------------------------------------------------------------
> > We must use time wisely and forever realize that the time is
> > always ripe to do right."
> >
> >             -- Nelson Mandela
> > -------------------------------------------------------------------
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




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

Hi
  In search of the definition for your question, I've came across an
intersting Doc. Iam just giving  here the snapshot of that.

   In PHP terms, the toplevel directory would be the global
   namespace, and the pathname separator would be ->. Thus, the names
   $cart->items and $another_cart->items name two different variables.
   Note that the variable is named $cart->items, not $cart->$items, that
   is, a variable name in PHP has only a single dollar sign.

The above para is stated in PHP Manual

I done many tests on this operator, atlast I found that, its not only a
dereferencing operator to access a variable or method, rather its a
namespace seperator. We can create any hierarchy of name spaces with
this op., on an object after creating it with 'new'. 

I'm still not clear about this.




On Fri, 8 Mar 2002, Kearns, Terry wrote:

> Because I'm not a hacker on the PHP engine, I don't really know but I also
> saw this symbol when learning C++ recently. It is used in C++ as a shortcut
> to dereferencing and accessing an objects properties/methods on objects
> which are on the free store (heap). Normally C++ uses the dot operator to
> access methods/properties (eg. "foo.do()"), but when the object needs to
> first be dereferenced, then "foo->do()" can be used as a shortcut to
> "(*foo).do()".
> 
> Of course, this doesn't help you at all does it :) But I thought it was an
> interesting connection to C++ and maybe hints at how PHP internally manages
> objects. Perhaps it's just a coincidence.
> 
> [TK] 
> 
> > -----Original Message-----
> > From: S.Murali Krishna [mailto:[EMAIL PROTECTED]] 
> > Sent: Monday, 4 March 2002 9:48 PM
> > To: Jack
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] What is "->" mean in php?
> > 
> > 
> > 
> > If you have any Object Oriented Programming experience, then 
> > you may not had asked this. Its a operator to access methods, 
> > and variables inside a instance of a class , in which the 
> > variable before "->" is the instance of the  class and the 
> > latter is a method or variable of that class. This is what I 
> > know, if you have any explanatory docs, pls let me know.
> > 
> >     
> > 
> > On Mon, 4 Mar 2002, Jack wrote:
> > 
> > > Dear all
> > > There is one symbol in PHP that i always see is "->", could 
> > anyone pls 
> > > tell me what is this, and what does that do? Here is the 
> > statement i 
> > > saw could some pls explain what it means?
> > > 
> > > if (!empty($row->usd_period)
> > > 
> > > Thx a lot
> > > Jack
> > > [EMAIL PROTECTED]
> > > 
> > > 
> > > 
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > 
> > 
> > <[EMAIL PROTECTED]>
> > -------------------------------------------------------------------
> > We must use time wisely and forever realize that the time is 
> > always ripe to do right."
> >             
> >             -- Nelson Mandela
> > -------------------------------------------------------------------
> > 
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> 

<[EMAIL PROTECTED]>
-------------------------------------------------------------------
We must use time wisely and forever realize that the time is 
always ripe to do right."
            
                -- Nelson Mandela
-------------------------------------------------------------------

--- End Message ---
--- Begin Message ---

I have a question about cookies,why is the time that the cookies
expired not same as the time that parameter of session.cookie_lifetime
set?

for example, I wanna the cookies expired 5 minutes later,what should I
do?I think I should set the parameter,as follow:

session.cookie_lifetime = 300

right?

But, after restart my apache server,I found the cookies maybe expired
after 2 minutes,not 5 minutes as I want.

why?
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, vallee.marc-
[EMAIL PROTECTED] says...
> Hi,
> 
> Here is a foo.txt file :
> 
> name=foo
> age=100
> sex=y
> 
> I want to open the file, find the age line, and then replace the 100 with
> another value.
> The only way i see, is to rewrite the entire file........

That is correct. You need to load the file into your script, make 
whatever changes and then write it back.
> 
> Maybe this is a stupid question, but, i tried the online doc, and saw
> nothing about this....
> 

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> php script :
> 
> <?php
> $ini_array = parse_ini_file("conf/conf.php");
> echo($ini_array[var1]);
> ?>
> 
> content of conf/conf.php :
> 
> [data]
> var1 = xxx
> 
> 
> After execution of the php script, it is impossible to delete the conf.php
> file.
> 
> Any idea ?
> 
> greg

If you are running on a Unix type system, the user that your scripts run 
as may not have apropriate file/directory permissions to delete the file.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam
--- End Message ---
--- Begin Message ---
In article <006401c1c600$ba52c210$0600a8c0@aspire006>, 
[EMAIL PROTECTED] says...
> Dear Mark,
> 
>   Thanx for your reply.
> 
>   The solution you mentioned I knew it allready but i cannot change the name
> of order to order[] or something else but i still want to know is there any
> other way i can solve this issue.   I got so many anwer saying that it is
> not possible I wonder why because PHP is supporting so many feature why not
> this. In Java and Cgi-Perl it is very simple why not in PHP that's my
> question.
> 
>   In java i use : (works for both GET and POST)
> 
> public Enumeration ServletRequest.getParameterNames() - for getting all the
> names
> public String[] ServletRequest.getParameterValues(String) - for getting all
> values for the given name ( this is the one which accomplishes my job, gets
> both order's values)
> 
>   I am very sure that there must be some solution to this but I don't know
> how to do this in PHP.  I have one solution using GET method but not with
> POST.
> 
>   Looking forward for solution to this issue.
> 
>   Regards,
> 
> karthikeyan.

Have you looked at $HTTP_POST_VARS (or $_POST, depending on version) or 
$QUERY_STRING?

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam
--- End Message ---
--- Begin Message ---
Hi,

  I use PHP 4.0.6, I am not sure about $_POST but $HTTP_POST_VARS removes
duplicate entries.  As far as $QUERY_STRING is concerned well I knew it
could do it but I want to use POST method.

  Not that happy knowing that PHP doesn't support this feature when Java and
CGI-Perl can.

  Regards,

karthikeyan.
----- Original Message -----
From: David Robley <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 08, 2002 6:21 AM
Subject: [PHP] Re: REQUEST QUESTION


>
> In article <006401c1c600$ba52c210$0600a8c0@aspire006>,
> [EMAIL PROTECTED] says...
> > Dear Mark,
> >
> >   Thanx for your reply.
> >
> >   The solution you mentioned I knew it allready but i cannot change the
name
> > of order to order[] or something else but i still want to know is there
any
> > other way i can solve this issue.   I got so many anwer saying that it
is
> > not possible I wonder why because PHP is supporting so many feature why
not
> > this. In Java and Cgi-Perl it is very simple why not in PHP that's my
> > question.
> >
> >   In java i use : (works for both GET and POST)
> >
> > public Enumeration ServletRequest.getParameterNames() - for getting all
the
> > names
> > public String[] ServletRequest.getParameterValues(String) - for getting
all
> > values for the given name ( this is the one which accomplishes my job,
gets
> > both order's values)
> >
> >   I am very sure that there must be some solution to this but I don't
know
> > how to do this in PHP.  I have one solution using GET method but not
with
> > POST.
> >
> >   Looking forward for solution to this issue.
> >
> >   Regards,
> >
> > karthikeyan.
>
> Have you looked at $HTTP_POST_VARS (or $_POST, depending on version) or
> $QUERY_STRING?
>
> --
> David Robley
> Temporary Kiwi!
>
> Quod subigo farinam
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Anyone know of an easy to use library/or code that will read and write
> an ini file?
 
See parse_ini_file() together with the file handling functions.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam
--- End Message ---
--- Begin Message ---
> > Anyone know of an easy to use library/or code that will read and write
> > an ini file?
> See parse_ini_file() together with the file handling functions.

Dave,
http://www.php.net/manual/en/function.parse-ini-file.php
Good, but no code to write to an ini file?
:) John

--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> > > Anyone know of an easy to use library/or code that will read and write
> > > an ini file?
> > See parse_ini_file() together with the file handling functions.
> 
> Dave,
> http://www.php.net/manual/en/function.parse-ini-file.php
> Good, but no code to write to an ini file?
> :) John
 

I think the coder actually has to do a little bit from time to time - PHP 
is good but not _that_ good.

Just out of curiosity, what do you think would be the algorithm for 
_writing to_ an ini file? How many sections does it have? What are they 
called? What is the structure of the entries allowed in each section? How 
many entries can each section have? What are the possible range of values 
for any entry? Rhetorical question, don't tell me.

What I am saying here is that it is a lot easier to parse a file given 
its basic structure, than it is to create a file based on that structure 
but with a huge, almost infinite, number of possible entries.

In other words, you'll have to roll your own, using the file functions.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam
--- End Message ---
--- Begin Message ---
Nico Vrouwe wrote:


> $i<ord('Z') seems easier to me than $i<ord('A')+26 :)


Easier:

<?php
for ($a = $i = 'A'; $i != 'Z'; $a .= ++$i) ;
?>

now $a contains 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

--- End Message ---
--- Begin Message ---
I am inserting into the table values with single Quote.

If I give the command through text file -  Insert into test values 
('manisha\' test') - then this is ok, but when i try to insert the manisha 
' test value through http://<hostname>/sqladmin using GUI then MySql is 
giving error.

Any help regarding this ?

Any body knows how to stop and start the MySql service ?

--- End Message ---
--- Begin Message ---
Hi Manisha:

> If I give the command through text file -  Insert into test values 
> ('manisha\' test') - then this is ok, but when i try to insert the 
> manisha ' test value through http://<hostname>/sqladmin using GUI then 
> MySql is giving error.

What's the error?  That would certainly help us help you.  It might even 
help you help yourself.

I'm guessing that your php.ini file has gpc_magic_quotes on.  If so,
don't manually escape the data you're submitting, since PHP does it
automatically.


> Any body knows how to stop and start the MySql service ?

Depends.  Do you have control over the server?  If so...
   net stop mysqld
may do the trick for you.

Later,

--Dan

-- 
                PHP scripts that make your job easier
              http://www.analysisandsolutions.com/code/
         SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
--- End Message ---
--- Begin Message ---
thanks, you are right, gpc_magic_quotes of php.ini  was off.



At 11:08 PM 3/7/02 -0500, Analysis & Solutions wrote:
>Hi Manisha:
>
> > If I give the command through text file -  Insert into test values
> > ('manisha\' test') - then this is ok, but when i try to insert the
> > manisha ' test value through http://<hostname>/sqladmin using GUI then
> > MySql is giving error.
>
>What's the error?  That would certainly help us help you.  It might even
>help you help yourself.
>
>I'm guessing that your php.ini file has gpc_magic_quotes on.  If so,
>don't manually escape the data you're submitting, since PHP does it
>automatically.
>
>
> > Any body knows how to stop and start the MySql service ?
>
>Depends.  Do you have control over the server?  If so...
>    net stop mysqld
>may do the trick for you.
>
>Later,
>
>--Dan
>
>--
>                 PHP scripts that make your job easier
>               http://www.analysisandsolutions.com/code/
>          SQL Solution  |  Layout Solution  |  Form Solution
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
On Fri, Mar 08, 2002 at 12:44:30PM +0800, Manisha wrote:

> thanks, you are right, gpc_magic_quotes of php.ini  was off.

Oh, so then in your script, you weren't using the addslashes() function.

Personally, I prefer *magic_quotes to be off, allowing me to precisely
control what I want to do with the input.

Enjoy,

--Dan

-- 
                PHP scripts that make your job easier
              http://www.analysisandsolutions.com/code/
         SQL Solution  |  Layout Solution  |  Form Solution
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
--- End Message ---
--- Begin Message ---
On Friday 08 March 2002 13:10, Analysis & Solutions wrote:
> On Fri, Mar 08, 2002 at 12:44:30PM +0800, Manisha wrote:
> > thanks, you are right, gpc_magic_quotes of php.ini  was off.
>
> Oh, so then in your script, you weren't using the addslashes() function.
>
> Personally, I prefer *magic_quotes to be off, allowing me to precisely
> control what I want to do with the input.

For portability, the best thing to do would be to check what the settings are 
using get_magic_quotes_gpc(), get_magic_quotes_runtime() or ini_get() and act 
accordingly.


--- End Message ---
--- Begin Message ---
Thanks again for your help last night Jim. I found another source that by
passes the middle man and this script (see below) is quicker. It works great
for ONE ticker symbol. Yahoo allows one to retrieve multiple quotes by
typing in comma separated tickers with no spaces.    msft,rhat,^dji

The commas get turned into pluses. The multiple ticker URL for above tickers
is thus:
http://finance.yahoo.com/d/quotes.csv?s=msft+rhat+^dji&f=sl1d1t1c1ohgv&e=.cs
v

If I change $symbol = msft+rhat+^dji
How could I save all to a multi-dimensional array?

Thanks

Craig ><>
[EMAIL PROTECTED]



<?php

$symbol = "msft";

$url =
"http://finance.yahoo.com/d/quotes.csv?s=$symbol&f=sl1d1t1c1ohgv&e=.csv";;
$fp = fopen($url , "r");
if (!fp)
{
echo "could not connect to the site";
}
else
{
$data = fgetcsv($fp,1000,",");
fclose($fp);

print_r($data);

?>

<br><br>

<table>
<tr><td>description</td><td>latest figure</td><tr>
<tr><td>Market</td><td><?php echo $data[0] ?></td></tr>
<tr><td>last price</td><td><?php echo $data[1] ?></td></tr>
<tr><td>date</td><td><?php echo $data[2] ?></td></tr>
<tr><td>time</td><td><?php echo $data[3] ?></td></tr>
<tr><td>change</td><td><?php echo $data[4] ?></td></tr>
<tr><td>open</td><td><?php echo $data[5] ?></td></tr>
<tr><td>high</td><td><?php echo $data[6] ?></td></tr>
<tr><td>low</td><td><?php echo $data[7] ?></td></tr>
</table>

<?php

}

?>

--- End Message ---
--- Begin Message ---
I have a file called dbconnect that stores all of my mysql information
(host, user, pass) up until now I have always just used localhost as the
hostname because it was on my local server. My question is what do I have to
do to connect to a different server? Do I just have to put in the computers
ip address?

--- End Message ---
--- Begin Message ---
Josiah Wallingford wrote:
> I have a file called dbconnect that stores all of my mysql information
> (host, user, pass) up until now I have always just used localhost as the
> hostname because it was on my local server. My question is what do I have to
> do to connect to a different server? Do I just have to put in the computers
> ip address?
> 
> 

Yes.  Except:

If that server will allow a remote connection from yours, then you're 
all set.  If that server doesn't allow remote MySQL connections, you'll 
need to have that mysql administrator allow remote connections for that 
mysql user and/or ip.

--- End Message ---
--- Begin Message ---
Hello everyone,

I would like to know why you put this character (!) in front of this:
<?php
$var1 = "Hello";
$var2 = "hello";
if (!strcasecmp($var1, $var2)) {
    echo '$var1 is equal to $var2 in a case-insensitive string comparison';
}
?>
Do you see the (!) in front of the strcasecmp() function? That! Why do you put 
that there? 

I'm trying to learn PHP, but it's been kinda hard. THANKS A LOT GUYS! 

-GENESiS DESiGNS
-Sean Kennedy
-http://www.gdesigns.vcn.com

--- End Message ---
--- Begin Message ---
> I would like to know why you put this character (!) in front of this:

An ! means that the following statement should be false. So:

if (!isset($variable))

means "If $variable is not set"

Jason
--- End Message ---
--- Begin Message ---


I have given like that you have mentioned below.again it is giving the
same error.pls tell me how i will solve that......

"" Your terminal lacks the ability to clear the screen or position the
 cursor.""

-Uma


On Wed, 6 Mar 2002, Philip Hallstrom wrote:

PH>Try...
PH>
PH>lynx -dump ....
PH>
PH>-philip
PH>
PH>On Thu, 7 Mar 2002, Uma Shankari T. wrote:
PH>
PH>>
PH>>
PH>>  Hello,
PH>>
PH>>     I am facing some problem in the crontab...Can anyone tell me how to
PH>> solve this
PH>>
PH>>  Actually i have written the php script to send mail to the users after a
PH>> week.In the crontab i have made a entry so that it will trigger after
PH>> 12.05.
PH>>
PH>>  5 0 * * *       lynx http://info/php/MailForm.php
PH>>
PH>> I have received a mail like this.And also it didn't send the mail to
PH>> the users....why it is so
PH>>
PH>>
PH>> "" Your terminal lacks the ability to clear the screen or position the
PH>> cursor.""
PH>>
PH>>
PH>>
PH>> -Uma
PH>>
PH>>
PH>>
PH>>
PH>>
PH>>
PH>> --
PH>> PHP General Mailing List (http://www.php.net/)
PH>> To unsubscribe, visit: http://www.php.net/unsub.php
PH>>
PH>

--- End Message ---
--- Begin Message ---

Why don't you call the script as command line one and redirect output
to /dev/null.


On Fri, 8 Mar 2002, Uma Shankari T. wrote:

> 
> 
> I have given like that you have mentioned below.again it is giving the
> same error.pls tell me how i will solve that......
> 
> "" Your terminal lacks the ability to clear the screen or position the
>  cursor.""
> 
> -Uma
> 
> 
> On Wed, 6 Mar 2002, Philip Hallstrom wrote:
> 
> PH>Try...
> PH>
> PH>lynx -dump ....
> PH>
> PH>-philip
> PH>
> PH>On Thu, 7 Mar 2002, Uma Shankari T. wrote:
> PH>
> PH>>
> PH>>
> PH>>  Hello,
> PH>>
> PH>>     I am facing some problem in the crontab...Can anyone tell me how to
> PH>> solve this
> PH>>
> PH>>  Actually i have written the php script to send mail to the users after a
> PH>> week.In the crontab i have made a entry so that it will trigger after
> PH>> 12.05.
> PH>>
> PH>>  5 0 * * *       lynx http://info/php/MailForm.php
> PH>>
> PH>> I have received a mail like this.And also it didn't send the mail to
> PH>> the users....why it is so
> PH>>
> PH>>
> PH>> "" Your terminal lacks the ability to clear the screen or position the
> PH>> cursor.""
> PH>>
> PH>>
> PH>>
> PH>> -Uma
> PH>>
> PH>>
> PH>>
> PH>>
> PH>>
> PH>>
> PH>> --
> PH>> PHP General Mailing List (http://www.php.net/)
> PH>> To unsubscribe, visit: http://www.php.net/unsub.php
> PH>>
> PH>
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

<[EMAIL PROTECTED]>
-------------------------------------------------------------------
We must use time wisely and forever realize that the time is 
always ripe to do right."
            
                -- Nelson Mandela
-------------------------------------------------------------------

--- End Message ---
--- Begin Message ---
Hello, I use PDF function to generate a PDF file.

It works fine except I cannot generate a document with more than 10 pages !

For each page I use pdf_begin_page($pdf, 595, 842);
I close each page with pdf_end_page


Any ideas ??

jean-arthur



----------------------------------------------------------------
EuroVox
4, place Félix Eboue
75583 Paris Cedex 12
Tel : 01 44 67 05 05
Fax : 01 44 67 05 19
Web : http://www.eurovox.fr
----------------------------------------------------------------

--- End Message ---
--- Begin Message ---
Hi there, 

I would prefer to take away the possibility for PHP to parse my
documents in the /uploaded/ directory. 

What has to be written into the .htaccess file for PHP *not* to parse
*anything* therein (not .php, not .phtml, not .html, not .php3, not
.blah... in a word -- NOTHING). 

It would be very bad when somebody could upload malicious code to my
server, wouldn't it! 

Thanks!
Lauri

--- End Message ---
--- Begin Message ---
On Thursday 07 March 2002 19:21, Lars Torben Wilson wrote: 

> // The direct way:
> $foo->{$test . '_foo'}();

Thanks Lars

This was what I was looking for, just couldn't remember the syntax

--- End Message ---
--- Begin Message ---
I'm having the same problem -

I've been using the mail() command for quite some time now and it's been
working 100% and executing immediately.

Suddenly, this morning, it is taking about 60 seconds to send mail, delaying
the display of the php web page by that same amount of time.

I have checked the mail server and sending mail from the command prompt
(linux) and there is no delay there.

Does anybody have any clue? I even momentarily downgraded to 4.1.0 to make
sure it wasnt a bug in 4.1.2


"Paul" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Can nobody help?  This is so frustrating.  I cannot see what's wrong, open
> to ANY suggestions!
>
> Thanks.
>
> Paul
> "Paul" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hello,
> >
> > I wonder if anyone can help me with a problem I have.  I have some sites
> > hosted on a Cobalt Raq4 server (not sure if this is relevant).  I
recently
> > upgraded PHP from a package at www.pkgmaster.com, and since making this
> > upgrade I have problems with PHP that I cannot find the solution to.
> >
> > I have conacted their 'team' who have thus far offered no explanation,
> > saying it must be something else causing these issues with PHP, but I
> > haven't made any more changes, just installed the new PHP version.
> >
> > The problems are with the mail() function taking an AGE to excecute, and
> > environmental HTTP header information not being sent/recieved by
getenv().
> >
> > Some examples follow..
> >
> > For example, as an extremely basic example of the mail function going
> slow,
> > this simple script:
> > <?
> > mail("[EMAIL PROTECTED]", "Test subject", "Test message");
> > print "finished!";
> > ?>
> >
> > Which can be found at http://www.clicktolearn.co.uk/test/mail.php in
> action,
> > ran (as it should do) extremely fast the week before I made the upgrade
> from
> > the packages.  Now, as you will see, it runs dog slow.
> >
> > Secondly, the following script shows the lack of headers:
> > http://www.clicktolearn.co.uk/test/  (click the link, so there's a
referer
> > to the script page)...
> >
> > <?
> > function get_http_headers($url, $proto="HTTP/1.0", $timeout=10) {
> >         $return = false;
> >         if (substr($url,0,7)=="http://";) {
> >                 $url = substr($url,7);
> >         }
> >
> >         $parts = parse_url("http://".$url);
> >
> >         $ips = gethostbynamel($parts["host"]);
> >
> >         if ($ips[0]) {
> >                 $ip = $ips[0];
> >                 $host = $parts["host"];
> >                 $path = ($parts["path"]) ? $parts["path"] : "/";
> >                 $port = ($parts["port"]) ? $parts["port"] : 80;
> >
> >                 $start = time();
> >                 $timeout = $timeout + $start;
> >
> >                 if($sock = fsockopen($host, $port)) {
> >                         set_socket_blocking($sock, 0);
> >                         switch($proto) {
> >                                 case "HTTP/1.1":
> >                                         set_socket_blocking($sock, 1);
> >                                         fputs($sock, sprintf("HEAD %s
> %s\n",
> > $path, $proto));
> >                                         fputs($sock, sprintf("Host:
> %s\n\n",
> > $host));
> >                                         break;
> >                                 default:
> >                                         fputs($sock, sprintf("HEAD %s
> > %s\n\n", $path, $proto));
> >                                 }
> >
> >                         while(!feof($sock) && $t<$timeout) {
> >                                 $line .= fgets($sock,1);
> >                                 $t = time();
> >                         }
> >                         fclose($sock);
> >                         $end = time();
> >
> >                         if ($t>=$timeout) {
> >                                 $http = parse_output($line);
> >                                 $http["result"] = 502;
> >                                 $http["message"] = "Timed Out";
> >                                 $http["time_used"] = $end - $start;
> >                                 $return = $http;
> >                         } elseif($line) {
> >                                 $http = parse_output($line);
> >                                 $http["time_used"] = $end - $start;
> >                                 $return = $http;
> >                         }
> >                 }
> >         }
> >         return $return;
> > }
> >
> > function parse_output($line) {
> >         $lines = explode("\n", $line);
> >         if(substr($lines[0],0,4)=="HTTP") {
> >         list($http["protocol"], $http["result"], $http["message"]) =
> > split("[[:space:]]+",$lines[0],3);
> >         } else if(substr($lines[0],0,7)=="Server:") {
> >                 $http["server"] = substr($lines[0],8);
> >         }
> >         for ($i=1; $i<count($lines); $i++) {
> >                 list($key, $val) = split(":[[:space:]]*", $lines[$i],2);
> >                 $key = strtolower(trim($key));
> >                 if ($key) {
> >                         $http[$key] = trim($val);
> >                 } else {
> >                         break;
> >                 }
> >         }
> >         return($http);
> > };
> > var_dump(getallheaders());
> > print "<br><br>";
> >
>
var_dump(get_http_headers('http://www.clicktolearn.co.uk/test/testheaders.ph
> > p'));
> > print "<br><br>";
> > print $HTTP_REFERER;
> > print "<br><br>";
> > print "<a href='Javascript: history.back();'>Back</a>";
> > print "<br><br>";
> > var_dump(getenv($HTTP_REFERER));
> > ?>
> >
> > Under the "Back" link is the output of: var_dump(getenv($HTTP_REFERER));
> > Now I know that this was working before the upgrade, as a log in script
I
> > use on the main site uses getenv($HTTP_REFERER) to send them back to
where
> > they came from.  This again worked 100% fine before PHP upgrade.
> >
> > Sorry to take up your time, but there is a problem somewhere that has
> > certainly only begun with PHP since I upgraded to 4.1.2, and I dont know
> > what it could be!?
> >
> > Thanks in advance.
> >
> > Paul Mullett
> >
> >
> >
>
>


--- End Message ---
--- Begin Message ---
Can somebody tell me how many variables can i store in one session,
or how many KB can one session resist


--- End Message ---
--- Begin Message ---
Guys,

I want to randomly pick one of a number of values, with given probability for each 
item, e.g.

abc 50%
def 25%
ghi 25%

The obvious way is to take a list where the 50% item is given twice and then randomly 
pick one, but what if I want to use a probability of 51.3% (and don't tell me of a 
list with 1000 entries and 513 times the 'abc' item *g*).

This seems to be trivial, but I just can't think of a simple and proper way to do it.

Any ideas?

Regards,

Gunther E. Biernat


--- End Message ---

Reply via email to