php-general Digest 17 Dec 2008 22:33:34 -0000 Issue 5851

Topics (messages 284721 through 284749):

Re: Good PHP book?
        284721 by: David Robley
        284724 by: Richard Heyes
        284725 by: Richard Heyes
        284726 by: David Robley
        284738 by: Robert Cummings
        284749 by: Ashley Sheridan

www.winemasters.pt - test
        284722 by: Wine Masters Challenge 2009

Re: Create unique non-autoincrement key for 700,000     records?
        284723 by: Jochem Maas
        284732 by: tedd
        284737 by: Robert Cummings

Re: checking local file size
        284727 by: David Robley
        284729 by: John Pillion

Re: Curl with asp pages....
        284728 by: shiplu

Missing namespaceURI after importNode()
        284730 by: Tim Lind

Re: Secure uploads tutorial
        284731 by: tedd

error flashing on redirect
        284733 by: Terion Miller
        284734 by: Stut
        284735 by: ceo.l-i-e.com

Re: Phpmyadmin password
        284736 by: Jim Lucas
        284739 by: VamVan

Printing
        284740 by: Dan Shirah
        284741 by: Bastien Koert
        284742 by: Jason Pruim
        284743 by: Jay Blanchard
        284744 by: Dan Shirah
        284745 by: Dan Shirah
        284746 by: Bastien Koert
        284747 by: Dan Shirah
        284748 by: Dan McCullough

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 ---
Lupus Michaelis wrote:

> 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.
> 

Viz: Windows Version xx.x


Cheers
-- 
David Robley

Windows: XT emulator for an AT.
Today is Sweetmorn, the 59th day of The Aftermath in the YOLD 3174. 


--- End Message ---
--- Begin Message ---
> Sounds like you need "Self Esteem for Dummies."

Lol. It's not a question of self-esteem, more based on the number of
non-starter businesses I've attempted to start.

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated December 5th)

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

What are "Floppies"? Is it a reference to a particular male problem?

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated December 5th)

--- End Message ---
--- Begin Message ---
Daniel Brown wrote:

> 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.
> 

What? They were cross platform? I recall copping Michaelangelo on Win 3.n
from some commercial software floppy. Not nice - it cleaned out the FAT or
something equally nasty. A reinstall was called for :-)


Cheers
-- 
David Robley

"I already showed you how to do that," Tom said tautly.
Today is Sweetmorn, the 59th day of The Aftermath in the YOLD 3174. 


--- End Message ---
--- Begin Message ---
On Wed, 2008-12-17 at 10:47 +0000, Richard Heyes wrote:
> > Floppies hold 1.4 megs now?  Mine don't and they're even dual-sided. :(
> 
> What are "Floppies"? Is it a reference to a particular male problem?

If so, then I want to know what dual sided means?

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


--- End Message ---
--- Begin Message ---
On Wed, 2008-12-17 at 13:13 -0500, Robert Cummings wrote:
> On Wed, 2008-12-17 at 10:47 +0000, Richard Heyes wrote:
> > > Floppies hold 1.4 megs now?  Mine don't and they're even dual-sided. :(
> > 
> > What are "Floppies"? Is it a reference to a particular male problem?
> 
> If so, then I want to know what dual sided means?
> 
> Cheers,
> Rob.
> -- 
> http://www.interjinn.com
> Application and Templating Framework for PHP
> 
> 
Maybe it means the state affects you independent of sexual
preference? ;)


Ash
www.ashleysheridan.co.uk


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

--- End Message ---
--- Begin Message ---
Robert Cummings schreef:
> 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.

it is, amongst other things. ands no it doesn't look very random,
but it's garanteed (in your lifetime) to be unique even when you
make the call simultaneous on any number of machines.

I guess you could do better by doing something more complex than
the single query I suggested ... but the first 8 chars are pretty
much random enough to avoid simple (or even complex) guess work ...
they're more random than the passwords most people use to log into
'whatever'. :-)

my point was more that it's a bit silly to go about creating reams
of code to generate random strings when there are prebuilt functions
in the various tools we use written by people much cleverer than us
(well me anyway) ... i.e. Leverage (siedenote: enjoyable TV show) the
work of some crypto wizard and write a single LOC rather than create stacks
of code you have to maintain which is probably not as good as the pre-built
'wheels'.

that said UUID() is an interesting thing in it's own right, worthy of
investigation.

> 
>> sometimes less is more (although oddly more is never less ;-)
> 
> What about when more is black holes?

hmm. I guess that would depend on which side of the event horizon
you were at. :-)

> Cheers,
> Rob.


--- End Message ---
--- Begin Message ---
At 9:23 PM -0500 12/16/08, Robert Cummings wrote:
I haven't come accross UUID() before. It looks time based to me.

Yeah, it stops the nine month thing.  :-)

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Wed, 2008-12-17 at 11:32 +0100, Jochem Maas wrote:
> >
> > 
> >> sometimes less is more (although oddly more is never less ;-)
> > 
> > What about when more is black holes?
> 
> hmm. I guess that would depend on which side of the event horizon
> you were at. :-)

Is there conservation of reality across the event horizon? If so, then
there's neither more or less ;)

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


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

>> > 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/

Um, sudo? Or be root when you install as the PEAR/PECL structure is usually
owned by root.


Cheers
-- 
David Robley

"This is a sick bird," said Tom illegally.
Today is Sweetmorn, the 59th day of The Aftermath in the YOLD 3174. 


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

> > 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/
> 
> Um, sudo? Or be root when you install as the PEAR/PECL structure is
usually
> owned by root.


Just tried that - I don't have the permissions to sudo :(


--- End Message ---
--- Begin Message ---
On Wed, Dec 17, 2008 at 6:28 AM, ioannes <ioan...@btinternet.com> wrote:
> shiplu wrote:
>>
>> On Sun, Dec 7, 2008 at 8:22 AM, ioannes <ioan...@btinternet.com> wrote:
>>
>>>
>>> shiplu wrote:
>>>
>>>>
>>>> When you are dealing with curl, anything can be done as long as its a
>>>> HTTP
>>>> request.Its all about sending HTTP headers and content.
>>>>
>>>> To parse HTML content you can use HTML parser. Regular expression may
>>>> not
>>>> work each time.
>>>> Pattern changes over time.
>>>>
>>>> Download Wireshark. Collect 2 sample request and response packet from
>>>> there.
>>>> Make a format and use it with CURL.
>>>> Thats it. So Simple. You never gonna  need to know who is generating the
>>>> site, PHP or ASP.NET.
>>>>
>>>>
>>>>
>>>>
>>>
>>> I downloaded Wireshark onto Windows XP, got as far as Capture Options
>>> from
>>> Ethernet, Capture Filter is host <IP address of target page>, click
>>> Start,
>>> go to browser and access page, Stop Wireshark, Save captured file or
>>> Export
>>> as HTTP object which gives me the source of the page again.  Is this what
>>> you mean?   What do you mean by make a format - do you mean for instance
>>> parse the page with string finder functions etc.   How is this helping
>>> over
>>> identifying the correct POST variables (using LiveHTTP etc) of the
>>> request
>>> and feeding into a curl function?  What do you mean by 'make a format'
>>> versus 'pattern changes over time' - is format a Wireshark function, if
>>> so
>>> where do I find it.   Thanks, John
>>>
>>>
>>>
>>
>>
>> "make a format" is not like a button in wireshirk that has label "make
>> a format" and it will do everything for you. You have to do it
>> yourself. By wireshirk you'll see every type of headers and contents
>> for almost every type of protocols. So you'll use this soft for
>> analyzing the http conversation. Data will not only be in content but
>> also in headers. so parse both if needed. then use the same data and
>> make successive requests.
>> If you are using regular expression it will fail to match if pattern
>> changes. Your pattern '/<input type="hidden" name="__VIEWSTATE"
>> id="__VIEWSTATE" value="([^"]*?)" \/>/ will match <input type="hidden"
>> name="__VIEWSTATE" id="__VIEWSTATE" value="ABC7D5ACSE" /> but wont
>> match <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
>> value="ABC7D5ACSE">. Do you see the difference?? It wont mach <input
>> type="hidden" id="__VIEWSTATE" name="__VIEWSTATE"  value="ABC7D5ACSE"
>> /> too. Because the attributes order is changed. Your regex will not
>> work but their website will render very well. to overcome this, you
>> have to use html/xml parser. So you can go to input element. then look
>> for name attribute and if the name attribute is "__VIEWSTATE" then
>> fetch the value attributes content.  To make any input element name,
>> value attribute must be present. So your code will match every time.
>> It wont fail in 99.99% case.
>>
>> Hope that make sense
>>
>>
>
> Yes, thanks.  What HTML parser do you suggest?
>
> John
>

For php there is a dom extension.
Documentation can be found in http://www.php.net/dom

Thanks.

-- 
A K M Mokaddim
http://talk.cmyweb.net
http://twitter.com/shiplu
Stop Top Posting !!

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


I am importing a node into a new document so that I can perform an XSL transformation on just that node. This works sometimes, however, I've come into the following problem, where the namespaceURI is there on the node but doesn't make it through the importNode() to the next document.

Can you tell me what might be the cause of loosing the namespace on importing the node? Bearing in mind that the childnode itself (being the result of an xsl transformation) was previously imported into the document as a replacement for it's original node.

I'm using PHP 5 DOM and XSL extensions.



Tim


CODE SNIPPET:


# ...$childNode exists previous to this point

echo "\n --- source node --- \n";

echo $this->srcDocument->saveXML($childNode);
var_dump($childNode->namespaceURI);

# importing childnode into a new doc

$newDoc = new DOMDocument();
$newRoot = $newDoc->importNode($childNode, true);
$newDoc->appendChild($newRoot);

echo "\n --- import of source node --- \n";

echo $newDoc->saveXML($newRoot);
var_dump($newRoot->namespaceURI);

# will be using newDoc for an XSL transformation and replacing childNode
# with the new doc,
# (which is what was previously done successfully with child node)


OUTPUT SNIPPET:

 --- source node ---
<pre:name/>string(15) "xtc:website.com"


 --- import of source node ---
<name/>NULL

--- End Message ---
--- Begin Message ---
At 1:55 PM +1100 12/17/08, Tim Starling wrote:
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.

Oh, I see the problem (I think).

I was thinking it was a server-side problem -- IOW, how do you stop someone from uploading a clever script that the server will somehow run.

But instead, this is how to stop someone from uploading a script that will become evil when someone else views it using IE. Is that it?

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
I am working on the login script I have been troubling over, and when I hit
submit it throws an error and even though I have error reporting E_All on
because its on a redirect or something I can see the error for only a split
second so I can't catch it to figure it out (does this make sense?) how
would I go about making that error visible long enough to read?

Thanks Guys!
Terion

--- End Message ---
--- Begin Message ---
2008/12/17 Terion Miller <webdev.ter...@gmail.com>:
> I am working on the login script I have been troubling over, and when I hit
> submit it throws an error and even though I have error reporting E_All on
> because its on a redirect or something I can see the error for only a split
> second so I can't catch it to figure it out (does this make sense?) how
> would I go about making that error visible long enough to read?

Erm... find out what's redirecting it, and remove it. Or have I missed
something?

-Stuart

-- 
http://stut.net/

--- End Message ---
--- Begin Message ---
Change php.ini (or .htacces or ini_set) so that display_errors is OFF and 
log_errors is ON and log them to some file you do this to, all day, every day:



tail -f /var/log/httpd/error_log



You'll definitely need this as you get more complex site interaction, 
particularly with Ajax calls that don't have any visible output to the screen.



Also use error_reporting E_ALL to find all your uninitialized variables and 
typos in array indices.



--- End Message ---
--- Begin Message ---
Micah Gersten wrote:
> 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
> 
> 
> 

That is the case, but only if the op is using http auth

if they are using config or cookie based, then it might/should be stored in the 
config.inc.php file.

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---
--- Begin Message ---
Yeah I felt the same. It should be config.inc.php. Well I dont think its in
clear text though (alteast in the latest version). May be u can do a bowl
fish encryption of your new custom password and reset it in the file.

Thanks,
V

On Wed, Dec 17, 2008 at 9:01 AM, Jim Lucas <li...@cmsws.com> wrote:

> Micah Gersten wrote:
> > 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
> >
> >
> >
>
> That is the case, but only if the op is using http auth
>
> if they are using config or cookie based, then it might/should be stored in
> the config.inc.php file.
>
> --
> Jim Lucas
>
>   "Some men are born to greatness, some achieve greatness,
>       and some have greatness thrust upon them."
>
> Twelfth Night, Act II, Scene V
>    by William Shakespeare
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Hello all,

Could someone please point me in the right direction for printing files
through PHP?

I already have my application setup so that it creates documents and saves
them to a folder.  How would I go about printing all of the files in the
folder via PHP?

I've looked into the Print functions in the manual (
http://us2.php.net/manual/en/ref.printer.php) but this does not seem to be
the right thing to use to print documents that already exist.

Thanks,
Dan

--- End Message ---
--- Begin Message ---
On Wed, Dec 17, 2008 at 2:57 PM, Dan Shirah <mrsqua...@gmail.com> wrote:

> Hello all,
>
> Could someone please point me in the right direction for printing files
> through PHP?
>
> I already have my application setup so that it creates documents and saves
> them to a folder.  How would I go about printing all of the files in the
> folder via PHP?
>
> I've looked into the Print functions in the manual (
> http://us2.php.net/manual/en/ref.printer.php) but this does not seem to be
> the right thing to use to print documents that already exist.
>
> Thanks,
> Dan
>
I would suggest sending a PDF to the client and allowing the client to
handle the rest.


-- 

Bastien

Cat, the other other white meat

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

On Dec 17, 2008, at 2:57 PM, Dan Shirah wrote:

Hello all,

Could someone please point me in the right direction for printing files
through PHP?

I already have my application setup so that it creates documents and saves them to a folder. How would I go about printing all of the files in the
folder via PHP?

I've looked into the Print functions in the manual (
http://us2.php.net/manual/en/ref.printer.php) but this does not seem to be
the right thing to use to print documents that already exist.

Do you want to print this on your office printer or on the website users printer?

If you are looking for away to print it on their printer, why not just grab all the files that need to be printed, make a PDF of it, and then use the browsers print feature?



--
Jason Pruim
japr...@raoset.com
616.399.2355




--- End Message ---
--- Begin Message ---
[snip]
Could someone please point me in the right direction for printing files
through PHP?

I already have my application setup so that it creates documents and
saves
them to a folder.  How would I go about printing all of the files in the
folder via PHP?

I've looked into the Print functions in the manual (
http://us2.php.net/manual/en/ref.printer.php) but this does not seem to
be
the right thing to use to print documents that already exist.
[/snip]

Does it save them to a folder on the server? Or does it save them on the
client?

If it is on the server then the server would have to send the docs to a
printer queue.

If it is on the client PHP cannot really do anything about. PHP cannot
force the client to print but it could send the docs to the client once
a request has been made.

--- End Message ---
--- Begin Message ---
>
>   Do you want to print this on your office printer or on the website users
> printer?
>
> If you are looking for away to print it on their printer, why not just grab
> all the files that need to be printed, make a PDF of it, and then use the
> browsers print feature?
>
>
>
>  --
> Jason Pruim
> japr...@raoset.com
> 616.399.2355
>

I want it to print to the users local printer.

Basically the user has a form and based on their search criteria they will
get multiple results.

Next to each result I have a checkbox that the user will use to select the
documents they want to print.

Once they have selected everything they want to print, they click on a
"Print Selection" link.

The checkboxes all have the same name but different dynamically assigned
values, so once they click to print, an array of values for the checkbox
name is passed to my next page.

I have a for () loop on the next page that extracts each individual value
and uses it in a query to extract information and build a pdf which is
automatically output to a file.

Once a PDF has been generated I want to send it to the users printer to be
printed.

--- End Message ---
--- Begin Message ---
>
> Does it save them to a folder on the server? Or does it save them on the
> client?
>
> If it is on the server then the server would have to send the docs to a
> printer queue.
>
> If it is on the client PHP cannot really do anything about. PHP cannot
> force the client to print but it could send the docs to the client once
> a request has been made.
>

Yes, it saves the created documents to a folder on the server.  Since any
user could request to print the same document I first check to see if the
document already exists.

If it does exist I naturally want to skip the creation process and just
print it and move on to the next selection.

I have another process that clears out this folder once every 24 hours so it
doesn't accumulate a massive store of files.

--- End Message ---
--- Begin Message ---
On Wed, Dec 17, 2008 at 3:16 PM, Dan Shirah <mrsqua...@gmail.com> wrote:

> >
> >   Do you want to print this on your office printer or on the website
> users
> > printer?
> >
> > If you are looking for away to print it on their printer, why not just
> grab
> > all the files that need to be printed, make a PDF of it, and then use the
> > browsers print feature?
> >
> >
> >
> >  --
> > Jason Pruim
> > japr...@raoset.com
> > 616.399.2355
> >
>
> I want it to print to the users local printer.
>
> Basically the user has a form and based on their search criteria they will
> get multiple results.
>
> Next to each result I have a checkbox that the user will use to select the
> documents they want to print.
>
> Once they have selected everything they want to print, they click on a
> "Print Selection" link.
>
> The checkboxes all have the same name but different dynamically assigned
> values, so once they click to print, an array of values for the checkbox
> name is passed to my next page.
>
> I have a for () loop on the next page that extracts each individual value
> and uses it in a query to extract information and build a pdf which is
> automatically output to a file.
>
> Once a PDF has been generated I want to send it to the users printer to be
> printed.
>

You can't, the best you can do is send the PDF down and let the user choose
to do with it what they will

-- 

Bastien

Cat, the other other white meat

--- End Message ---
--- Begin Message ---
>
>   You can't, the best you can do is send the PDF down and let the user
>> choose to do with it what they will
>
>
>
> --
>
> Bastien
>

So you think I should try and look into a way to have FPDF append each
document to the already created document, and once all pages have been added
to the PDF force it back to the user to open in the broswer?

--- End Message ---
--- Begin Message ---
I did something similar, but it was some work I did for a company and the
application was an internal application that used PHP and a Java applet to
send the file to a workers local printer since it cant be accomplished by
PHP itself.

On Wed, Dec 17, 2008 at 3:30 PM, Dan Shirah <mrsqua...@gmail.com> wrote:

> >
> >   You can't, the best you can do is send the PDF down and let the user
> >> choose to do with it what they will
> >
> >
> >
> > --
> >
> > Bastien
> >
>
> So you think I should try and look into a way to have FPDF append each
> document to the already created document, and once all pages have been
> added
> to the PDF force it back to the user to open in the broswer?
>

--- End Message ---

Reply via email to