php-general Digest 17 Dec 2008 09:08:28 -0000 Issue 5850

Topics (messages 284682 through 284720):

Re: Secure uploads tutorial
        284682 by: Ashley Sheridan
        284714 by: Tim Starling
        284716 by: Tim Starling

Re: checking local file size
        284683 by: Bojan Tesanovic
        284703 by: John Pillion
        284704 by: Chris
        284705 by: John Pillion
        284706 by: Chris
        284718 by: John Pillion

Re: Create unique non-autoincrement key for 700,000 records?
        284684 by: support.trafficregenerator.com
        284707 by: Jochem Maas
        284711 by: Robert Cummings

runtime access to static variable
        284685 by: Jack Bates
        284686 by: ceo.l-i-e.com
        284687 by: Nathan Rixham
        284688 by: Nathan Rixham
        284702 by: Micah Gersten

Re: Good PHP book?
        284689 by: Robert Cummings
        284690 by: Jay Moore
        284691 by: Daniel Brown
        284692 by: Jay Moore
        284693 by: Daniel Brown
        284694 by: Ashley Sheridan
        284695 by: Robert Cummings
        284696 by: Robert Cummings
        284697 by: Daniel Brown
        284698 by: Ashley Sheridan
        284699 by: Robert Cummings
        284700 by: Daniel Brown
        284701 by: Ashley Sheridan
        284719 by: Lupus Michaelis

Phpmyadmin password
        284708 by: It flance
        284709 by: Micah Gersten
        284710 by: Chris

Can PHP be used to snatch images cross-domain?
        284712 by: Rob Gould
        284713 by: Robert Cummings
        284715 by: Rob Gould
        284717 by: Chris
        284720 by: Jan Ka¹tánek

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On Tue, 2008-12-16 at 16:02 +0000, Peter Ford wrote:
> tedd wrote:
> > I can't imagine evil code still working after someone resizes the file.
> > 
> 
> Yeah, but the uploaded OpenOffice Writer doc won't look too good either... :)
> 
> I prefer to move files to an off-line store, run them through a unix 'file'
> command (with a mime-type magic file) to get the mime-type, use that to decide
> whether or not to accept, and then serve them back to clients through a 
> script.
> As an optional step, on really paranoid systems, I run a virus scan over the
> upload (with clamav, usually).
> <troll>
> I'm not exactly sure what all the fuss is about protecting IE users from
> malicious code - if they care then they shouldn't be using IE, and if they 
> don't
> care they shouldn't be on the internet.
> </troll>
> Tim's efforts do seem to be a bit of overkill...
> 
> -- 
> Peter Ford                              phone: 01580 893333
> Developer                               fax:   01580 893399
> Justcroft International Ltd., Staplehurst, Kent
> 
Go one further; punish all IE users by infecting them...

Hmm, OK, so not my best or most serious suggestion maybe. I've relied on
having the OS report the file-type using the aforementioned file
command, and it seems to work OK. For really paranoid systems, I store
the file in a non web-accessible location and use  a binary safe fopen()
to stream the file to the user.


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
tedd wrote:
> At 11:45 PM +1100 12/16/08, Tim Starling wrote:
>> I thought the list might be interested in a tutorial for secure
>> web-based file uploads that I just wrote:
>>
>> http://tstarling.com/blog/2008/12/secure-web-uploads/
>>
>> -- Tim Starling
>
> Tim:
>
> That's a good read -- thanks -- but it's more of an article than a
> tutorial.
>
> In any event, instead of posting to your blog, I though starting a
> dialog here might serve the php community better. So here goes:
>
> In your blog you suggest looking for the magic number in image files
> and not using getimagesize(). So what about this approach?
>
> 1. Restrict the File-Type.
> 2. Pass the file through exif_read_data() and see if File-Type and
> MimeType match.
> 3. Resize the image.
>
> Do you see any security problems this?
>
> I can't imagine evil code still working after someone resizes the file.
>

That depends on whether the resize preserves metadata. ImageMagick's
-resize does. Internet Explorer will search the metadata looking for
HTML tags and other indications of file type, if it's in the first 255
bytes.

exif_read_data() only works for JPEG and TIFF, and IE is fairly secure
for JPEG, so it's not a problem if you restrict uploads to JPEG. But if
you extended your scheme to PNG, it's easy to imagine a vulnerability
being exposed for IE 6 clients.

The image data is another issue. Whether it's possible to construct an
image such that, when resized by a certain factor and then compressed by
a known algorithm, the resulting compressed stream contains given text,
is an open question. I suspect it is, but it probably won't be a
technique within reach of the average spammer until some security
researcher publishes a script.

-- Tim Starling

--- End Message ---
--- Begin Message ---
Peter Ford wrote:
> tedd wrote:
>   
>> I can't imagine evil code still working after someone resizes the file.
>>
>>     
>
> Yeah, but the uploaded OpenOffice Writer doc won't look too good either... :)
>
> I prefer to move files to an off-line store, run them through a unix 'file'
> command (with a mime-type magic file) to get the mime-type, use that to decide
> whether or not to accept, and then serve them back to clients through a 
> script.
> As an optional step, on really paranoid systems, I run a virus scan over the
> upload (with clamav, usually).

There are some file types, such as .png and .wav, where that approach is
not at all secure. The file command will tell you that the file is
image/png, but IE 6 will detect it as text/html and run scripts in it.

The ClamAV step is almost pointless. It does nothing to deter an
attacker who is targeting your site specifically.

-- Tim Starling

--- End Message ---
--- Begin Message --- Well you need to know the TMP file name that has been in progress of upload, it is usually at /tmp folder also you need to know the actual size of file uploading, there is an extension for PHP that will give you this info but you need to compile it , on my cars site for uploading images I am using this one

http://blog.liip.ch/archive/2006/09/28/upload-progress-meter- extension-for-php-5-2.html


On Dec 16, 2008, at 9:20 PM, John P wrote:

I know this isn't a php question (though I'm using PHP for the server
side... does that count?). I'm hoping though that some of you guys are just as experienced in ajax as you are PHP, because I can't find any good ajax
forums.

you can respond to me personally if needed, to keep it off the php list....

my question:

I know there are alot of ajax/php upload progress bars out there, but
they're either complicated, unreliable, or just generally don't fit my
needs. Thus, i'm making my own.

One problem I'm running into though, is how to check the local file size as
compared to the uploaded file size.

I can check and display the total uploaded size (ie, 437kb uploaded so
far...), but to get the percent, I have to know the total size - BEFORE it's fully uploaded. I would like to say "437kb of 932kb uploaded so far"... but how do I get the "932" from the local file? It doesn't do too much good to
say how much has been uploaded if they don't know how much is left...

I know it's possible (most other meters do this) - I just can't figure out
how.

any hints?

Thanks



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Bojan Tesanovic
http://classiccars.carster.us/






--- End Message ---
--- Begin Message ---

"Bojan Tesanovic" <btesano...@gmail.com> wrote in message
news:<c4dac606-7711-49cd-9e03-5cdd5627f...@gmail.com>...
> Well you need to know the TMP file name that has been in progress of  
> upload, it is usually at /tmp folder

I know how to get that...

> also you need to know the actual size of file uploading, there is an  
> extension for PHP that will give you this info
> but you need to compile it , on my cars site for uploading images I  
> am using this one
> 
> http://blog.liip.ch/archive/2006/09/28/upload-progress-meter- 
> extension-for-php-5-2.html
> 

I downloaded the uploadprogress zip from that site (their example looks like
it provides what I'm looking for). At the expense of sounding ignorant...
How do I add that extension to PHP?  I looked through the example code, and
I get the idea of what's happening, but I don't know how to add it to my
server (I use shared hosting, though I have shell access).  Does it need to
be built into a *.so or *.dll and added to the PHP.ini file?  If so, how do
I build it?

In short, what next?

Thanks



> 
> On Dec 16, 2008, at 9:20 PM, John P wrote:
> 
> > I know this isn't a php question (though I'm using PHP for the server
> > side... does that count?).  I'm hoping though that some of you guys  
> > are just
> > as experienced in ajax as you are PHP, because I can't find any  
> > good ajax
> > forums.
> >
> > you can respond to me personally if needed, to keep it off the php  
> > list....
> >
> > my question:
> >
> > I know there are alot of ajax/php upload progress bars out there, but
> > they're either complicated, unreliable, or just generally don't fit my
> > needs. Thus, i'm making my own.
> >
> > One problem I'm running into though, is how to check the local file  
> > size as
> > compared to the uploaded file size.
> >
> > I can check and display the total uploaded size (ie, 437kb uploaded so
> > far...), but to get the percent, I have to know the total size -  
> > BEFORE it's
> > fully uploaded.  I would like to say "437kb of 932kb uploaded so  
> > far"... but
> > how do I get the "932" from the local file? It doesn't do too much  
> > good to
> > say how much has been uploaded if they don't know how much is left...
> >
> > I know it's possible (most other meters do this) - I just can't  
> > figure out
> > how.
> >
> > any hints?
> >
> > Thanks
> >
> >
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> Bojan Tesanovic
> http://classiccars.carster.us/
> 
> 
> 
> 
> 
> 


--- End Message ---
--- Begin Message ---
John Pillion wrote:

"Bojan Tesanovic" <btesano...@gmail.com> wrote in message
news:<c4dac606-7711-49cd-9e03-5cdd5627f...@gmail.com>...
Well you need to know the TMP file name that has been in progress of upload, it is usually at /tmp folder

I know how to get that...

also you need to know the actual size of file uploading, there is an extension for PHP that will give you this info but you need to compile it , on my cars site for uploading images I am using this one

http://blog.liip.ch/archive/2006/09/28/upload-progress-meter- extension-for-php-5-2.html


I downloaded the uploadprogress zip from that site (their example looks like
it provides what I'm looking for). At the expense of sounding ignorant...
How do I add that extension to PHP?  I looked through the example code, and
I get the idea of what's happening, but I don't know how to add it to my
server (I use shared hosting, though I have shell access).  Does it need to
be built into a *.so or *.dll and added to the PHP.ini file?  If so, how do
I build it?

In short, what next?

http://pecl.php.net/package/uploadprogress

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


--- End Message ---
--- Begin Message ---
>> "Bojan Tesanovic" <btesano...@gmail.com>> wrote in message
>> news:<c4dac606-7711-49cd-9e03-5cdd5627f...@gmail.com>>...
>>> Well you need to know the TMP file name that has been in progress of  
>>> upload, it is usually at /tmp folder
>> 
>> I know how to get that...
>> 
>>> also you need to know the actual size of file uploading, there is an  
>>> extension for PHP that will give you this info
>>> but you need to compile it , on my cars site for uploading images I  
>>> am using this one
>>>
>>> http://blog.liip.ch/archive/2006/09/28/upload-progress-meter- 
>>> extension-for-php-5-2.html
>>>
>> 
>> I downloaded the uploadprogress zip from that site (their example looks
like
>> it provides what I'm looking for). At the expense of sounding ignorant...
>> How do I add that extension to PHP?  I looked through the example code,
and
>> I get the idea of what's happening, but I don't know how to add it to my
>> server (I use shared hosting, though I have shell access).  Does it need
to
>> be built into a *.so or *.dll and added to the PHP.ini file?  If so, how
do
>> I build it?
>> 
>> In short, what next?
>
> http://pecl.php.net/package/uploadprogress

I already downloaded that, thanks.  How do I apply it is my question.
There's no documentation for the installation of it, that I see....




--- End Message ---
--- Begin Message ---

In short, what next?
http://pecl.php.net/package/uploadprogress

I already downloaded that, thanks.  How do I apply it is my question.
There's no documentation for the installation of it, that I see....

'Course it is :)

http://www.php.net/manual/en/install.pecl.php

Linked from here: http://pecl.php.net/doc/index.php

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


--- End Message ---
--- Begin Message ---
> > I already downloaded that, thanks.  How do I apply it is my question.
> > There's no documentation for the installation of it, that I see....
> 
> 'Course it is :)
> 
> http://www.php.net/manual/en/install.pecl.php
> 
> Linked from here: http://pecl.php.net/doc/index.php
> 

I tried installing it like the documentation said... but I got the following
errors. I contacted the hosting service (dreamhost) and they said they don't
provide support for pecl, though they do support perl.  Anyone?

------

$ pecl install uploadprogress

Failed to download pecl/uploadprogress within preferred state "stable",
latest release is version 0.9.1, stability "beta", use
"channel://pecl.php.net/uploadprogress-0.9.1" to install Cannot initialize
'uploadprogress', invalid or missing package file Package "uploadprogress"
is not valid install failed



$ pecl install uploadprogress-beta

Cannot install, php_dir for channel "pecl.php.net" is not writeable by the
current user
.com/


--- End Message ---
--- Begin Message ---
On Monday, December 15, 2008 7:29 PM, gould...@mac.com wrote:

I have a mySQL database with 700,000 records in it, which are presently keyed with an "auto-increment" field.

What I'd like to do is create another field with a field where each and every record number has a unique keyvalue. Example: "su5e23vlskd" for records 1, and "34fdfdsglkdj4" for record 2. All that matters is that it's unique, and isn't a number that can be guessed or an "autoincrement" number, where a hacker can just figure out the keyvalue by incrementing numbers. It doesn't matter to me if each keyvalue field is just numbers, or a number/letter combination - - - all that matters is that each keyvalue field is unique. Is there an automatic way that mySQL could do that, or would I need to write a php script to somehow go through each record and create this unique value?


Here is my answer to your question.
You can use this same logic to create unique id's for many things.
Hope this comes out okay in an email, if not I also put it online here:
http://www.bigdoghost.com/downloads/php-284646.html

<?php

error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
ini_set('display_startup_errors','1');
ini_set('display_errors','1');


function dec2base($dec)
{
$digits = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
$value = "";
$base  = strlen($digits);
while($dec>$base-1)
{
 $rest = $dec % $base;
 $dec  = $dec / $base;
 $value = $digits[$rest].$value;
}

$value = $digits[intval($dec)].$value;
return (string) $value;
}

/*
// Step 1) define database connection

define('DB_HOST', 'localhost'); // Change this to the proper DB Host name
define('DB_USERNAME', 'myusername');  // Change this to the proper DB User
define('DB_PASSWD', 'mypassword'); // Change this to the proper DB User password
define('DB_NAME', 'mydatabase');  // Change this to the proper DB Name

@mysql_connect(DB_HOST, DB_USERNAME, DB_PASSWD) or die("Error: Database connection information is incorrect"); @mysql_select_db(DB_NAME) or die("Error: Database connection information is incorrect");

*/

/*
// Step 2) create test schema

CREATE TABLE IF NOT EXISTS `test` (
 `id` int(11) NOT NULL auto_increment,
 `mykey` varchar(20) NOT NULL,
 PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

*/


/*
// Step 3) create 700,000 records

for ($i=1; $i <= 700000; $i++)
{
@mysql_query("INSERT INTO test VALUES ('', '')");
}

*/

/*
// Step 4) update 700,000 records


// The larger this number is detrmines the size of "mykey"
$int = 1000000;

$result = @mysql_query("SELECT id FROM test ORDER BY id ASC");

if (@mysql_num_rows($result) > 0)
{
while ($row = @mysql_fetch_object($result))
{
 // Add the two numbers together and base it
 $mykey = dec2base($int+$row->id);
@mysql_query("UPDATE test SET mykey='".$mykey."' WHERE id='".$row->id."'");
}
}

*/

?>
--- End Message ---
--- Begin Message ---
supp...@trafficregenerator.com schreef:
>> On Monday, December 15, 2008 7:29 PM, gould...@mac.com wrote:
>>

...

> <?php
> 
> error_reporting(E_ALL);
> ini_set('error_reporting', E_ALL);
> ini_set('display_startup_errors','1');
> ini_set('display_errors','1');
> 
> 
> function dec2base($dec)
> {
> $digits = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
> $value = "";
> $base  = strlen($digits);
> while($dec>$base-1)
> {
>  $rest = $dec % $base;
>  $dec  = $dec / $base;
>  $value = $digits[$rest].$value;
> }
> 
> $value = $digits[intval($dec)].$value;
> return (string) $value;
> }
> 
> /*
> // Step 1) define database connection
> 
> define('DB_HOST', 'localhost'); // Change this to the proper DB Host name
> define('DB_USERNAME', 'myusername');  // Change this to the proper DB User
> define('DB_PASSWD', 'mypassword'); // Change this to the proper DB User
> password
> define('DB_NAME', 'mydatabase');  // Change this to the proper DB Name
> 
> @mysql_connect(DB_HOST, DB_USERNAME, DB_PASSWD) or die("Error: Database
> connection information is incorrect");
> @mysql_select_db(DB_NAME) or die("Error: Database connection information
> is incorrect");
> 
> */
> 
> /*
> // Step 2) create test schema
> 
> CREATE TABLE IF NOT EXISTS `test` (
>  `id` int(11) NOT NULL auto_increment,
>  `mykey` varchar(20) NOT NULL,
>  PRIMARY KEY  (`id`)
> ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
> 
> */
> 
> 
> /*
> // Step 3) create 700,000 records
> 
> for ($i=1; $i <= 700000; $i++)
> {
> @mysql_query("INSERT INTO test VALUES ('', '')");
> }
> 
> */
> 
> /*
> // Step 4) update 700,000 records
> 
> 
> // The larger this number is detrmines the size of "mykey"
> $int = 1000000;
> 
> $result = @mysql_query("SELECT id FROM test ORDER BY id ASC");
> 
> if (@mysql_num_rows($result) > 0)
> {
> while ($row = @mysql_fetch_object($result))
> {
>  // Add the two numbers together and base it
>  $mykey = dec2base($int+$row->id);
>  @mysql_query("UPDATE test SET mykey='".$mykey."' WHERE
> id='".$row->id."'");
> }
> }
> 
> */

or just:

mysql_query("UPDATE test SET mykey=UUID()");

can't see any reason to go down the 'loop the dataset and roll your
own much less random, much more likely to collide, unique value' road.

sometimes less is more (although oddly more is never less ;-)

just be sure to read the docs regarding charsets and indexes to make
sure you don't inadvertently create a performance problem (due to
unused indexes):

http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_uuid

> ?>
> 


--- End Message ---
--- Begin Message ---
On Wed, 2008-12-17 at 02:03 +0100, Jochem Maas wrote:
>
> or just:
> 
> mysql_query("UPDATE test SET mykey=UUID()");
> 
> can't see any reason to go down the 'loop the dataset and roll your
> own much less random, much more likely to collide, unique value' road.

Not terribly random:

7e55a4d0-1d31-102c-8104-001fd05507bc
7e8e9ed4-1d31-102c-8104-001fd05507bc
7ec56be4-1d31-102c-8104-001fd05507bc
7efbb50a-1d31-102c-8104-001fd05507bc
7f339bf0-1d31-102c-8104-001fd05507bc

But it's about as good as what has already come up :) I haven't come
accross UUID() before. It looks time based to me.

> sometimes less is more (although oddly more is never less ;-)

What about when more is black holes?

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
How do I access a static variable when I do not know the name of the
class until runtime?

I have the following example PHP:

ket% cat test.php 
<?php

class Test
{
  public static
    $STEPS = array(
      'foo',
      'bar');
}

$className = 'Test';

var_dump($className::$STEPS);
ket% 

Unfortunately when I run it I get:

ket% php test.php 

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
in /home/jablko/trash/test.php on line 13
ket% 

I can call a static function using call_user_func(array($className,
'functionName')), and I can access a class constant using
constant($className.'::CONSTANT_NAME'). How do I access a static
variable?


--- End Message ---
--- Begin Message ---
Try this, maybe:

($className)::$STEPS

--- End Message ---
--- Begin Message ---
Jack Bates wrote:
How do I access a static variable when I do not know the name of the
class until runtime?

I have the following example PHP:

ket% cat test.php <?php

class Test
{
  public static
    $STEPS = array(
      'foo',
      'bar');
}

$className = 'Test';

var_dump($className::$STEPS);
ket%
Unfortunately when I run it I get:

ket% php test.php
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
in /home/jablko/trash/test.php on line 13
ket%
I can call a static function using call_user_func(array($className,
'functionName')), and I can access a class constant using
constant($className.'::CONSTANT_NAME'). How do I access a static
variable?


this does beg the question why don't you know the classname at runtime.. seems to be a slight design flaw and may make sense for you to post the full problem (you must have chosen to implement this for a reason..)

if you really really must do this, you'd be best off to have a look at reflection..

<?php

class TestClass {
        
        public static $STEPS = array( 'foo' , 'bar' );
        
}

$testClass = new TestClass;

$rTestClass = new ReflectionClass( get_class($testClass) );

print_r( $rTestClass->getStaticPropertyValue('STEPS') );

?>

--- End Message ---
--- Begin Message ---
Jack Bates wrote:
How do I access a static variable when I do not know the name of the
class until runtime?

I have the following example PHP:

ket% cat test.php <?php

class Test
{
  public static
    $STEPS = array(
      'foo',
      'bar');
}

$className = 'Test';

var_dump($className::$STEPS);
ket%
Unfortunately when I run it I get:

ket% php test.php
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
in /home/jablko/trash/test.php on line 13
ket%
I can call a static function using call_user_func(array($className,
'functionName')), and I can access a class constant using
constant($className.'::CONSTANT_NAME'). How do I access a static
variable?


this is also a not great but usable, stricter and faster solution:

<?php

class TestClass {
        
        public static $STEPS = array( 'foo' , 'bar' );
        
        public function steps() {
                return self::getSteps();
        }
        
        public static function getSteps() {
                return self::$STEPS;
        }
        
        public static function setSteps( $steps ) {
                self::$STEPS = $steps;
        }
}

$testClass = new TestClass;

print_r( $testClass->steps() );

?>

really though why..?

--- End Message ---
--- Begin Message ---
Jack Bates wrote:
> How do I access a static variable when I do not know the name of the
> class until runtime?
>
> I have the following example PHP:
>
> ket% cat test.php 
> <?php
>
> class Test
> {
>   public static
>     $STEPS = array(
>       'foo',
>       'bar');
> }
>
> $className = 'Test';
>
> var_dump($className::$STEPS);
> ket% 
>
> Unfortunately when I run it I get:
>
> ket% php test.php 
>
> Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
> in /home/jablko/trash/test.php on line 13
> ket% 
>
> I can call a static function using call_user_func(array($className,
> 'functionName')), and I can access a class constant using
> constant($className.'::CONSTANT_NAME'). How do I access a static
> variable?
>
>
>   

Check this out:
http://us2.php.net/manual/en/language.oop5.static.php

It actually won't work until 5.3.0 when they add late static binding.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com




Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



--- End Message ---
--- Begin Message ---
On Tue, 2008-12-16 at 13:50 -0600, Jay Moore wrote:
> > Ps. That was a lame attempt at humour... I extract and distill knowledge
> > from the Internet and save myself from having to buy books.
> 
> 
> I hear they have that on computers now.  I should check it out one of 
> these days.  Maybe I'll buy a book.

Yeah, I got a good deal on the Internet compressed to 1.4 megs so I
could carry it on a floppy disk.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
On Tue, 2008-12-16 at 13:50 -0600, Jay Moore wrote:
Ps. That was a lame attempt at humour... I extract and distill knowledge
from the Internet and save myself from having to buy books.

I hear they have that on computers now. I should check it out one of these days. Maybe I'll buy a book.

Yeah, I got a good deal on the Internet compressed to 1.4 megs so I
could carry it on a floppy disk.

Cheers,
Rob.

Floppies hold 1.4 megs now?  Mine don't and they're even dual-sided. :(

--- End Message ---
--- Begin Message ---
On Tue, Dec 16, 2008 at 17:04, Jay Moore <jaymo...@accu-com.com> wrote:
>
> Floppies hold 1.4 megs now?  Mine don't and they're even dual-sided. :(

    Jay,

    Throw out your 62K and 5.25" floppies and get with the 1980's,
brother.  It's all about the 3.5" "hard" disks now.  They're radical!

-- 
</Daniel P. Brown>
http://www.parasane.net/
daniel.br...@parasane.net || danbr...@php.net
50% Off Hosting! http://www.pilotpig.net/specials.php

--- End Message ---
--- Begin Message ---
Daniel Brown wrote:
On Tue, Dec 16, 2008 at 17:04, Jay Moore <jaymo...@accu-com.com> wrote:
Floppies hold 1.4 megs now?  Mine don't and they're even dual-sided. :(

    Jay,

    Throw out your 62K and 5.25" floppies and get with the 1980's,
brother.  It's all about the 3.5" "hard" disks now.  They're radical!


Ok.  Let me back them up to these reel-to-reel tapes quick, just in case.

--- End Message ---
--- Begin Message ---
On Tue, Dec 16, 2008 at 17:11, Jay Moore <jaymo...@accu-com.com> wrote:
>
> Ok.  Let me back them up to these reel-to-reel tapes quick, just in case.

    Just be careful that you don't get the Michaelangelo or Friday The
13th viruses.... especially if you're converting over on a C-64 1541
drive.

-- 
</Daniel P. Brown>
http://www.parasane.net/
daniel.br...@parasane.net || danbr...@php.net
50% Off Hosting! http://www.pilotpig.net/specials.php

--- End Message ---
--- Begin Message ---
On Tue, 2008-12-16 at 16:11 -0600, Jay Moore wrote:
> Daniel Brown wrote:
> > On Tue, Dec 16, 2008 at 17:04, Jay Moore <jaymo...@accu-com.com> wrote:
> >> Floppies hold 1.4 megs now?  Mine don't and they're even dual-sided. :(
> > 
> >     Jay,
> > 
> >     Throw out your 62K and 5.25" floppies and get with the 1980's,
> > brother.  It's all about the 3.5" "hard" disks now.  They're radical!
> > 
> 
> Ok.  Let me back them up to these reel-to-reel tapes quick, just in case.
> 
Hmm, what about punch cards as well, just in case those magnetic tapes
get ruined by an EMP...


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On Tue, 2008-12-16 at 17:07 -0500, Daniel Brown wrote:
> On Tue, Dec 16, 2008 at 17:04, Jay Moore <jaymo...@accu-com.com> wrote:
> >
> > Floppies hold 1.4 megs now?  Mine don't and they're even dual-sided. :(
> 
>     Jay,
> 
>     Throw out your 62K and 5.25" floppies and get with the 1980's,
> brother.  It's all about the 3.5" "hard" disks now.  They're radical!

He's right... standard was actually 1.44 megs... though I swear, every
time I loaded one of those buggers I lost 10 to 50k to lost sectors. I
think I still have a few 3.5" disks buried someplace cold with my save
files for Rogue, Hero's Quest, and a slew of Dragonlance games. My wife
calls me a packrat :) They're probably half consumed by mold or
something.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
On Tue, 2008-12-16 at 22:21 +0000, Ashley Sheridan wrote:
> On Tue, 2008-12-16 at 16:11 -0600, Jay Moore wrote:
> > Daniel Brown wrote:
> > > On Tue, Dec 16, 2008 at 17:04, Jay Moore <jaymo...@accu-com.com> wrote:
> > >> Floppies hold 1.4 megs now?  Mine don't and they're even dual-sided. :(
> > > 
> > >     Jay,
> > > 
> > >     Throw out your 62K and 5.25" floppies and get with the 1980's,
> > > brother.  It's all about the 3.5" "hard" disks now.  They're radical!
> > > 
> > 
> > Ok.  Let me back them up to these reel-to-reel tapes quick, just in case.
> > 
> Hmm, what about punch cards as well, just in case those magnetic tapes
> get ruined by an EMP...

Cue Tedd and his stones in 3... 2... 1...

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
On Tue, Dec 16, 2008 at 17:22, Robert Cummings <rob...@interjinn.com> wrote:
>
> Cue Tedd and his stones in 3... 2... 1...

    Rocks[TM].

-- 
</Daniel P. Brown>
http://www.parasane.net/
daniel.br...@parasane.net || danbr...@php.net
50% Off Hosting! http://www.pilotpig.net/specials.php

--- End Message ---
--- Begin Message ---
On Tue, 2008-12-16 at 17:22 -0500, Robert Cummings wrote:
> On Tue, 2008-12-16 at 22:21 +0000, Ashley Sheridan wrote:
> > On Tue, 2008-12-16 at 16:11 -0600, Jay Moore wrote:
> > > Daniel Brown wrote:
> > > > On Tue, Dec 16, 2008 at 17:04, Jay Moore <jaymo...@accu-com.com> wrote:
> > > >> Floppies hold 1.4 megs now?  Mine don't and they're even dual-sided. :(
> > > > 
> > > >     Jay,
> > > > 
> > > >     Throw out your 62K and 5.25" floppies and get with the 1980's,
> > > > brother.  It's all about the 3.5" "hard" disks now.  They're radical!
> > > > 
> > > 
> > > Ok.  Let me back them up to these reel-to-reel tapes quick, just in case.
> > > 
> > Hmm, what about punch cards as well, just in case those magnetic tapes
> > get ruined by an EMP...
> 
> Cue Tedd and his stones in 3... 2... 1...
> 
> Cheers,
> Rob.
> -- 
> http://www.interjinn.com
> Application and Templating Framework for PHP
> 
> 
These stones? http://xkcd.com/505/



Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On Tue, 2008-12-16 at 22:30 +0000, Ashley Sheridan wrote:
> On Tue, 2008-12-16 at 17:22 -0500, Robert Cummings wrote:
> > On Tue, 2008-12-16 at 22:21 +0000, Ashley Sheridan wrote:
> > > On Tue, 2008-12-16 at 16:11 -0600, Jay Moore wrote:
> > > > Daniel Brown wrote:
> > > > > On Tue, Dec 16, 2008 at 17:04, Jay Moore <jaymo...@accu-com.com> 
> > > > > wrote:
> > > > >> Floppies hold 1.4 megs now?  Mine don't and they're even dual-sided. 
> > > > >> :(
> > > > > 
> > > > >     Jay,
> > > > > 
> > > > >     Throw out your 62K and 5.25" floppies and get with the 1980's,
> > > > > brother.  It's all about the 3.5" "hard" disks now.  They're radical!
> > > > > 
> > > > 
> > > > Ok.  Let me back them up to these reel-to-reel tapes quick, just in 
> > > > case.
> > > > 
> > > Hmm, what about punch cards as well, just in case those magnetic tapes
> > > get ruined by an EMP...
> > 
> > Cue Tedd and his stones in 3... 2... 1...


> These stones? http://xkcd.com/505/

Pretty much... but with far more misplacements.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
On Tue, Dec 16, 2008 at 17:30, Ashley Sheridan <a...@ashleysheridan.co.uk> 
wrote:
>>
> These stones? http://xkcd.com/505/

    That's fantastic, Ash.  I haven't seen that one.  I'm CC'ing Tedd
directly on that.

-- 
</Daniel P. Brown>
http://www.parasane.net/
daniel.br...@parasane.net || danbr...@php.net
50% Off Hosting! http://www.pilotpig.net/specials.php

--- End Message ---
--- Begin Message ---
On Tue, 2008-12-16 at 17:44 -0500, Daniel Brown wrote:
> On Tue, Dec 16, 2008 at 17:30, Ashley Sheridan <a...@ashleysheridan.co.uk> 
> wrote:
> >>
> > These stones? http://xkcd.com/505/
> 
>     That's fantastic, Ash.  I haven't seen that one.  I'm CC'ing Tedd
> directly on that.
> 
> -- 
> </Daniel P. Brown>
> http://www.parasane.net/
> daniel.br...@parasane.net || danbr...@php.net
> 50% Off Hosting! http://www.pilotpig.net/specials.php
> 
Hehe, it's the only xkcd one I can remember with rocks in!


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
Daniel Brown a écrit :

    You'd be surprised.  The "For Dummies" series is one of the
best-selling franchises in mainstream publishing history.

  Best-selling are not a proof of quality.

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

--- End Message ---
--- Begin Message ---
Hi,

I lost phpmyadmin password. Is there anyway to recover it?

Thank you


      


--- End Message ---
--- Begin Message ---
It flance wrote:
> Hi,
>
> I lost phpmyadmin password. Is there anyway to recover it?
>
> Thank you
>
>   

PHPMyAdmin uses MySQL's internal authentication.  Log into your MySQL
server and reset your password.

http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



--- End Message ---
--- Begin Message ---
It flance wrote:
Hi,

I lost phpmyadmin password. Is there anyway to recover it?

ask phpmyadmin:

http://www.phpmyadmin.net/home_page/support.php

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


--- End Message ---
--- Begin Message ---
If I have a php script on my own server, can it be used to snatch a JPEG image 
off of another server on a different domain and upload it to my server?  For 
example, could I provide an URL to an image on another server and a path on my 
own server in which to place it?  I know in the world of Ajax, I could run into 
cross-domain security issues, but I'm wondering if I can get around that with 
PHP.

--- End Message ---
--- Begin Message ---
On Tue, 2008-12-16 at 21:29 -0500, Rob Gould wrote:
> If I have a php script on my own server, can it be used to snatch a JPEG 
> image off of another server on a different domain and upload it to my server? 
>  For example, could I provide an URL to an image on another server and a path 
> on my own server in which to place it?  I know in the world of Ajax, I could 
> run into cross-domain security issues, but I'm wondering if I can get around 
> that with PHP.
> 

Yes, this can be done quite easily.

<?php

    $content = file_get_contents( 'http://www.foo.com/images/foo.png' );
    file_put_contents( '/tmp/foo.png', $content );

?>

You will need fopen wrappers enabled for this to work. Either way, there
are other ways to skin the cat if fopen wrappers cannot be enabled.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
Brilliant!

Now why do all these other scripts I've found make it look so hard??

http://wiki.dreamhost.com/index.php/CURL

Take a look at the last script on that site.  I suppose it's because of all the 
error-handling.  That last "downloader class" looks promising, through I'm not 
sure how to pass an URL into it to get and save to a special directory on my 
server.  I like your example better.


 
On Tuesday, December 16, 2008, at 09:41PM, "Robert Cummings" 
<rob...@interjinn.com> wrote:
>On Tue, 2008-12-16 at 21:29 -0500, Rob Gould wrote:
>> If I have a php script on my own server, can it be used to snatch a JPEG 
>> image off of another server on a different domain and upload it to my 
>> server?  For example, could I provide an URL to an image on another server 
>> and a path on my own server in which to place it?  I know in the world of 
>> Ajax, I could run into cross-domain security issues, but I'm wondering if I 
>> can get around that with PHP.
>> 
>
>Yes, this can be done quite easily.
>
><?php
>
>    $content = file_get_contents( 'http://www.foo.com/images/foo.png' );
>    file_put_contents( '/tmp/foo.png', $content );
>
>?>
>
>You will need fopen wrappers enabled for this to work. Either way, there
>are other ways to skin the cat if fopen wrappers cannot be enabled.
>
>Cheers,
>Rob.
>-- 
>http://www.interjinn.com
>Application and Templating Framework for PHP
>
>
>

--- End Message ---
--- Begin Message ---
Rob Gould wrote:
Brilliant!

Now why do all these other scripts I've found make it look so hard??

http://wiki.dreamhost.com/index.php/CURL

curl can handle timeouts much better (file_get_contents will timeout when the server on the other end says so). it can also tell you if a 404 is returned, and handle basic authentication.

file_get_contents is very simple. if i replace foo.png with a 404 page, that's what you'll get - and that's what you'll save as your image.

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


--- End Message ---
--- Begin Message ---
Chris:
>
> curl can handle timeouts much better (file_get_contents will timeout when
> the server on the other end says so).

If you use stream context, you can set timeout to file_get_contents() as well.

-- 
toby

http://toby.cz/

--- End Message ---

Reply via email to