php-general Digest 27 Mar 2009 14:19:26 -0000 Issue 6035

Topics (messages 290728 through 290754):

Re: Multiple cookies on the same computer
        290728 by: dg
        290731 by: Shawn McKenzie
        290732 by: Shawn McKenzie
        290748 by: Ken Watkins
        290750 by: Ken Watkins
        290754 by: Shawn McKenzie

Re: flushing AJAX scripts
        290729 by: Raymond Irving
        290743 by: Andrea Giammarchi

Re: Regex
        290730 by: Shawn McKenzie
        290736 by: Jochem Maas
        290744 by: Bob McConnell
        290749 by: Jesse.Hazen.arvatousa.com
        290751 by: Jesse.Hazen.arvatousa.com

Re: Limit Local Search to Content
        290733 by: George Langley

PHP and making a ZIP file
        290734 by: Ron Piggott
        290735 by: Chris
        290739 by: Ashley Sheridan

WHILE LOOP PROBLEM
        290737 by: Andrew Williams
        290738 by: Craig Whitmore
        290742 by: Arno Kuhl

Exporting text with chinese characters in CSV
        290740 by: Ai Leen
        290741 by: Ashley Sheridan

php5activescript.dll
        290745 by: Robert Johnson

Error printer_open()
        290746 by: Gerardo Picotti
        290747 by: Bastien Koert
        290752 by: Gerardo Picotti
        290753 by: Shawn McKenzie

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

On Mar 26, 2009, at 7:14 PM, Ken Watkins wrote:

To keep up with their identities, I created a script for each family member to run (dad.php, mom.php, etc.), and it sets a cookie on each computer and uses sessions so I know who is connecting.

Each family member only uses her/his own page? Maybe set a unique cookie name based on each page?
--- End Message ---
--- Begin Message ---
Ken Watkins wrote:
> Hi all.
> 
> Newbie here.
> 
> I have set up a blog site where my family creates posts and they get emailed 
> to members of the family. To keep up with their identities, I created a 
> script for each family member to run (dad.php, mom.php, etc.), and it sets a 
> cookie on each computer and uses sessions so I know who is connecting. It 
> works great unless I want to share a computer between two users.
> 
> I thought I had a solution: install both Firefox and IE on the same computer 
> and set two different cookies. But this doesn't seem to work. My question is: 
> Is it possible to set one cookie for IE and another for Firefox so that, 
> depending on which browser is used, I can tell who is connecting to the blog? 
> If this is not possible, is there another easy way to do it?
> 
> Thanks for your help.
> 
> - Ken Watkins
> 
> 

Even if you don't need it secure, have a login.  Dad and mom can login
with dad or mom with no password if all you need to do is give them
their own cookie/session.


-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:
> Ken Watkins wrote:
>> Hi all.
>>
>> Newbie here.
>>
>> I have set up a blog site where my family creates posts and they get emailed 
>> to members of the family. To keep up with their identities, I created a 
>> script for each family member to run (dad.php, mom.php, etc.), and it sets a 
>> cookie on each computer and uses sessions so I know who is connecting. It 
>> works great unless I want to share a computer between two users.
>>
>> I thought I had a solution: install both Firefox and IE on the same computer 
>> and set two different cookies. But this doesn't seem to work. My question 
>> is: Is it possible to set one cookie for IE and another for Firefox so that, 
>> depending on which browser is used, I can tell who is connecting to the 
>> blog? If this is not possible, is there another easy way to do it?
>>
>> Thanks for your help.
>>
>> - Ken Watkins
>>
>>
> 
> Even if you don't need it secure, have a login.  Dad and mom can login
> with dad or mom with no password if all you need to do is give them
> their own cookie/session.
> 
> 

Optionally, I just thought that if this was too much for them to
do/remember, they could have their own bookmarks, like "Dad - Yoursite"
(http://www.yoursite.com/index.php?person=dad) and Mom - Yoursite
(http://www.yoursite.com/index.php?person=mom) and set the
session/cookie or whatever you're doing based on $_GET['person'].

I would still opt for the login though, even if not secure.

-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---
>>> On 3/26/2009 at 11:12 PM, in message <[email protected]>, 
>>> Shawn McKenzie <[email protected]> wrote:
Shawn McKenzie wrote:
> Ken Watkins wrote:
>> Hi all.
>>
>> Newbie here.
>>
>> I have set up a blog site where my family creates posts and they get emailed 
>> to members of the family. To keep up with their identities, I created a 
>> script for each family member to run (dad.php, mom.php, etc.), and it sets a 
>> cookie on each computer and uses sessions so I know who is connecting. It 
>> works great unless I want to share a computer between two users.
>>
>> I thought I had a solution: install both Firefox and IE on the same computer 
>> and set two different cookies. But this doesn't seem to work. My question 
>> is: Is it possible to set one cookie for IE and another for Firefox so that, 
>> depending on which browser is used, I can tell who is connecting to the 
>> blog? If this is not possible, is there another easy way to do it?
>>
>> Thanks for your help.
>>
>> - Ken Watkins
>>
>>
> 
> Even if you don't need it secure, have a login.  Dad and mom can login
> with dad or mom with no password if all you need to do is give them
> their own cookie/session.
> 
> 

Optionally, I just thought that if this was too much for them to
do/remember, they could have their own bookmarks, like "Dad - Yoursite"
(http://www.yoursite.com/index.php?person=dad) and Mom - Yoursite
(http://www.yoursite.com/index.php?person=mom) and set the
session/cookie or whatever you're doing based on $_GET['person'].

I would still opt for the login though, even if not secure.

-- 
Thanks!
-Shawn
http://www.spidean.com 

 
Hi Shawn -

I was hoping to avoid logging in every time, but that may be the best way.
What I still don't understand is:  I thought that Firefox and IE each had their 
own cookies, and that I could determine the user by which browser they used. In 
other words, Firefox's cookie would be for dad and IE's for mom. But I can't 
figure out how to do that. Do Firefox and IE share cookies?

Thanks.
Ken


--- End Message ---
--- Begin Message ---
>>> On 3/26/2009 at 10:24 PM, in message 
>>> <[email protected]>, dg 
>>> <[email protected]> wrote:

On Mar 26, 2009, at 7:14 PM, Ken Watkins wrote:

>> To keep up with their identities, I created a script for each family  
>> member to run (dad.php, mom.php, etc.), and it sets a cookie on each  
>> computer and uses sessions so I know who is connecting.

>Each family member only uses her/his own page?  Maybe set a unique  
>cookie name based on each page?

Hi.

No, they all go to a common page. I may have to take Shawn's suggestion and 
just have them login if I can't figure another way to do it.

Thanks.
Ken




--- End Message ---
--- Begin Message ---
Ken Watkins wrote:
>>>> On 3/26/2009 at 11:12 PM, in message <[email protected]>, 
>>>> Shawn McKenzie <[email protected]> wrote:
> Shawn McKenzie wrote:
>> Ken Watkins wrote:
>>> Hi all.
>>>
>>> Newbie here.
>>>
>>> I have set up a blog site where my family creates posts and they get 
>>> emailed to members of the family. To keep up with their identities, I 
>>> created a script for each family member to run (dad.php, mom.php, etc.), 
>>> and it sets a cookie on each computer and uses sessions so I know who is 
>>> connecting. It works great unless I want to share a computer between two 
>>> users.
>>>
>>> I thought I had a solution: install both Firefox and IE on the same 
>>> computer and set two different cookies. But this doesn't seem to work. My 
>>> question is: Is it possible to set one cookie for IE and another for 
>>> Firefox so that, depending on which browser is used, I can tell who is 
>>> connecting to the blog? If this is not possible, is there another easy way 
>>> to do it?
>>>
>>> Thanks for your help.
>>>
>>> - Ken Watkins
>>>
>>>
>> Even if you don't need it secure, have a login.  Dad and mom can login
>> with dad or mom with no password if all you need to do is give them
>> their own cookie/session.
>>
>>
> 
> Optionally, I just thought that if this was too much for them to
> do/remember, they could have their own bookmarks, like "Dad - Yoursite"
> (http://www.yoursite.com/index.php?person=dad) and Mom - Yoursite
> (http://www.yoursite.com/index.php?person=mom) and set the
> session/cookie or whatever you're doing based on $_GET['person'].
> 
> I would still opt for the login though, even if not secure.
> 

No, they use their own cookies so if you want to do it that way, use:
$_SERVER['HTTP_USER_AGENT'] and set the cookie based upon the browser.

Another thought I had was if you can add domain aliases,
dad.yoursite.com and mom.yoursite.com, then they will each have
different cookies.

-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---
Hello Jim,

You will need to do some low level ajax coding from the client side with the 
onreadychange event. If you're using jquery 1.3 then you can create your own 
XHR object with the xhr callback handler.

To learn more about the ready state check out this link:
http://www.quirksmode.org/blog/archives/2005/09/xmlhttp_notes_r_2.html

You might find what you're looking for with the following ready state:

"3 - Interactive Downloading, responseText holds the partial data. "


Raymond Irving
Create Rich PHP Web Apps Today!
Raxan PDI - http://raxanpdi.com/

--- On Thu, 3/26/09, jim white <[email protected]> wrote:

> From: jim white <[email protected]>
> Subject: [PHP] flushing AJAX scripts
> To: [email protected]
> Date: Thursday, March 26, 2009, 4:01 PM
> I am using jQuery AJAX request to run
> a script that can take several minutes to create a report. I
> want to start the script and immediately echo a response to
> close the connection and then let the script complete a
> report which I can get later. I have tried several thing
> such as
> 
> ob_start();
> echo json_encode(array("time"=>$now,
> "message"=>"Report has started running!"));
> ob_end_flush();
> 
> However, the script does not respond and (I suppose close
> the connection) until the report is complete. How can I fix
> this behaviour?
> 
> Jim
> 
> 
> -- James (Jim) B. White
> tel: (919)-380-9615
> homepage: http://jimserver.net/ 
> 
> -- PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
Some browser would like to receive at list N characters (bytes) even if
you force the flush, before the browser will show those characters.
In
any case, the Ajax request will not be completed until its readyState
will be 4, which means the page execution on the server has finished
(released, php has gone, flush or not flush)
For a task like this one you have few options:
 1 - launch  new thread if your host is able to do it
 2 - use a Comet like response (for php I wrote Phico some while ago)
In any case, I hope this stressful operation cannot be performed from thousand 
of users or you can say bye bye to the service.
Alternatives:
 1 - optimize your database
 2 - delegate the job once a time rather than every click (cronjob)
 3 - if the bottleneck is PHP, create an extension in C to perform the same task

Hope this help.

Regards

P.S.
Internet Explorer a part, you can read the responseText on readystate 3
which will be called different time (most likely for each flush).
If IE is not your target, you could consider this opportunity to read the sent 
stream so far.

> Date: Fri, 27 Mar 2009 08:49:35 +1100
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> Subject: Re: [PHP] flushing AJAX scripts
> 
> jim white wrote:
> > I am using jQuery AJAX request to run a script that can take several 
> > minutes to create a report. I want to start the script and immediately 
> > echo a response to close the connection and then let the script complete 
> > a report which I can get later. I have tried several thing such as
> > 
> > ob_start();
> > echo json_encode(array("time"=>$now, "message"=>"Report has started 
> > running!"));
> > ob_end_flush();
> 
> Try something like this
> 
> echo "something";
> flush();
> 
> without the ob* stuff.
> 
> -- 
> Postgresql & php tutorials
> http://www.designmagick.com/
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx

--- End Message ---
--- Begin Message ---
[email protected] wrote:
> Nistan,
> 
> Just got home, tested on linux. No problem on linux, the control-z just 
> exits. I may just go ahead and post my issue to the PHP windows list to see 
> if anything comes up, and not worry if it doesnt. I appreciate the help very 
> much
> 
> 
> 
> Thanks,
> 
> Jesse

Ctrl z suspends the current process running in the shell in linux.  Not
sure about winbloze.  Probably sends an escape char of some sort.


-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---
[email protected] schreef:
> Hi,
> 
>  
> 
> Brand new to regex. So I have a cli which runs a regex on users input,
> to make sure that only 0-9 and A-Z are accepted. It should strip
> everything else. My problem is that when you press control-Z (on
> Windows; I have not yet tested this on linux, and I will, but I would
> like this to be compatible with both OS's) it loops infinitely saying
> invalid data (because of the next method call, which decides what to do
> based on your input). So, here is the input code. Is there a way I can
> ensure that control commands are stripped, here?
> 

there is, your control-Z is not a Z at all, and it's only printed as ^Z
so you can see it ... it's actually a non-printing char.

try this regexp for stripping control chars:

/[\x00-\x1f]+/

>  
> 
>  
> 
>  
> 
>             public function getSelection() {
> 
>  
> 
>                         $choice =
> $this->validateChoice(trim(strtoupper(fgets(STDIN))));
> 
>                         return $choice;
> 
>  
> 
>             }
> 
>  
> 
>             private function validateChoice($choice) {
> 
>  
> 
>                         $choice =
> ereg_replace("/[^0-9A-Z]/","",$choice);
> 
>                         return $choice;
> 
>  
> 
>             }
> 
>  
> 
>  
> 
>  
> 
> I have tried a ton of different things to try and fix this. Tried
> /\c.|[^0-9A-Z]/, and many variations of \c and the [^0-9A-Z], to no
> avail. I also tried using both preg_replace() as well as ereg_replace().
> I spent a lot of time on the regex section of the PHP manual, but I am
> not finding anything. Any advise on how to accomplish this?
> 
>  
> 
>  
> 
>  
> 
> Thanks,
> 
>  
> 
> Jesse Hazen
> 
> 


--- End Message ---
--- Begin Message ---
From: Nitsan Bin-Nun

> If you can point me on the character which control-z creates it would
make
> it easier, I have no idea of it ;)

On Thu, Mar 26, 2009 at 11:06 PM, <[email protected]> wrote:
>>
>> Thanks again. Sad to say, same result.
>>
>> The second option looped an error: Warning: preg_replace():
Compilation
>> failed: nothing to repeat at offset 17

The actual value is 0x1A, and it maps to the ASCII SUB (substitute)
control character. The carrot-Z (^Z) representation is how Unix CLI
software would display it. Many control codes that didn't actually do
anything were printed on the terminals with the carrot prefix. Sometimes
codes that did trigger a function in the terminal would be printed that
way to prevent the function from triggering.

Control-Z is a left over from the CP/M days. It was used to mark the end
of text files, since the original file allocation table (FAT) only
tracked the number of clusters assigned to a file. Some MS-DOS and
MS-Windows applications still tack it on to the end of files. I guess
that's their idea of backward compatibility.

Bob McConnell

--- End Message ---
--- Begin Message ---
Jochem,

Thanks, but this regex did not seem to work for me. At least, not on
Windows. I will not be able to test on linux for a few hours. 

I spoke too soon yesterday, too. Control-Z is a problem on Windows, and
not on Linux. However, on linux, control-D is a problem.


 
 
 
Thanks,
 
Jesse Hazen
-----Original Message-----
From: Jochem Maas [mailto:[email protected]] 
Sent: Thursday, March 26, 2009 11:45 PM
To: Hazen, Jesse, arvato digital services llc
Cc: [email protected]
Subject: Re: [PHP] Regex

[email protected] schreef:
> Hi,
> 
>  
> 
> Brand new to regex. So I have a cli which runs a regex on users input,
> to make sure that only 0-9 and A-Z are accepted. It should strip
> everything else. My problem is that when you press control-Z (on
> Windows; I have not yet tested this on linux, and I will, but I would
> like this to be compatible with both OS's) it loops infinitely saying
> invalid data (because of the next method call, which decides what to
do
> based on your input). So, here is the input code. Is there a way I can
> ensure that control commands are stripped, here?
> 

there is, your control-Z is not a Z at all, and it's only printed as ^Z
so you can see it ... it's actually a non-printing char.

try this regexp for stripping control chars:

/[\x00-\x1f]+/

>  
> 
>  
> 
>  
> 
>             public function getSelection() {
> 
>  
> 
>                         $choice =
> $this->validateChoice(trim(strtoupper(fgets(STDIN))));
> 
>                         return $choice;
> 
>  
> 
>             }
> 
>  
> 
>             private function validateChoice($choice) {
> 
>  
> 
>                         $choice =
> ereg_replace("/[^0-9A-Z]/","",$choice);
> 
>                         return $choice;
> 
>  
> 
>             }
> 
>  
> 
>  
> 
>  
> 
> I have tried a ton of different things to try and fix this. Tried
> /\c.|[^0-9A-Z]/, and many variations of \c and the [^0-9A-Z], to no
> avail. I also tried using both preg_replace() as well as
ereg_replace().
> I spent a lot of time on the regex section of the PHP manual, but I am
> not finding anything. Any advise on how to accomplish this?
> 
>  
> 
>  
> 
>  
> 
> Thanks,
> 
>  
> 
> Jesse Hazen
> 
> 


--- End Message ---
--- Begin Message ---
Bruce,

Sure thing. So basically what I am trying to accomplish is when this
script runs, a menu is displayed to the user, it looks somewhat like
this:



Welcome
        To continue, please select your game mode.

        [Mode]  [Description]
        A.)     Mode A
        B.)     Mode B
        C.)     Mode C
        D.)     Mode D
        E.)     Mode E
        F.)     Mode F
        Q.)     Quit.

        To begin, please type the mode letter.

Mode:

 

Then, the below lines of code come into play:


        public function getSelection() {

                $choice =
$this->validateChoice(trim(strtoupper(fgets(STDIN))));
                return $choice;

        }

        private function validateChoice($choice) {

                $choice = preg_replace("/[\x00-\x1f]+/","",$choice);
                return $choice;

        }


So now the script is waiting for user input. The next thing to happen,
right after this code, is:


        private function validate($choice,$display,$input) {

                $valid = false;
                while(!$valid) {

                        switch($choice) {

                                case "Q":
                                        $display->writeCredits();
                                        sleep(4);
                                        exit(0);
                                case "A":
                                        $valid = true;
                                        break;
                                case "B":
                                        $valid = true;
                                        break;
                                case "C":
                                        $valid = true;
                                        break;
                                case "D":
                                        $valid = true;
                                        break;
                                case "E":
                                        $valid = true;
                                        break;
                                case "F":
                                        $valid = true;
                                        break;
                                default:
                                        $display->writeInvalidChoice();
                                        $choice =
$input->getSelection();
                                        break;
                
                        }

                }

                return $choice;

        }



Now, this is where the script loops infinitely. But, this is only the
first method which validates user input. There are several others.
Basically, my script should accept user input, strip anything that will
not be needed (like anything other than letters and numbers) and then
allow the user to proceed, where the script checks to see if the
numbers/letters they entered correspond to the menu's in any way.

Everything in the script runs perfect, except the fact that the control
statements print infinitely. And while I am sure there is something I
could do to this method to make it not loop infinitely, I would also
need to do this to several other loops. 


 
 
Thanks,
 
Jesse Hazen
-----Original Message-----
From: bruce [mailto:[email protected]] 
Sent: Thursday, March 26, 2009 5:23 PM
To: Hazen, Jesse, arvato digital services llc; [email protected]
Subject: RE: [PHP] Regex

hi...

if you haven't solved your issue... can you tell me in detail what
you're trying to accomplish? what are the steps to running the script?

thanks


-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Thursday, March 26, 2009 1:23 PM
To: [email protected]
Subject: [PHP] Regex


Hi,

 

Brand new to regex. So I have a cli which runs a regex on users input,
to make sure that only 0-9 and A-Z are accepted. It should strip
everything else. My problem is that when you press control-Z (on
Windows; I have not yet tested this on linux, and I will, but I would
like this to be compatible with both OS's) it loops infinitely saying
invalid data (because of the next method call, which decides what to do
based on your input). So, here is the input code. Is there a way I can
ensure that control commands are stripped, here?

 

 

 

 

 

            public function getSelection() {

 

                        $choice =
$this->validateChoice(trim(strtoupper(fgets(STDIN))));

                        return $choice;

 

            }

 

            private function validateChoice($choice) {

 

                        $choice =
ereg_replace("/[^0-9A-Z]/","",$choice);

                        return $choice;

 

            }

 

 

 

I have tried a ton of different things to try and fix this. Tried
/\c.|[^0-9A-Z]/, and many variations of \c and the [^0-9A-Z], to no
avail. I also tried using both preg_replace() as well as ereg_replace().
I spent a lot of time on the regex section of the PHP manual, but I am
not finding anything. Any advise on how to accomplish this?

 

 

 

Thanks,

 

Jesse Hazen


--- End Message ---
--- Begin Message --- Hi Ashley. That's what I'm doing, but want to limit what gets stored to just the content. Every page has a drop-down menu of, for instance, various cities, so I want to exclude that part of the page in my search terms. I don't want every page to think it has content on Calgary, Hamburg, Phoenix, etc. I finally walked myself through the code I had been modifying, and found that they were parsing it line by line with an fgets (rather than word by word). So was able to use Stuart's original idea of surrounding the content with an unique comment line, and setting a flag to tell whether to parse the line or not. If it found the <!-- start_search --> line, it would start parsing, and stop again when it reached the <!-- stop_search --> line. Is also nice that I can then specify multiple sections within the page if I need to.

On 26-Mar-09, at 6:22 PM, Ashley Sheridan wrote:

What about storing all of the page content in the database to start
with, then searching with a mysql statement is a breeze!

On Thu, 2009-03-26 at 16:29 -0600, George Langley wrote:
----- Original Message -----
From: Stuart <[email protected]>
You can't have any extra info in a closing HTML tag. This
problem is
usually handled using comments. Something like the following...

<div id="divContent">
<!-- content begin -->
sofihsod hiosdh sdh gus us u sg
<!-- content end -->
</div>

You then just start with you see the begin comment and stop
when you
hit the end comment.
---------
Hmm, they are stripping out the tags before looking at the words, so didn't work quite as I originally thought. The solution seems to be to explode the string based on the entire comment before doing the word-by-word storing. I wrote up the following test code that seems to work and handles any string or error I could think of. Am wondering if this is good or is there better/more efficient code?


<?php

function contentString($pString, $pStart, $pStop){
        echo "$pString<br />";
        
        $finalArray = array();
        $finalString = "";
        $exploded1 = explode($pStart, $pString); // makes array $exploded1
        
for ($i=1; $i<count($exploded1); $i++) // ignore first item (0) in array
        {
                $exploded2 = explode($pStop, $exploded1[$i]);
array_push($finalArray, $exploded2[0]); // array of just the wanted sections
        }
        foreach ($finalArray as $value3)
        {
$finalString .= $value3 . " "; // " " ensures separation between substrings
        }
$finalString = trim($finalString); // trim any extra white space from beginning/end
        
        echo $finalString;
        echo "<br /><br />";
}

// TEST
        $startTerm = "START";
        $stopTerm = "STOP";
        
        // test typical string
$theString = "one two START three four STOP five six START seven eight STOP nine ten"; contentString($theString, $startTerm, $stopTerm); // outputs "three four seven eight"
        // test string with immediate START
$theString = "START one two STOP three four START five six STOP seven eight START nine ten"; contentString($theString, $startTerm, $stopTerm); // outputs "one two five six nine ten"
        // test string with "error" (2 STARTS)
$theString = "START one two START three four STOP five six START seven eight STOP nine ten"; contentString($theString, $startTerm, $stopTerm); // outputs "one two three four seven eight"
        // test string with no space between separators and real content
$theString = "STARTone twoSTOP three four STARTfive sixSTOP seven eight STARTnine ten"; contentString($theString, $startTerm, $stopTerm); // outputs "one two five six nine ten"
        
?>

Any thoughts/suggestions? Thanks!

George


Ash
www.ashleysheridan.co.uk


George Langley
Multimedia Developer, Audio/Video Editor, Musician, Arranger, Composer

http://www.georgelangley.ca


--- End Message ---
--- Begin Message ---
Does anyone know how to make a ZIP file using PHP?  This is for an
application where the files the user selected will be put into a ZIP
file and then the ZIP file made available for download.  Ron

--- End Message ---
--- Begin Message ---
Ron Piggott wrote:
Does anyone know how to make a ZIP file using PHP?  This is for an
application where the files the user selected will be put into a ZIP
file and then the ZIP file made available for download.  Ron

http://www.php.net/zip would be a good place to start.

Or http://pear.php.net/package/File_Archive if your host can't/won't install the requirements.

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


--- End Message ---
--- Begin Message ---
On Fri, 2009-03-27 at 16:11 +1100, Chris wrote:
> Ron Piggott wrote:
> > Does anyone know how to make a ZIP file using PHP?  This is for an
> > application where the files the user selected will be put into a ZIP
> > file and then the ZIP file made available for download.  Ron
> 
> http://www.php.net/zip would be a good place to start.
> 
> Or http://pear.php.net/package/File_Archive if your host can't/won't 
> install the requirements.
> 
> -- 
> Postgresql & php tutorials
> http://www.designmagick.com/
> 
> 
If you're hosting it yourself, and it's on a Linux platform, you could
shell out and archive it from there. That'll give you the advantage of
using any compression format the OS supports, and lets you do cool
things like spanned rar archives and such.


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
can some tell why the below loop stop running after some time.

$start=10;
const run=0;
while($start >run){

//do somthing

}

-- 
Best Wishes
Andrew Williams

--- End Message ---
--- Begin Message ---
On Fri, 2009-03-27 at 08:11 +0000, Andrew Williams wrote:
> can some tell why the below loop stop running after some time.
> 
> $start=10;
> const run=0;
> while($start >run){
> 
> //do somthing
> 
> }
> 
max_execution_time


--- End Message ---
--- Begin Message ---
-----Original Message-----
From: Andrew Williams [mailto:[email protected]] 
Sent: 27 March 2009 10:12 AM
To: PHP LIST
Subject: [PHP] WHILE LOOP PROBLEM

can some tell why the below loop stop running after some time.

$start=10;
const run=0;
while($start >run){

//do somthing

}

--

The webserver or php environment is probably terminating the script. It will
only run for the max number of seconds set in your php.ini file.

Arno


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

I need to export data from database with UTF-8 encoding to an csv file. I am outputing html tables with the Content Type set to msexcel.

The chinese texts came out as symbols. I tried
using mb_convert_encoding the text from UTF-8 to UTF-16LE
iconv from UTF8 to gb2312
iconv from UTF-8 to cp1252

Can anyone who has successfully export english text with chinese characters mixed in to CSV help?

Thank you very much,
Ai Leen
--- End Message ---
--- Begin Message ---
On Fri, 2009-03-27 at 17:40 +0800, Ai Leen wrote:
> Hi Everyone,
> 
> I need to export data from database with UTF-8 encoding to an csv file. I am 
> outputing html tables with the Content Type set to msexcel.
> 
> The chinese texts came out as symbols. I tried
> using mb_convert_encoding the text from UTF-8 to UTF-16LE
> iconv from UTF8 to gb2312
> iconv from UTF-8 to cp1252
> 
> Can anyone who has successfully export english text with chinese characters 
> mixed in to CSV help?
> 
> Thank you very much,
> Ai Leen 
> 
> 
Strictly speaking, a csv file won't contain HTML markup, so you should
probably just stick to delimited value lines in your file. Have you
tried changing the Content Type to text/plain and then save your PHP
script as utf-8. It's this last one that sometimes causes problems, as I
believe it is needed for PHP to correctly output utf-8.


Ash
www.ashleysheridan.co.uk


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

I've been trying to locate this file and could not find it in the downloads 
area and got this message when I tried - http://pecl4win.php.net/ 

"The pecl4win build box is temporarily out of service. We're preparing a 
new build system. "

Any suggestions?
Thanks. 

--- End Message ---
--- Begin Message ---
Hi.
I'm trying to use the printer functions in my php development.
I add the php_printer.dll in the "c:/php/ext/" path.
I add the line in the php.ini file like that: extension=php_printer.dll.
But that doesn't work and gives the next error:

Fatal error: Call to undefined function printer_open().

What can I do?
Thanks for your help!


Gerardo


--- End Message ---
--- Begin Message ---
On Fri, Mar 27, 2009 at 8:37 AM, Gerardo Picotti <[email protected]>wrote:

> Hi.
> I'm trying to use the printer functions in my php development.
> I add the php_printer.dll in the "c:/php/ext/" path.
> I add the line in the php.ini file like that: extension=php_printer.dll.
> But that doesn't work and gives the next error:
>
> Fatal error: Call to undefined function printer_open().
>
> What can I do?
> Thanks for your help!
>
>
> Gerardo
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Does the php_printer.dll exist in the EXT folder?


-- 

Bastien

Cat, the other other white meat

--- End Message ---
--- Begin Message ---
Yes, dll file exists in this folder: C:\PHP\EXT


Bastien Koert escribió:


On Fri, Mar 27, 2009 at 8:37 AM, Gerardo Picotti <[email protected] <mailto:[email protected]>> wrote:

    Hi.
    I'm trying to use the printer functions in my php development.
    I add the php_printer.dll in the "c:/php/ext/" path.
    I add the line in the php.ini file like that:
    extension=php_printer.dll.
    But that doesn't work and gives the next error:

    Fatal error: Call to undefined function printer_open().

    What can I do?
    Thanks for your help!


    Gerardo


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

Does the php_printer.dll exist in the EXT folder?


--

Bastien

Cat, the other other white meat


--- End Message ---
--- Begin Message ---
Gerardo Picotti wrote:
> Hi.
> I'm trying to use the printer functions in my php development.
> I add the php_printer.dll in the "c:/php/ext/" path.
> I add the line in the php.ini file like that: extension=php_printer.dll.
> But that doesn't work and gives the next error:
> 
> Fatal error: Call to undefined function printer_open().
> 
> What can I do?
> Thanks for your help!
> 
> 
> Gerardo
> 
You restarted your web server?

-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---

Reply via email to