|
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-help
lists.php.net
Date: Tue Feb 26 2008 - 05:02:50 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 26 Feb 2008 11:02:50 -0000 Issue 5315
Topics (messages 270129 through 270142):
Re: temprorary error
270129 by: Matty Sarro
270131 by: Warren Vail
270135 by: tedd
session id
270130 by: Åukasz Wojciechowski
270132 by: Daniel Brown
Re: When to use design patterns?
270133 by: tedd
270134 by: tedd
270140 by: Wolf
Re: Deleting all rows in a database every 24 hours?
270136 by: Daevid Vincent
Re: Mysql vs. Mysqli crash handling
270137 by: Larry Garfield
PHP cuts download process prematurely
270138 by: Manuel Barros Reyes
270139 by: Shawn McKenzie
270141 by: Andrés Robinet
Re: insert text with no specific format into database table
270142 by: jeffry s
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
So, if God begat Rasmus, and Rasmus begat PHP... that means PHP is like a
gift from God right? Kinda like the Transformers? And microwave burritos?
On Mon, Feb 25, 2008 at 3:09 PM, Wolf <lonewolf
nc.rr.com> wrote:
>
> ---- tedd <tedd.sperling
gmail.com> wrote:
> > At 11:18 AM -0500 2/25/08, Daniel Brown wrote:
> > > I didn't think Quakers could use computers. Or electricity.
> > >
> > >--
> > ></Dan>
> >
> >
> > No, that's the Amish.
> >
> > Quakers are the one's who make cereal.
> >
> Except for Joseph who run the underground power cable through the field
> one day and has the computer which hides in the hidden chamber behind the
> roll-top desk that is activated via a hidden release/tumbler system.
>
> There are definitely days when the power being missing are fun though...
> ;)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
That sound like the lineage to me. (Don't you hear the voices?)
Warren Vail
> -----Original Message-----
> From: Matty Sarro [mailto:msarro
gmail.com]
> Sent: Monday, February 25, 2008 2:50 PM
> To: Wolf
> Cc: tedd; php-general
lists.php.net
> Subject: Re: [PHP] RE: temprorary error
>
> So, if God begat Rasmus, and Rasmus begat PHP... that means PHP is like a
> gift from God right? Kinda like the Transformers? And microwave burritos?
>
> On Mon, Feb 25, 2008 at 3:09 PM, Wolf <lonewolf
nc.rr.com> wrote:
>
> >
> > ---- tedd <tedd.sperling
gmail.com> wrote:
> > > At 11:18 AM -0500 2/25/08, Daniel Brown wrote:
> > > > I didn't think Quakers could use computers. Or electricity.
> > > >
> > > >--
> > > ></Dan>
> > >
> > >
> > > No, that's the Amish.
> > >
> > > Quakers are the one's who make cereal.
> > >
> > Except for Joseph who run the underground power cable through the field
> > one day and has the computer which hides in the hidden chamber behind
> the
> > roll-top desk that is activated via a hidden release/tumbler system.
> >
> > There are definitely days when the power being missing are fun though...
> > ;)
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
attached mail follows:
At 5:49 PM -0500 2/25/08, Matty Sarro wrote:
>So, if God begat Rasmus, and Rasmus begat PHP... that means PHP is
>like a gift from God right? Kinda like the Transformers? And
>microwave burritos?
I'm glad that someone get's it. :-)
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
attached mail follows:
Hi, I'm using SWFUpload JavaScript for my upload in my logged part of
website. I'm passing session_id in every post request from flash
object. In my script I set forwarded id with
session_id($_POST['passed_id']) but I got logout on that request (it's
redirecting me to login page) and I'm also logged out in my browser
(not flash). Then I need to relog. Everything is working fine when I'm
not touching session_id() id setting. Any clues?
--
Åukasz Wojciechowski
attached mail follows:
On Mon, Feb 25, 2008 at 5:51 PM, £ukasz Wojciechowski
<nostrzak
gmail.com> wrote:
> Hi, I'm using SWFUpload JavaScript for my upload in my logged part of
> website. I'm passing session_id in every post request from flash
> object. In my script I set forwarded id with
> session_id($_POST['passed_id']) but I got logout on that request (it's
> redirecting me to login page) and I'm also logged out in my browser
> (not flash). Then I need to relog. Everything is working fine when I'm
> not touching session_id() id setting. Any clues?
Try this instead:
<?
session_start();
$_SESSION['passed_id'] = $_POST['passed_id']; // Sets the server-side
session variable
$_COOKIE['PHPSESSID'] = $_POST['passed_id']; // Names the session
whatever data was POST'ed
?>
As always, BE SURE TO SANITIZE YOUR CODE!
--
</Dan>
Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>
attached mail follows:
At 4:27 PM -0500 2/25/08, Jason Pruim wrote:
>On Feb 25, 2008, at 4:18 PM, tedd wrote:
>>I do everything from basic design to back-end stuff and everything
>>in between -- all with the newest buzz-words applied (i.e.,
>>graceful degradation, unobtrusive code, accessible, functional,
>>secure, and it validates).
>Can you do web 2.0? Because it just HAS to be web 2.0... anything
>else is soooooooo last version.... :)
No, I'm already doing Web 3.0.
In this biz, you have to stay ahead of the game.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
attached mail follows:
At 9:58 PM +0000 2/25/08, Stut wrote:
>>
>
>Not disagreeing with you, but just to be clear Joomla is a fork of Mambo.
>
>-Stut
Oh, I thought everyone was talking about dances and all along it's
been silverware.
Damn, I'm never going to get this design pattern thing. :-)
Cheers,
tedd
--
------
http://sperling.com http://ancientstones.com http://earthstones.com
attached mail follows:
It depends on the size and scope of your project. For the most part, you should know what you have coded before and when encountering something new, the previous work should help in doing the new work.
Hth
Wolf
-----Original Message-----
From: skylark <myphplist
gmail.com>
Sent: Saturday, February 23, 2008 5:16 AM
To: PHP General List <php-general
lists.php.net>
Subject: [PHP] When to use design patterns?
Hi all,
Design patterns are really hot today.
And I am really interested when and how often they are used.
It is said that 99% of the projects don't need them.
Any opinion appreciated.
Regards,
Shelley
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Or make a 'truncate.sql' file with the tables in it to truncate:
TRUNCATE TABLE foo;
TRUNCATE TABLE bar;
Then in the crontab "mysql mydatabase < truncate.sql"
No PHP needed.
> -----Original Message-----
> From: Daniel Brown [mailto:parasane
gmail.com]
> Sent: Friday, February 22, 2008 6:59 AM
> To: Zoran Bogdanov
> Cc: php-general
lists.php.net
> Subject: Re: [PHP] Deleting all rows in a database every 24 hours?
>
> On Fri, Feb 22, 2008 at 1:28 AM, Zoran Bogdanov
> <test1.test1
hi.t-com.hr> wrote:
> > The title says it all, how do I perform an action every 24 hours?
>
> Another question better answered on Google.
>
> PHP Script:
> <?
> $sql = "TRUNCATE TABLE `tablename`";
> mysql_query($sql);
> ?>
>
> Crontab Entry:
> 40 3 * * * `which php` /path/to/your/script.php
>
> That will run every morning at 3:40a server time with the
> path-preferred PHP. If you're on Windows, look up Scheduled Tasks.
>
> --
> </Dan>
>
> Daniel P. Brown
> Senior Unix Geek
> <? while(1) { $me = $mind--; sleep(86400); } ?>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
On Monday 25 February 2008, Daniel Brown wrote:
> On Mon, Feb 25, 2008 at 3:07 PM, Larry Garfield <larry
garfieldtech.com>
wrote:
> > Hi folks. I've an odd issue.
>
> Only fair. You're an odd bird, and we're an odd bunch. ;-P
>
> > If I connect to a MySQL DB using ext/mysql, and for whatever reason the
> > process dies (uncaught exception, fatal error, etc.) the connection is
> > garbage collected and closed. If, however, I use ext/mysqli, the
> > connection remains open forever and just eats up resources, eventually
> > resulting in hitting the connection limit. Same app, same database, same
> > server.
>
> What version of PHP and MySQL (client extension and server) are you
> using?
Yeah, I should have mentioned that...
PHP 5.1.6, MySQL 5.0.48 (client and server I think; I'm not the sysadmin).
> What do your mysqli_query() command and SQL query string look like?
I'll have to ask our sysadmin for the test scripts he ran. (We're running the
site on Drupal, which can handle either, but has a lot of DB abstraction
involved. He tested it sans-Drupal, but I am not sure what his scripts
were.)
> > Any idea why mysqli behaves that way, and how to make it clean up
> > properly? (Yes I should of course try to avoid fatals in the first
> > place, but when they do happen I don't want them to bring the whole
> > server to its knees.)
>
> I may not be able to help you, since I've only recently started
> switching myself over to mysqli (I know, as always I'm late to adopt),
> but with more information, maybe someone like Richard Lynch can come
> in and work a miracle.
Hi Rich! :-)
--
Larry Garfield AIM: LOLG42
larry
garfieldtech.com ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson
attached mail follows:
I am building a report application that generates some text files for
download and when the download starts it stops prematurely.
The file sizes are currently in the order of the mega bytes and when I
try the script that generates and sends the file in a test server the
process goes smoothly no matter the size of the file but as soon as I
move the script to the production server dowloads cut at 300kb aprox.
My current workarround is to gzip the files and that is giving me some
extra time but the files are growing and sooner or later my
workarround will become useless.
I guess the download is stoped by some timeout and not because of the
amount of kb downloaded because the size varies slightly. If that
timeout exists it should be of apox. 5-10 seconds.
I use this function to perform the upload $contenido is the content of
the file and to that variable I assign the big chunk of output from
the report, $nombre_archivo is the optional name for the file. I can
paste more code but I think the problem is here.
<?php
function enviarArchivo($contenido, $nombre_archivo = "") {
if($nombre_archivo == "") {
$nombre_archivo = date("dmyHi").".csv";
}
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$nombre_archivo");
header("Content-Length: ".strlen($contenido));
echo $contenido;
}
?>
Thanks in advance
Manuel
attached mail follows:
Manuel Barros Reyes wrote:
> I am building a report application that generates some text files for
> download and when the download starts it stops prematurely.
>
> The file sizes are currently in the order of the mega bytes and when I
> try the script that generates and sends the file in a test server the
> process goes smoothly no matter the size of the file but as soon as I
> move the script to the production server dowloads cut at 300kb aprox.
> My current workarround is to gzip the files and that is giving me some
> extra time but the files are growing and sooner or later my
> workarround will become useless.
>
> I guess the download is stoped by some timeout and not because of the
> amount of kb downloaded because the size varies slightly. If that
> timeout exists it should be of apox. 5-10 seconds.
>
> I use this function to perform the upload $contenido is the content of
> the file and to that variable I assign the big chunk of output from
> the report, $nombre_archivo is the optional name for the file. I can
> paste more code but I think the problem is here.
>
> <?php
> function enviarArchivo($contenido, $nombre_archivo = "") {
>
>
>
> if($nombre_archivo == "") {
>
> $nombre_archivo = date("dmyHi").".csv";
>
> }
>
>
>
> header("Content-Type: application/octet-stream");
>
> header("Content-Disposition: attachment; filename=$nombre_archivo");
>
> header("Content-Length: ".strlen($contenido));
>
> echo $contenido;
>
> }
>
> ?>
>
> Thanks in advance
> Manuel
What does your error log say when this happens?
-Shawn
attached mail follows:
> -----Original Message-----
> From: Shawn McKenzie [mailto:nospam
mckenzies.net]
> Sent: Monday, February 25, 2008 11:19 PM
> To: php-general
lists.php.net
> Subject: [PHP] Re: PHP cuts download process prematurely
>
> Manuel Barros Reyes wrote:
> > I am building a report application that generates some text files for
> > download and when the download starts it stops prematurely.
> >
> > The file sizes are currently in the order of the mega bytes and when I
> > try the script that generates and sends the file in a test server the
> > process goes smoothly no matter the size of the file but as soon as I
> > move the script to the production server dowloads cut at 300kb aprox.
> > My current workarround is to gzip the files and that is giving me some
> > extra time but the files are growing and sooner or later my
> > workarround will become useless.
> >
> > I guess the download is stoped by some timeout and not because of the
> > amount of kb downloaded because the size varies slightly. If that
> > timeout exists it should be of apox. 5-10 seconds.
> >
> > I use this function to perform the upload $contenido is the content of
> > the file and to that variable I assign the big chunk of output from
> > the report, $nombre_archivo is the optional name for the file. I can
> > paste more code but I think the problem is here.
> >
> > <?php
> > function enviarArchivo($contenido, $nombre_archivo = "") {
> >
> >
> >
> > if($nombre_archivo == "") {
> >
> > $nombre_archivo = date("dmyHi").".csv";
> >
> > }
> >
> >
> >
> > header("Content-Type: application/octet-stream");
> >
> > header("Content-Disposition: attachment; filename=$nombre_archivo");
> >
> > header("Content-Length: ".strlen($contenido));
> >
> > echo $contenido;
> >
> > }
> >
> > ?>
> >
> > Thanks in advance
> > Manuel
>
> What does your error log say when this happens?
>
> -Shawn
Though this is not likely to solve the problem, try adding the following two
lines at the beginning of the script (even before you query the database and do
all your logic)
ignore_user_abort(true);
set_time_limit(0);
If this solves the problem you should read this http://ar2.php.net/info and this
http://ar2.php.net/manual/es/function.ignore-user-abort.php carefully and then
choose more rational settings. PHP has a default execution time of 30s.
However, this is not likely to solve the problem as execution time should not be
affected by streaming and we are assuming the user/browser is not aborting the
connection. On the other hand you could support download resuming (it involves
some tricky headers and if you are willing to dig deeper into this read the
manual notes at http://ar.php.net/manual/es/function.header.php). But this won't
solve your problem... at least for IE as it doesn't support resuming :(.
You need the log files to know exactly what the problem is. And, even if you are
not solving this issue using compression as a workaround, you may also want to
add at the beginning of the script:
ob_start("ob_gzhandler")
Or... you can use "zlib.output_compression" INI setting in an .htaccess file or
in php.ini.
Compressed files will require more server processing but will download way
faster. ob_gzhandler and zlib compression are transparent to the end user, so
they will think they've got the uncompressed file, no need to gzip the files
programmatically.
Regards,
Rob
Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 |
Email: info
bestplace.net | MSN Chat: best
bestplace.net | SKYPE: bestplace |
Web: bestplace.biz | Web: seo-diy.com
attached mail follows:
thank you all.
it is a great help..
On Tue, Feb 26, 2008 at 1:15 AM, Shawn McKenzie <nospam
mckenzies.net>
wrote:
> Shawn McKenzie wrote:
> > jeffry s wrote:
> >> i have text file and a table created with
> >>
> >> create table word(
> >> id int not null auto_increment primary key,
> >> word varchar(50),
> >> definition text
> >> )
> >>
> >> the text contain list of words but not really in specific format
> >>
> >> word, some text definition
> >> word, some text definition, some text definition, etc
> >>
> >>
> >> i want to read the file line by line,
> >> take the first word before comma (,) and insert into the word column in
> the
> >> database
> >> whatever after follow the first comma(,) will be inserted into the
> >> definition column in the word table database.
> >>
> >> i am not sure how to read the file line by line in php.
> >> and how to separate the line of text into two. divided by the 1st
> comma (,)
> >> ..
> >> my idea is using the explode(',' $text) function. but this one will
> separate
> >> everything between a comma(,) into an array.
> >> i wan't to know if there is another better way to do it..
> >>
> >>
> >> any idea?
> >> thank you!
> >>
> >
> > Read about the file() function and also read about the explode()
> > function's limit parameter.
> >
> > -Shawn
> >
> >
> > if(($lines = file("file.txt"))) {
> > foreach($lines as $line) {
> > list($word, $definition) = explode($line, ',', 1);
> > //insert word and definition SQL stuff here
> > }
> > }
>
> Maybe I should read up on the limit parameter also :-0
>
> list($word, $definition) = explode($line, ',', 2);
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]