php-general Digest 28 Oct 2006 10:05:49 -0000 Issue 4426
Topics (messages 243769 through 243786):
Re: [funny] The state of Java Development
243769 by: Ashley M. Kirchner
243771 by: Daevid Vincent
243774 by: Miles Thompson
How do I get ini_set('output_handler', '') to work?!
243770 by: Daevid Vincent
243779 by: Tom Atkinson
Non-blocking sockets
243772 by: Eric
243776 by: Stut
243780 by: Eric
243781 by: Jochem Maas
243783 by: Rasmus Lerdorf
Re: DATETIME or UNIX TIMESTAMPS?
243773 by: Børge Holen
Re: counting records in db
243775 by: Børge Holen
Is there such a thing?
243777 by: Integz
243778 by: Tom Atkinson
Re: <OPTION
243782 by: Robert Cummings
Upload not finding directory to write to.
243784 by: Dave M G
243785 by: Robert Cummings
Re: Shopping Cart
243786 by: CK
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 ---
Daevid Vincent wrote:
"The state of Java Development"
A friend snapped this picture at the Barnes & Noble in Woodinville, WA...
Nice and ... blank.
--
W | It's not a bug - it's an undocumented feature.
+--------------------------------------------------------------------
Ashley M. Kirchner <mailto:[EMAIL PROTECTED]> . 303.442.6410 x130
IT Director / SysAdmin / Websmith . 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 ---
UGH!!!! This stupid list server stripped out the inline image. WTF!?
Here, I put it on my site http://daevid.com/junk/Java_Dev.jpg
DÆVID
________________________________
From: Daevid Vincent [mailto:[EMAIL PROTECTED]
Sent: Friday, October 27, 2006 1:58 PM
To: [email protected]
Subject: [PHP] [funny] The state of Java Development
"The state of Java Development"
A friend snapped this picture at the Barnes & Noble in Woodinville,
WA...
--- End Message ---
--- Begin Message ---
At 06:04 PM 10/27/2006, you wrote:
UGH!!!! This stupid list server stripped out the inline image. WTF!?
Here, I put it on my site http://daevid.com/junk/Java_Dev.jpg
DÆVID
They have the same staff trainer as Chapters / Indigo has in Canada.
Chapters also threw out 1/4 of the books and replaced them with "seasonal
items" - candles, scents, notepaper - you know, that ssort of stuff.
Cheers - Miles
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.14/501 - Release Date: 10/26/2006
--- End Message ---
--- Begin Message ---
What am I doing wrong...
In my php.ini I have this for my web pages (and I want it):
output_handler = ob_gzhandler
But this causes my command line script to not show output until the very
end.
I thought I could disable it at the top of a script, but it's not working!?!
#!/usr/bin/php -q
<?php
ini_set('output_handler', 'mb_output_handler');
system('php -i | grep output_handler');
?>
[EMAIL PROTECTED] ./myscript.php
output_handler => ob_gzhandler => ob_gzhandler
zlib.output_handler => no value => no value
If I comment out the line in the php.ini file, then things work great (and
what exactly is the output_handler being used if I don't specify one? It
just says
output_handler => no value => no value
I tried to put this in my script too but it doesn't make any difference:
ini_set('output_handler', '');
or
ini_set('output_handler', null);
[EMAIL PROTECTED] ./myscript.php
output_handler => ob_gzhandler => ob_gzhandler
zlib.output_handler => no value => no value
UGH!
--- End Message ---
--- Begin Message ---
You can't test it like that. When you use system('php') you invoke a new
instance of php that has the default values. You are apparently already
familiar with ini_set() so why not use ini_get() to test if your code works?
Daevid Vincent wrote:
What am I doing wrong...
In my php.ini I have this for my web pages (and I want it):
output_handler = ob_gzhandler
But this causes my command line script to not show output until the very
end.
I thought I could disable it at the top of a script, but it's not working!?!
#!/usr/bin/php -q
<?php
ini_set('output_handler', 'mb_output_handler');
system('php -i | grep output_handler');
?>
[EMAIL PROTECTED] ./myscript.php
output_handler => ob_gzhandler => ob_gzhandler
zlib.output_handler => no value => no value
If I comment out the line in the php.ini file, then things work great (and
what exactly is the output_handler being used if I don't specify one? It
just says
output_handler => no value => no value
I tried to put this in my script too but it doesn't make any difference:
ini_set('output_handler', '');
or
ini_set('output_handler', null);
[EMAIL PROTECTED] ./myscript.php
output_handler => ob_gzhandler => ob_gzhandler
zlib.output_handler => no value => no value
UGH!
--- End Message ---
--- Begin Message ---
When I create a socket/stream that connects to a news sever and try to
recv data from the socket when there is nothing there (Like if the
server sends one line and I call recv twice) the socket freezes. I
assume this is because using socket_create or fsockopen creates a
blocking TCP/Stream socket by default. When I call socket_set_nonblock()
and the socket_connect I get "A non-blocking operation could not be
completed immediately". Could someone show me exactly how to create a
non-blocking TCP/Stream socket? Thanks in advance.
--- End Message ---
--- Begin Message ---
Eric wrote:
When I create a socket/stream that connects to a news sever and try to
recv data from the socket when there is nothing there (Like if the
server sends one line and I call recv twice) the socket freezes. I
assume this is because using socket_create or fsockopen creates a
blocking TCP/Stream socket by default. When I call socket_set_nonblock()
and the socket_connect I get "A non-blocking operation could not be
completed immediately". Could someone show me exactly how to create a
non-blocking TCP/Stream socket? Thanks in advance.
I may be wrong but I think you need to set the socket non-blocking after
the connect. You cannot do a non-blocking connect.
-Stut
--- End Message ---
--- Begin Message ---
Stut wrote:
Eric wrote:
When I create a socket/stream that connects to a news sever and try to
recv data from the socket when there is nothing there (Like if the
server sends one line and I call recv twice) the socket freezes. I
assume this is because using socket_create or fsockopen creates a
blocking TCP/Stream socket by default. When I call
socket_set_nonblock() and the socket_connect I get "A non-blocking
operation could not be completed immediately". Could someone show me
exactly how to create a non-blocking TCP/Stream socket? Thanks in
advance.
I may be wrong but I think you need to set the socket non-blocking after
the connect. You cannot do a non-blocking connect.
-Stut
Then the socket recv doesnt work. Gives me "Unable read from socket".
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket,"news.csh.rit.edu",119);
socket_set_nonblock($socket);
socket_recv($socket,$buf,1024,0);
echo $buf;
--- End Message ---
--- Begin Message ---
Eric wrote:
> Stut wrote:
>> Eric wrote:
>>> When I create a socket/stream that connects to a news sever and try
>>> to recv data from the socket when there is nothing there (Like if the
>>> server sends one line and I call recv twice) the socket freezes. I
>>> assume this is because using socket_create or fsockopen creates a
>>> blocking TCP/Stream socket by default. When I call
>>> socket_set_nonblock() and the socket_connect I get "A non-blocking
>>> operation could not be completed immediately". Could someone show me
>>> exactly how to create a non-blocking TCP/Stream socket? Thanks in
>>> advance.
>>
>> I may be wrong but I think you need to set the socket non-blocking
>> after the connect. You cannot do a non-blocking connect.
>>
>> -Stut
> Then the socket recv doesnt work. Gives me "Unable read from socket".
>
> $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
> socket_connect($socket,"news.csh.rit.edu",119);
> socket_set_nonblock($socket);
> socket_recv($socket,$buf,1024,0);
> echo $buf;
I *think* you need to be looking here:
http://php.net/manual/en/function.socket-select.php
>
--- End Message ---
--- Begin Message ---
Jochem Maas wrote:
> Eric wrote:
>> Stut wrote:
>>> Eric wrote:
>>>> When I create a socket/stream that connects to a news sever and try
>>>> to recv data from the socket when there is nothing there (Like if the
>>>> server sends one line and I call recv twice) the socket freezes. I
>>>> assume this is because using socket_create or fsockopen creates a
>>>> blocking TCP/Stream socket by default. When I call
>>>> socket_set_nonblock() and the socket_connect I get "A non-blocking
>>>> operation could not be completed immediately". Could someone show me
>>>> exactly how to create a non-blocking TCP/Stream socket? Thanks in
>>>> advance.
>>> I may be wrong but I think you need to set the socket non-blocking
>>> after the connect. You cannot do a non-blocking connect.
>>>
>>> -Stut
>> Then the socket recv doesnt work. Gives me "Unable read from socket".
>>
>> $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
>> socket_connect($socket,"news.csh.rit.edu",119);
>> socket_set_nonblock($socket);
>> socket_recv($socket,$buf,1024,0);
>> echo $buf;
>
> I *think* you need to be looking here:
>
> http://php.net/manual/en/function.socket-select.php
I would actually suggest going a bit higher level and using
stream_socket_client() instead. Using a stream is much more flexible.
See the manual page for the function for some examples.
-Rasmus
--- End Message ---
--- Begin Message ---
I've completely switched.
The support for datetime and also timestamp in mysql is amazing...
Writing usable applications witch depend on date functions and also
applications witch just shows the time is much easier, instead of reading
throught all the freakin' manuals to do small operations and writing line
upon line with deprecated??? code, no not exactly , but you catch my drift.
On Thursday 26 October 2006 22:40, João Cândido de Souza Neto wrote:
> I use always unix timestamp as well, except in birth date.
>
> ""Marcelo de Moraes Serpa"" <[EMAIL PROTECTED]> escreveu na mensagem
> news:[EMAIL PROTECTED]
>
> > Hello list,
> >
> > I've always used Unix Timestamps until now, but lately I've reading about
> > MySQL's datetime datatype and its benefits (dates before 1970, after
> > 2030, SQL functions to deal with them, etc). However, I don't see much
> > support for
> > them in the PHP API. I'm also a Flash programmer and the Flash 8 API Date
> > datatype also only understands unix timestamps. Taking this into account,
> > I'm not really sure if it really worths it to "move" to the DATETIME
> > datatype. What would you do? Any advice would be much appreciated!
> >
> > Marcelo.
--
---
Børge
Kennel Arivene
http://www.arivene.net
---
--- End Message ---
--- Begin Message ---
On Friday 27 October 2006 19:34, Richard Lynch wrote:
> Your idea to use 'COUNT(Username)' is just about the ONLY part of that
> script that you are doing correctly...
>
> :-)
>
> Start reading here:
> http://phpsec.org/
>
> And the header("Location: ...") requires a full URL.
No it doesn't. but he's missing an ' at first glance
>
> And you should have better error-checking, probably.
> [Though maybe you have a custom error handler not apparent]
>
> And your DB password should probably be a hash/crypted value.
>
> And it looks like maybe you are using register_globals "on" which is bad.
>
> Once again, start reading:
> http://phpsec.org/
>
> On Thu, October 26, 2006 1:16 pm, [EMAIL PROTECTED] wrote:
> > Would it be ok to use the same code to check if customer is loged in?
> >
> > $query = mysql_query("
> > SELECT COUNT(Username) as NoOfRecords
> > FROM customers
> > WHERE Username = '$Username' AND Password =
> > '$Password'");
> > if (mysql_result($query, 0) == 0)
> > {
> > echo 'Please try again';
> > }
> > else
> > {
> > header('location: index.php);
> > exit;
> > }
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some starving artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
--
---
Børge
Kennel Arivene
http://www.arivene.net
---
--- End Message ---
--- Begin Message ---
http://www.evilbitz.com/2006/10/27/local-php-standalone-binaries-2/
--- End Message ---
--- Begin Message ---
http://gtk.php.net/
Integz wrote:
http://www.evilbitz.com/2006/10/27/local-php-standalone-binaries-2/
--- End Message ---
--- Begin Message ---
On Fri, 2006-10-27 at 13:51 +0200, Jochem Maas wrote:
>
> >>>> range(1, 31)
> >>> Memory waster ;)
> >> any idea as to what the damage is as compared to the classic for loop?
> >
> > Given that a variable probably costs X and that any variable cane be
> > stored as Y in an array, and an array would cost Z where the Z = X * Y _
> > 1 (Y element + 1 for the array container itself).
> >
> > Then the range format would cost 31 + 1 (the array itself + 31 entries)
> > whereas the for loop would cost 1 + 1 (cost to store i + cost to store
> > endpoint comparison. Thus the damage is about 15*. Given general
> > computer science consideration, this is a constant and thus practically
> > neglible.
> >
> > Cheers
> > Rob (ps. the above may be completely incoherent since I'm completely
> > drunk atm after celebrating two friends birthdays tonight).
>
> not a bad explainantion then ;-) it's only the last bit I didn't quite follow
> :-)
*heheh* It makes sense to me, though my head still hurts from last
night :)
Which part exactly did you not quite follow?
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. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
PHP List,
I had a file upload script which was working fine. Then, because of
other needs, I changed my local Apache settings so that my local web
site directory structure behaved the same as they do on my web hosting
service.
What I mean by that is that before, I would access my local web sites by
going to their directories within the localhost (/var/www) directory:
localhost/web_sites/web_site_one/index.php
Now I just go to:
web_site_one/
If i create a link that says <a href="/">link</a>, it goes to the root
of the web site, where the index.php is.
Within that root directory, I have a directory called "image", where I'm
trying to put my uploaded image files.
The destination file location should then be "/image/", shouldn't it?
My code looks like this:
$fileLocation = "/image/" . $_POST['name'];
if(move_uploaded_file($_FILES['file']['tmp_name'], $fileLocation))
{
chmod ($fileLocation, 0777);
}
$_POST['name'] is a name for the file that the user has entered.
But this now gives me an error that it can't open a stream to the
destination.
I also checked to make sure that the "image" directory has fully open
permissions, and it's currently set to "drwxrwxrwx", or "0777".
Am I missing some fundamental issue with directory structures on an
Apache server?
--
Dave M G
Ubuntu 6.06 LTS
Kernel 2.6.17.7
Pentium D Dual Core Processor
PHP 5, MySQL 5, Apache 2
--- End Message ---
--- Begin Message ---
On Sat, 2006-10-28 at 14:49 +0900, Dave M G wrote:
> PHP List,
>
> I had a file upload script which was working fine. Then, because of
> other needs, I changed my local Apache settings so that my local web
> site directory structure behaved the same as they do on my web hosting
> service.
>
> What I mean by that is that before, I would access my local web sites by
> going to their directories within the localhost (/var/www) directory:
>
> localhost/web_sites/web_site_one/index.php
>
> Now I just go to:
>
> web_site_one/
>
> If i create a link that says <a href="/">link</a>, it goes to the root
> of the web site, where the index.php is.
>
> Within that root directory, I have a directory called "image", where I'm
> trying to put my uploaded image files.
>
> The destination file location should then be "/image/", shouldn't it?
>
> My code looks like this:
>
> $fileLocation = "/image/" . $_POST['name'];
> if(move_uploaded_file($_FILES['file']['tmp_name'], $fileLocation))
> {
> chmod ($fileLocation, 0777);
> }
>
> $_POST['name'] is a name for the file that the user has entered.
>
> But this now gives me an error that it can't open a stream to the
> destination.
>
> I also checked to make sure that the "image" directory has fully open
> permissions, and it's currently set to "drwxrwxrwx", or "0777".
>
> Am I missing some fundamental issue with directory structures on an
> Apache server?
Shouldn't you have something closer to:
<?php
$fileLocation = '/var/www/web_site_one/image/'.$_POST['name'];
?>
Because your trying to access a filesystem path and not a web path. More
generically if you want:
<?php
$myPath = ereg_replace( '/.*$', '', __FILE__ );
$fileLocation = $myPath.'/image/'.$_POST['name'];
?>
That still presumes a script in the site's root directory.
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. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Hi,
Yes, I have and thought I was seeking the assistance of knowledgeable
colleagues . The solution researched does not offer the desired
features. I was not asking for code, but perhaps some solutions/
applications to explore.
CK
PS
I don't appreciate being scolded.
On Oct 27, 2006, at 3:07 AM, Chris wrote:
CK wrote:
Hi,
A client has requested a cart with the following features, any
leads on such a package, preferably open-source?
Have you done any research at all? We're not going to do your work
for you..
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Oct 27, 2006, at 3:07 AM, Chris wrote:
CK wrote:
Hi,
A client has requested a cart with the following features, any
leads on such a package, preferably open-source?
Have you done any research at all? We're not going to do your work
for you..
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---