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 21 Jun 2006 03:26:08 -0000 Issue 4197

php-general-digest-helplists.php.net
Date: Tue Jun 20 2006 - 22:26:08 CDT


php-general Digest 21 Jun 2006 03:26:08 -0000 Issue 4197

Topics (messages 238410 through 238451):

complex control structure- please help
        238410 by: IG
        238448 by: Chris

Re: comparing strings - again!
        238411 by: John Nichel
        238429 by: Jochem Maas

Paging Help
        238412 by: Rodrigo de Oliveira Costa
        238413 by: Juanjo Pascual
        238415 by: Andrei
        238419 by: Adam Zey

MYSQL_CONNECT vs MYSQL_PCONNECT
        238414 by: Juanjo Pascual
        238416 by: Robert Cummings
        238418 by: Joe Wollard

Re: [?? Probable Spam] [PHP] MYSQL_CONNECT vs MYSQL_PCONNECT
        238417 by: Andrei

shutting down a web app for maintenance
        238420 by: Ben Liu
        238421 by: Jon Anderson
        238422 by: Ben Liu
        238423 by: Adam Zey
        238424 by: Adam Zey
        238425 by: Ben Liu
        238426 by: Adam Zey
        238427 by: Ben Liu

Re: mysql_db_query & INSERT
        238428 by: Prathaban Mookiah

Problem displaying a mysql database field
        238430 by: Don
        238431 by: Stut
        238450 by: Chris

Processing HTML in mail form
        238432 by: Jonas Rosling
        238445 by: Prathaban Mookiah

For Loop
        238433 by: Albert Padley
        238434 by: Ray Hauge
        238435 by: Jeffrey Sambells
        238436 by: Adam Zey
        238437 by: David Tulloh
        238438 by: Ray Hauge
        238439 by: Albert Padley
        238440 by: Robert Cummings
        238441 by: D. Dante Lorenso

Re: comparing a string
        238442 by: Rafael

Stream download problem
        238443 by: Michael Satterwhite
        238446 by: Prathaban Mookiah
        238447 by: Prathaban Mookiah
        238451 by: Michael Satterwhite

Re: GD problems
        238444 by: Chris

session problem
        238449 by: weetat

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Hi all,

This may not be complex at all- maybe my head is just screwed up this
afternoon!

I am looping through arrays all at one time for the following-

$filter_subject
$filter_body
$filter_email
$filter_subject_like
$filter_body_like
$filter_email_like

Examples of the following could be-

$filter_subject[0] = "This is the subject";
$filter_body[0] = "This is the body";
$filter_email[0] = "emailemail.com";
$filter_subject_like[0] = "";
$filter_body_like[0] = "";
$filter_email_like[0] = "";

$filter_subject[1] = "";
$filter_body[1] = "";
$filter_email[1] = "";
$filter_subject_like[1] = "lots of nice things";
$filter_body_like[1] = "horrible body text";
$filter_email_like[1] = "emailemail.com";

$filter_subject[2] = "";
$filter_body[2] = "";
$filter_email[2] = "";
$filter_subject_like[2] = "Lots of nice things";
$filter_body_like[2] = "";
$filter_email_like[2] = "";

$filter_subject[3] = "";
$filter_body[3] = "This is the complete body";
$filter_email[3] = "";
$filter_subject_like[3] = "Part of the subject";
$filter_body_like[3] = "";
$filter_email_like[3] = "";

I then run something like the following on the variables $subject,
$body, $email, $subject_like, $body_like and $email_like....

....
for($e=0;$e<count($filter_subject);$e++) {
...
                                 
            if($subject == $filter_subject[$e])
{$found_subject = 1;} // Subject has been found
            if($body == $filter_body[$e])
{$found_body = 1;} // Body has been found
            if($email == $filter_email[$e])
{$found_email = 1;} // Email has been found
   
            if(strpos($subject_like, $filter_subject_like[$e]))
{$found_subject_like = 1;} // Subject(like) has been found
            if(strpos($body_like, $filter_body_like[$e]))
{$found_body_like = 1;} // Body(like) has been found
            if(strpos($email_like, $filter_email_like[$e]))
{$found_email_like = 1;} // Email(like) has been found

...
}

What I want to do is work out if (from the above examples) the following
(not written in php by the way, just in kind of english)

example 0 -
if - ($subject == "This is the subject" AND $body == "This is the body"
AND $email == "emailemail.com") THEN DO THE FOLLOWING....

example 1 -
if - ($subject == "lots of nice things" AND $body_like contains
"horrible body text" AND $email contains "emailemail.com") THEN DO THE
FOLLOWING....

example 2
if - ($subject contains "Lots of nice things") THEN DO THE FOLLOWING....

example 3
if - ($body == "This is the complete body" AND $subject contains "Part
of the subject") THEN DO THE FOLLOWING....

How can I organise a control structure so that I can do the above? My
brain is hurting and I could do with some thoughts from you guys!

attached mail follows:


IG wrote:
> Hi all,
>
> This may not be complex at all- maybe my head is just screwed up this
> afternoon!
>
> I am looping through arrays all at one time for the following-
>
> $filter_subject
> $filter_body
> $filter_email
> $filter_subject_like
> $filter_body_like
> $filter_email_like
>
> Examples of the following could be-
>
> $filter_subject[0] = "This is the subject";
> $filter_body[0] = "This is the body";
> $filter_email[0] = "emailemail.com";
> $filter_subject_like[0] = "";
> $filter_body_like[0] = "";
> $filter_email_like[0] = "";
>
> $filter_subject[1] = "";
> $filter_body[1] = "";
> $filter_email[1] = "";
> $filter_subject_like[1] = "lots of nice things";
> $filter_body_like[1] = "horrible body text";
> $filter_email_like[1] = "emailemail.com";
>
> $filter_subject[2] = "";
> $filter_body[2] = "";
> $filter_email[2] = "";
> $filter_subject_like[2] = "Lots of nice things";
> $filter_body_like[2] = "";
> $filter_email_like[2] = "";
>
> $filter_subject[3] = "";
> $filter_body[3] = "This is the complete body";
> $filter_email[3] = "";
> $filter_subject_like[3] = "Part of the subject";
> $filter_body_like[3] = "";
> $filter_email_like[3] = "";
>
>
>
>
> I then run something like the following on the variables $subject,
> $body, $email, $subject_like, $body_like and $email_like....
>
> ....
> for($e=0;$e<count($filter_subject);$e++) {
> ...
> if($subject ==
> $filter_subject[$e]) {$found_subject = 1;} //
> Subject has been found
> if($body == $filter_body[$e])
> {$found_body = 1;} // Body has been found
> if($email == $filter_email[$e])
> {$found_email = 1;} // Email has been found
> if(strpos($subject_like, $filter_subject_like[$e]))
> {$found_subject_like = 1;} // Subject(like) has been found
> if(strpos($body_like, $filter_body_like[$e]))
> {$found_body_like = 1;} // Body(like) has been found
> if(strpos($email_like, $filter_email_like[$e]))
> {$found_email_like = 1;} // Email(like) has been found
>
> ...
> }
>
> What I want to do is work out if (from the above examples) the following
> (not written in php by the way, just in kind of english)
>
> example 0 -
> if - ($subject == "This is the subject" AND $body == "This is the body"
> AND $email == "emailemail.com") THEN DO THE FOLLOWING....
>
> example 1 -
> if - ($subject == "lots of nice things" AND $body_like contains
> "horrible body text" AND $email contains "emailemail.com") THEN DO THE
> FOLLOWING....
>
> example 2
> if - ($subject contains "Lots of nice things") THEN DO THE FOLLOWING....
>
> example 3
> if - ($body == "This is the complete body" AND $subject contains "Part
> of the subject") THEN DO THE FOLLOWING....
>
>
> How can I organise a control structure so that I can do the above? My
> brain is hurting and I could do with some thoughts from you guys!
>

You're most of the way there.

convert it to php code and you're basically done:

if ($body == '...') {
  echo "Body is $body\n";
}

and so on.

I don't see the problem here ?

--
Postgresql & php tutorials
http://www.designmagick.com/

attached mail follows:


Jochem Maas wrote:
> rossaztechost.com wrote:
>> var_dump gives
>>
>> Company Director string(17)
>>
>> Company Director string(16)
>>
>> Why would they be different?
>
> probably because there is either:
>
> 1. white space in the value in your data source
> 2. white space being outputted along side the value when creating a form field weith that valu
>
> that and/or possible the fact that your doing a trim()
> in one place but not in another - personally I usually trim() incoming string data
> (regardless of any other validation/sanitation) to avoid stuff like this
>
>> Seems like they have add some extra
>> whitespace?
>
> exactly. btw: var_dump() should be showing exactly where the white space is e.g.:
>
>
> code:
> <?php
> $s1 = "Company Director "; $s2 = "Company Director"; var_dump($s1, $s2);
>
> output:
> string(17) "Company Director "
> string(16) "Company Director"
>

Without the quotes he's not going to see the extra white space though,
as the browser is going to render the first space it comes too, but it
will piss on any white space after that (for display purpose). Main
reason I wrap my debugging data in <pre></pre>.

--
John C. Nichel IV
Programmer/System Admin (▄berGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


John Nichel wrote:
> Jochem Maas wrote:

...

>>
>> exactly. btw: var_dump() should be showing exactly where the white
>> space is e.g.:
>>
>>
>> code:
>> <?php
>> $s1 = "Company Director "; $s2 = "Company Director"; var_dump($s1, $s2);
>>
>> output:
>> string(17) "Company Director "
>> string(16) "Company Director"
>>
>
> Without the quotes he's not going to see the extra white space though,
> as the browser is going to render the first space it comes too, but it
> will piss on any white space after that (for display purpose). Main
> reason I wrap my debugging data in <pre></pre>.

I use <pre> too when debugging in the browser - but I was testing on the
cmdline, that said var_dump() outputs the quotes when outputting to the browser
too. I wasn't 100% sure but I just checked to be safe ;-)

>

attached mail follows:


I have the following problem, I need to make a paging system to show
results from search on a Mysql database. I found a class that
should do the job but couldn't figure it out how to use it. Does
anybody has an Idea of hos to do this? I thank in advance for any help
you guys can provide me.
Rodrigo

attached mail follows:


<?php
// Num of records each time
$NUM_RECORDS = 10;

if ($_GET["pag"] == "") {
    $ini = 0;
    $pag = 1;
}
else {
    $ini = ($pag - 1) * $NUM_RECORDS;
}

// Query to show
$query_rsData = "SELECT * FROM table LIMIT " . $ini . ", " . $NUM_RECORDS;
$rsData = mysql_query($query_rsData, $DB_CONECTION);

// Total records
$query_rsData2 = "SELECT * FROM table";
$rsData2 = mysql_query($query_rsData2, $DB_CONECTION);
$num_total_records = mysql_num_rows($rsData2);

// Total pages
$total_pag = ceil($num_total_records / $NUM_RECORDS);

$previous_page = $pag - 1;
$next_page = $pag + 1;
?>

Links for the pages
-------------------

First page: this_page.php?pag=1
Previous page: this_page?pag=<?php echo previous_page; ?>
Next page: this_page?pag=<?php echo next_page; ?>
Last page: this_page?pag=<?php echo total_pag; ?>

Rodrigo de Oliveira Costa escribiˇ:
> I have the following problem, I need to make a paging system to show
> results from search on a Mysql database. I found a class that
> should do the job but couldn't figure it out how to use it. Does
> anybody has an Idea of hos to do this? I thank in advance for any help
> you guys can provide me.
> Rodrigo
>

attached mail follows:


Juanjo Pascual wrote:
> <?php
> // Num of records each time
> $NUM_RECORDS = 10;
>
> if ($_GET["pag"] == "") {
> $ini = 0;
> $pag = 1;
> }
> else {
> $ini = ($pag - 1) * $NUM_RECORDS;
> }
>
> // Query to show
> $query_rsData = "SELECT * FROM table LIMIT " . $ini . ", " . $NUM_RECORDS;
> $rsData = mysql_query($query_rsData, $DB_CONECTION);
>
> // Total records
> $query_rsData2 = "SELECT * FROM table";
> $rsData2 = mysql_query($query_rsData2, $DB_CONECTION);
> $num_total_records = mysql_num_rows($rsData2);
>

    Since you query all enregs from table why not query all first and
the do mysql_data_seek on result?

 // Query to show
 $query_rsData = "SELECT * FROM {table} ORDER BY {Whatever field}";
 $rsData = mysql_query($query_rsData, $DB_CONECTION);
 $num_total_records = mysql_num_rows( $rsData );

 $total_pag = ceil($num_total_records / $NUM_RECORDS);

 if( $pag < 1 )
     $pag = 1;
 elseif( $pag > $total_pag )
     $pag = $total_pag;

 $start_enreg = ($pag-1) * $NUM_RECORDS;

 mysql_data_seek( $rsData, $start_enreg );

 while( ($result = mysql_fetch_object( $rsData )) )
 {
    // display data...
 }

> // Total pages
> $total_pag = ceil($num_total_records / $NUM_RECORDS);
>
> $previous_page = $pag - 1;
> $next_page = $pag + 1;
> ?>
>
> Links for the pages
> -------------------
>
> First page: this_page.php?pag=1
> Previous page: this_page?pag=<?php echo previous_page; ?>
> Next page: this_page?pag=<?php echo next_page; ?>
> Last page: this_page?pag=<?php echo total_pag; ?>
>
>
> Rodrigo de Oliveira Costa escribiˇ:
>> I have the following problem, I need to make a paging system to show
>> results from search on a Mysql database. I found a class that
>> should do the job but couldn't figure it out how to use it. Does
>> anybody has an Idea of hos to do this? I thank in advance for any help
>> you guys can provide me.
>> Rodrigo
>>
>

attached mail follows:


Andrei wrote:
>
> Since you query all enregs from table why not query all first and
> the do mysql_data_seek on result?
>
> // Query to show
> $query_rsData = "SELECT * FROM {table} ORDER BY {Whatever field}";
> $rsData = mysql_query($query_rsData, $DB_CONECTION);
> $num_total_records = mysql_num_rows( $rsData );
>
> $total_pag = ceil($num_total_records / $NUM_RECORDS);
>
> if( $pag < 1 )
> $pag = 1;
> elseif( $pag > $total_pag )
> $pag = $total_pag;
>
> $start_enreg = ($pag-1) * $NUM_RECORDS;
>
> mysql_data_seek( $rsData, $start_enreg );
>
> while( ($result = mysql_fetch_object( $rsData )) )
> {
> // display data...
> }
>

Querying all data in the first place is a waste, and the practice of
seeking through a dataset seems silly when MySQL has the "LIMIT" feature
to specify which data you want to return.

I believe the proper way to do this would be something like this
(Simplified example, of course):

$query = "SELECT SQL_CALC_FOUND_FOWS * FROM foo LIMIT 30, 10";
$result = mysql_query($query);
$query = "SELECT found_rows()";
$num_rows = mysql_result(mysql_query($query), 0);

That should be much faster than the methods used by either of you guys.

As a comment, it would have been better to do "SELECT COUNT(*) FROM foo"
and reading the result rather than doing "SELECT * FROM foo" and then
mysql_num_rows(). Don't ask MySQL to collect data if you're not going to
use it! That actually applies to why you shouldn't use mysql_data_seek
either.

Regards, Adam.

attached mail follows:


How can i know which of both is better to use each time?

attached mail follows:


On Tue, 2006-06-20 at 12:34, Juanjo Pascual wrote:
> How can i know which of both is better to use each time?

Use mysql_pconnect() if the connection overhead is large. This is
usually the case if the database is off on a remote server somewhere in
lala land. Remote servers within your LAN don't usually require
mysql_pconnect(). Use mysql_connect() for pretty much all other
connections.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


If you're not sure you should probably stick with mysql_connect() -
otherwise you could end up bogging down mysql with way more
connections than you need if you're not careful.

On Jun 20, 2006, at 12:34 PM, Juanjo Pascual wrote:

> How can i know which of both is better to use each time?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


        As you didn't mentioned what you use your queries for, maybe read the
manual?

   Andy

Juanjo Pascual wrote:
> How can i know which of both is better to use each time?
>

attached mail follows:


Hello All,

I'm not sure this is strictly a PHP related question or perhaps a
server admin question as well. What do you do when you are trying to
shutdown a web application for maintenance (like a membership or
registration-required system)? I understand that you can temporarily
upload or activate a holding page that prevents users from continuing
to login/use the system, but how can you insure that there are no
ongoing sessions or users still in the process of doing something?
What's the best method for handling this, especially if you don't have
full control of the server hosting the web app?

Thanks for any advice,

- Ben

attached mail follows:


Assuming you're using a web server that supports htaccess files, you
could easily just pop in a .htaccess file that denies access to
everything. You could even add a PHP ini directive like:

php_value auto_prepend_file "maintenance.php"

where maintenance.php could contain something like:

<html><head><title>Down for Maintenance</title></head><body>Site down
for maintenance!</body></html> <?php exit(0); ?>

(Or, to be sure, you could do both.)

jon

Ben Liu wrote:
> Hello All,
>
> I'm not sure this is strictly a PHP related question or perhaps a
> server admin question as well. What do you do when you are trying to
> shutdown a web application for maintenance (like a membership or
> registration-required system)? I understand that you can temporarily
> upload or activate a holding page that prevents users from continuing
> to login/use the system, but how can you insure that there are no
> ongoing sessions or users still in the process of doing something?
> What's the best method for handling this, especially if you don't have
> full control of the server hosting the web app?
>
> Thanks for any advice,
>
> - Ben
>

attached mail follows:


Hi Jon,

Thanks for the response. What would these solutions mean in regards to
users who are active at the moment that the .htaccess file is added?
Would it be wise to force some kind of logout, destruction of open
sessions, etc. I guess there is no simple, graceful way to allow users
to complete whatever they are doing and then kick them off while
preventing new users from logging in. I was thinking for example, what
if someone is in the process of uploading a file to the web app host
or filling out step 2 of a 4 part membership form or something that
requires multiple steps.

- Ben

On 6/20/06, Jon Anderson <jongamingsolutions.ca> wrote:
> Assuming you're using a web server that supports htaccess files, you
> could easily just pop in a .htaccess file that denies access to
> everything. You could even add a PHP ini directive like:
>
> php_value auto_prepend_file "maintenance.php"
>
> where maintenance.php could contain something like:
>
> <html><head><title>Down for Maintenance</title></head><body>Site down
> for maintenance!</body></html> <?php exit(0); ?>
>
> (Or, to be sure, you could do both.)
>
> jon
>
> Ben Liu wrote:
> > Hello All,
> >
> > I'm not sure this is strictly a PHP related question or perhaps a
> > server admin question as well. What do you do when you are trying to
> > shutdown a web application for maintenance (like a membership or
> > registration-required system)? I understand that you can temporarily
> > upload or activate a holding page that prevents users from continuing
> > to login/use the system, but how can you insure that there are no
> > ongoing sessions or users still in the process of doing something?
> > What's the best method for handling this, especially if you don't have
> > full control of the server hosting the web app?
> >
> > Thanks for any advice,
> >
> > - Ben
> >
>
>

attached mail follows:


Ben Liu wrote:
> Hello All,
>
> I'm not sure this is strictly a PHP related question or perhaps a
> server admin question as well. What do you do when you are trying to
> shutdown a web application for maintenance (like a membership or
> registration-required system)? I understand that you can temporarily
> upload or activate a holding page that prevents users from continuing
> to login/use the system, but how can you insure that there are no
> ongoing sessions or users still in the process of doing something?
> What's the best method for handling this, especially if you don't have
> full control of the server hosting the web app?
>
> Thanks for any advice,
>
> - Ben

I normally do what you say; activate a holding page. The question comes
to mind, does it really matter if a user's session is interrupted? Is
the web application dealing with data that is critical enough (or
non-critical data in a possibly destructive manner) that you can't just
cut them off for a while?

You have to consider that users could just as easily be cut off by a
server crash, packetloss/network issues (on your end OR theirs, or
anywhere in between), or just might hit the stop button while a script
is running (Which, IIRC, ordinarily terminates the script the next time
you try to send something). If your web app works in a way such that you
can't just pull the plug and everything is fine, you're running some
pretty big risks that your app will get into unrecoverable states from
everyday issues.

If you wanted to get fancy, you could code your system to prevent new
logins, expire normal logins much faster (Say, after 15 minutes instead
of hours or days), and then wait for all users to be logged out before
continuing.

Regards, Adam Zey.

attached mail follows:


Ben Liu wrote:
> Hello All,
>
> I'm not sure this is strictly a PHP related question or perhaps a
> server admin question as well. What do you do when you are trying to
> shutdown a web application for maintenance (like a membership or
> registration-required system)? I understand that you can temporarily
> upload or activate a holding page that prevents users from continuing
> to login/use the system, but how can you insure that there are no
> ongoing sessions or users still in the process of doing something?
> What's the best method for handling this, especially if you don't have
> full control of the server hosting the web app?
>
> Thanks for any advice,
>
> - Ben

I normally do what you say; activate a holding page. The question comes
to mind, does it really matter if a user's session is interrupted? Is
the web application dealing with data that is critical enough (or
non-critical data in a possibly destructive manner) that you can't just
cut them off for a while?

You have to consider that users could just as easily be cut off by a
server crash, packetloss/network issues (on your end OR theirs, or
anywhere in between), or just might hit the stop button while a script
is running (Which, IIRC, ordinarily terminates the script the next time
you try to send something). If your web app works in a way such that you
can't just pull the plug and everything is fine, you're running some
pretty big risks that your app will get into unrecoverable states from
everyday issues.

If you wanted to get fancy, you could code your system to prevent new
logins, expire normal logins much faster (Say, after 15 minutes instead
of hours or days), and then wait for all users to be logged out before
continuing.

Regards, Adam Zey.

attached mail follows:


Thanks Adam,

What you say makes good sense to me. Is there some method to run a
script that kills all active sessions on a host? It could become part
of the maintenance script I suppose:

1) Kill all active sessions
2) Put up generic maintenance screen
3) Deny further login attempts

- Ben

On 6/20/06, Adam Zey <azeynit.ca> wrote:
> Ben Liu wrote:
> > Hello All,
> >
> > I'm not sure this is strictly a PHP related question or perhaps a
> > server admin question as well. What do you do when you are trying to
> > shutdown a web application for maintenance (like a membership or
> > registration-required system)? I understand that you can temporarily
> > upload or activate a holding page that prevents users from continuing
> > to login/use the system, but how can you insure that there are no
> > ongoing sessions or users still in the process of doing something?
> > What's the best method for handling this, especially if you don't have
> > full control of the server hosting the web app?
> >
> > Thanks for any advice,
> >
> > - Ben
>
> I normally do what you say; activate a holding page. The question comes
> to mind, does it really matter if a user's session is interrupted? Is
> the web application dealing with data that is critical enough (or
> non-critical data in a possibly destructive manner) that you can't just
> cut them off for a while?
>
> You have to consider that users could just as easily be cut off by a
> server crash, packetloss/network issues (on your end OR theirs, or
> anywhere in between), or just might hit the stop button while a script
> is running (Which, IIRC, ordinarily terminates the script the next time
> you try to send something). If your web app works in a way such that you
> can't just pull the plug and everything is fine, you're running some
> pretty big risks that your app will get into unrecoverable states from
> everyday issues.
>
> If you wanted to get fancy, you could code your system to prevent new
> logins, expire normal logins much faster (Say, after 15 minutes instead
> of hours or days), and then wait for all users to be logged out before
> continuing.
>
> Regards, Adam Zey.
>

attached mail follows:


Shutting down Apache would do the trick ;) But if you're in a shared
hosting environment that may not be possible.

As for sessions, it depends how you track them. You can't kill all PHP
sessions in one go, but you could have your web app nuke the sessions of
users after they come back after maintenance. Something like
first_login_after_maint in the database, that if set to true, mandates
that any existing session data be destroyed before continuing.

I assume that the reason you want to kill session data is because the
data and how it is used would be different after the maintenance?
Because otherwise, if you've denied all access to ANY of your webapp's
php scripts, it shouldn't matter if the user has session data. If you
physically move the web app's PHP scripts (Or set up a redirect, etc),
they can't do anything with it.

Regards, Adam

Ben Liu wrote:
> Thanks Adam,
>
> What you say makes good sense to me. Is there some method to run a
> script that kills all active sessions on a host? It could become part
> of the maintenance script I suppose:
>
> 1) Kill all active sessions
> 2) Put up generic maintenance screen
> 3) Deny further login attempts
>
> - Ben
>
> On 6/20/06, Adam Zey <azeynit.ca> wrote:
>> Ben Liu wrote:
>> > Hello All,
>> >
>> > I'm not sure this is strictly a PHP related question or perhaps a
>> > server admin question as well. What do you do when you are trying to
>> > shutdown a web application for maintenance (like a membership or
>> > registration-required system)? I understand that you can temporarily
>> > upload or activate a holding page that prevents users from continuing
>> > to login/use the system, but how can you insure that there are no
>> > ongoing sessions or users still in the process of doing something?
>> > What's the best method for handling this, especially if you don't have
>> > full control of the server hosting the web app?
>> >
>> > Thanks for any advice,
>> >
>> > - Ben
>>
>> I normally do what you say; activate a holding page. The question comes
>> to mind, does it really matter if a user's session is interrupted? Is
>> the web application dealing with data that is critical enough (or
>> non-critical data in a possibly destructive manner) that you can't just
>> cut them off for a while?
>>
>> You have to consider that users could just as easily be cut off by a
>> server crash, packetloss/network issues (on your end OR theirs, or
>> anywhere in between), or just might hit the stop button while a script
>> is running (Which, IIRC, ordinarily terminates the script the next time
>> you try to send something). If your web app works in a way such that you
>> can't just pull the plug and everything is fine, you're running some
>> pretty big risks that your app will get into unrecoverable states from
>> everyday issues.
>>
>> If you wanted to get fancy, you could code your system to prevent new
>> logins, expire normal logins much faster (Say, after 15 minutes instead
>> of hours or days), and then wait for all users to be logged out before
>> continuing.
>>
>> Regards, Adam Zey.
>>

attached mail follows:


On 6/20/06, Adam Zey <azeynit.ca> wrote:
> Shutting down Apache would do the trick ;) But if you're in a shared
> hosting environment that may not be possible.
>

Yeah, don't have full control over the server in this case.

> As for sessions, it depends how you track them. You can't kill all PHP
> sessions in one go, but you could have your web app nuke the sessions of
> users after they come back after maintenance. Something like
> first_login_after_maint in the database, that if set to true, mandates
> that any existing session data be destroyed before continuing.
>
How about iterating through the /tmp directory and deleting all the
session cookies? On second thought, that would kill all the sessions
for other apps as well.

> I assume that the reason you want to kill session data is because the
> data and how it is used would be different after the maintenance?
> Because otherwise, if you've denied all access to ANY of your webapp's
> php scripts, it shouldn't matter if the user has session data. If you
> physically move the web app's PHP scripts (Or set up a redirect, etc),
> they can't do anything with it.
>

I didn't have a specific reason for doing it, just wasn't sure what
the ramifications of having open sessions alive through the
maintenance period and afterward might be so I thought it best to just
kill them. It doesn't sound like anything horrible can happen except
some inconvenience maybe.

> Regards, Adam
>
> Ben Liu wrote:
> > Thanks Adam,
> >
> > What you say makes good sense to me. Is there some method to run a
> > script that kills all active sessions on a host? It could become part
> > of the maintenance script I suppose:
> >
> > 1) Kill all active sessions
> > 2) Put up generic maintenance screen
> > 3) Deny further login attempts
> >
> > - Ben
> >
> > On 6/20/06, Adam Zey <azeynit.ca> wrote:
> >> Ben Liu wrote:
> >> > Hello All,
> >> >
> >> > I'm not sure this is strictly a PHP related question or perhaps a
> >> > server admin question as well. What do you do when you are trying to
> >> > shutdown a web application for maintenance (like a membership or
> >> > registration-required system)? I understand that you can temporarily
> >> > upload or activate a holding page that prevents users from continuing
> >> > to login/use the system, but how can you insure that there are no
> >> > ongoing sessions or users still in the process of doing something?
> >> > What's the best method for handling this, especially if you don't have
> >> > full control of the server hosting the web app?
> >> >
> >> > Thanks for any advice,
> >> >
> >> > - Ben
> >>
> >> I normally do what you say; activate a holding page. The question comes
> >> to mind, does it really matter if a user's session is interrupted? Is
> >> the web application dealing with data that is critical enough (or
> >> non-critical data in a possibly destructive manner) that you can't just
> >> cut them off for a while?
> >>
> >> You have to consider that users could just as easily be cut off by a
> >> server crash, packetloss/network issues (on your end OR theirs, or
> >> anywhere in between), or just might hit the stop button while a script
> >> is running (Which, IIRC, ordinarily terminates the script the next time
> >> you try to send something). If your web app works in a way such that you
> >> can't just pull the plug and everything is fine, you're running some
> >> pretty big risks that your app will get into unrecoverable states from
> >> everyday issues.
> >>
> >> If you wanted to get fancy, you could code your system to prevent new
> >> logins, expire normal logins much faster (Say, after 15 minutes instead
> >> of hours or days), and then wait for all users to be logged out before
> >> continuing.
> >>
> >> Regards, Adam Zey.
> >>
>
>

attached mail follows:


No. I was looking for a way to do it.

mysql_insert_id did the job for me. I can't figure out how I missed out on
this function. I browsed through the manual for 2 hours yesterday looking for
such a function.

Anway, thank you Jay and Chris. And you too John, for your attention.

Cheers,

Prathap

---------- Original Message -----------
From: John Nichel <jnichelby-tor.com>
To:
Sent: Tue, 20 Jun 2006 00:19:20 -0400
Subject: Re: [PHP] mysql_db_query & INSERT

> Jay Blanchard wrote:
> > [snip]
> > How do I retrieve the auto generated primary key field
> > in the first table during the first insert operation.
> > [/snip]
> >
> > http://www.php.net/mysql_insert_id
> >
>
> You mean they have a manual for this stuff??
>
> Holy Toledo!
>
> --
> By-Tor.com
> ...it's all about the Rush
> http://www.by-tor.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
------- End of Original Message -------

attached mail follows:


Hi,
 
I have a varchar field in a MySQL database that contains a line of text like
so:
 
"This is a line if text"
 
The double quotes are included in the database field.
 
I cannot seem to display it on my HTML page, it always shows as blank. I
have tried using both the stripslashes() and the html_entity_decode() but it
still shows as blank.
 
How can I display this please???
 
Tks,
Don

attached mail follows:


Don wrote:
> I have a varchar field in a MySQL database that contains a line of text like
> so:
>
> "This is a line if text"
>
> The double quotes are included in the database field.
>
> I cannot seem to display it on my HTML page, it always shows as blank. I
> have tried using both the stripslashes() and the html_entity_decode() but it
> still shows as blank.
>
> How can I display this please???

Well, using my highly developed frontal lobe I can see from your code
that... ahh, hang on a tick - you didn't include any code. Can't help,
sorry.

-Stut

attached mail follows:


Don wrote:
> Hi,
>
> I have a varchar field in a MySQL database that contains a line of text like
> so:
>
> "This is a line if text"
>
> The double quotes are included in the database field.
>
> I cannot seem to display it on my HTML page, it always shows as blank. I
> have tried using both the stripslashes() and the html_entity_decode() but it
> still shows as blank.
>
> How can I display this please???

If you're putting this into a <input type="text"> type box you need to
encode it not decode it.

htmlspecialchars or htmlentities will do it for you.

--
Postgresql & php tutorials
http://www.designmagick.com/

attached mail follows:


I've done the following code bellow for an e-mail form. But it handles the
HTML tags as text. Is there anyway to get the HTML tags processed to form
the mail?

<?php

    extract($_POST);
    
    $subject = 'Intresseanmalan';
    
    $forname = stripslashes($forname);
    
    $lastname = stripslashes($lastname);
    
    $date_of_birth = stripslashes($date_of_birth);
    
    $post_address = stripslashes($post_address);
    
    $zip_code = stripslashes($zip_code);
    
    $city = stripslashes($city);
    
    $phone = stripslashes($phone);
    
    $mail = stripslashes($mail);
    
    $description = stripslashes($description);
    
    $hairdresser = stripslashes($hairdresser);
    
    $makeup = stripslashes($makeup);
    
    $text = 'F-name: '.$forname.'<br>'.
            'L-name: '.$lastname.'<br>'.
            'Birth: '.$date_of_birth.'<br>'.
            'Address: '.$post_address.'<br>'.
            'Zip: '.$zip_code.'<br>'.
            'City: '.$city.'<br>'.
            'Phone: '.$phone.'<br>'.
            'Mail: '.$mail.'<br>'.
            'Desc: '.$description.'<br>'.
            'Hair: '.$hairdresser.'<br>'.
            'Make: '.$makeup;
    
    mail('monicaguldhair.se',$subject,$text,"From: $forname $lastname
<$mail>");

?>

The mail looks like this when recived:

F-namn: J<br>L-namn: R<br>Birth: 12<br>Address: 34<br>Zip: 56<br>City:
78<br>Phone: 90<br>Mail: jkjjkl.se<br>Desc: N<br>Hair: hair<br>Make: makeup

Thanks in advance // Jonas

attached mail follows:


Jonas:

I am not sure if I understood your problem correct. But the way I understood
it, you want the mail to be displayed as:

F-namn: J
L-namn: R
Birth: 12
Address: 34
Zip: 56
City: 78
Phone: 90
Mail: jkjjkl.se
Desc: N
Hair: hair
Make: makeup

Am I correct? If that is the case, I guess you should use '\n' instead of
'<BR>'.

Cheers,

Prathap

---------- Original Message -----------
From: Jonas Rosling <webmastergamearena.se>
To: PHP Lists <php-generallists.php.net>
Sent: Tue, 20 Jun 2006 23:56:47 +0200
Subject: [PHP] Processing HTML in mail form

> I've done the following code bellow for an e-mail form. But it
> handles the HTML tags as text. Is there anyway to get the HTML tags
> processed to form the mail?
>
> <?php
>
> extract($_POST);
>
> $subject = 'Intresseanmalan';
>
> $forname = stripslashes($forname);
>
> $lastname = stripslashes($lastname);
>
> $date_of_birth = stripslashes($date_of_birth);
>
> $post_address = stripslashes($post_address);
>
> $zip_code = stripslashes($zip_code);
>
> $city = stripslashes($city);
>
> $phone = stripslashes($phone);
>
> $mail = stripslashes($mail);
>
> $description = stripslashes($description);
>
> $hairdresser = stripslashes($hairdresser);
>
> $makeup = stripslashes($makeup);
>
> $text = 'F-name: '.$forname.'<br>'.
> 'L-name: '.$lastname.'<br>'.
> 'Birth: '.$date_of_birth.'<br>'.
> 'Address: '.$post_address.'<br>'.
> 'Zip: '.$zip_code.'<br>'.
> 'City: '.$city.'<br>'.
> 'Phone: '.$phone.'<br>'.
> 'Mail: '.$mail.'<br>'.
> 'Desc: '.$description.'<br>'.
> 'Hair: '.$hairdresser.'<br>'.
> 'Make: '.$makeup;
>
> mail('monicaguldhair.se',$subject,$text,"From: $forname
> $lastname <$mail>");
>
> ?>
>
> The mail looks like this when recived:
>
> F-namn: J<br>L-namn: R<br>Birth: 12<br>Address: 34<br>Zip:
> 56<br>City: 78<br>Phone: 90<br>Mail: jkjjkl.se<br>Desc: N<br>Hair:
> hair<br>Make: makeup
>
> Thanks in advance // Jonas
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
------- End of Original Message -------

attached mail follows:


I have a regular for loop - for($i=1; $i<100; $i++)

Within the loop I need to create variables named:

$p1name;
$p2name;
$p3name;
etc.

The integer portion of each variable name needs to be the value of $i.

I can't seem to get my syntax correct?

Can someone point me in the right direction?

Thanks.

Albert Padley

attached mail follows:


On Tuesday 20 June 2006 15:14, Albert Padley wrote:
> I have a regular for loop - for($i=1; $i<100; $i++)
>
> Within the loop I need to create variables named:
>
> $p1name;
> $p2name;
> $p3name;
> etc.
>
> The integer portion of each variable name needs to be the value of $i.
>
> I can't seem to get my syntax correct?
>
> Can someone point me in the right direction?
>
> Thanks.
>
> Albert Padley

If you really want to keep the p?name syntax, I would suggest throwing them in
an array with keys.

$arr["p1name"]
$arr["p2name"]

Then that way you can create the key dynamically:

$arr["p".$i."name"]

Not pretty, but it works.

Thanks,
--
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

attached mail follows:


for($i=1; $i<100; $i++) {
        ${'p'.$i.'name'} = 'whatever';
}

- jeff

On 20-Jun-06, at 6:14 PM, Albert Padley wrote:

> I have a regular for loop - for($i=1; $i<100; $i++)
>
> Within the loop I need to create variables named:
>
> $p1name;
> $p2name;
> $p3name;
> etc.
>
> The integer portion of each variable name needs to be the value of $i.
>
> I can't seem to get my syntax correct?
>
> Can someone point me in the right direction?
>
> Thanks.
>
> Albert Padley
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


Ray Hauge wrote:
> On Tuesday 20 June 2006 15:14, Albert Padley wrote:
>> I have a regular for loop - for($i=1; $i<100; $i++)
>>
>> Within the loop I need to create variables named:
>>
>> $p1name;
>> $p2name;
>> $p3name;
>> etc.
>>
>> The integer portion of each variable name needs to be the value of $i.
>>
>> I can't seem to get my syntax correct?
>>
>> Can someone point me in the right direction?
>>
>> Thanks.
>>
>> Albert Padley
>
> If you really want to keep the p?name syntax, I would suggest throwing them in
> an array with keys.
>
> $arr["p1name"]
> $arr["p2name"]
>
> Then that way you can create the key dynamically:
>
> $arr["p".$i."name"]
>
> Not pretty, but it works.
>
> Thanks,

I haven't checked this, but couldn't you reference it as $arr["p$iname"]
? Is there a reason why variable expansion wouldn't work in this
circumstance?

If it does, you could make it easier to read by doing $arr["p{$i}name"]
even though the {} aren't required. It'd be a lot easier to read than
concatenations :)

Regards, Adam.

attached mail follows:


Are you sure that you don't want an array? Arrays are normally much
better for this type of thing.

That said,
${"p{$i}name"} = 'foo';

David

Albert Padley wrote:
> I have a regular for loop - for($i=1; $i<100; $i++)
>
> Within the loop I need to create variables named:
>
> $p1name;
> $p2name;
> $p3name;
> etc.
>
> The integer portion of each variable name needs to be the value of $i.
>
> I can't seem to get my syntax correct?
>
> Can someone point me in the right direction?
>
> Thanks.
>
> Albert Padley
>

attached mail follows:


On Tuesday 20 June 2006 15:28, Adam Zey wrote:
> Ray Hauge wrote:
> > On Tuesday 20 June 2006 15:14, Albert Padley wrote:
> >> I have a regular for loop - for($i=1; $i<100; $i++)
> >>
> >> Within the loop I need to create variables named:
> >>
> >> $p1name;
> >> $p2name;
> >> $p3name;
> >> etc.
> >>
> >> The integer portion of each variable name needs to be the value of $i.
> >>
> >> I can't seem to get my syntax correct?
> >>
> >> Can someone point me in the right direction?
> >>
> >> Thanks.
> >>
> >> Albert Padley
> >
> > If you really want to keep the p?name syntax, I would suggest throwing
> > them in an array with keys.
> >
> > $arr["p1name"]
> > $arr["p2name"]
> >
> > Then that way you can create the key dynamically:
> >
> > $arr["p".$i."name"]
> >
> > Not pretty, but it works.
> >
> > Thanks,
>
> I haven't checked this, but couldn't you reference it as $arr["p$iname"]
> ? Is there a reason why variable expansion wouldn't work in this
> circumstance?
>
> If it does, you could make it easier to read by doing $arr["p{$i}name"]
> even though the {} aren't required. It'd be a lot easier to read than
> concatenations :)
>
> Regards, Adam.

Both of those ways work. I think there's a question on the PHP Certification
Exam about the different ways to work with strings.

--
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

attached mail follows:


Thanks everyone. Always nice to know there is more than one direction
to go in.

Albert

On Jun 20, 2006, at 4:52 PM, Ray Hauge wrote:

> On Tuesday 20 June 2006 15:28, Adam Zey wrote:
>> Ray Hauge wrote:
>>> On Tuesday 20 June 2006 15:14, Albert Padley wrote:
>>>> I have a regular for loop - for($i=1; $i<100; $i++)
>>>>
>>>> Within the loop I need to create variables named:
>>>>
>>>> $p1name;
>>>> $p2name;
>>>> $p3name;
>>>> etc.
>>>>
>>>> The integer portion of each variable name needs to be the value
>>>> of $i.
>>>>
>>>> I can't seem to get my syntax correct?
>>>>
>>>> Can someone point me in the right direction?
>>>>
>>>> Thanks.
>>>>
>>>> Albert Padley
>>>
>>> If you really want to keep the p?name syntax, I would suggest
>>> throwing
>>> them in an array with keys.
>>>
>>> $arr["p1name"]
>>> $arr["p2name"]
>>>
>>> Then that way you can create the key dynamically:
>>>
>>> $arr["p".$i."name"]
>>>
>>> Not pretty, but it works.
>>>
>>> Thanks,
>>
>> I haven't checked this, but couldn't you reference it as $arr["p
>> $iname"]
>> ? Is there a reason why variable expansion wouldn't work in this
>> circumstance?
>>
>> If it does, you could make it easier to read by doing $arr["p{$i}
>> name"]
>> even though the {} aren't required. It'd be a lot easier to read than
>> concatenations :)
>>
>> Regards, Adam.
>
> Both of those ways work. I think there's a question on the PHP
> Certification
> Exam about the different ways to work with strings.
>
> --
> Ray Hauge
> Programmer/Systems Administrator
> American Student Loan Services
> www.americanstudentloan.com
> 1.800.575.1099
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


On Tue, 2006-06-20 at 19:19, Albert Padley wrote:
> Thanks everyone. Always nice to know there is more than one direction
> to go in.
>
> Albert
>
>
> On Jun 20, 2006, at 4:52 PM, Ray Hauge wrote:
>
> > On Tuesday 20 June 2006 15:28, Adam Zey wrote:
> >> Ray Hauge wrote:
> >>> On Tuesday 20 June 2006 15:14, Albert Padley wrote:
> >>>> I have a regular for loop - for($i=1; $i<100; $i++)
> >>>>
> >>>> Within the loop I need to create variables named:
> >>>>
> >>>> $p1name;
> >>>> $p2name;
> >>>> $p3name;
> >>>> etc.
> >>>>
> >>>> The integer portion of each variable name needs to be the value
> >>>> of $i.
> >>>>
> >>>> I can't seem to get my syntax correct?
> >>>>
> >>>> Can someone point me in the right direction?
> >>>>
> >>>> Thanks.
> >>>>
> >>>> Albert Padley
> >>>
> >>> If you really want to keep the p?name syntax, I would suggest
> >>> throwing
> >>> them in an array with keys.
> >>>
> >>> $arr["p1name"]
> >>> $arr["p2name"]
> >>>
> >>> Then that way you can create the key dynamically:
> >>>
> >>> $arr["p".$i."name"]
> >>>
> >>> Not pretty, but it works.
> >>>
> >>> Thanks,
> >>
> >> I haven't checked this, but couldn't you reference it as $arr["p
> >> $iname"]
> >> ? Is there a reason why variable expansion wouldn't work in this
> >> circumstance?
> >>
> >> If it does, you could make it easier to read by doing $arr["p{$i}
> >> name"]
> >> even though the {} aren't required. It'd be a lot easier to read than
> >> concatenations :)
> >>
> >> Regards, Adam.
> >
> > Both of those ways work. I think there's a question on the PHP
> > Certification
> > Exam about the different ways to work with strings.

Ahhh, got to love the fact that there's a question, yet no need for the
taker to actually understand the implications. Does anyone know if you
can get toilet paper with certs printed on it?

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Albert Padley wrote:
> Thanks everyone. Always nice to know there is more than one direction
> to go in.

A alternative to variable variables might use these:

    http://us3.php.net/manual/en/function.compact.php
    http://us3.php.net/manual/en/function.extract.php

'extract' looks like it might be right up your alley:

    <?php
    $vars = array();
    for ($i=1; $i<100; $i++) { $vars["p".$i."name"] = $i; }
    extract($vars);
    ?>

Dante

>>>> On Tuesday 20 June 2006 15:14, Albert Padley wrote:
>>>>> I have a regular for loop - for($i=1; $i<100; $i++)
>>>>>
>>>>> Within the loop I need to create variables named:
>>>>>
>>>>> $p1name;
>>>>> $p2name;
>>>>> $p3name;
>>>>> etc.
>>>>>
>>>>> The integer portion of each variable name needs to be the value of
>>>>> $i.
>>>>>
>>>>> I can't seem to get my syntax correct?
>>>>>
>>>>> Can someone point me in the right direction?
>>>>>
>>>>> Thanks.
>>>>>
>>>>> Albert Padley

attached mail follows:


(inline)

Adam Zey wrote:
> Rafael wrote:
>> A single "=" it's an assignment, not a comparison; and though it
>> sometimes work, you shouldn't compare strings with "==", but using
>> string functions, such as strcmp()... or similar_text(), etc.
>
> This is PHP, not C. Operators such as == support strings for a reason,
> people should use them as such.

        You shouldn't rely on what other languages do, but the one you're
working with; PHP has no explicit data-types and manages strings as PERL
does. Just as you say there's a reason why "==" supports strings,
there's also a reason (or more) for strcmp() to exists --it's just safer
to use strcmp() instead of "==", e.g: 24 == "24/7"

> If you need to ensure type, (so that 0 == "foo" doesn't return true),
> then you can use ===.
>
> Using a function call that does more than you need when there is an
> operator to achieve the same goal is bad advice.

        I think you haven't encounter a "special case" to make you understand
"==" does NOT have the same behaviour as strcmp() It's just like the
(stranger) case of the loop
   for ( $c = 'a'; $c <= 'z'; $c ++ )
       echo $c;

> Not to mention the fact
> that it leads to harder to read code. Which of these has a more readily
> apparent meaning?
>
> if ( strcmp($foo,$bar) == 0 )
>
> if ( $foo === $bar )

        That might be true, either way you need to know the language to
understand what the first line does and that the second isn't a typo.
--
Atentamente / Sincerely,
J. Rafael Salazar Maga˝a

attached mail follows:


I have a site that generates a file to be streamed down. The relevant
code is:
----------------------------------------------------------
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: attachment; filename=$EXPORT_TIME.txt");
header("Content-disposition: attachment");
header("Pragma: no-cache");
header("Expires: 0");
echo $filestring;
die();
-----------------------------------------------------------

$EXPORT_TIME has been set to a valid filename in earlier part of script.
The script has been called by the user clicking on a line similar to
   <a href="easy.php?download=stream&dltype=full.

If the browser in use is Firefox, Mozilla, or almost anything, it works
correctly. If the browser is Internet Explorer, the download fails. It
appears in that case that the filename expected is the full url used to
call the page (e.g. easy.php?download=stream&dltype=full) which is an
invalid filename, hence the failure.

...and before you suggest it, *NO*, I cannot tell my client that they
can't use Internet Explorer.

Can anyone offer any help?
---Michael

attached mail follows:


Micheal,

I ran into this problem too. A easy workaround is to right click and choose
'save as' which worked for me.

For complete information on this you want to have a look at http://support.
microsoft.com/default.aspx/kb/279667

Cheers,

Prathap

---------- Original Message -----------
From: Michael Satterwhite <michaelweblore.com>
To: PHP Users <php-generallists.php.net>
Sent: Tue, 20 Jun 2006 19:32:17 -0500
Subject: [PHP] Stream download problem

> I have a site that generates a file to be streamed down. The
> relevant code is:
> ----------------------------------------------------------
> header("Content-type: application/vnd.ms-excel");
> header("Content-disposition: attachment; filename=$EXPORT_TIME.txt");
> header("Content-disposition: attachment");
> header("Pragma: no-cache");
> header("Expires: 0");
> echo $filestring;
> die();
> -----------------------------------------------------------
>
> $EXPORT_TIME has been set to a valid filename in earlier part of
> script. The script has been called by the user clicking on a line
> similar to <a href="easy.php?download=stream&dltype=full.
>
> If the browser in use is Firefox, Mozilla, or almost anything, it
> works correctly. If the browser is Internet Explorer, the download
> fails. It appears in that case that the filename expected is the
> full url used to call the page (e.g.
> easy.php?download=stream&dltype=full) which is an invalid filename,
> hence the failure.
>
> ...and before you suggest it, *NO*, I cannot tell my client that
> they can't use Internet Explorer.
>
> Can anyone offer any help?
> ---Michael
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
------- End of Original Message -------

attached mail follows:


Micheal,

I ran into this problem too. A easy workaround is to right click and choose
'save as' which worked for me.

For complete information on this you may want to have a look at http://
support.
microsoft.com/default.aspx/kb/279667

Cheers,

Prathap

---------- Original Message -----------
From: Michael Satterwhite <michaelweblore.com>
To: PHP Users <php-generallists.php.net>
Sent: Tue, 20 Jun 2006 19:32:17 -0500
Subject: [PHP] Stream download problem

> I have a site that generates a file to be streamed down. The
> relevant code is:
> ----------------------------------------------------------
> header("Content-type: application/vnd.ms-excel");
> header("Content-disposition: attachment; filename=$EXPORT_TIME.txt");
> header("Content-disposition: attachment");
> header("Pragma: no-cache");
> header("Expires: 0");
> echo $filestring;
> die();
> -----------------------------------------------------------
>
> $EXPORT_TIME has been set to a valid filename in earlier part of
> script. The script has been called by the user clicking on a line
> similar to <a href="easy.php?download=stream&dltype=full.
>
> If the browser in use is Firefox, Mozilla, or almost anything, it
> works correctly. If the browser is Internet Explorer, the download
> fails. It appears in that case that the filename expected is the
> full url used to call the page (e.g.
> easy.php?download=stream&dltype=full) which is an invalid filename,
> hence the failure.
>
> ...and before you suggest it, *NO*, I cannot tell my client that
> they can't use Internet Explorer.
>
> Can anyone offer any help?
> ---Michael
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
------- End of Original Message -------

attached mail follows:


Prathaban Mookiah wrote:
> Micheal,
>
> I ran into this problem too. A easy workaround is to right click and choose
> 'save as' which worked for me.

I wish that would work. The URL is along the lines of
<a href="easy.php?download=stream&dltype=full> - and it's this that gets
substituted for the filename. It reports that it cannot be written to
the cache.

> For complete information on this you want to have a look at http://support.
> microsoft.com/default.aspx/kb/279667

I find this interesting MSoft claims to have fixed the problem back at
IE 5.1, but I'm still seeing it - and I'm up to date as is my client. Of
course, I seldom believe anything MSoft says.

attached mail follows:


Beauford wrote:
> After my last email I searched around some more and found the following.
>
> /Q: gd keeps saying it can't find png or jpeg support. I did install
> libpng and libjpeg. What am I missing?/
> /A: Be sure to do "make install-headers" for libpng and "make
> install-lib" for libjpeg, in addition to "make install."/
>
> This is basically what you were saying, but as I said these header files
> do not exist on their own (for Slackware anyways) and just by chance I
> came across the above, but in any event it still doesn't work. It might
> be nice though if somewhere in the instructions it says, hey, you might
> need to do this.
>
> Then I found this when searching on the jpeg errors I keep getting.
>
> /This error occures becuase the linker (ld) cannot find the jpeg library./
> /You can fix this problem by editing the config.nice file inside the php4/
> /directory and adding /
> /LDFLAGS='-L/path/to/lib' \ /
> /above the ./configure \ /
>
> /For example is your libjpeg.so resides inside /usr/local/lib, you'd add/
> /-L/usr/local./
>
> /Once you've edited the file, remove config.cache and run ./config.nice,/
> /after that make; make install; should work./
>
> Since my/// libjpeg.so / is in /usr/lib I put/// LDFLAGS='-L/user' \/ -
> I still get the same error. If I compile without the jpeg it works like
> a charm - so I recompiled libjpeg thinking it may have gotten screwed
> up, but same errors.
>
> So the question is, why can't it find these files?
>
> Any ideas on what else I can do. I'm assuming that other people have
> this working on Slackware, if so, how did they do it? I posted to that
> forum as well and didn't get one answer.

Please always CC the list - you'll get more (and faster) help.

As David suggested, try adding this:

--with-jpeg-dir=/usr --with-png-dir=/usr

to the php configure command.

If that doesn't work, where is the jpeglib.h file?

Mine is in the /usr/include folder, so I use /usr for the
--with-jpeg-dir parameter.

If that file doesn't exist anywhere on your system, you haven't got the
headers installed for libjpeg.

--
Postgresql & php tutorials
http://www.designmagick.com/

attached mail follows:


Hi all,

  I have 2 php page , whenever i click the submit in 1st page , the
  $_SESSION['LIST_OF_DATA'] display nothing in the 2nd page.

  If i do echo print_r($_SESSION['LIST_OF_DATA']) in first page , it
displayed the data correctly.

Anybody have any ideas why php session behaviour is like that ?

Thanks - weetat

    below is the 1st page :

    <?php

        session_start();
        $arrayoffiles = listoffiles();

        $params = array(
                      'mode' => 'Jumping',
                     'itemData' => $arrayoffiles,
                 'perPage' => 10,
                         'delta' => 8,
                  'append' => true,
                      'clearIfVoid' => true,
                      'useSessions' => true,
                       'closeSession' => true,
        );

        $pager = & Pager::factory($params);
        $data = $pager->getPageData();
        $links = $pager->getLinks();
        $_SESSION['LIST_OF_DATA'] = $data;

    ?>

    below is second page :

     <?php

         session_start();

         echo print_r($_SESSION['LIST_OF_DATA']);

     ?>