php-general Digest 19 Apr 2002 08:48:55 -0000 Issue 1295
Topics (messages 93598 through 93643):
Re: How to create, name and start PHP sessions
93598 by: Phil Powell
93605 by: Michael Virnstein
Re: verify file types when uploading to server...
93599 by: Vince LaMonica
Re: alphabetizing titles when first word begins with 'The','A',etc.
93600 by: Joel Boonstra
Re: Newline features and differences between php3 and php4
93601 by: Richard Archer
93610 by: Jason Wong
Re: Forms in PHP
93602 by: Demitrious S. Kelly
Re: Nasty DoS in PHP
93603 by: Paul Roberts
Trouble w/Apache PHP on WinME
93604 by: Ken Villines
Executing a time intensive script
93606 by: Zach Curtis
93609 by: CC Zona
Re: Directory
93607 by: Demitrious S. Kelly
Array Question
93608 by: Jason Lam
93611 by: Steve Cayford
Reading Session File from /tmp directory
93612 by: Devin Atencio
Re: Number checker
93613 by: Philip Olson
how to popup a new browser window from php
93614 by: Wo Chang
93621 by: Martin Towell
93622 by: Jason Wong
93627 by: Mirek Novak
fopen() question
93615 by: David McInnis
93628 by: Jason Wong
Tagi It!
93616 by: Jason Whitaker
Variable Inside Variable
93617 by: Jeff Oien
93633 by: Jason Wong
storing session variables in a database
93618 by: Randy Johnson
Sorry Testing Please DELETE ... No PHP mail for awhile now
93619 by: Daniel Negron/KBE
Sorry Testing Please DELETE ... Sorry It was my server
93620 by: Daniel Negron/KBE
Why not success?Need your help,please!!!
93623 by: zhaoxd
Re: php printer functions...
93624 by: Yasuo Ohgaki
Thank
93625 by: zhaoxd
Help With postgresql
93626 by: Jr
How long does a session last? Need to have it at 20mins
93629 by: Phil Powell
Why my gd can not work?help please!!!
93630 by: zhaoxd
93631 by: zhaoxd
93632 by: zhaoxd
93634 by: Jan Peuker
93635 by: Jason Wong
93637 by: zhaoxd
93639 by: Jason Wong
REPOST: Login Frontend: Call for Suggestions
93636 by: Ashley M. Kirchner
Querying Oracle from PHP
93638 by: Jon
.inc over .php
93640 by: Jacob Wyke
93642 by: Jason Wong
Re: how to get row by row from CSV file
93641 by: Tim Ward
Discarded extension on file download
93643 by: Tomas Mikulecky
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 ---
OK thanx figured out a workaround in the meantime, I am setting and
retaining part of the session, but not all session variables, am I doing
this wrong???
$ip = $REMOTE_ADDR;
// Check for session - if session is set user has already logged in
session_start();
$login_state = &$_SESSION["login_state"];
if ($login_state["hasLoggedIn"] === 1) $hasLoggedIn = 1;
if ($login_state["ip"] != $REMOTE_ADDR) $hasLoggedIn = 0; // Prevents
session stealing
$temp .= "Your new session id is: " . $login_state["ip"] . "<br>";
$login_state["ip"] never exists, though it's supposed to when the session is
created upon successful login:
// Set up session variable with username and redirect to pic upload lib
session_start();
$login_state["hasLoggedIn"] = 1;
$login_state["ip"] = $ip;
session_register("login_state");
header("Location: http://" . $HTTP_HOST . $PHP_SELF);
You can see I am going to be a big problem :(
Phil
"Uchendu Nwachukwu" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Make sure you aren't sending any HTML to the browser for any reason before
> the session_start(); call.
>
> Surefire way to prevent this error: place the following line as the first
> line of PHP script you execute on every page:
>
> ob_start();
>
> Check out http://www.php.net/ob_start for details on what that does.
>
> --
> Uchendu Nwachukwu
> newsreply AT unndunn DOT com - www.unndunn.com
>
> "Phil Powell" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I am now getting the following errors on every page:
> >
> > Warning: Cannot send session cache limiter - headers already sent
(output
> > started at c:\program files\apache
> > group\apache\htdocs\webmissions\picupload\miss_pic_upload.php:25) in
> > c:\program files\apache
> > group\apache\htdocs\webmissions\picupload\miss_pic_upload.php on line 81
> >
> > This is when I use the following block of code to first SET the session
> for
> > the very first time:
> >
> > if (mysql_num_rows($results) == 0) {
> > // Could not find info in db redirect to login library with error
msg
> > $errorHTML .= "<font color=cc0000>We could not find your
information
> ";
> > $errorHTML .= " in our database. Please try again.</font><p>";
> > $hasLoggedIn = 0;
> > } else if (strcmp(session_name(), "hasLoggedIn") != 0) {
> > // Set up session variable with username and redirect to pic upload
> lib
> > session_name("hasLoggedIn");
> > $name = session_name();
> > session_start();
> > $HTTP_SESSION_VARS["username"] = $username;
> > $HTTP_SESSION_VARS["ip"] = $REMOTE_ADDR; // To prevent session
> stealing
> > }
> >
> > I am completely confused!
> >
> > Phil
> >
> > "Michael Virnstein" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > you have to put this on top of every of your pages:
> > > ---------------------------------
> > > session_name("hasLoggedIn");
> > > $stuff = session_name();
> > > session_start();
> > > ---------------------------------
> > > session_name first sets the name. then you call session_start which
will
> > > look for the
> > > sessionid in ${session_name()}. that is why you have to call
> > session_name()
> > > BEFORE calling
> > > session_start();
> > >
> > > Regards Michael
> > >
> > >
> > > "Phil Powell" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > Thanx, however, I cannot retain the session_name when I go to the
next
> > > URL.
> > > > How do I retain the session_name especially when I have to use a
form
> > > > method=POST?
> > > >
> > > > I have a URL that will be the login
> > > >
> > > > Once you login you will have a session (that works now)
> > > >
> > > > That page with the session will have a form with five <input=file>
> type
> > > form
> > > > elements
> > > >
> > > > Once submitted you will be at a "thank-you" page and files uploaded,
> but
> > > > then the session is gone (session_name is back to PHPSESSID again)
> > > >
> > > > What do I do to keep it? I cannot use cookies and putting it in the
> URL?
> > > >
> > > > Phil
> > > > "Michael Virnstein" <[EMAIL PROTECTED]> wrote in message
> > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > > session_name will retur the previos name of the session, so in
your
> > case
> > > > > $stuff will contain "PHPSESSID"
> > > > > and i think you have to call session_start(); before you do
> > > > > $HTTP_SESSION_VARS["username"] = $username;
> > > > >
> > > > > so perhaps this will work:
> > > > >
> > > > > session_name("hasLoggedIn");
> > > > > $stuff = session_name();
> > > > > session_start();
> > > > > $HTTP_SESSION_VARS["username"] = $username;
> > > > >
> > > > > Regards, Michael
> > > > >
> > > > > "Phil Powell" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > > > Will the following lines set up a session by the name of
> > "hasLoggedIn"
> > > > > with
> > > > > > HTTP_SESSION_VARS["username"]?
> > > > > >
> > > > > > $stuff = session_name("hasLoggedIn");
> > > > > > $HTTP_SESSION_VARS["username"] = $username;
> > > > > > session_start();
> > > > > >
> > > > > > I am trying to create a page that sets a session variable upon
> > > > successful
> > > > > > login, problem is, the session_name() never changes it always
> > remains
> > > > the
> > > > > > default PHPSESSID what am I doing wrong now?
> > > > > >
> > > > > > I fixed the problem with multiple files, that was bizarre!
> > > > > >
> > > > > > Thanx
> > > > > > Phil
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > "Uchendu Nwachukwu" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > In your example, simply place this line in your code (on *every* page
> you
> > > want the session to be on):
> > >
> > > session_name("HasLoggedIn");
> > > session_register("username");
> > >
> > > If your PHP was compiled with '--enable-trans-sid' you shouldn't have
to
> > > worry about anything else. PHP will automatically store the session ID
> in
> > a
> > > cookie, or it will pass the session ID in your HTML links. If it
wasn't
> > > compiled with '--enable-trans-sid', you'll need to use the constant
SID.
> > >
> > > Example:
> > > ------------------------------------------------------------------
> > > <?php
> > > session_name("HasLoggedIn");
> > > session_register("username"); ?>
> > >
> > > Welcome <?=$username;?>. <!-- assumes user has already entered a
> username
> > on
> > > some other page -->
> > >
> > > <a href="nextpage.php?<?=SID;?>">Click here to continue.</a>
> > > ------------------------------------------------------------------
> > >
> > > Hope that helps! Check out
http://www.php.net/manual/en/ref.session.php
> > for
> > > more info
> > >
> > > --
> > > Uchendu Nwachukwu
> > > newsreply AT unndunn DOT com - www.unndunn.com
> > >
> > > "Phil Powell" <[EMAIL PROTECTED]> wrote in message
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > Thanx, however, I cannot retain the session_name when I go to the
next
> > > URL.
> > > > How do I retain the session_name especially when I have to use a
form
> > > > method=POST?
> > > >
> > > > I have a URL that will be the login
> > > >
> > > > Once you login you will have a session (that works now)
> > > >
> > > > That page with the session will have a form with five <input=file>
> type
> > > form
> > > > elements
> > > >
> > > > Once submitted you will be at a "thank-you" page and files uploaded,
> but
> > > > then the session is gone (session_name is back to PHPSESSID again)
> > > >
> > > > What do I do to keep it? I cannot use cookies and putting it in the
> URL?
> > > >
> > > > Phil
> > > > "Michael Virnstein" <[EMAIL PROTECTED]> wrote in message
> > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > > session_name will retur the previos name of the session, so in
your
> > case
> > > > > $stuff will contain "PHPSESSID"
> > > > > and i think you have to call session_start(); before you do
> > > > > $HTTP_SESSION_VARS["username"] = $username;
> > > > >
> > > > > so perhaps this will work:
> > > > >
> > > > > session_name("hasLoggedIn");
> > > > > $stuff = session_name();
> > > > > session_start();
> > > > > $HTTP_SESSION_VARS["username"] = $username;
> > > > >
> > > > > Regards, Michael
> > > > >
> > > > > "Phil Powell" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > > > Will the following lines set up a session by the name of
> > "hasLoggedIn"
> > > > > with
> > > > > > HTTP_SESSION_VARS["username"]?
> > > > > >
> > > > > > $stuff = session_name("hasLoggedIn");
> > > > > > $HTTP_SESSION_VARS["username"] = $username;
> > > > > > session_start();
> > > > > >
> > > > > > I am trying to create a page that sets a session variable upon
> > > > successful
> > > > > > login, problem is, the session_name() never changes it always
> > remains
> > > > the
> > > > > > default PHPSESSID what am I doing wrong now?
> > > > > >
> > > > > > I fixed the problem with multiple files, that was bizarre!
> > > > > >
> > > > > > Thanx
> > > > > > Phil
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
--- End Message ---
--- Begin Message ---
you have to call session_start() before you send any output to the browser,
because it sends some headers.
"Phil Powell" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am now getting the following errors on every page:
>
> Warning: Cannot send session cache limiter - headers already sent (output
> started at c:\program files\apache
> group\apache\htdocs\webmissions\picupload\miss_pic_upload.php:25) in
> c:\program files\apache
> group\apache\htdocs\webmissions\picupload\miss_pic_upload.php on line 81
>
>
> This is when I use the following block of code to first SET the session
for
> the very first time:
>
> if (mysql_num_rows($results) == 0) {
> // Could not find info in db redirect to login library with error msg
> $errorHTML .= "<font color=cc0000>We could not find your information
";
> $errorHTML .= " in our database. Please try again.</font><p>";
> $hasLoggedIn = 0;
> } else if (strcmp(session_name(), "hasLoggedIn") != 0) {
> // Set up session variable with username and redirect to pic upload
lib
> session_name("hasLoggedIn");
> $name = session_name();
> session_start();
> $HTTP_SESSION_VARS["username"] = $username;
> $HTTP_SESSION_VARS["ip"] = $REMOTE_ADDR; // To prevent session
stealing
> }
>
> I am completely confused!
>
> Phil
>
>
> "Michael Virnstein" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > you have to put this on top of every of your pages:
> > ---------------------------------
> > session_name("hasLoggedIn");
> > $stuff = session_name();
> > session_start();
> > ---------------------------------
> > session_name first sets the name. then you call session_start which will
> > look for the
> > sessionid in ${session_name()}. that is why you have to call
> session_name()
> > BEFORE calling
> > session_start();
> >
> > Regards Michael
> >
> >
> > "Phil Powell" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Thanx, however, I cannot retain the session_name when I go to the next
> > URL.
> > > How do I retain the session_name especially when I have to use a form
> > > method=POST?
> > >
> > > I have a URL that will be the login
> > >
> > > Once you login you will have a session (that works now)
> > >
> > > That page with the session will have a form with five <input=file>
type
> > form
> > > elements
> > >
> > > Once submitted you will be at a "thank-you" page and files uploaded,
but
> > > then the session is gone (session_name is back to PHPSESSID again)
> > >
> > > What do I do to keep it? I cannot use cookies and putting it in the
URL?
> > >
> > > Phil
> > > "Michael Virnstein" <[EMAIL PROTECTED]> wrote in message
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > session_name will retur the previos name of the session, so in your
> case
> > > > $stuff will contain "PHPSESSID"
> > > > and i think you have to call session_start(); before you do
> > > > $HTTP_SESSION_VARS["username"] = $username;
> > > >
> > > > so perhaps this will work:
> > > >
> > > > session_name("hasLoggedIn");
> > > > $stuff = session_name();
> > > > session_start();
> > > > $HTTP_SESSION_VARS["username"] = $username;
> > > >
> > > > Regards, Michael
> > > >
> > > > "Phil Powell" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > > Will the following lines set up a session by the name of
> "hasLoggedIn"
> > > > with
> > > > > HTTP_SESSION_VARS["username"]?
> > > > >
> > > > > $stuff = session_name("hasLoggedIn");
> > > > > $HTTP_SESSION_VARS["username"] = $username;
> > > > > session_start();
> > > > >
> > > > > I am trying to create a page that sets a session variable upon
> > > successful
> > > > > login, problem is, the session_name() never changes it always
> remains
> > > the
> > > > > default PHPSESSID what am I doing wrong now?
> > > > >
> > > > > I fixed the problem with multiple files, that was bizarre!
> > > > >
> > > > > Thanx
> > > > > Phil
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
--- End Message ---
--- Begin Message ---
On Thu, 18 Apr 2002, Miguel Cruz wrote:
} Not sure what you're tring to achieve, but that only checks the file's
} name. You might want to use file (man 1 file) to verify that it actually
} is a JPEG, since people can put malicious data into a file named xxx.jpg
} and perhaps fool IE into doing bad things.
Another idea:
$the_file_type = $HTTP_POST_FILES['filename']['type'];
$registered_types = array(
"image/gif" => ".gif",
"image/pjpeg" => ".jpg, .jpeg",
"image/jpeg" => ".jpg, .jpeg",
"application/msword" => ".doc",
"application/vnd.ms-excel" => ".xls",
"application/octet-stream" => ".exe, .fla",
"application/pdf" => ".pdf"
);
$allowed_images = array("image/gif","image/pjpeg","image/jpeg");
if (!in_array($the_file_type,$allowed_images))
{
// produce your error text here
}
This looks at the mimetype of the file, using the
$HTTP_POST_FILES['filename']['type'] varible [note that "filename" is the
name passed from your form - "type" is the actual string you need to use
to access the mimetype.
Read http://us.php.net/manual/en/features.file-upload.php for more info on
this.
HTH,
/vjl/
--
Vince LaMonica UC Irvine, School of Social Ecology
W3 Developer <*> 116 Social Ecology I, Irvine, CA 92697
[EMAIL PROTECTED] https://www.seweb.uci.edu/~vjl
If Bill Gates had a nickel for every time Windows crashed...
... oh wait, never mind.
--- End Message ---
--- Begin Message ---
Steph,
> Hi. Im using MySQL and as part of my tables I have titles (of stories).
> My question os in regards to outputing those titles. Some of the titles
> begin with words such as 'The', 'A', 'An', etc. Is there a way to order
> these particular titles based on the second word in the title??
Late reply -- I don't check this folder that often.
I had this exact problem. Don't bother with temp tables, or extra fields,
or anything like that. You can build it all into your MySQL query. A
resident MySQL expert gave me this recipe (well, one very similar):
<?
$query = 'SELECT title_field, some_other_fields
FROM some_table
WHERE some_field = 'some_criteria'
ORDER BY TRIM(leading "An " from
TRIM(leading "A " from
TRIM(leading "The " from title_field)))
';
?>
No fuss, no muss. You don't have to worry about what order they were
inserted in, artificially munging your data, or anything else.
HTH!
--
[ joel boonstra | [EMAIL PROTECTED] ]
--- End Message ---
--- Begin Message ---
At 8:24 AM -0700 18/4/02, Chris Hall wrote:
> I'm using the mail() function on a project for a client. His hosting
>provider currently offers php3, meanwhile I've been developing in php4. So
>far, I don't haven't found any problems other than the following:
>In php4, inside the mail function I use newline definitions to seperate
>data, and it works terrific. But in php3 mail() doesn't seem to parse the
>newline tags, and it prints them in the email body. Workarounds/fixes?
Sounds to me as if you have an extra newline in there. The first blank
line indicates to the MTA/MUA the end of the headers and the start of
the message body.
Note that (IMHO) the manual page for mail() is wrong. I believe the
line endings used to separate headers should be the system's native
line endings. Not "\r\n". Using "\r\n" on a Unix box can cause some
MTA's (qmail, in particular) to imagine *two* line endings, thus ending
your headers.
...R.
--- End Message ---
--- Begin Message ---
On Friday 19 April 2002 04:58, Richard Archer wrote:
> Note that (IMHO) the manual page for mail() is wrong. I believe the
> line endings used to separate headers should be the system's native
> line endings. Not "\r\n". Using "\r\n" on a Unix box can cause some
> MTA's (qmail, in particular) to imagine *two* line endings, thus ending
> your headers.
The manual is correct. See:
http://cr.yp.to/immhf/header.html
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
The trouble with superheros is what to do between phone booths.
-- Ken Kesey
*/
--- End Message ---
--- Begin Message ---
Use an array
<input type="hidden" name="itemid[]" value="1">1</input>
<input type="hidden" name="itemid[]" value="2">2</input>
<input type="hidden" name="itemid[]" value="3">3</input>
$numberofitemids=count($itemid);
echo $itemid[0]; // == 1
echo $itemid[1]; // == 2
echo $itemid[2]; // == 3
cheers
-----Original Message-----
From: Alia Mikati [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 2:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Forms in PHP
Hello
I hope u can help me with this problem. I dont know if it is possible to
do it. I'm using PHP and XML to generate the folowing HTML:
...
<form method="post" action="cart.php">
<input type="hidden" name="itemid" value="1">1</input>
...
<input type="hidden" name="itemid" value="2">2</input>
...
<input type="hidden" name="itemid" value="3">3</input>
...
...
I want to use PHP to count the number of $itemid in this file. Is it
possible? And how?
Thx a lot
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Also win2k and apache(cgi)
i got an internal server error, due to the malformed header, CPU usage peaked at 100%
and then dropped off.
So i changed the code to the loop below and max execution time came up but CPU usage
didn't drop straight off, so i had closer look, php exits after 30 seconds but the CPU
usage continues in ie and apache and the page keeps loading, so i think that's down to
output buffering . interestingly i had no trouble loading phpmyadmin and running a
query while this was happening, it was just a little slower......
<?php
$a=1;
while(0<1) {
$a++;
echo $a."<br>";
}
?>
So if you want to crash your server with an infinite loop there's plenty of ways to do
it. <g>
Paul Roberts
[EMAIL PROTECTED]
++++++++++++++++++++++++
----- Original Message -----
From: "Jason Soza" <[EMAIL PROTECTED]>
To: "Jason Murray" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, April 18, 2002 7:29 AM
Subject: RE: [PHP] Nasty DoS in PHP
> Very odd indeed. Well, here's my setup:
> Windoze2K
> PHP 4.1.2
> Apache 1.3.something
> Accessing it via IE 6.0, although this should not have any bearing on
> anything
>
> I'd be interested in knowing your versions and the versions of the first guy
> that posted about this. Maybe he has the same setup as me, or close enough,
> but both of us are different from you. My browser just kept loading and
> loading like all was well, while task manager was skipping all over the
> place and I had to wait 5 - 10 seconds after I moved my mouse for the cursor
> to move. I timed the script, and after 30 secs, it was still going (although
> I stopped it soon thereafter to keep from having to reboot). So I reset
> php.ini's execution time limit down to 5 seconds and ran it twice more, and
> both times it went well past 5 seconds.
>
> Of course, none of this bothers me as I won't be putting while(0>1) {
> header("A") } into any of my scripts, nor was I ever planning on it! :)
>
> -----Original Message-----
> From: Jason Murray [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 17, 2002 10:13 PM
> To: 'Jason Soza'; [EMAIL PROTECTED]
> Subject: RE: [PHP] Nasty DoS in PHP
>
>
> > Mine produced the same error message as yours, Jason, but the memory
> > and CPU usage continued until I hit the 'stop' button on the browser.
> > It seemed to have overridden both time and memory limits, as it had
> > racked up 320 megs of my RAM by the time I stopped it.
>
> It certainly didn't do that here, but it could be a difference between
> RAM, PHP and Apache versions (simple paranoia ;)) that causes it.
>
> PHP clearly sent the error *to my browser* and the browser stopped loading
> immediately (thus, the "fatal" error was indeed fatal, and PHP terminated
> at that time).
>
> J
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--- End Message ---
--- Begin Message ---
I am doing some php development and testing it on my WinME system. I have
Apache installed and the only way I can get anything to execute is with a
shebang at the beginning of the file. Then the shebang is printed in the
page:( Anyone know how to get around this. I don't have this trouble with
ASP pages.
Thanks
-Ken
--- End Message ---
--- Begin Message ---
I have three scripts login.php, auth_user.php, and function.php. The
login.php script does user authentication and routes the user to
auth_user.php. The function.php script, which contains process_function(),
does some very intensive data processing and may take from 30 seconds to 3
minutes to run.
Here's what I have tried to do:
// login.php script
require("function.php");
...
... do some authentication stuff
...
process_function(); // makes user wait too long to get to the authenticated
area
include("auth_user.php"); // takes user to authenticated area
If I try to run the process_function() from the login.php script, the script
takes too long to run. How can I get this function to run so it does not
interfere with user logging in? Is there a way to get the function to
execute and let it run on its own within login.php and let the user continue
on to the authenticated area without that delay?
Another thought I had was to get the function.php script that contains the
function to execute on its own based on time (e.g., run every hour on the
hour). Is there a way to do that?
Thank you.
_________________
Zach Curtis
Programmer Analyst
POPULUS
www.populus.com
_________________
Confidentiality Statement:
This e-mail message and any attachment(s) are confidential and may contain
proprietary information that may not be disclosed without express
permission. If you have received this message in error or are not the
intended recipient, please immediately notify the sender by replying to this
message and then please delete this message and any attachment(s). Any use,
dissemination, distribution, or reproduction by unintended recipients is not
authorized.
Thank you.
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Zach Curtis) wrote:
> Is there a way to get the function to
> execute and let it run on its own within login.php and let the user continue
> on to the authenticated area without that delay?
<http://php.net/set-time-limit>
<http://php.net/ignore-user-abort>
--
CC
--- End Message ---
--- Begin Message ---
Use the dir class
-----Original Message-----
From: Jeroen Timmers [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 16, 2002 4:57 AM
To: [General]
Subject: [PHP] Directory
Hello,
can i read a directory for files and other directory's with a php
function
for exameple
d:\localhost\
had the follow dirs and files
test.php
test2.php
\test\
\test2\
now i want that in my browser with a php function
Jeroen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
$arr2 is a 2d array.
$arr1[0] = 1;
$arr1[1] = 10;
$arr2[0] = $arr1;
print $arr2[0][1];
Result will be 10
But,
$arr1[0] = 1;
$arr1[1] = 10;
$arr2[0] = $arr1;
$arr3 = each($arr2);
print $arr3[1];
Result is not 10. So, function "each" is not taking the whole $arr2[0]
out......
My question is what function should I use to iterate array elements (with
arrays in it)?
Jay
--- End Message ---
--- Begin Message ---
On Thursday, April 18, 2002, at 04:38 PM, Jason Lam wrote:
> $arr2 is a 2d array.
>
> $arr1[0] = 1;
> $arr1[1] = 10;
> $arr2[0] = $arr1;
> print $arr2[0][1];
>
> Result will be 10
>
> But,
>
> $arr1[0] = 1;
> $arr1[1] = 10;
> $arr2[0] = $arr1;
> $arr3 = each($arr2);
> print $arr3[1];
What are you expecting? Check out the documentation for each() at
http://www.php.net/manual/en/function.each.php
At this point $arr3 should look like this (I think, but try
print_r($arr3) to be sure):
{
0 => 0,
1 => array (
0 => array (
0 => 1,
1 => 10
)
),
key => 0,
value => array (
0 => array (
0 => 1,
1 => 10
)
)
}
>
> Result is not 10. So, function "each" is not taking the whole $arr2[0]
> out......
>
> My question is what function should I use to iterate array elements
> (with
> arrays in it)?
>
How about foreach()?
-Steve
> Jay
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
I am trying to read a session file from the /tmp directory then
restore the PHP variables from this but I can't get it to work, i'm
doing the following:
$acontents = file("/tmp/sess_$sessid");
$data = $acontents[0];
unserialize($data);
$sessid is a valid session id, but unserialize doesn't give me
the values for $hostname, $username, etc?
Any help?
--- End Message ---
--- Begin Message ---
use is_numeric()
http://uk.php.net/is_numeric
--- End Message ---
--- Begin Message ---
Dear All,
One simple question:
Is there any easy way to popup a new browser from PHP
without using any Javascript?
Any helps would be greatly appreciated.
--Wo
--- End Message ---
--- Begin Message ---
use vbscript :P
otherwise no - php = server - [java|vb]script = client
-----Original Message-----
From: Wo Chang [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 19, 2002 9:15 AM
To: [EMAIL PROTECTED]
Subject: [PHP] how to popup a new browser window from php
Dear All,
One simple question:
Is there any easy way to popup a new browser from PHP
without using any Javascript?
Any helps would be greatly appreciated.
--Wo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Friday 19 April 2002 07:14, Wo Chang wrote:
> Dear All,
>
> One simple question:
>
> Is there any easy way to popup a new browser from PHP
> without using any Javascript?
No.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Your step will soil many countries.
*/
--- End Message ---
--- Begin Message ---
Martin Towell wrote:
>use vbscript :P
>otherwise no - php = server - [java|vb]script = client
>
<:o)>
of course there IS way how to do it from php .. put into your code
something like this special secret code stolen from M$
<H1>
<FONT color="red">
PRESS CTRL+N 
</FONT> <U>N O W ! !</U>
</H1>
I don't how to put desired content into this new window ... but question
wasn't about that
:o)
HTH,
<:o)\>
M.
>
>
>-----Original Message-----
>From: Wo Chang [mailto:[EMAIL PROTECTED]]
>Sent: Friday, April 19, 2002 9:15 AM
>To: [EMAIL PROTECTED]
>Subject: [PHP] how to popup a new browser window from php
>
>
>Dear All,
>
>One simple question:
>
>Is there any easy way to popup a new browser from PHP
>without using any Javascript?
>
>Any helps would be greatly appreciated.
>
>--Wo
>
>
--- End Message ---
--- Begin Message ---
I am having a problem reading a remote file using fopen and http://. I
suspect this is because the remote file is sending back a cookie. Can
anyone confirm and/or offer a solution?
Here is what I am doing.
$CP_url is a full url in the form http://blah.com/footer.html
$filename = "$CP_url";
$fd = fopen ($filename, "r");
$PAGE_FOOTER = fread ($fd, filesize ($filename));
fclose ($fd);
David McInnis
--- End Message ---
--- Begin Message ---
On Friday 19 April 2002 08:04, David McInnis wrote:
> I am having a problem reading a remote file using fopen and http://. I
> suspect this is because the remote file is sending back a cookie. Can
> anyone confirm and/or offer a solution?
If it is indeed sending back a cookie then you need something like curl,
IIRC, a simple fopen() wouldn't work.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
No one becomes depraved in a moment.
-- Decimus Junius Juvenalis
*/
--- End Message ---
--- Begin Message ---
I am looking for a pre-wrote script thats does the same thing as what this
company offers: http://www.tagit-board.com any one know where i can get one?
to give ya an idea i want a script that will take a visitors name and
message(maybe another field for a website) and write it to a page heres an
example: http://www.geocities.com/babied0ll/tagit.html
--
Jason Whitaker
--- End Message ---
--- Begin Message ---
I have a script which retrieves the body of an email message from
a MySQL database to be sent to someone who applies using a form.
The script contains this:
$url = "<a href=\"http://$HTTP_HOST$SCRIPT_NAME\">http://$HTTP_HOST$SCRIPT_NAME</a>";
$url = addslashes("$url");
$msg1 .= "$body"; //to be sent via mail()
Then within the body of the message I want $url to show up.
The body of the message in the database looks like this:
-----------
You are receiving this exclusive message to confirm your
application through $url.
-----------
I've tried everything I can think of with $url, curly brackets, backslashes
etc. What am I missing? Thanks.
Jeff Oien
--- End Message ---
--- Begin Message ---
On Friday 19 April 2002 09:31, Jeff Oien wrote:
> I have a script which retrieves the body of an email message from
> a MySQL database to be sent to someone who applies using a form.
> The script contains this:
>
> $url = "<a
> href=\"http://$HTTP_HOST$SCRIPT_NAME\">http://$HTTP_HOST$SCRIPT_NAME</a>";
> $url = addslashes("$url");
>
> $msg1 .= "$body"; //to be sent via mail()
>
> Then within the body of the message I want $url to show up.
> The body of the message in the database looks like this:
> -----------
> You are receiving this exclusive message to confirm your
> application through $url.
> -----------
> I've tried everything I can think of with $url, curly brackets, backslashes
> etc. What am I missing? Thanks.
Use eval().
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
A grammarian's life is always in tense.
*/
--- End Message ---
--- Begin Message ---
anybody have a good tutorial/example of storing sessions in a database?
Randy
--- End Message ---
--- Begin Message ---
Thank You
<><><><><><><><><><><><><><><><>
Daniel Negrón
Lotus Notes Administrator / Developer
KB Electronics, Inc.
954.346.4900x122
http://www.kbelectronics.com
<><><><><><><><><><><><><><><><>
--- End Message ---
--- Begin Message ---
Thank You
<><><><><><><><><><><><><><><><>
Daniel Negrón
Lotus Notes Administrator / Developer
KB Electronics, Inc.
954.346.4900x122
http://www.kbelectronics.com
<><><><><><><><><><><><><><><><>
--- End Message ---
--- Begin Message ---
I met with some problems when I tried to compile php into apache web server.In a
words,my php can not worked in the apache server,apache server can not recognize php
file.
help,please!!!
In httpd.conf of apache server,after I make install,I found only a few php information
,as follow:
<Files ~ "\.(cgi|shtml|phtml|php?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/usr/local/apache/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
I wanna make php+ssl into apache server,my procedure of compling is as follow:
Mysql
-----------------------------------------------------------------------
./configure --prefix=/usr/local/mysql
make
make install
cd scripts
./mysql_install_db
cd /usr/local/mysql/share/mysql/
chmod 611 mysql.server
./mysql.server start
/usr/local/mysql/share/mysql/mysql.server start
GD:
---------------------------------------------------------------
make
make install
Apache:
---------------------------------------------------------------
./configure --prefix=/usr/local/apache
openssl:
---------------------------------------------------------------
./config
make
make test
make install
mod_ssl:
---------------------------------------------------------------
./configure --with-apache=../apache_1.3.24 --with-ssl=../openssl-0.9.6
--prefix=../apache_1.3.24
php:
---------------------------------------------------------------
./configure --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.24
--enable-track-vars --with-gd=../gd-1.8.4 make
make install
Apache:
---------------------------------------------------------------
./configure --prefix=/usr/local/apache --activate-module=src/modules/php4/libphp4.a
--enable-module=ssl
make
make certificate
make install
All procedure passed without any problems,and next I write a test page,test.php:
<?
phpinfo();
?>
in the directory of /usr/local/apache/htdocs/,then,using my IE,the URL is
https://localhost/test.php,but the result of displaying is blank text "<?
phpinfo();?>".
In a words,my php has not worked in the apache server,apache server can not recognize
php file.
What shall I do?Is my httpd.conf not right?
Help,please!
zhaoxd
--- End Message ---
--- Begin Message ---
Jimmy wrote:
> I'm running PHP 4.1.1 on a Win2K box. If I understand the manual correctly,
> the printer functions have been integrated into PHP as of v4.0.4. However,
> when I try to call any of the printer functions, nothing works.
>
> Any ideas or suggestions?
>
You need to build/install extension by yourself.
printer extension is PECL module now, IIRC.
--
Yasuo Ohgaki
--- End Message ---
--- Begin Message ---
Thank u all,I've got it!!!
:)
--- End Message ---
--- Begin Message ---
Hello,
I need help with a website that I had design as a E-commerce tool.
There's a credit card option in the shopping cart, That I would like to
remove. The guy that design the site said that It would need to be turned
off in the database. Any help would be great. I know the database is
postgresql.
Thanks for any help.
Jr
--- End Message ---
--- Begin Message ---
I had thought that a session would last only 20 mins if
session.gc_maxlifetime is set at 1440. Was I wrong in assuming this? I
have pages that have session_start() at the top to persist the session
throughout the life-cycle of these pages, however, I want the session to
expire after 20 mins or so of use. How can I assure that the session will
expire after 20 mins?
Thanx
Phil
--- End Message ---
--- Begin Message ---
I have installed gd-1.8.4 in apache server without any problems.To check if the gd can
work,I write some codes with php like this:
<?
Header("Content-type: image/gif");
$im = imagecreate(40,30);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
imageline($im, 1, 1, 350, 25, $black);
imagearc($im, 200, 15, 20, 20, 35, 190, $white1);
imagestring($im, 5, 4, 10, "Graph TEST!!", $white);
ImageGif($im);
ImageDestroy($im);
?>.
However,the output in IE is the warning message:" <b>Warning</b>: ImageGif: No GIF
create support in this PHP build in <b>/usr/local/apache/htdocs/index.php</b> on line
<b>9</b><br>".why??
when I add comment to the line of ImageGif($im),nothing is displayed,why??
ps:my php work very well in this server.
help,please!!
--- End Message ---
--- Begin Message ---
I have installed gd-1.8.4 in apache server without any problems.To check if the gd can
work,I write some codes in php like this:
<?
Header("Content-type: image/gif");
$im = imagecreate(40,30);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
imageline($im, 1, 1, 350, 25, $black);
imagearc($im, 200, 15, 20, 20, 35, 190, $white1);
imagestring($im, 5, 4, 10, "Graph TEST!!", $white);
ImageGif($im);
ImageDestroy($im);
?>.
However,the output in IE is the warning message:" <b>Warning</b>: ImageGif: No GIF
create support in this PHP build in <b>/usr/local/apache/htdocs/index.php</b> on line
<b>9</b><br>".why??
when I add comment to the line of ImageGif($im),nothing is displayed,why??
ps:my php work very well in this server.
help,please!!
--- End Message ---
--- Begin Message ---
I have installed gd-1.8.4 in apache server without any problems.To check if the gd can
work,I write some codes in php like this:
<?
Header("Content-type: image/gif");
$im = imagecreate(40,30);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
imageline($im, 1, 1, 350, 25, $black);
imagearc($im, 200, 15, 20, 20, 35, 190, $white1);
imagestring($im, 5, 4, 10, "Graph TEST!!", $white);
ImageGif($im);
ImageDestroy($im);
?>.
However,the output in IE is the warning message:" <b>Warning</b>: ImageGif: No GIF
create support in this PHP build in <b>/usr/local/apache/htdocs/index.php</b> on line
<b>9</b><br>".why??
when I add comment to the line of ImageGif($im),nothing is displayed,why??
ps:my php work very well in this server.
help,please!!
--- End Message ---
--- Begin Message ---
GIF is licensed by Unisys(it is a compuserve format). This is very
expensive, so it has been cut out of php. Solution: a) use PNG b) get an old
version of php.
regars,
Jan Peuker
P.S.: In future, please don't post 3 times using courier-extrabig.
----- Original Message -----
From: "zhaoxd" <[EMAIL PROTECTED]>
To: "php mailling list" <[EMAIL PROTECTED]>
Sent: Friday, April 19, 2002 9:06 AM
Subject: [PHP] Why my gd can not work?help please!!!
> I have installed gd-1.8.4 in apache server without any problems.To check
if the gd can work,I write some codes in php like this:
> <?
> Header("Content-type: image/gif");
> $im = imagecreate(40,30);
> $black = ImageColorAllocate($im, 0,0,0);
> $white = ImageColorAllocate($im, 255,255,255);
> imageline($im, 1, 1, 350, 25, $black);
> imagearc($im, 200, 15, 20, 20, 35, 190, $white1);
> imagestring($im, 5, 4, 10, "Graph TEST!!", $white);
> ImageGif($im);
> ImageDestroy($im);
> ?>.
> However,the output in IE is the warning message:" <b>Warning</b>:
ImageGif: No GIF create support in this PHP build in
<b>/usr/local/apache/htdocs/index.php</b> on line <b>9</b><br>".why??
>
> when I add comment to the line of ImageGif($im),nothing is displayed,why??
>
> ps:my php work very well in this server.
>
> help,please!!
>
>
>
>
>
>
--- End Message ---
--- Begin Message ---
On Friday 19 April 2002 15:06, zhaoxd wrote:
> I have installed gd-1.8.4 in apache server without any problems.To check if
> the gd can work,I write some codes in php like this:
<?
> Header("Content-type: image/gif");
> $im = imagecreate(40,30);
> $black = ImageColorAllocate($im, 0,0,0);
> $white = ImageColorAllocate($im, 255,255,255);
> imageline($im, 1, 1, 350, 25, $black);
> imagearc($im, 200, 15, 20, 20, 35, 190, $white1);
> imagestring($im, 5, 4, 10, "Graph TEST!!", $white);
> ImageGif($im);
> ImageDestroy($im);
> ?>.
> However,the output in IE is the warning message:" <b>Warning</b>:
> ImageGif: No GIF create support in this PHP build in
> <b>/usr/local/apache/htdocs/index.php</b> on line <b>9</b><br>".why??
> when I add comment to the line of ImageGif($im),nothing is displayed,why??
The GD library which is on your system has the GIF functions removed owing to
patents/licensing issues. Either get an older version of the library (the
official GD Library website doesn't have it anymore, try searching on
Google), or use PNG instead of GIF.
Also please refrain from posting the same thing more than once -- it only
annoys people.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Saints should always be judged guilty until they are proved innocent.
-- George Orwell, "Reflections on Gandhi"
*/
--- End Message ---
--- Begin Message ---
> On Friday 19 April 2002 15:06, zhaoxd wrote:
> > I have installed gd-1.8.4 in apache server without any problems.To check if
> > the gd can work,I write some codes in php like this:
> <?
> > Header("Content-type: image/gif");
>
> > $im = imagecreate(40,30);
>
> > $black = ImageColorAllocate($im, 0,0,0);
>
> > $white = ImageColorAllocate($im, 255,255,255);
>
> > imageline($im, 1, 1, 350, 25, $black);
>
> > imagearc($im, 200, 15, 20, 20, 35, 190, $white1);
>
> > imagestring($im, 5, 4, 10, "Graph TEST!!", $white);
>
> > ImageGif($im);
>
> > ImageDestroy($im);
>
> > ?>.
>
> > However,the output in IE is the warning message:" <b>Warning</b>:
> > ImageGif: No GIF create support in this PHP build in
> > <b>/usr/local/apache/htdocs/index.php</b> on line <b>9</b><br>".why??
>
> > when I add comment to the line of ImageGif($im),nothing is displayed,why??
>
>
> The GD library which is on your system has the GIF functions removed owing to
> patents/licensing issues. Either get an older version of the library (the
> official GD Library website doesn't have it anymore, try searching on
> Google), or use PNG instead of GIF.
>
> Also please refrain from posting the same thing more than once -- it only
> annoys people.
>
sorry for annoying you all with so many letters.
: )
But this time,when I use imagepng function instead imagegif funtion,the result is
not right ,either!
The warning message displayed also,which is "<b>Warning</b>: ImagePng: No PNG support
in this PHP build in <b>/usr/local/apache/htdocs/index.php</b> on line <b>9</b><br>".
Why&What shall I do now?
--- End Message ---
--- Begin Message ---
On Friday 19 April 2002 15:41, zhaoxd wrote:
> But this time,when I use imagepng function instead imagegif funtion,the
> result is not right ,either!
> The warning message displayed also,which is "<b>Warning</b>: ImagePng: No
> PNG support in this PHP build in <b>/usr/local/apache/htdocs/index.php</b>
> on line <b>9</b><br>".
> Why&What shall I do now?
Did you compile php with:
--with-png-dir
?
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Riffle West Virginia is so small that the Boy Scout had to double as the
town drunk.
*/
--- End Message ---
--- Begin Message ---
I have a directory on my server that contains log files for all my virtual hosts.
I'd like to create a (web) login page that each owner of those vhosts can use to gain
access to their individual log files. Ideally by using the same login they have on
the system (their physical log in), but not required.
My problems are, a) each login need only access to their log files, no one else's,
and b) some logins will have more than one vhost (and consequently more than one log
directory).
Right now I have the directory structure setup as follows:
/main logs/
/main logs/<vhost 1>
/main logs/<vhost 2>
/main logs/<vhost 3>
etc.
etc.
So, if the owner of <vhost 1> logs in, I want them to be "dropped" within
/main_logs/<vhost 1>/ to see their log files. But, I don't know how to tie the
different vhosts that belong to the same owner together.
(I suspect someone might ask why, so I'll also note this: The reason I have this
setup is because I run statistics on each log file, and it's those reports that the
users get access to, not the actual physical log file)
I'm open to suggestions.
--
H | "Life is the art of drawing without an eraser." - John Gardner
+--------------------------------------------------------------------
Ashley M. Kirchner <mailto:[EMAIL PROTECTED]> . 303.442.6410 x130
Director of Internet Operations / SysAdmin . 800.441.3873 x130
Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave, #6
http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.
--- End Message ---
--- Begin Message ---
Hi,
I am evaluating if it is posible to connect Oracle 8i from PHP, running a
PL/SQL procedure and returning the results, avaible in a temp table, to
HTML. Besides, I need to format the results of the query in PDF document and
make a pie chart based on he results of the contents of the table I
mentioned before. I looking for some adds-on to PHP that makes it posible to
do this all..
Any suggestions would be appreciated. Thanks in advanced
--- End Message ---
--- Begin Message ---
Just a few quick questions if anybody is out there.
Why use .inc as a file extenstion when you can use .php ??
What are the advantages/disadvantages to using .inc?
Is one more secure?
Which is faster?
Which is consider a better pratice?
Thanks a lot.
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
On Friday 19 April 2002 16:10, Jacob Wyke wrote:
> Just a few quick questions if anybody is out there.
Nobody here but us chickens.
> Why use .inc as a file extenstion when you can use .php ??
Just a matter of aesthetics. Some people might like to use .inc to remind
themselves that the file is to be included and not run on its own.
> What are the advantages/disadvantages to using .inc?
None from a technical point of view
> Is one more secure?
On default webserver settings, .inc may be less secure because by default the
webserver would not treat .inc files as php files and thus return them as-is.
Thus if people know the name of your "filename.inc" they could potentially
browse to it and thus see its contents.
There are two ways to counter this:
1) have the .inc files in a directory outside the scope of the webserver
directory.
2) set the webserver to treat .inc files as php files.
> Which is faster?
No difference.
> Which is consider a better pratice?
As long as you take the necessary precautions then it boils down to a matter
of preference.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
"Home, Sweet Home" must surely have been written by a bachelor.
-- Samuel Butler
*/
--- End Message ---
--- Begin Message ---
Look at file() and fgets() functions.
File gives you the whole file as a row per element array
e.g. ...
If ($csvfile = file("yourfile.csv"))
{ foreach($csvfile as $row)
{ $csvarray[] = explode(",", $row);
}
}
... gives you a structure from the csv that you can walk through in php.
Using fopen and while fgets may be more efficient, especially if you don't
want the whole file
If ($fhandle = fopen("yourfile.csv", "r"))
{ while ($row = fgets($fhandle))
{ ... // etc.
}
}
Tim Ward
Internet Chess www.chessish.com <http://www.chessish.com>
----------
From: Jack [SMTP:[EMAIL PROTECTED]]
Sent: 18 April 2002 14:18
To: [EMAIL PROTECTED]
Subject: how to get row by row from CSV file
Dear all
I'm a beginner of php, i tried to get the CSV file, but it return
like
Column by Colume, but how i can get it in Row by Row, cause i want
to point
to specific data i want, but not the whole file content!
--
Thx a lot!
Jack
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Hi
I am trying to offer downloading files from a web server, using PHP.
The files are gzipped text and have all .txt.gz extensions. Now while on
Windows systems both IE and Netscape offers to download it under the
full name (althought IE adds [some_number] to the base of the file
name), under Unix or Linux systems (tested with netscape 4.7) the '.gz'
part is discarded from the file name and the file is saved with .txt
only. Downloaded file is still gzipped.
The part of script serving the files is as follows:
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=$my_filename");
echo($file_body);
What am-I doing wrong? Thanks in advance
Tom
--- End Message ---