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 9 Mar 2004 15:20:24 -0000 Issue 2636

php-general-digest-helplists.php.net
Date: Tue Mar 09 2004 - 09:20:24 CST


php-general Digest 9 Mar 2004 15:20:24 -0000 Issue 2636

Topics (messages 179863 through 179899):

Retrieving Browser SSL Info in PHP
        179863 by: Daniel Collins

date() before 1 Jan 1970...
        179864 by: adwinwijaya
        179870 by: Ben Ramsey
        179871 by: Ben Ramsey

Re: MYSQL & Image functions
        179865 by: David Robley

Re: new session in new window
        179866 by: Chris Shiflett
        179867 by: trlists.clayst.com
        179869 by: Tim Traver
        179874 by: Chris Shiflett

Re: using mail() for multiple email address...
        179868 by: trlists.clayst.com

gd for windows not working
        179872 by: Joe Patiani

OT Match Against
        179873 by: Richard Baskett
        179876 by: Richard Baskett

IMAP und Umlaute
        179875 by: Jochen Kaechelin
        179886 by: Michael Kunze

mail() and passwords
        179877 by: Will
        179878 by: tom meinlschmidt

Very, very wiered problem - Part 2
        179879 by: Mário Gamito
        179885 by: Marek Kilimajer
        179888 by: Mário Gamito
        179889 by: Jay Blanchard
        179897 by: Marek Kilimajer

Re: getting message from file
        179880 by: Kenneth
        179881 by: umesh
        179884 by: tom meinlschmidt

Re: fsockopen() errors.
        179882 by: Phil Ewington - 43 Plc

how do i detect the exsistens of a network printer?
        179883 by: Shay

Re: Back Button produces Parse Error
        179887 by: Michael Kunze

hello world == 0 ?
        179890 by: test
        179891 by: Tom Rogers
        179892 by: test
        179893 by: Richard Davey

Re: Changing Default Charset
        179894 by: Brian V Bonini
        179895 by: Brian V Bonini

small business inventory management package
        179896 by: Christian Calloway

Pagination & MSSQL
        179898 by: Alex Hogan

migration of mysql to SQL server
        179899 by: German

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:


Hello,

My problem is this: I wish to have extremely highly secure sessions. I have
instituted full SSL, tuned apache, and set the web server security such that
there is very low possiblity of internal session hijacking. However, I am
concerned about the session fixation problem (as well as a direct attack on
the client box yielding the cookie contents), and would like to take into
consideration a user's browser SSL certificate as a fairly reliable
session-duration indicator that I am talking to the proper client throughout
the session. However I cannot find any environment variable or server
variable that suggests what the CLIENT's SSL information might be, only what
my server's certificates say. This is a fairly common recommendation on the
'net, and I must be a dunce but I cannot find out how to retrieve this
information in PHP. Could someone kindly point me in the direction of the
right variable here? Thanks!

attached mail follows:


Hello php-general,

  how to display date like Monday, 1 January 1903 18:11 pm in php ?
  (since the date() function only able to display date before 1970)
  (and why it only support date after 1 Jan 1970) ?
  thanks

--
Best regards,
 adwin

attached mail follows:


Check out the manual:
http://www.php.net/strtotime

Theoretically, this should work:
$old_date = strtotime("January 1, 1903 18:11 pm");
echo date("Y-m-d H:i:s", $old_date);

But all that echoes is:
1969-12-31 18:59:59

On that manual page, you'll see the following note:

<quote>
Note: The valid range of a timestamp is typically from Fri, 13 Dec 1901
20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that
correspond to the minimum and maximum values for a 32-bit signed
integer.) Additionally, not all platforms support negative timestamps,
therefore your date range may be limited to no earlier than the Unix
epoch. This means that e.g. dates prior to Jan 1, 1970 will not work on
Windows, some Linux distributions, and a few other operating systems.
</quote>

I'm not sure whether there is a good work-around for converting that
string to a timestamp; however, this does work and will produce the
desired results:

$old_date = mktime(0, 11, 18, 1, 1, 1903);
echo date("Y-m-d H:i:s", $old_date);

Adwinwijaya wrote:

> Hello php-general,
>
> how to display date like Monday, 1 January 1903 18:11 pm in php ?
> (since the date() function only able to display date before 1970)
> (and why it only support date after 1 Jan 1970) ?
> thanks
>

--
Regards,
  Ben Ramsey
  http://benramsey.com
  http://www.phpcommunity.org/wiki/People/BenRamsey

attached mail follows:


Ben Ramsey wrote:
> $old_date = mktime(0, 11, 18, 1, 1, 1903);
> echo date("Y-m-d H:i:s", $old_date);

Argh! I had the numbers reversed. It should be:
$old_date = mktime(18, 11, 0, 1, 1, 1903);

But you get the idea...

--
Regards,
  Ben Ramsey
  http://benramsey.com
  http://www.phpcommunity.org/wiki/People/BenRamsey

attached mail follows:


In article <1078732406.5267.2.cameldhcppc2>, t.a.johnsonverizon.net
says...
> I am trying to use any of the image functions with image data from a
> mysql database. I can get these functions to work from files on the
> server but for some reason, not out of the database. If any one has
> gotten this to work, code you shoot me over some sample code, or
> functions on what to do.
>
You probably need to eval() the strings after you extract them from the
database.

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


--- Tim Traver <tt-listsimplenet.com> wrote:
> I sent a new session ID with the link to the new window like this :
>
> <a href="?PHPSESSID=123456789" target="_blank">
>
> but all it does is change the current session id to the new one, so if
> I go back to the main window, it carries the new session into it.

Yeah, you're only using one browser, so you can only have one set of
cookies. To do this, you can't rely on cookies at all, which can be a
hassle. Otherwise, the session identifier will always be the most recent
one used, because that's what the cookie will reflect (unless you add some
logic to do otherwise).

I still think it might be better to approach this with programming logic.
As I said, this strategy will work, but it's ugly.

> The reason I'm doing the access control through sessions is so that I
> don't have to pass any info in URL's and re-authenticate a user every
> time they hit a page.

We're only talking about propagating the session identifier on the URL.
This has nothing to do with authentication and everything to do with
identification.

> By saving that information locally in session variables, none of that
> info gets out, and no one can spoof it.

Yikes, that's a lot of misinformation in one sentence! Cookies are saved
locally, and they can make session identifier propagation seem transparent
for both the user and the developer. However, just as with URL data,
cookies are just something sent along in the request, so they're being
provided by the client. So, this information most definitely "gets out".

Sessions are not stored locally; they are stored on the server. It is very
important that you understand this, in fact, if you want to implement
secure session management. You should leverage this fact to strengthen
your mechanism.

Lastly, anyone can spoof this. The session identifier has to be provided
by the client, but a secure session mechanism will treat it with some
skepticism. Nothing from the client should ever be blindly trusted, which
is what I interpret "no one can spoof it" to be suggesting.

I have an article that elaborates much more on this topic that you can
read for free:

http://shiflett.org/articles/the-truth-about-sessions

Hope that helps.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming mid-2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

attached mail follows:


On 8 Mar 2004 Tim Traver wrote:

> I sent a new session ID with the link to the new window like this :
>
> <a href="?PHPSESSID=123456789" target="_blank">
>
> but all it does is change the current session id to the new one, so if I go
> back to the main window, it carries the new session into it.

I think this is trickier than it sounds. Calling session_name with the
new name just prior to calling session_start should do it if you know
what name to set. But where are you going to get the name? If it is
hard-coded you are OK but if it is dynamic, as it has to be with user
logins, you need a place to store the session name -- and you can't use
sessions to do it! You end up having to pass at least something in the
URL, even if it is just a digit:

        print("<a href=\"?$sessnum\" ...>");

the URL would be something like:

        http://www.mydomain.com/page.php?1

from which you do something like:

        session_name("PHPSESSID" . $_SERVER["QUERY_STRING"]);
        session_start();

(obviously some error-checking might be beneficial as well).

I don't think you can do what you want with sessions alone. HTTP is
"too stateless" for that!

--
Tom

attached mail follows:


Chris,

ok, let me start over a little bit...

what I meant by the session data getting stored locally is that it is local
to the web server, not locally on the client browser. I understand how
session variables work. I just said local, and i was thinking
server...sorry about that...

what i meant by "no one can spoof it" is that no one knows what session
variables are stored with what data that is being used to authenticate that
session (ie additional digests to authenticate the request), and none of
those variables and values are set in a cookie or in URL's.

Nice article by the way, and I am indeed already using those same methods
to secure the user session. (I use SHA1 on the IP,PHPSESSIONID,user agent,
and a secret...)

So, it sounds like the only way for it to set a new cookie is by opening a
new browser app, which would allow you to send a new cookie different than
your other windows, and it doesn't look like I can do that from an existing
window, cause it will always send the same cookie...

darn...I guess I'll have to live with that...hmmmm...maybe I can set it on
a different cookie path...that might work...

anyways, thanks for the discussion chris.

Tim.

At 08:16 PM 3/8/2004, Chris Shiflett wrote:
>--- Tim Traver <tt-listsimplenet.com> wrote:
> > I sent a new session ID with the link to the new window like this :
> >
> > <a href="?PHPSESSID=123456789" target="_blank">
> >
> > but all it does is change the current session id to the new one, so if
> > I go back to the main window, it carries the new session into it.
>
>Yeah, you're only using one browser, so you can only have one set of
>cookies. To do this, you can't rely on cookies at all, which can be a
>hassle. Otherwise, the session identifier will always be the most recent
>one used, because that's what the cookie will reflect (unless you add some
>logic to do otherwise).
>
>I still think it might be better to approach this with programming logic.
>As I said, this strategy will work, but it's ugly.
>
> > The reason I'm doing the access control through sessions is so that I
> > don't have to pass any info in URL's and re-authenticate a user every
> > time they hit a page.
>
>We're only talking about propagating the session identifier on the URL.
>This has nothing to do with authentication and everything to do with
>identification.
>
> > By saving that information locally in session variables, none of that
> > info gets out, and no one can spoof it.
>
>Yikes, that's a lot of misinformation in one sentence! Cookies are saved
>locally, and they can make session identifier propagation seem transparent
>for both the user and the developer. However, just as with URL data,
>cookies are just something sent along in the request, so they're being
>provided by the client. So, this information most definitely "gets out".
>
>Sessions are not stored locally; they are stored on the server. It is very
>important that you understand this, in fact, if you want to implement
>secure session management. You should leverage this fact to strengthen
>your mechanism.
>
>Lastly, anyone can spoof this. The session identifier has to be provided
>by the client, but a secure session mechanism will treat it with some
>skepticism. Nothing from the client should ever be blindly trusted, which
>is what I interpret "no one can spoof it" to be suggesting.
>
>I have an article that elaborates much more on this topic that you can
>read for free:
>
>http://shiflett.org/articles/the-truth-about-sessions
>
>Hope that helps.
>
>Chris
>
>=====
>Chris Shiflett - http://shiflett.org/
>
>PHP Security - O'Reilly
> Coming mid-2004
>HTTP Developer's Handbook - Sams
> http://httphandbook.org/
>PHP Community Site
> http://phpcommunity.org/
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

SimpleNet's Back !
http://www.simplenet.com

attached mail follows:


--- Tim Traver <tt-listsimplenet.com> wrote:
> what I meant by the session data getting stored locally is that it is
> local to the web server, not locally on the client browser.

I see. My apologies.

Perhaps we should both refrain from using locally and instead use server
and client to be clear. :-)

> what i meant by "no one can spoof it" is that no one knows what session
> variables are stored with what data that is being used to authenticate
> that session

Yes, now that I see you're speaking about session data on the server, I
think the "no one can spoof it" is right. I hesitate to ever say such a
thing, only because I know it is too absolute to be true. But, session
data is very safe, I agree.

> Nice article by the way, and I am indeed already using those same
> methods to secure the user session. (I use SHA1 on the IP, PHPSESSIONID,
> user agent, and a secret...)

Thanks for the kind words. I must point out that you'll never see me
suggesting to use the IP address for anything important, especially
anything regarding security.

Also, George Schlossnagle recently expressed to me that he has observed
the User-Agent header changing for the same client. I've never heard of
this myself, and he had nothing but his memory of the event to support it,
but it's something to keep in mind. I try to never "punish" a user who
fails a check, just in case the user isn't actually the bad guy. Rather, I
ask the user to re-enter the password or something, which is less
problematic (unless the user really is a bad guy).

> So, it sounds like the only way for it to set a new cookie is by opening
> a new browser app, which would allow you to send a new cookie different
> than your other windows, and it doesn't look like I can do that from an
> existing window, cause it will always send the same cookie...

That's right. Recently, I think someone on this list was describing how a
particular version of IE behaves the exact way that you're wanting - it
kept cookies separate for each window. I've never seen or heard of this
being confirmed, but there's another rumor for you. :-)

> darn...I guess I'll have to live with that...hmmmm...maybe I can set it
> on a different cookie path...that might work...

Yes, there are many options for you if you write a bit of code. One option
would be to write your own session handler for the admin side of things,
using session_set_save_handler() to register your custom functions. Then,
you could do something as simple as appending "admin" to the session
identifier before storing and retrieving session data. This would be no
less secure than the standard mechanism, and it would allow you to have as
many sessions per user as you need.

> anyways, thanks for the discussion chris.

No problem. I hope this was more helpful.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming mid-2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

attached mail follows:


On 8 Mar 2004 Adam Reiswig wrote:

> Normally, the two emails would end up in the same pop account but don't
> seem to be when I use the above script. If I send to one or the other
> they receive appropriately, but if I send to both at the same time, I
> only receive one email, not both. If anyone can help me as to why this
> is and if there is a remedy, I'd sure like to know about it. Thanks a lot!!

Is this on a Unix box? The same box where the domain is hosted? If so
I think sendmail does that -- it notices the duplication, and only
sends the message once.

--
Tom

attached mail follows:


On Tue, 9 Mar 2004, Mehdi Achour wrote:

> > guess. But the php extension not working. I need the php_gd2.dll running,
> > I`ve copied it into system dir. But it`s still not working.
> >
> > Please tell me the solution, so I can use the gd dll in my windows.

attached mail follows:


Do you have any idea why this query:

SELECT hh_listings.listID, listingName, phone, email, held, venderID,
hh_listings.disabled, hh_listings.deleted, hh_listings.levelID, levelName,
islandName FROM hh_listings, hh_listlevels, hh_islands WHERE
hh_listings.levelID=hh_listlevels.levelID AND
hh_listings.islandID=hh_islands.islandID AND hh_listings.deleted!='1' AND
MATCH (listingName) AGAINST ('spa*' IN BOOLEAN MODE) ORDER BY listID ASC

Is not showing the listingName 'Spa Enterprises' or 'Everything Spa', but it
is showing 'Spasms are us' or 'Loving Spat' all names are made up :)

Basically if the word has spa in it then it matches, but if it the exact
word.. it does not match.. what is going on?

thanks!

Rick

attached mail follows:


> Do you have any idea why this query:
>
> SELECT hh_listings.listID, listingName, phone, email, held, venderID,
> hh_listings.disabled, hh_listings.deleted, hh_listings.levelID, levelName,
> islandName FROM hh_listings, hh_listlevels, hh_islands WHERE
> hh_listings.levelID=hh_listlevels.levelID AND
> hh_listings.islandID=hh_islands.islandID AND hh_listings.deleted!='1' AND
> MATCH (listingName) AGAINST ('spa*' IN BOOLEAN MODE) ORDER BY listID ASC
>
> Is not showing the listingName 'Spa Enterprises' or 'Everything Spa', but it
> is showing 'Spasms are us' or 'Loving Spat' all names are made up :)
>
> Basically if the word has spa in it then it matches, but if it the exact
> word.. it does not match.. what is going on?
>
> thanks!
>
> Rick

Ok someone told me the answer so I thought I would post it here for everyone
else.. basically it doesnąt work with words less than 4 characters, unless
you set a certain variable on startup to use less than 4 characters when
using fulltext searching.

Cheers!

Rick

attached mail follows:


Wie kann ich denn in den Betreffzeilen
möglich Umlaute entfernen?

--
Jochen Kächelin

attached mail follows:


Jochen Kaechelin wrote:

> Wie kann ich denn in den Betreffzeilen
> möglich Umlaute entfernen?

hi,
first of all (if you would have read any postings on this list before
asking) you would have noticed that the main language is english.
anyway. have you read the manual?

you may wonna check this page:
http://de2.php.net/manual/en/function.preg-replace.php
(example 5 can be of use)

btw: it's not really necessary to actually remove any umlauts. if you
use the correct encoding you should be fine.

--
Michael Kunze
http://www.smrealms.de/

Yo'momma so fat her big toe got stuck in the catflap.

attached mail follows:


How do I modify the following to except a password for the SMTP server?????

[mail function]
SMTP = localhost

sendmail_from = my_emailtest.com

Please help!!

Thanks in advance!

~WILL~

attached mail follows:


I mean the only way is to use existing classes for sending emails via smtp socket or to write your
own one.

tom

On Tue, 9 Mar 2004 03:37:33 -0500
"Will" <will.wwawhosts.net> wrote:

> How do I modify the following to except a password for the SMTP server?????
>
> [mail function]
> SMTP = localhost
>
> sendmail_from = my_emailtest.com
>
> Please help!!
>
> Thanks in advance!
>
> ~WILL~
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--

==========================================================================
Tomas Meinlschmidt, SBN3, MCT, MCP, MCP+I, MCSE, NetApp Filer & NetCache
gPG fp: CB78 76D9 210F 256A ADF4 0B02 BECA D462 66AB 6F56 / $ID: 66AB6F56
GCS d-(?) s: a- C++ ULHISC*++++$ P+++>++++ L+++$>++++ E--- W+++$ N++(+) !o
    !K w(---) !O !M V PS+ PE Y+ PGP++ t+ !5 X? R tv b+ !DI D+ G e>+++
    h---- r+++ z+++
==========================================================================

attached mail follows:


Hi,

Here's the output of PHP error log:

"[09-Mar-2004 10:09:33] PHP Fatal error: renderer(): Failed opening
required '../include/complete_url.php' (include_path='.:/usr/local/lib/php')
in /home/vhosts/dte/ticct/object/renderer.php on line 21"

But the file complete_url is in it's place.

Any ideas ?

Warm Regards,
Mário Gamito

> -----Original Message-----
> From: Marek Kilimajer [mailto:kilimajerwebglobe.sk]
> Sent: Monday, March 08, 2004 11:34 PM
> To: Mário Gamito
> Cc: php-generallists.php.net
> Subject: Re: [PHP] Very, very wiered problem
>
> Mário Gamito wrote:
> > Hi,
> >
> > I have this site at http://www.dte.ua.pt/ticct
> >
> > I don't know why, but it has a very strange behaviour.
> > If you visit it and make a few reloads or browse through the site
> > you'll see that *randomly* it shows only a blank page or an error
> > saying it cannot find file whatever_file.php although it's there.
> >
> > I'm running SuSE 9, with a compiled Apache 1.3.29, PHP 4.3.4, and
> > MySQL
> > 3.23.28
> >
> > Can it be SuSE's compiler the source of the problem ?
> > It's random character makes it so difficult to debug :-(
> >
> > Any ideas would be apreciated.
> >
> > Warm Regards,
> > Mário Gamito
>
> check apache logs if there is any error saying child pid ...
> died unexpectably. disable various php extensions and check if the
> problem still occurs. hopefully this will help you pinpoint the
> problem
>
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
>
>

attached mail follows:


Is /home/vhosts/dte/ticct/include/complete_url.php readable for the
apache process?

Mário Gamito wrote:

> Hi,
>
> Here's the output of PHP error log:
>
> "[09-Mar-2004 10:09:33] PHP Fatal error: renderer(): Failed opening
> required '../include/complete_url.php' (include_path='.:/usr/local/lib/php')
> in /home/vhosts/dte/ticct/object/renderer.php on line 21"
>
> But the file complete_url is in it's place.
>
> Any ideas ?
>
> Warm Regards,
> Mário Gamito
>
>
>>-----Original Message-----
>>From: Marek Kilimajer [mailto:kilimajerwebglobe.sk]
>>Sent: Monday, March 08, 2004 11:34 PM
>>To: Mário Gamito
>>Cc: php-generallists.php.net
>>Subject: Re: [PHP] Very, very wiered problem
>>
>>Mário Gamito wrote:
>>
>>>Hi,
>>>
>>>I have this site at http://www.dte.ua.pt/ticct
>>>
>>>I don't know why, but it has a very strange behaviour.
>>>If you visit it and make a few reloads or browse through the site
>>>you'll see that *randomly* it shows only a blank page or an error
>>>saying it cannot find file whatever_file.php although it's there.
>>>
>>>I'm running SuSE 9, with a compiled Apache 1.3.29, PHP 4.3.4, and
>>>MySQL
>>>3.23.28
>>>
>>>Can it be SuSE's compiler the source of the problem ?
>>>It's random character makes it so difficult to debug :-(
>>>
>>>Any ideas would be apreciated.
>>>
>>>Warm Regards,
>>>Mário Gamito
>>
>>check apache logs if there is any error saying child pid ...
>>died unexpectably. disable various php extensions and check if the
>>problem still occurs. hopefully this will help you pinpoint the
>>problem
>>
>>--
>>PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
>>http://www.php.net/unsub.php
>>
>
>

attached mail follows:


Hi,

> Is /home/vhosts/dte/ticct/include/complete_url.php readable
> for the apache process?
Sure :-)

Warm Regards,
Mário Gamito

attached mail follows:


[snip]
Is /home/vhosts/dte/ticct/include/complete_url.php readable for the
apache process?

Mário Gamito wrote:

> Hi,
>
> Here's the output of PHP error log:
>
> "[09-Mar-2004 10:09:33] PHP Fatal error: renderer(): Failed opening
> required '../include/complete_url.php' (include_path='.:/usr/local/lib/php')
> in /home/vhosts/dte/ticct/object/renderer.php on line 21"
>
> But the file complete_url is in it's place.
>
> Any ideas ?
[/snip]

Try putting the full path.

P.S.
Because it is harder to read.
Why is it bad?
Top posting.
What's a bad habit?

Can everyone quite top posting? And trim your posts? Does anyone need a list etiquette FAQ?

attached mail follows:


Mário Gamito wrote:

> Hi,
>
>
>>Is /home/vhosts/dte/ticct/include/complete_url.php readable
>>for the apache process?
>
> Sure :-)
>
> Warm Regards,
> Mário Gamito

What is the request uri? Remember that include/require path is based on
the file requested by the browser, not on the path of the including file.

attached mail follows:


My data file is sth like:
2.208 2.18 2.415 2.283 2.234 2.155 2.389 2.201
2.204 2.181 2.43 2.285 2.231 2.164 2.387 2.197
2.2 2.179 2.429 2.29 2.225 2.181 2.385 2.195
2.196 2.178 2.424 2.291 2.225 2.213 2.386 2.19
........
I would like to get these data in order to plot graph.

I've tried to use fgets() and then convert them from string back into
array...but it seems doesn't work~

Thanks,
Kenneth

"Jason Wong" <php-generalgremlins.biz> wrote in message
news:200403090002.54972.php-generalgremlins.biz...
> On Monday 08 March 2004 09:04, Kenneth wrote:
>
> > I have a problem on getting content from a data file (data.txt).
> > I have many numbers in the file...all of them are about 2.XXX, and I
need
> > them to plot a graph.
>
> What does your data file look like? Show a few sample lines.
>
> > But I just can't read them out as a integer.
>
> What code did you use?
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> "Have you lived here all your life?"
> "Oh, twice that long."
> */

attached mail follows:


Hi,

Try using follow.

        $sContents=file_get_contents("filename");
        $sContents=split("",$sContents);

Ande then you will be able to use the values for plotting a graph.

Regards,

Umesh.

attached mail follows:


see php.net/file or php.net/fread

 $file = "somefile.dat";
 if (!fileexists($file)) return 0;
 $filecontent = file($file);
 $numbers = array();
 if (is_array($filecontent) && count($filecontent)) {
         foreach($filecontent as $line) {
                 // delete more than one space
                 $line = ereg_replace("[ ]*"," ", $line);
                 // explode whole line into array
                 $numbers_temp = explode(" ", $line);
                 // add temp arr to $numbers array
                 $numbers = array_merge($numbers, $numbers_temp);
         }
 }

 and now you have all the data in $numbers array...

you DON'T need to convert strings to numbers.

/tom

On Tue, 9 Mar 2004 15:25:16 +0800
"Kenneth" <kenneth_dotcomhotmail.com> wrote:

> My data file is sth like:
> 2.208 2.18 2.415 2.283 2.234 2.155 2.389 2.201
> 2.204 2.181 2.43 2.285 2.231 2.164 2.387 2.197
> 2.2 2.179 2.429 2.29 2.225 2.181 2.385 2.195
> 2.196 2.178 2.424 2.291 2.225 2.213 2.386 2.19
> ........
> I would like to get these data in order to plot graph.
>
> I've tried to use fgets() and then convert them from string back into
> array...but it seems doesn't work~
>
> Thanks,
> Kenneth
>
>
>
> "Jason Wong" <php-generalgremlins.biz> wrote in message
> news:200403090002.54972.php-generalgremlins.biz...
> > On Monday 08 March 2004 09:04, Kenneth wrote:
> >
> > > I have a problem on getting content from a data file (data.txt).
> > > I have many numbers in the file...all of them are about 2.XXX, and I
> need
> > > them to plot a graph.
> >
> > What does your data file look like? Show a few sample lines.
> >
> > > But I just can't read them out as a integer.
> >
> > What code did you use?
> >
> > --
> > Jason Wong -> Gremlins Associates -> www.gremlins.biz
> > Open Source Software Systems Integrators
> > * Web Design & Hosting * Internet & Intranet Applications Development *
> > ------------------------------------------
> > Search the list archives before you post
> > http://marc.theaimsgroup.com/?l=php-general
> > ------------------------------------------
> > /*
> > "Have you lived here all your life?"
> > "Oh, twice that long."
> > */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--

==========================================================================
Tomas Meinlschmidt, SBN3, MCT, MCP, MCP+I, MCSE, NetApp Filer & NetCache
gPG fp: CB78 76D9 210F 256A ADF4 0B02 BECA D462 66AB 6F56 / $ID: 66AB6F56
GCS d-(?) s: a- C++ ULHISC*++++$ P+++>++++ L+++$>++++ E--- W+++$ N++(+) !o
    !K w(---) !O !M V PS+ PE Y+ PGP++ t+ !5 X? R tv b+ !DI D+ G e>+++
    h---- r+++ z+++
==========================================================================

attached mail follows:


Tom,

Thought about that one or simply trying to catch the error in my site wide
error handler, will give it a try, thanks.

-- Phil.

> -----Original Message-----
> From: trlistsclayst.com [mailto:trlistsclayst.com]
> Sent: 08 March 2004 15:53
> To: PHP
> Subject: [PHP] Re: fsockopen() errors.
>
>
> On 8 Mar 2004 Phil Ewington - 43 Plc wrote:
>
> > Can anyone tell me the best way to avoid errors using
> fsockopen(). I have
> > tried wrapping the function call in a conditional statement,
> and have also
> > tried calling the function and then testing the return.
>
> Here's an approach I have used to avoid any error messages at all --
> presumably you could also set a flag in the error handler to indicate
> what happened, if you need that.
>
> .....
>
> $olderr = error_reporting(0);
> set_error_handler("ignoreerrhandler");
> $fp = fsockopen(.....)
> restore_error_handler();
> error_reporting($olderr);
> if ($fp) {
> [worked]
> } else {
> [failed]
> }
> .....
>
> function ignoreerrhandler($errno, $errstr, $errfile, $errline) {
> return;
> }
>
> --
> Tom
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


I am need to determine if the printer is on line before sending an to it, it
is connected to a unix amchine running solaris 8, any idea?

Thanks

attached mail follows:


Jough P wrote:

> Anyone else had this problem where one of your PHP pages produces some
> output for a user to click on. The user clicks on one of these links
> which causes some behavior, then clicks their browsers BACK button. Now
> the original PHP page is producing a parse error.
>
> My particular parse error says:
> Parse error: parse error in
> /Library/WebServer/Documents/nex/htdocs/index.php on line 52
>
> Anyone?

Hello,

try to clear your browser cache. If you had this error earlier during
testing and you havn't dissallow caching it may display the cached site.

--
Michael Kunze
http://www.smrealms.de/

Yeahand WHO'S got The Stanley Cup???

attached mail follows:


why is var_dump( 0 == 'hello world') TRUE and not FALSE?

attached mail follows:


Hi,

Wednesday, March 10, 2004, 12:22:08 AM, you wrote:
t> why is var_dump( 0 == 'hello world') TRUE and not FALSE?

because 0 is integer and the integer value of 'hello world' is 0 so
they are equal.

--
regards,
Tom

attached mail follows:


many thanx

Am Di, 2004-03-09 um 15.27 schrieb Tom Rogers:
> Hi,
>
> Wednesday, March 10, 2004, 12:22:08 AM, you wrote:
> t> why is var_dump( 0 == 'hello world') TRUE and not FALSE?
>
>
> because 0 is integer and the integer value of 'hello world' is 0 so
> they are equal.

http://jessikak.de

attached mail follows:


Hello test,

Tuesday, March 9, 2004, 2:22:08 PM, you wrote:

t> why is var_dump( 0 == 'hello world') TRUE and not FALSE?

The same reason: intval('hello world') will equal 0.

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

attached mail follows:


On Mon, 2004-03-08 at 21:34, Span wrote:
> I think it can't work if the server has set the default_charset in the
> php.ini .
>
> eg:
> if in php.ini has:
> default_charset="gb_2312"
> then only changing the charset in html page didn't work.
> >>header('Content-type: text/html; charset=UTF-8');

Are you sure? I've not actually tried it but php.ini also has a default
Content-type which you CAN override using header().

--
Brian GnuPG -> KeyID: 0x04A4F0DC | URL: www.gfx-design.com/keys
                                          Key Server: pgp.mit.edu
======================================================================
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
GnuPG: http://gnupg.org
http://www.biglumber.com/x/web?qs=0x2C35011004A4F0DC
Linux Registered User #339825 at http://counter.li.org

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQBATdYnLDUBEASk8NwRAi3dAJ0bulHv/tiM/uy++wq0yRK7mMo6rgCggIAg
5Om6yI++gOMTMQzmaQDs2F8=
=TOi7
-----END PGP SIGNATURE-----

attached mail follows:


On Mon, 2004-03-08 at 21:34, Span wrote:
> I think it can't work if the server has set the default_charset in the
> php.ini .
>
> eg:
> if in php.ini has:
> default_charset="gb_2312"
> then only changing the charset in html page didn't work.
> >>header('Content-type: text/html; charset=UTF-8');

Are you sure? I've not actually tried it but php.ini also has a default
Content-type which you CAN override using header().

--
Brian V Bonini <b-boninicox.net>

attached mail follows:


Hey,

Not looking to reinvent the wheel.. I am looking for an inventory management
software package (written in PHP of course) that would be suitable for a
small business. So in otherwords, nothing with any bells or whistles, just
something that is easily modified/extensible. Any suggestions, Thanks in
advance

Christian

attached mail follows:


Hi All,

 

I have searched for some references on pagination using mssql but have come
up empty.

 

I have looked at the tutorials on Zend and just about everywhere else but
unfortunately they all use LIMIT in the sql statement and the closest thing
to that in mssql is either TOP n, or SET ROWCOUNT which does me no good.

 

My thoughts were to bring in all the recordsets and parse through them line
by line to only show the ones that I want for the page that is displayed.
Part of my solution is below but I kekep getting this error;

 

Parse error: parse error, unexpected ')', expecting ';' in
D:\WWW\scriptgen\pagination_test.php on line 25

 

This is the code;

 

$limit = 10;

for ($i = 0; $i < $limit; $i++){ -- This is line 25

            $name = mssql_result($i);

            if($bgcolor == "#F2F7FF"){

                        $bgcolor = "#FFFFFF";

            }

            else{

                        $bgcolor = "#F2F7FF";

            }

            echo "<tr><td width=85% class=\"normal_text\"
bgcolor=\"$bgcolor\">$name</td></tr>\n";

}

 

Something wrong with my syntax?

 

 

alex hogan

 

P.S. OP is original poster isn't it...., damn..., I need to start drinking
decaf.

******************************************************************
The contents of this e-mail and any files transmitted with it are
confidential and intended solely for the use of the individual or
entity to whom it is addressed. The views stated herein do not
necessarily represent the view of the company. If you are not the
intended recipient of this e-mail you may not copy, forward,
disclose, or otherwise use it or any part of it in any form
whatsoever. If you have received this e-mail in error please
e-mail the sender.
******************************************************************

attached mail follows:


Message-ID: <001a01c405e9$f17ebbb0$160aa8c0Desing2>
From: "German" <soporteneuromedios.com>
To: <php-generallists.php.net>
Date: Tue, 9 Mar 2004 10:19:39 -0500
MIME-Version: 1.0
Content-Type: multipart/alternative;
        boundary="----=_NextPart_000_0017_01C405C0.07AE2710"
Subject: migration of mysql to SQL server

------=_NextPart_000_0017_01C405C0.07AE2710
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello, the problem that I have is that I must migrate the data of mysql =
to SQL server to work with php. If somebody knows escribame like doing =
it please. Thank you very much.

------=_NextPart_000_0017_01C405C0.07AE2710--


  • application/x-pkcs7-signature attachment: smime.p7s

  • application/x-pkcs7-signature attachment: smime.p7s