OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 18 Oct 2005 01:42:00 -0000 Issue 3743

php-general-digest-helplists.php.net
Date: Mon Oct 17 2005 - 20:42:00 CDT


php-general Digest 18 Oct 2005 01:42:00 -0000 Issue 3743

Topics (messages 224219 through 224261):

Re: php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742
        224219 by: Aftab Alam
        224221 by: Ravi
        224222 by: Jordan Miller
        224245 by: Richard Lynch
        224252 by: Ben

Re: can't get IIS to run php if the script is not directly under wwwroot
        224220 by: tony yau
        224223 by: Jay Blanchard
        224224 by: tony yau
        224225 by: Jay Blanchard
        224226 by: tony yau
        224227 by: Jay Blanchard
        224233 by: tony yau
        224246 by: Richard Lynch

Invoking a DLL with PHP
        224228 by: Jay Blanchard
        224230 by: Richard Davey
        224235 by: Jay Blanchard
        224237 by: Richard Davey
        224261 by: Gonzalo Monzón

Uploaded CSV -> database
        224229 by: Brian Dunning
        224231 by: Jim Moseby
        224232 by: Jim Moseby
        224234 by: Mark Rees
        224236 by: Jim Moseby
        224238 by: Brian Dunning
        224239 by: Jay Blanchard
        224240 by: Jim Moseby
        224248 by: Ben Litton

PHP5+FastCGI Segmentation Fault
        224241 by: Jason Kovacs

Test
        224242 by: J.Lubelan

PHP and sessions
        224243 by: J.Lubelan

Re: a couple of problems with PHP form
        224244 by: Richard Lynch

Re: Troubleshott GD & Freetype under Linux
        224247 by: Richard Lynch

Re: fckeditor and PDF and pesky users
        224249 by: Richard Lynch
        224250 by: Richard Lynch
        224251 by: Torgny Bjers
        224254 by: Jasper Bryant-Greene
        224255 by: Torgny Bjers
        224256 by: Richard Lynch
        224257 by: Richard Lynch
        224258 by: Jason Karns
        224259 by: Torgny Bjers
        224260 by: Jason Kovacs

Re: Obsession with BC, take 2
        224253 by: Richard Lynch

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


hi,
any one can help me

i want to generate Pdf file using php.
how can i & what tools is required for this.

 

Regards,
  _____

Aftab Alam

-----Original Message-----
From: php-general-digest-helplists.php.net
[mailto:php-general-digest-helplists.php.net]
Sent: Monday, October 17, 2005 4:06 PM
To: php-generallists.php.net
Subject: php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742

php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742

Topics (messages 224207 through 224218):

Funky array question
        224207 by: Brian Dunning
        224209 by: Minuk Choi
        224210 by: Jordan Miller
        224211 by: Jordan Miller
        224212 by: Jordan Miller

Re: editor
        224208 by: yangshiqi1089

a couple of problems with PHP form
        224213 by: Bruce Gilbert
        224218 by: Mark Rees

Re: OPTIMIZING - The fastest way to open and show a file
        224214 by: Ruben Rubio Rey
        224215 by: Ruben Rubio Rey
        224216 by: ac

can't get IIS to run php if the script is not directly under wwwroot
        224217 by: tony yau

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


I just had a small doubt......Is it possible to write JavaScript through PHP???

On 10/17/05, Aftab Alam <aalamtatashare.com> wrote:
> hi,
> any one can help me
>
> i want to generate Pdf file using php.
> how can i & what tools is required for this.
>
>
>
>
>
>
> Regards,
> _____
>
> Aftab Alam
>
>
>
>
> -----Original Message-----
> From: php-general-digest-helplists.php.net
> [mailto:php-general-digest-helplists.php.net]
> Sent: Monday, October 17, 2005 4:06 PM
> To: php-generallists.php.net
> Subject: php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742
>
>
>
> php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742
>
> Topics (messages 224207 through 224218):
>
> Funky array question
> 224207 by: Brian Dunning
> 224209 by: Minuk Choi
> 224210 by: Jordan Miller
> 224211 by: Jordan Miller
> 224212 by: Jordan Miller
>
> Re: editor
> 224208 by: yangshiqi1089
>
> a couple of problems with PHP form
> 224213 by: Bruce Gilbert
> 224218 by: Mark Rees
>
> Re: OPTIMIZING - The fastest way to open and show a file
> 224214 by: Ruben Rubio Rey
> 224215 by: Ruben Rubio Rey
> 224216 by: ac
>
> can't get IIS to run php if the script is not directly under wwwroot
> 224217 by: tony yau
>
> Administrivia:
>
> To subscribe to the digest, e-mail:
> php-general-digest-subscribelists.php.net
>
> To unsubscribe from the digest, e-mail:
> php-general-digest-unsubscribelists.php.net
>
> To post to the list, e-mail:
> php-generallists.php.net
>
>
> ----------------------------------------------------------------------
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


if you have compiled php with pdflib support, you can do this fairly
easily. see the manual:

http://www.php.net/pdf

Jordan

On Oct 17, 2005, at 6:06 AM, Aftab Alam wrote:

> hi,
> any one can help me
>
> i want to generate Pdf file using php.
> how can i & what tools is required for this.
>
>
>
>
>
>
> Regards,
> _____
>
> Aftab Alam
>
>
>
>
> -----Original Message-----
> From: php-general-digest-helplists.php.net
> [mailto:php-general-digest-helplists.php.net]
> Sent: Monday, October 17, 2005 4:06 PM
> To: php-generallists.php.net
> Subject: php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742
>
>
>
> php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742
>
> Topics (messages 224207 through 224218):
>
> Funky array question
> 224207 by: Brian Dunning
> 224209 by: Minuk Choi
> 224210 by: Jordan Miller
> 224211 by: Jordan Miller
> 224212 by: Jordan Miller
>
> Re: editor
> 224208 by: yangshiqi1089
>
> a couple of problems with PHP form
> 224213 by: Bruce Gilbert
> 224218 by: Mark Rees
>
> Re: OPTIMIZING - The fastest way to open and show a file
> 224214 by: Ruben Rubio Rey
> 224215 by: Ruben Rubio Rey
> 224216 by: ac
>
> can't get IIS to run php if the script is not directly under wwwroot
> 224217 by: tony yau
>
> Administrivia:
>
> To subscribe to the digest, e-mail:
> php-general-digest-subscribelists.php.net
>
> To unsubscribe from the digest, e-mail:
> php-general-digest-unsubscribelists.php.net
>
> To post to the list, e-mail:
> php-generallists.php.net
>
>
> ----------------------------------------------------------------------
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>

attached mail follows:


On Mon, October 17, 2005 6:06 am, Aftab Alam wrote:
> i want to generate Pdf file using php.
> how can i & what tools is required for this.

One way is to start here:
http://php.net/pdf

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Richard Lynch said the following on 10/17/05 13:14:
> On Mon, October 17, 2005 6:06 am, Aftab Alam wrote:
>
>>i want to generate Pdf file using php.
>>how can i & what tools is required for this.
>
>
> One way is to start here:
> http://php.net/pdf
>
>

When reading the above link note the last sentence under the
Installation heading. You want to install the pdflib extension using
PEAR with the command:
pear install pdflib

Once you've done that edit your php.ini and make sure it includes the line:
extension=pdf.so

Then restart your web server.

- Ben

attached mail follows:


Hi,

the security for my 'Project' folder (aliases 'phpproject' where test.php
is under) has

Access Permission:
Read, Script source access, Write, Directory Browsing

Application permission:
Execute(includes scripts)

under window explorer I've allowed Everyone and Internet Guest Account Full
control and both allow inheritable permission from parent. (I'm logged in
with Admin prev)

thanks
Tony

"tony yau" <tony.yauemigen.co.uk> wrote in message
news:divo68$uvd$1sea.gmane.org...
> Can someone help please,
>
> in w2k, when i put a test.php directly under wwwroot then it works, when i
> try using a virtual directory
> it fails/refused to run the script?!
>
> any hint anyone?
>
> --
> Tony
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


[snip]
the security for my 'Project' folder (aliases 'phpproject' where test.php
is under) has

Access Permission:
Read, Script source access, Write, Directory Browsing

Application permission:
Execute(includes scripts)

under window explorer I've allowed Everyone and Internet Guest Account Full
control and both allow inheritable permission from parent. (I'm logged in
with Admin prev)
[/snip]

Using Internet Information Services right click on the folder and then click
Properties. To the right of the Execute Permissions box click the
Configuration button. Click on the App Mapping tab and look for the PHP
extension. If it is not there you did not set up the Virtual Directory
properly.

attached mail follows:


Executable : C:\Apache\Apache2\php501\php5isapi.dll
Extension .php
Verb All
checked Script engine

I've have tried php.exe here but with no joy!
Tony

"Jay Blanchard" <jay.blanchardTHERMON.com> wrote in message
news:0CEC8258A6E4D611BE5400306E1CC9270915A873smtmb.tmc.local...
> [snip]
> the security for my 'Project' folder (aliases 'phpproject' where test.php
> is under) has
>
> Access Permission:
> Read, Script source access, Write, Directory Browsing
>
> Application permission:
> Execute(includes scripts)
>
> under window explorer I've allowed Everyone and Internet Guest Account
Full
> control and both allow inheritable permission from parent. (I'm logged in
> with Admin prev)
> [/snip]
>
> Using Internet Information Services right click on the folder and then
click
> Properties. To the right of the Execute Permissions box click the
> Configuration button. Click on the App Mapping tab and look for the PHP
> extension. If it is not there you did not set up the Virtual Directory
> properly.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


[snip]
Executable : C:\Apache\Apache2\php501\php5isapi.dll
Extension .php
Verb All
checked Script engine

I've have tried php.exe here but with no joy!
[/snip]

Did you install PHP as a CGI or ISAPI?

attached mail follows:


Hi Jay

thanks for your time.
i installed it as ISAPI

can i ask if you have had IIS5 on win2k professional running php scripts
that is not under the \wwwroot ?
some how i getting to think it can't (?!) be done although it does work for
II6 win2003 server!

Tony

"Jay Blanchard" <jay.blanchardTHERMON.com> wrote in message
news:0CEC8258A6E4D611BE5400306E1CC9270915A874smtmb.tmc.local...
> [snip]
> Executable : C:\Apache\Apache2\php501\php5isapi.dll
> Extension .php
> Verb All
> checked Script engine
>
> I've have tried php.exe here but with no joy!
> [/snip]
>
> Did you install PHP as a CGI or ISAPI?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


[snip]
thanks for your time.
i installed it as ISAPI

can i ask if you have had IIS5 on win2k professional running php scripts
that is not under the \wwwroot ?
some how i getting to think it can't (?!) be done although it does work for
II6 win2003 server!
[/snip]

I have IIS5 installed on W2K Pro running PHP scripts in virtual directories.
Try commenting the doc_root line in your php.ini and then restarting IIS.
This has been known to cause some problems with virtuals. Make sure that
php.ini can be read by everyone.

attached mail follows:


THANKS JAY, YOU ARE A SAINT :)

I commented out the doc_root and restart and it came alive :)

Thank you all
Tony

"Jay Blanchard" <jay.blanchardTHERMON.com> wrote in message
news:0CEC8258A6E4D611BE5400306E1CC9270915A875smtmb.tmc.local...
> [snip]
> thanks for your time.
> i installed it as ISAPI
>
> can i ask if you have had IIS5 on win2k professional running php scripts
> that is not under the \wwwroot ?
> some how i getting to think it can't (?!) be done although it does work
for
> II6 win2003 server!
> [/snip]
>
> I have IIS5 installed on W2K Pro running PHP scripts in virtual
directories.
> Try commenting the doc_root line in your php.ini and then restarting IIS.
> This has been known to cause some problems with virtuals. Make sure that
> php.ini can be read by everyone.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


On Mon, October 17, 2005 6:24 am, tony yau wrote:
> the security for my 'Project' folder (aliases 'phpproject' where
> test.php
> is under) has

Are there any security settings on the alias itself 'phpproject'?

Is an alias folder the same as a "shortcut" like you make in Windows
desktop explorer thingie?

Cuz those damn things are useless to anything but Windows Explorer
itself, as far as I could ever tell...

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Good morning gurus and gurettes!

I have been asked (and I think that we may have discussed this before in
general terms, a long time ago) to perform the preliminary analysis on a
project that ideally would have me invoking an existing .DLL using PHP. I
have been googling for tidbits for several days without much luck. I have
not built a test, but I will be doing so later today or tomorrow.

Does anyone have any insight to this type of process? Would I have to build
a PHP extension and compile the DLL as part of PHP's configuration? Ideally
the DLL would be a black box that could be accessed utilizing functions that
I build without a re-compile of any type.

Thanks for any insight that you may have...all clues welcome!

attached mail follows:


Hi Jay,

Monday, October 17, 2005, 3:20:58 PM, you wrote:

> Does anyone have any insight to this type of process? Would I have
> to build a PHP extension and compile the DLL as part of PHP's
> configuration? Ideally the DLL would be a black box that could be
> accessed utilizing functions that I build without a re-compile of
> any type.

Have only done this once, but I didn't compile the DLL into PHP
because that would have meant updating the php build every time a new
DLL was released, and updating the functions / documentation
accordingly.

The DLL was built specifically with a COM interface which I accessed
using the PHP COM functions (as I'm sure you've seen already). The DLL
authors had to rejig their original code a little, but it was a far
less painful process than compiling the DLL into PHP. However for the
next revision we are likely to move the DLL code into the .NET
framework, build a SOAP interface to it (C#) and let PHP talk to it
that way. Although that's more of a political decision than a
technical one, I'm just mentioning it incase the idea is useful for
you.

Cheers,

Rich
--
Zend Certified Engineer
http://www.launchcode.co.uk

attached mail follows:


[snip]
The DLL was built specifically with a COM interface which I accessed using
the PHP COM functions (as I'm sure you've seen already). The DLL authors had
to rejig their original code a little, but it was a far
less painful process than compiling the DLL into PHP. However for the next
revision we are likely to move the DLL code into the .NET framework, build a
SOAP interface to it (C#) and let PHP talk to it that way. Although that's
more of a political decision than a technical one, I'm just mentioning it
incase the idea is useful for you.
[/snip]

Unfortunately I may not be able to have the DLL re-built with the COM
interface. It is an older DLL containing engineering functions and it is
huge. The real dingle here is that I only need to access some of the
functionality of the DLL. I also do not want to compile it into PHP as it
(the DLL) is a moving target. This may be one of those projects where I say,
"Give me some more development folks and we'll get it done right." otherwise
we may not be able to do the project as it exists.

I am researching the requirements for adding the COM interface now.

attached mail follows:


Hi Jay,

Monday, October 17, 2005, 4:15:58 PM, you wrote:

> Unfortunately I may not be able to have the DLL re-built with the
> COM interface. It is an older DLL containing engineering functions
> and it is huge. The real dingle here is that I only need to access
> some of the functionality of the DLL. I also do not want to compile
> it into PHP as it (the DLL) is a moving target.

If the resources allow, you could always write a small command-line
driven Windows app that passes arguments through to the DLL functions
and returns the results? Then exec() the app. It's a bit too messy for
my liking, but it's certainly an option.

Cheers,

Rich
--
Zend Certified Engineer
http://www.launchcode.co.uk

attached mail follows:


Richard Davey escribió:

>Hi Jay,
>
>Monday, October 17, 2005, 4:15:58 PM, you wrote:
>
>
>
>>Unfortunately I may not be able to have the DLL re-built with the
>>COM interface. It is an older DLL containing engineering functions
>>and it is huge. The real dingle here is that I only need to access
>>some of the functionality of the DLL. I also do not want to compile
>>it into PHP as it (the DLL) is a moving target.
>>
>>
>
>If the resources allow, you could always write a small command-line
>driven Windows app that passes arguments through to the DLL functions
>and returns the results? Then exec() the app. It's a bit too messy for
>my liking, but it's certainly an option.
>
>Cheers,
>
>Rich
>
>
Hi all,

I did some succesful works on this issue using php4, i don't know if all
the methods i'm going to tell you work for php5 anyway.

The details of what you need to do with that dll from the php code or
the way the target dll works will let you take one or other way... These
are some of them:

You can build your own dll -or use that older dll as you say-, assuming
it have exported the necessary functions and calling them using the
php_w32api extension, just register necessary types, functions and
you're ready to go, without any kind of recompilation of php or any dll
static linking, the dll is just loaded when you register the dll
functions from the php code using that beautiful extension. There are
some tricks if you take this way, in relation with the type and size of
data you need to send or receive from the dll, but it works pretty well.
And you could code your own dll wrapper interface to the older dll if
some workaround is needed to have it working -perhaps callbacks, hard
data types, etc.-

Anyway could be a bit hard to success if you have to send or receive
complex data types like arrays, pointers, handles, etc. etc. but it
really depends on what you need to do with your data in the dll side,
maybe you could serialize and send as a string for the whole array
-excuse me, sure this is a bit off topic for your case-, or perhaps you
could call a function per every single item in the array you want to
send to the dll, then when finished maybe call another function to
process the previously loaded data. Calls via this extension really go
very fast and cause very low overhead.

Another way is by using your dll from a COM interface as Richard says,
an easy way to do this could be create an activex dll from Vb6 (that
"dll" or "exe" is just a com server or maybe you want to call it "ole",
but for this is just the same thing). Then, you could write the needed
code in Vb for your functionality or perhaps wrapping the dll with this
Vb activex object. This way you can send from php easily complex data
types like arrays, and use an oo interface to the dll. Maybe you will
need to hide some of the complexities with data types in the Vb COM
interface instead of having to lead with this in the php code -what
happens with the first way exposed-. So for some uses this can be
better. The worse is that you need to register the object in the
registry, as it is a COM server.

One more way is to create your library functions -or wrapper functions-
within a vc++ executable, and embed php into it, this way you can code
the php-dll interface as you were coding a php extension and use that
functions as php functions and methods, linking your project with
php_embed and handling it inside your executable to do the work. Of
course, this way isn't really possible if you need to have php running
on a webserver, as you need to link dynamically with php4_ts.dll

These methods give you poweful ways to extend or workaround over php
limits... :-P

So that was my 2cents. :^)

Hope it helps to clears a bit what could you do to get the job done.

Gonzalo.

attached mail follows:


Does anyone have an example of code to process a CSV file submitted
via a file upload and parse it out in order to write its records to a
db?

Hopefully yours,

- Brian

attached mail follows:


> -----Original Message-----
> From: Brian Dunning [mailto:brianbriandunning.com]
> Sent: Monday, October 17, 2005 10:37 AM
> To: php-generallists.php.net
> Subject: [PHP] Uploaded CSV -> database
>
>
> Does anyone have an example of code to process a CSV file submitted
> via a file upload and parse it out in order to write its
> records to a
> db?
>

With MYSQL (assuming permissions and such are in order) You would simply:

$sql="load data local infile '/path/to/csv' into table tablename fields
terminated by ','";

JM

attached mail follows:


> -----Original Message-----
> From: Jim Moseby [mailto:JMosebynrbindustries.com]
> Sent: Monday, October 17, 2005 10:41 AM
> To: 'Brian Dunning'; php-generallists.php.net
> Subject: RE: [PHP] Uploaded CSV -> database
>
>
> > -----Original Message-----
> > From: Brian Dunning [mailto:brianbriandunning.com]
> > Sent: Monday, October 17, 2005 10:37 AM
> > To: php-generallists.php.net
> > Subject: [PHP] Uploaded CSV -> database
> >
> >
> > Does anyone have an example of code to process a CSV file
> submitted
> > via a file upload and parse it out in order to write its
> > records to a
> > db?
> >
>
>
> With MYSQL (assuming permissions and such are in order) You
> would simply:
>
> $sql="load data local infile '/path/to/csv' into table
> tablename fields
> terminated by ','";
>

I should amend this to say that the columns in your CSV file, and in the
table must match for this to work.

If you wanted to parse through it line by line and do it all manually, check
out the fread() and explode() functions in the PHP manual.

JM

attached mail follows:


> > -----Original Message-----
> > From: Jim Moseby [mailto:JMosebynrbindustries.com]
> > Sent: Monday, October 17, 2005 10:41 AM
> > To: 'Brian Dunning'; php-generallists.php.net
> > Subject: RE: [PHP] Uploaded CSV -> database
> >
> >
> > > -----Original Message-----
> > > From: Brian Dunning [mailto:brianbriandunning.com]
> > > Sent: Monday, October 17, 2005 10:37 AM
> > > To: php-generallists.php.net
> > > Subject: [PHP] Uploaded CSV -> database
> > >
> > >
> > > Does anyone have an example of code to process a CSV file
> > submitted
> > > via a file upload and parse it out in order to write its
> > > records to a
> > > db?
> > >
> >
> >
> > With MYSQL (assuming permissions and such are in order) You
> > would simply:
> >
> > $sql="load data local infile '/path/to/csv' into table
> > tablename fields
> > terminated by ','";
> >
>
> I should amend this to say that the columns in your CSV file, and in the
> table must match for this to work.
>
> If you wanted to parse through it line by line and do it all manually,
check
> out the fread() and explode() functions in the PHP manual.

and don't forget fgetcsv()

attached mail follows:


> -----Original Message-----
> From: Mark Rees [mailto:mreesitsagoodprice.com]
> Sent: Monday, October 17, 2005 11:11 AM
> To: php-generallists.php.net
> Subject: Re: [PHP] Uploaded CSV -> database
>
>
> > > -----Original Message-----
> > > From: Jim Moseby [mailto:JMosebynrbindustries.com]
> > > Sent: Monday, October 17, 2005 10:41 AM
> > > To: 'Brian Dunning'; php-generallists.php.net
> > > Subject: RE: [PHP] Uploaded CSV -> database
> > >
> > >
> > > > -----Original Message-----
> > > > From: Brian Dunning [mailto:brianbriandunning.com]
> > > > Sent: Monday, October 17, 2005 10:37 AM
> > > > To: php-generallists.php.net
> > > > Subject: [PHP] Uploaded CSV -> database
> > > >
> > > >
> > > > Does anyone have an example of code to process a CSV file
> > > submitted
> > > > via a file upload and parse it out in order to write its
> > > > records to a
> > > > db?
> > > >
> > >
> > >
> > > With MYSQL (assuming permissions and such are in order) You
> > > would simply:
> > >
> > > $sql="load data local infile '/path/to/csv' into table
> > > tablename fields
> > > terminated by ','";
> > >
> >
> > I should amend this to say that the columns in your CSV
> file, and in the
> > table must match for this to work.
> >
> > If you wanted to parse through it line by line and do it
> all manually,
> check
> > out the fread() and explode() functions in the PHP manual.
>
> and don't forget fgetcsv()

Thanks! Good one. I didn't forget it, I just didn't know about it. :-)

JM

attached mail follows:


It looks like all of those tips will easily cover me for the latter
half of the operation. Any tips on how to get the uploaded CSV file
into memory in order to attack it with fgetcsv()? I'd rather not ever
have to actually write the file to the server's disk.

Thanks!

attached mail follows:


[snip]
It looks like all of those tips will easily cover me for the latter
half of the operation. Any tips on how to get the uploaded CSV file
into memory in order to attack it with fgetcsv()? I'd rather not ever
have to actually write the file to the server's disk.
[/snip]

Once you have performed move_uploaded_file() you will have to fopen and loop
through the file to read and perform error checking. After you have
processed the file you could then unlink() it, removing it from the server's
disk. Here is an example where Excel files are uploaded as tab delimited
text;

/*real file name*/
$fileName = ($HTTP_POST_FILES['docfile']['name']);
$docWork = "/path/to/file/after/move/";

move_uploaded_file($HTTP_POST_FILES['docfile']['tmp_name'], $docWork .
$fileName) or die("File cannot be uploaded");

/*
** open uploaded file and do stuff to it
*/
$i = 0;
$fileTab = fopen($docWork.$fileName, "r");
        while(!feof($fileTab)){
                $fileLine = fgets($fileTab, 1024);

                $arrLine = explode("\t", $fileLine);
                $cmLength = strlen($arrLine[0]);

        /* do other stuff here */
        }
fclose($fileTab);

attached mail follows:


> -----Original Message-----
> From: Brian Dunning [mailto:brianbriandunning.com]
> Sent: Monday, October 17, 2005 11:39 AM
> To: php-generallists.php.net
> Subject: Re: [PHP] Uploaded CSV -> database
>
>
> It looks like all of those tips will easily cover me for the latter
> half of the operation. Any tips on how to get the uploaded CSV file
> into memory in order to attack it with fgetcsv()? I'd rather
> not ever
> have to actually write the file to the server's disk.
>
> Thanks!
>

If you are using the "standard" file upload facilities, your file is being
written to disk when it is being uploaded. As far as I can tell, fgetcsv()
will only read a file from disk:

<?php // from the manual
$row = 1;
$handle = fopen ("test.csv","r");
while ($data = fgetcsv ($handle, 1000, ",")) {
    $num = count ($data);
    print "<p> $num fields in line $row: <br>\n";
    $row++;
    for ($c=0; $c < $num; $c++) {
        print $data[$c] . "<br>\n";
    }
}
fclose ($handle);
?>

If you are instead using a socket connection to receive the file in a stream
from the client, you could assign it to a string variable, and use
explode().

These are fairly uncharted territories for me, so others will likely have
better answers.

JM

attached mail follows:


Actually I think fgetcsv will work with any valid file pointer and at
least in PHP 5, the streams implementation will allow you to use a variety
of protocols to create the stream.

http://us2.php.net/manual/en/wrappers.php

I understand that it isn't even too teribbly difficult to implement your
own stream if one isn't already to your liking, but I'm afraid I haven't
found need to go beyond the simple read-a-file-from disk style operation.

Ben

On Mon, 17 Oct 2005 11:45:04 -0400, Jim Moseby <JMosebynrbindustries.com>
wrote:

>> -----Original Message-----
>> From: Brian Dunning [mailto:brianbriandunning.com]
>> Sent: Monday, October 17, 2005 11:39 AM
>> To: php-generallists.php.net
>> Subject: Re: [PHP] Uploaded CSV -> database
>>
>>
>> It looks like all of those tips will easily cover me for the latter
>> half of the operation. Any tips on how to get the uploaded CSV file
>> into memory in order to attack it with fgetcsv()? I'd rather
>> not ever
>> have to actually write the file to the server's disk.
>>
>> Thanks!
>>
>
> If you are using the "standard" file upload facilities, your file is
> being
> written to disk when it is being uploaded. As far as I can tell,
> fgetcsv()
> will only read a file from disk:
>
> <?php // from the manual
> $row = 1;
> $handle = fopen ("test.csv","r");
> while ($data = fgetcsv ($handle, 1000, ",")) {
> $num = count ($data);
> print "<p> $num fields in line $row: <br>\n";
> $row++;
> for ($c=0; $c < $num; $c++) {
> print $data[$c] . "<br>\n";
> }
> }
> fclose ($handle);
> ?>
>
> If you are instead using a socket connection to receive the file in a
> stream
> from the client, you could assign it to a string variable, and use
> explode().
>
> These are fairly uncharted territories for me, so others will likely have
> better answers.
>
> JM

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

attached mail follows:


Hello,

I have Apache 2, PHP5 (cgi-fcgi), FastCGI, and Suexec on FC4 64-bit, and it works for the most part,
but some 3rd-party PHP software written for PHP4 will break and in my error_log I've seen the message:

"FastCGI: (dynamic) server /.../php-fcgi terminated due to uncaught signal '11' (Segmentation fault)",

causing it to flood the error_log with messages that it could not remain running for 30 sec and its restart
was backed off to 600 seconds, then reports an Internal Server Error.

Is this normal or expected from some PHP scripts, or is there a misconfiguration in my setup?
How do I troubleshoot this? Any help would be appreciated, thanks.

-Jason Kovacs

attached mail follows:


test

attached mail follows:


Hello

Can anybody help me with sessions?
Where is the problem? I start session in "start.php" script.

<?php // start.php script
session_name('test');
session_start();
$_SESSION['fig1'] = 'split';
..
..
..
$split = "http://". $_SERVER['HTTP-HOST']. dirname($_SERVER['PHP_SELF']).
"/split.php";
?>
<a href=<?php echo $split ?> target="_blank" title="Split user">Split
testing</a>

______________________________________________________

After link cliking in IE or OPERA they start new session. How can I conect
to existing session?

<?php // split.php
session_name('test');
session_start(); // unable to connect to existing session, create another
one.
?>
..
..
..

I used this two scripts wit DeepNet Explorer and all works fine, but in IE
and OPERA function session_start() called from split.php start new session
so I can't read $_SESSON array than.

Thanks for any hints

attached mail follows:


On Mon, October 17, 2005 5:32 am, Mark Rees wrote:
> -----------------------------------------------------
> sorry, my editor has not indented again
> -----------------------------------------------------
> also, I want the field to appear hilighted when there is no
> information so I am doing this:
>
> <input class="<? if($error_msg){ echo "error"; } ELSE { echo
> "normal"; } id="firstname" name="firstname" type="text"
> value="{$_POST['firstname']}"? />"

I think the quote mark balancing is messed up here...

<input class="
this starts a quote for the class=

There appears to be no ending quote for that...

It may simply have been lost in email editing, however...

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Sat, October 15, 2005 11:24 am, Feris Thia C. wrote:
> My PHP engine still cannot load JPEG library (GD) and Freetype
> fonts...
>
> I use ./config.nice to reconfigure PHP coz it works... and I have
> compile it
> with --jpeg-dir options. And seems not working at all.
>
> How can I troubleshoot and resolve these problems ?

When you run configure (or config.nice) it generates a BUNCH of text
output.

It also logs a BUNCH of stuff to a log file in that same directory.

Re-direct the output and/or look in that log file for WARNING or ERROR
messages from the configure.

configure considers some command-line options such as --jpeg-dir as
"non-fatal" and cheerfully continues on its merry way, giving you a
"valid" PHP compile with, errr, not quite what you asked for. :-^

I've long considered this a "bug" personally, though have never
persuaded anybody else to my way of thinking...

Most likely, the --jpeg-dir and/or the --with-gd are not quite right,
and you just need to adjust a directory name somewhere, or put in some
symlinks so "configure" finds the stuff it is looking for where it
expects to find it, instead of where you (or your RPMs) put it.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Sat, October 15, 2005 7:26 am, Edward Vermillion wrote:
> Do they want the PDF to display in the page, or is a link to a PDF ok
> for them?

I've already warned them that a PDF embedded into a page is impossible.

That may not be true, technically, for all I know, but I've sure never
seen it, and don't even want to try to go somewhere that so few have
gone.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Fri, October 14, 2005 6:03 pm, Jason Kovacs wrote:
> Richard Lynch said the following on Friday, October 14, 2005 3:39 PM:
>
>> So...
>>
>> Do I:
>>
>> A) Attempt to hack fckEditor to "allow" a PDF to get uploaded, and
>> then display a link to the PDF instead of alink to the fckEditor
>> output.
>>
>> B) Give them a separate, possibly confusing, input to upload files
>> to
>> tie in as links to the fckEditor area
>
> I've had success with this, creating a seperate utility to upload
> documents
> to the filesystem and keeping track of them in mysql. I chose to
> allow
> displaying the PDF's and Doc's through links in the FCKEditor content,
> because I have never found a way to embed the PDF data into pages.

I don't think PDF embedded into pages exists...

Not saying for sure it doesn't, and sure not saying it SHOULDN'T, but
I've told them it ain't happening for them in the time-frame we've
got. :-)

> I added a custom drop-down menu to FCKEditor's Link window that fills
> in the URL upon selecting the menu item, but this url consisted of
> just a
> path to a redirect.php script where I set a GET variable to the ID of
> the
> document, then passing through the PDF or DOC data. Though you could
> link the full path to the PDF in the URL, I just had my documents
> stored
> behind the web-accessible address. Every time a new document was
> uploaded, I decided to write the URL's statically to a file that the
> FCKEditor script (changed fck_link.html to fck_link.php) will read
> into
> Javascript arrays, as opposed to accessing the DB every time this Link
> window was viewed. I added about 50 lines of Javascript code to
> fck_link.php to do what I wanted in setting the URL from the Select
> list.

Sweet!

> I must warn you though, every time that I upgrade FCKEditor, I have to
> reapply the changes I've done and there is the possibility that the
> FCKEditor scripts may change to cause compatibility problems. Let me
> know if you are interested in this route and I can post my alterations
> to
> FCKEditor,

Please do!

> but the PDF file management is up to you.

Oh yeah. That's for sure.

> I've had many
> non-technical users working with this utility just fine for about 6
> months,
> so it works and though its not the most graceful implementation from a
> developer's standpoint, it makes the user interface easiest to work
> with.

It certainly sounds like a very good solution.

Be really nifty if fckEditor folks took a look at it and considered
adding it as a feature.

We can't be the only ones needing this kind of thing.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Richard Lynch wrote:

>On Sat, October 15, 2005 7:26 am, Edward Vermillion wrote:
>
>
>>Do they want the PDF to display in the page, or is a link to a PDF ok
>>for them?
>>
>>
>
>I've already warned them that a PDF embedded into a page is impossible.
>
>That may not be true, technically, for all I know, but I've sure never
>seen it, and don't even want to try to go somewhere that so few have
>gone.
>
>

I think you would be able to use an IFRAME, or even a FRAME, to load the
PDF into like you would open it in any normal browser using the standard
PDF plugin that's used when you click a PDF in your browser. That is,
set the src of the iframe to the path of the PDF. Give it a try and let
us know how it works out. IFRAMEs are smart sometimes, especially when
building application interfaces.

Regards,
Torgny

attached mail follows:


Richard Lynch wrote:

> On Sat, October 15, 2005 7:26 am, Edward Vermillion wrote:
>
> > Do they want the PDF to display in the page, or is a link to a PDF
> > ok for them?
>
>
> I've already warned them that a PDF embedded into a page is
> impossible.
>
> That may not be true, technically, for all I know, but I've sure
> never seen it, and don't even want to try to go somewhere that so few
> have gone.
>

I would expect that putting the PDF in an <iframe> would work, but I
wouldn't trust browsers or the Acrobat plugin to not crash horribly in
that sort of situation. It's also going to be very confusing for users
seeing the Acrobat toolbar floating in the middle of their page.

It would be interesting to see some tests of PDF-in-<iframe> done in
various different browsers, but unless it just happened to work
perfectly in every common browser (we can all dream, can't we?) I
wouldn't touch it.

Jasper

attached mail follows:


Jasper Bryant-Greene wrote:

> Richard Lynch wrote:
>
>> On Sat, October 15, 2005 7:26 am, Edward Vermillion wrote:
>>
>> > Do they want the PDF to display in the page, or is a link to a PDF
>> > ok for them?
>>
>>
>> I've already warned them that a PDF embedded into a page is
>> impossible.
>>
>> That may not be true, technically, for all I know, but I've sure
>> never seen it, and don't even want to try to go somewhere that so few
>> have gone.
>>
>
> I would expect that putting the PDF in an <iframe> would work, but I
> wouldn't trust browsers or the Acrobat plugin to not crash horribly in
> that sort of situation. It's also going to be very confusing for users
> seeing the Acrobat toolbar floating in the middle of their page.
>
> It would be interesting to see some tests of PDF-in-<iframe> done in
> various different browsers, but unless it just happened to work
> perfectly in every common browser (we can all dream, can't we?) I
> wouldn't touch it.
>
> Jasper

After some consideration I am pretty sure it works, since an <iframe/>
is just the same as a <frame/>, and I am dead certain you can open a PDF
document, or a Word document, or a Flash file, inside a frame without
anything crashing. As for the PDF toolbar, I think that with the proper
CSS styles on the <iframe/> element you can make it pretty apparent that
the <iframe/> contains a PDF document.

Also, when using <iframe/> you are weeding out those old browsers that
wouldn't support even loading an <iframe/>, which means that you get
relatively new browsers, and those should all support this method.

Besides, if this is for an editor interface, for a specific client, one
could reasonably demand that they use at least one of the newer browsers
such as IE5+ or Mozilla. If not for a specific client, or subset of
clients, but for a general update of an entire application that is open
sourced, I agree with Jasper, don't touch it. :)

Regards,
Torgny

attached mail follows:


On Mon, October 17, 2005 3:31 pm, Torgny Bjers wrote:
> I think you would be able to use an IFRAME, or even a FRAME, to load
> the
> PDF into like you would open it in any normal browser using the
> standard
> PDF plugin that's used when you click a PDF in your browser. That is,
> set the src of the iframe to the path of the PDF. Give it a try and
> let
> us know how it works out. IFRAMEs are smart sometimes, especially when
> building application interfaces.

I'm the kind of guy who considers CSS and JavaScript too unreliable
with older browsers to use...

I don't think I'm gonna be testing iFrames out any time soon.

Plus, I *KNOW* that some users (e.g., me) configure Acrobat to *NOT*
put a PDF in my browser, but open a separate application, because
that's invariably the way I want to view it, flipping back-and-forth
to the 'net to cross-ref with both windows open.

So, even if it sort of worked, for users who don't do that, or even if
I could force it to work, and not LET them open up in another window,
I don't think that's a Good Idea for keeping happy users, so that
ain't gonna happen either.

But that's just me.

Somebody else reading this thread might say "keen-o" and do it.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Mon, October 17, 2005 3:56 pm, Torgny Bjers wrote:
> Also, when using <iframe/> you are weeding out those old browsers that

If somebody else wants to weed out old browsers, that's all fine and
good, but that's not me...

> Besides, if this is for an editor interface, for a specific client,
> one
> could reasonably demand that they use at least one of the newer
> browsers
> such as IE5+ or Mozilla. If not for a specific client, or subset of
> clients, but for a general update of an entire application that is
> open
> sourced, I agree with Jasper, don't touch it. :)

I personally don't think I should demand editors use a specific browser.

I believe in customer choice.

For that matter, *I* probably don't use a browser that does this
right, being as I'm usually on Linux, almost always on Netscape, and
very very very rarely do PDF and/or Flash work really right for me.

And you know what?

I very very very seldom care badly enough about any of the content I'm
"missing" and when I do care enough to go get it, I'm disappointed by
the content more often than I'm pleased that I took that effort.

Again, this is obviously MY weird world-view at work here. :-)

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


>-----Original Message-----
>From: Richard Lynch [mailto:ceol-i-e.com]
>Sent: Monday, October 17, 2005 5:11 PM
>To: Torgny Bjers
>Cc: php-generallists.php.net
>Subject: Re: [PHP] fckeditor and PDF and pesky users
>
>On Mon, October 17, 2005 3:56 pm, Torgny Bjers wrote:
>> Also, when using <iframe/> you are weeding out those old browsers that
>
>If somebody else wants to weed out old browsers, that's all fine and good,
but that's not me...
>
>> Besides, if this is for an editor interface, for a specific client,
>> one could reasonably demand that they use at least one of the newer
>> browsers such as IE5+ or Mozilla. If not for a specific client, or
>> subset of clients, but for a general update of an entire application
>> that is open sourced, I agree with Jasper, don't touch it. :)
>
>I personally don't think I should demand editors use a specific browser.
>
>I believe in customer choice.
>
>For that matter, *I* probably don't use a browser that does this right,
being as I'm usually on Linux, almost always on Netscape, and very very very
>rarely do PDF and/or Flash work really right for me.
>
>And you know what?
>
>I very very very seldom care badly enough about any of the content I'm
"missing" and when I do care enough to go get it, I'm disappointed by the
content >more often than I'm pleased that I took that effort.
>
>Again, this is obviously MY weird world-view at work here. :-)
>
>--
>Like Music?
>http://l-i-e.com/artists.htm
>
>--
>PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
>

Not that you'd want to use a deprecated tag, but using an embed tag with a
src value pointing to a PDF file (with appropriate height/width) will render
the entire Adobe plugin with toolbars and all directly in the page, as
demonstrated here:
http://www.cstv.com/auto_pdf/p_hotos/s_chools/osu/sports/m-footbl/auto_pdf/w
eekly-release

Jason Karns

attached mail follows:


Richard Lynch wrote:

>On Mon, October 17, 2005 3:56 pm, Torgny Bjers wrote:
>
>
>>Also, when using <iframe/> you are weeding out those old browsers that
>>
>>
>
>If somebody else wants to weed out old browsers, that's all fine and
>good, but that's not me...
>
>

Didn't say I wanted to. It was a suggestion. :) I personally prefer Lynx
when I am surfing, since then I get rid of everything, including images,
javascript, and plugins -- just me and text. Nah, seriously, I kind of
like Firefox since 80x25 text space in lynx can get a bit annoying when
navigating a site that somebody added a bzillion images to, but let's
not talk about browsers and favorites, since that'd be another long
ardous flame fest. :P

>>Besides, if this is for an editor interface, for a specific client,
>>one
>>could reasonably demand that they use at least one of the newer
>>browsers
>>such as IE5+ or Mozilla. If not for a specific client, or subset of
>>clients, but for a general update of an entire application that is
>>open
>>sourced, I agree with Jasper, don't touch it. :)
>>
>>
>
>I personally don't think I should demand editors use a specific browser.
>
>I believe in customer choice.
>
>For that matter, *I* probably don't use a browser that does this
>right, being as I'm usually on Linux, almost always on Netscape, and
>very very very rarely do PDF and/or Flash work really right for me.
>
>And you know what?
>
>I very very very seldom care badly enough about any of the content I'm
>"missing" and when I do care enough to go get it, I'm disappointed by
>the content more often than I'm pleased that I took that effort.
>
>Again, this is obviously MY weird world-view at work here. :-)
>
>
I wasn't trying to advocate you doing something you don't want to do. If
you consider the feature worth implementing, weighing the options, you
implement it, or you don't, either way, your choice. I merely stated
that it does work, when using a recent browser.

The <iframe/> tag was added in IE3+ which is pretty darn old, and if
you've seen ANYBODY using anything Microsoft-made prior to IE3 in your
server logs of late, let me know. :)

The following major browsers have support for <iframe/>:

Internet Explorer for Macintosh: 5.2 (not sure about 5.1)
Internet Explorer: 3.0 and above
Mozilla: 1.0 and above
Netscape Navigator: above 4.0 (which should be 6.0)
Opera: 4.0 and above
Safari: 1.0 and above

So, if you use one of these browsers, and considering that you rarely
(I'd say about %1-5) see people using anything below these versions,
you'd be safe adding an <iframe/> if you wanted to. If the browser does
not have support for <iframe/> it will ignore the tag and it won't break
anything at all.

As Jason Karns showed in the example from cstv, and you could test that
on all your different browsers and see what happens, if they have the
plugin installed, it ought to work...

But, on that note, if it is entirely vital to display the PDF, why not
convert the PDF to HTML instead and display that then? Would work in all
browsers, a little hit on the server performance, which can be avoided
by caching the results of a PDF -> HTML conversion. Don't ask me where
to get code for this, as I have no clue, but I am sure it exists somewhere.

Regards,
Torgny

attached mail follows:


Richard Lynch said the following on Monday, October 17, 2005 3:30 PM:
> On Fri, October 14, 2005 6:03 pm, Jason Kovacs wrote:
>> Richard Lynch said the following on Friday, October 14, 2005 3:39 PM:
>
>> I added a custom drop-down menu to FCKEditor's Link window that fills
>> in the URL upon selecting the menu item, but this url consisted of
>> just a
>> path to a redirect.php script where I set a GET variable to the ID of
>> the
>> document, then passing through the PDF or DOC data. Though you could
>> link the full path to the PDF in the URL, I just had my documents
>> stored
>> behind the web-accessible address. Every time a new document was
>> uploaded, I decided to write the URL's statically to a file that the
>> FCKEditor script (changed fck_link.html to fck_link.php) will read
>> into
>> Javascript arrays, as opposed to accessing the DB every time this Link
>> window was viewed. I added about 50 lines of Javascript code to
>> fck_link.php to do what I wanted in setting the URL from the Select
>> list.
>
> Sweet!
>
>> I must warn you though, every time that I upgrade FCKEditor, I have to
>> reapply the changes I've done and there is the possibility that the
>> FCKEditor scripts may change to cause compatibility problems. Let me
>> know if you are interested in this route and I can post my alterations
>> to
>> FCKEditor,
>
> Please do!
>
>> but the PDF file management is up to you.
>
> Oh yeah. That's for sure.
>
>> I've had many
>> non-technical users working with this utility just fine for about 6
>> months,
>> so it works and though its not the most graceful implementation from a
>> developer's standpoint, it makes the user interface easiest to work
>> with.
>
> It certainly sounds like a very good solution.
>
> Be really nifty if fckEditor folks took a look at it and considered
> adding it as a feature.
>
> We can't be the only ones needing this kind of thing.

Here's my changes to FCKEditor, and it works on version 2.0 RC3, but should
work for other later versions too unless drastic changes have been made by
it's developers to the affected scripts. I tried to clean it up for you as
much as possible and took out my customizations using doc ID's and broadened
it to use string URL's, which you'll need to write along with the doc
entry's Title to a static JS file that gets read by FCKEditor (using php).
The code also handles grouping uploaded documents into 1-level-deep groups,
so this is something you'll have to keep track of in your upload utility.
If that's not something you need or can easily figure out, just take out the
JS code that deals with Option Groups and flatten the document data array.

FCKEditor Customization Notes for linking Documents
---------------------------------------------------
By Jason Kovacs - 2005-05-04

1. Install the FCKeditor utility to /path/to/public_html/js/FCKeditor/.

2. The directory /path/to/public_html/js/data/ must be created and have
permissions of 777.

3. Set up the Document Upload utility to write static data to the file
/path/to/public_html/js/data/fck_link_docdata.js
   with the following structure:
---
var documentGroups = ["Group 1","Group 2"];
var documentData =
[
 [
  ["Doc Title 1","URL"],
  ["Doc Title 2","URL"]
 ],
 [
  ["Doc Title 1","URL"],
  ["Doc Title 2","URL"]
 ]
];
---

4. Rename ./js/FCKeditor/editor/dialog/fck_link.html to fck_link.php and
Edit it to have these changes:

4a. Below <meta name="robots" content="noindex, nofollow" />, insert:
<SCRIPT Language="JavaScript"><!--
<?
readfile("/path/to/public_html/js/data/fck_link_docdata.js");
?>
//--></SCRIPT>

4b. Insert the following two Table rows above the <tr> for "Protocol":
     <tr>
      <td nowrap="nowrap" colspan=3>
       <span fckLang="DlgLnkDocument">Documents</span><br />
       <select style="WIDTH: 100%" id="cmbLinkDocument"
onchange="SetDocumentUrl(this.value);">
                                                         <option
value=0>Select a Document File</option>
       </select>
      </td>
     </tr>

5. Edit ./js/FCKeditor/editor/dialog/fck_link/fck_link.html to have these
changes:

5a. Add these lines after "LoadSelection() ;" in the window.onload
function() call:
 // Load the Documents select menu with optgroups/options from the included
data arrays.
 LoadDocumentData() ;

5b. Before the SetLinkType function, add the following:

function LoadDocumentData()
{
 var sUrl = GetE('txtUrl').value;
 var docSelectObj = GetE('cmbLinkDocument');
 for(var i=0; i < documentGroups.length; i++)
 {
  optGroup = document.createElement('optgroup');
  optGroup.label = documentGroups[i];
  docSelectObj.appendChild(optGroup);
  for(var j=0; j < documentData[i].length; j++)
  {
   var objOption = document.createElement("option");
   objOption.innerHTML = documentData[i][j][0];
   objOption.value = documentData[i][j][1];
   if(objOption.value == sUrl) objOption.selected = true;
                        optGroup.appendChild(objOption);
  }
 }
}

5c. Change the line in the function SetLinkType from:
 window.parent.SetTabVisibility( 'Advanced' , (linkType != 'anchor' ||
bHasAnchors) ) ;
    To the line:
 window.parent.SetTabVisibility( 'Advanced' , false ) ;

5d. Change the line in the function OnUrlChange from:
 var sProtocol = oRegex.UrlOnChangeProtocol.exec( sUrl ) ;
    To the lines:
 var sProtocol = oRegex.UrlOnChangeProtocol.exec( "" ) ; // force change
protocol
 sProtocol = oRegex.UrlOnChangeProtocol.exec( sUrl ) ;

5e. Add the following function after SetUrl at the end of the file:

function SetDocumentUrl( url )
{
 if(url=="")
 {
  SetUrl("");
  SetTarget(""); OnTargetNameChange();
 }
 else
 {
  SetUrl( url );
  SetTarget("_blank"); OnTargetNameChange();
  var pageSelectObj = GetE('cmbLinkContentPage');
  pageSelectObj.selectedIndex = 0;
 }
}

6. Alter ./js/FCKeditor/editor/js/fckeditorcode_ie_2.js where fck_link.html
is used and change it to fck_link.php .

This should be a good base for you to work with, but make customizations to
get to work for your needs, and obviously change the paths where necessary.
Hope it helps you and others.

-Jason Kovacs

attached mail follows:


On Fri, October 14, 2005 5:18 pm, GamblerZG wrote:
>>>The second one is by using two
>>>different
>>>apache modules. It *does not break anything*, but it's a pain to
>>>setup.
>>>
>>>Judging sheerly by functionality and compatibility the second ways
>>> is
>>>better.
>>>
>>>However, judging from what I know about PHP, nobody tries to make
>>> that
>>>way easier, because everybody assume that everyone else use the
>>> first
>>>way. Is it good old catch 22 in action, or are there some design
>>>considerations I'm not aware of?
>>
>> A great number of people have worked on, and are working on, ways to
>> make this easier.
>>
>> Most people, however, find it more practical to simply have 2
>> different server configurations (old and new) and migrate clients
>> onto
>> the new server slowly, at the CLIENT'S pace, instead of losing
>> customers by just trashing their site out from under them.
>
> Actually, I was speaking about PHP developers.

As was I...

Keep in mind that most, if not all, PHP developers are also PHP users
and have to manage servers just as you do.

They surely did not intentionally make things difficult for themselves
on purpose.

We know for a fact that they have tried, in the past:
1. Different filename extensions.
2. Having 2 versions in a single Apache Module at one time
3. Running one of 2 versions as CGI
4. Putting some services/hosts on a different server, masking it
through Apache magic proxy thingie.

> The sheer fact that
> they
> bothered to write compatibility mode shows that they don't really
> count
> on hosters using two engines side-by-side. On the other hand, the only
> disadvantage of such approach is installation, and developers have the
> power to remove this shortcoming. Since they preferred the first way
> of
> handling compatibility, there must be some language design issues with
> the second one. It would be interesting to know/discuss them.

Perhaps you should subscribe to and search through the Developers' and
Internals mailing lists where such conversations take place.

I daresay a great deal of information and discussion is there.

I am quite confident that it is nowhere near as simple as you think.

--
Like Music?
http://l-i-e.com/artists.htm