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 29 Dec 2006 10:55:24 -0000 Issue 4540

php-general-digest-helplists.php.net
Date: Fri Dec 29 2006 - 04:55:24 CST


php-general Digest 29 Dec 2006 10:55:24 -0000 Issue 4540

Topics (messages 246262 through 246277):

Re: reading MS Excel?
        246262 by: Jiffy Slides Leonard Burton

Chocked
        246263 by: Peter Lauri
        246264 by: Skip Evans
        246265 by: J├╝rgen Wind
        246266 by: Paul Novitski
        246268 by: Johannes Lindenbaum
        246270 by: Peter Lauri
        246272 by: Robert Cummings

Re: Apache 2.2 + PHP5.2 + php_oci8.dll
        246267 by: james tanhs

403 Forbidden
        246269 by: Abhijit Raje

help with \n\r in strings
        246271 by: Angelo Zanetti
        246273 by: Robert Cummings
        246274 by: Peter Lauri
        246275 by: Frank Arensmeier
        246276 by: Robert Cummings
        246277 by: Arpad Ray

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

My reply was made in ignorance of the php classes that will read excel
documents.

I would follow that road and not my advice!

Leonard.

On 12/28/06, John Meyer <john.l.meyergmail.com> wrote:
> On a side note, but going on the basis that the users are uploading .xls
> files and don't understand how to convert. Would it be better to use
> php's routines or to automate excel, convert it inside there, and then
> use the result?
> Leonard Burton wrote:
> > On 12/28/06, Jiffy Slides Leonard Burton <servicejiffyslides.com> wrote:
> >> HI Will,
> >>
> >> > Is it possible to read Excel files and store the info to DB? If so how?
> >>
> >> It is best (well depending on the application) to save the files as
> >> .csv and then use fgetcsv. it will allow you to parse each line and
> >> cell in the file and then go from there.
> >>
> >> Take Care,
> >>
> >> --
> >> Leonard Burton, N9URK
> >> leonardburtongmail.com
> >>
> >> "The prolonged evacuation would have dramatically affected the
> >> survivability of the occupants."
> >>
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Leonard Burton, N9URK
leonardburtongmail.com

"The prolonged evacuation would have dramatically affected the
survivability of the occupants."

attached mail follows:


I was chocked when I got my additional dedicated server from my server
provider. I assumed everyting would have been the same as I ordered the
server with same package name etc. The chocking part was that the server had
PHP5 and not PHP4.

 

Ok, it is not a hard piece of work to get it working, but one thing stunned
me :-)

 

Assuming that I have the following structure:

 

/index.php

/classes/first.class.php

/classes/second.class.php

 

Index.php:

 

include_once("classes/first.class.php");

 

 

first.class.php

 

include_once("second.class.php");

 

 

This worked fine, but this time I get an "open dir" error. Is this something
that is new to PHP5 for this, or do I just need to config the server to
accept this "sloppy" including of files?

 

Best regards,

Peter Lauri

 

 <http://www.dwsasia.com/> www.dwsasia.com - company web site

 <http://www.lauri.se/> www.lauri.se - personal web site

 <http://www.carbonfree.org.uk/> www.carbonfree.org.uk - become Carbon Free

 

attached mail follows:


"chocked" ?

"chocking" ???

Peter Lauri wrote:
> I was chocked when I got my additional dedicated server from my server
> provider. I assumed everyting would have been the same as I ordered the
> server with same package name etc. The chocking part was that the server had
> PHP5 and not PHP4.
>
>
>
> Ok, it is not a hard piece of work to get it working, but one thing stunned
> me :-)
>
>
>
> Assuming that I have the following structure:
>
>
>
> /index.php
>
> /classes/first.class.php
>
> /classes/second.class.php
>
>
>
> Index.php:
>
>
>
> include_once("classes/first.class.php");
>
>
>
>
>
> first.class.php
>
>
>
> include_once("second.class.php");
>
>
>
>
>
> This worked fine, but this time I get an "open dir" error. Is this something
> that is new to PHP5 for this, or do I just need to config the server to
> accept this "sloppy" including of files?
>
>
>
> Best regards,
>
> Peter Lauri
>
>
>
> <http://www.dwsasia.com/> www.dwsasia.com - company web site
>
> <http://www.lauri.se/> www.lauri.se - personal web site
>
> <http://www.carbonfree.org.uk/> www.carbonfree.org.uk - become Carbon Free
>
>
>
>

--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240

attached mail follows:


what if you prepend your path with "./" :

include_once("./classes/first.class.php");

include_once("./second.class.php");

is the include path configured correctly?

--
View this message in context: http://www.nabble.com/Chocked-tf2892714.html#a8082223
Sent from the PHP - General mailing list archive at Nabble.com.

attached mail follows:


At 12/28/2006 03:51 PM, Skip Evans wrote:
>"chocked" ?
>
>"chocking" ???

RTFM:
http://php.net/chocked

Warm regards,
Paul

attached mail follows:


I think this is correct:

Let's just assume for a minute that in your index.php you echo out getcwd();
Output would be / (only an example)

According to that you do the following include:
include("./classes/first.class.php");

If you were to echo getcwd() after the include in the first.class.php it
would output /

You would then have to include your second class (inside the
first.class.php - correct?) as:
include("./classes/second.class.php")
to make it a "correct" include without PHP having to search the
directories for the include.

Give that a shot.

Regards,
Johannes

attached mail follows:


Hi,

I got it working before the post, but I was just curious if there were any
change from php4 to php5 as I have been using that method for a while now.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

-----Original Message-----
From: Johannes Lindenbaum [mailto:johannesjlindenbaum.de]
Sent: Friday, December 29, 2006 4:24 AM
To: php-generallists.php.net
Subject: [PHP] Re: Chocked

I think this is correct:

Let's just assume for a minute that in your index.php you echo out getcwd();
Output would be / (only an example)

According to that you do the following include:
include("./classes/first.class.php");

If you were to echo getcwd() after the include in the first.class.php it
would output /

You would then have to include your second class (inside the
first.class.php - correct?) as:
include("./classes/second.class.php")
to make it a "correct" include without PHP having to search the
directories for the include.

Give that a shot.

Regards,
Johannes

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

attached mail follows:


On Fri, 2006-12-29 at 09:48 +0100, Peter Lauri wrote:
> Hi,
>
> I got it working before the post, but I was just curious if there were any
> change from php4 to php5 as I have been using that method for a while now.

Is the php.ini the same? Make sure it actually uses the php.ini that you
think it uses by checking phpinfo(). Make sure "." is in the include
path.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Hi Roman,
Why can't you use the newest client?
Bcoz 10g client doesn't connect to mine server runing on 8i.

Which procedure is it? Use depends.exe to find out what other libraries
you're missing.
Noting is missing, but when it starts it prompts that error.
Tq

On 12/23/06, Roman Neuhauser <neuhausersigpipe.cz> wrote:
>
> # phpforummailinglistgmail.com / 2006-12-23 12:21:35 +0800:
> > I saw numerous posting on this type of posting and no one seems to have
> a
> > consistent solution to it.
> >
> > Lately, I am quite disapointed with the pain of going thru this
> > configuration and testing.
> > I need to access the oracle 8i server db using XP + Oracle client 8i +
> > Apache 2.2 + PHP5.2 and I have tried the following without success.
>
> Why can't you use the newest client?
>
> > What is the error ? not sumething special but common
> > "PHP Warning: PHP Startup: Unable to load dynamic library
> > 'c:\\php52\\ext\\php_oci8.dll' - The specified procedure could not be
> > found.\r\n in Unknown on line 0"
>
> Which procedure is it? Use depends.exe to find out what other libraries
> you're missing.
>
> > 1. download the php_oci8.dll from
> > http://pecl4win.php.net/ext.php/php_oracle.dll (you name the version,
> tried
> > everythign doesn't work)
> > 2. assign ORACLE_HOME, NSL_LANGUAGE...nope...doesn't work.
> > 3. use old php4.1.xx + Apache 1.3xx on XP with Oracle client 8i...nope
> > doesn't work ( I use this in my NT4, it works like charm)
> > 4. Zendcore for oracle...no no...it doesn't support Oracle 8i
> connectivity.
> > 5. anyone know where to look for oracle 8i/9i clients for linux ? not
> > available at oracle website :(
>
>
>
> --
> How many Vietnam vets does it take to screw in a light bulb?
> You don't know, man. You don't KNOW.
> Cause you weren't THERE. http://bash.org/?255991
>

attached mail follows:


Hi,
    When I try to run any php script on apache I get a error "Authorization required 403 Forbidden". I don't get this error on IIS. I am using Windows XP professional please help. I am using Apache 2.2.1

attached mail follows:


Hi all,

I receive a text file with a whole bunch of strings. and each line is
terminated by what I presume is \n\r however when I read the string into
PHP, it seems that the last column of the row and the first column of
the next row are connected but it appears as a space but I've done all
kinds of tests like $spacePos = strrpos($dateAmount, ' '); but this is
always empty.

So is there a way to test for \r\n? or what else can I use to delimit
these two values (last column of row and first column of next row)?

Thanks in advance.

Angelo
                                       
--
------------------------------------------------------------------------
Angelo Zanetti
Systems developer
------------------------------------------------------------------------

*Telephone:* +27 (021) 469 1052
*Mobile:* +27 (0) 72 441 3355
*Fax:* +27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* angelozlogic.co.za <mailto:angelozlogic.co.za>

attached mail follows:


On Fri, 2006-12-29 at 11:42 +0200, Angelo Zanetti wrote:
> Hi all,
>
> I receive a text file with a whole bunch of strings. and each line is
> terminated by what I presume is \n\r however when I read the string into
> PHP, it seems that the last column of the row and the first column of
> the next row are connected but it appears as a space but I've done all
> kinds of tests like $spacePos = strrpos($dateAmount, ' '); but this is
> always empty.
>
> So is there a way to test for \r\n? or what else can I use to delimit
> these two values (last column of row and first column of next row)?
>
> Thanks in advance.

strpos( $dateAmount, "\n" )

or

strpos( $dateAmount, "\r" )

Double quotes are required for expansion of special characters.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Try:

$string_as_array = explode("\n", $string);

echo "<pre>";
print_r($string_as_array);
echo "</pre>";

The array that you get will contain segments of the string that is separated
with \n. Let me know if that helps.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

-----Original Message-----
From: Angelo Zanetti [mailto:angelozlogic.co.za]
Sent: Friday, December 29, 2006 10:43 AM
To: PHP List
Subject: [PHP] help with \n\r in strings

Hi all,

I receive a text file with a whole bunch of strings. and each line is
terminated by what I presume is \n\r however when I read the string into
PHP, it seems that the last column of the row and the first column of
the next row are connected but it appears as a space but I've done all
kinds of tests like $spacePos = strrpos($dateAmount, ' '); but this is
always empty.

So is there a way to test for \r\n? or what else can I use to delimit
these two values (last column of row and first column of next row)?

Thanks in advance.

Angelo
                                       
--
------------------------------------------------------------------------
Angelo Zanetti
Systems developer
------------------------------------------------------------------------

*Telephone:* +27 (021) 469 1052
*Mobile:* +27 (0) 72 441 3355
*Fax:* +27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* angelozlogic.co.za <mailto:angelozlogic.co.za>

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

attached mail follows:


If you just want to test for \n\r -

if ( substr ( -2, $my_string ) == "\n\r" ) { // substr with the
negative value of 2 will give you the last two characters of your string
        // do some stuff
}

I think it would be a good idea to explain a little bit more what you
are trying to accomplish. Are you preparing the string for a database
insert? Do you want to sanitise the string?

Stripping off those kind of characters can also be done with trim (or
ltrim - trims white space characters from the left of the string or
rtim - trims from the right). Read the manual for more details and
options.

If you are not quite sure what those characters are, you can find out
with this little helper.

$characters = preg_split( '//', $my_string );
foreach ( $characters as $character ) {
        echo "ASCI value of the character {$character} is: " . ord
( $character ) . "<br />\n";
}

Then you can look up the values in a ASCI table.

/frank

29 dec 2006 kl. 11.01 skrev Peter Lauri:

> Try:
>
> $string_as_array = explode("\n", $string);
>
> echo "<pre>";
> print_r($string_as_array);
> echo "</pre>";
>
> The array that you get will contain segments of the string that is
> separated
> with \n. Let me know if that helps.
>
> Best regards,
> Peter Lauri
>
> www.dwsasia.com - company web site
> www.lauri.se - personal web site
> www.carbonfree.org.uk - become Carbon Free
>
> -----Original Message-----
> From: Angelo Zanetti [mailto:angelozlogic.co.za]
> Sent: Friday, December 29, 2006 10:43 AM
> To: PHP List
> Subject: [PHP] help with \n\r in strings
>
> Hi all,
>
> I receive a text file with a whole bunch of strings. and each line is
> terminated by what I presume is \n\r however when I read the string
> into
> PHP, it seems that the last column of the row and the first column of
> the next row are connected but it appears as a space but I've done all
> kinds of tests like $spacePos = strrpos($dateAmount, ' '); but this is
> always empty.
>
> So is there a way to test for \r\n? or what else can I use to delimit
> these two values (last column of row and first column of next row)?
>
> Thanks in advance.
>
> Angelo
>
> --
> ----------------------------------------------------------------------
> --
> Angelo Zanetti
> Systems developer
> ----------------------------------------------------------------------
> --
>
> *Telephone:* +27 (021) 469 1052
> *Mobile:* +27 (0) 72 441 3355
> *Fax:* +27 (0) 86 681 5885
> *
> Web:* http://www.zlogic.co.za
> *E-Mail:* angelozlogic.co.za <mailto:angelozlogic.co.za>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


On Fri, 2006-12-29 at 11:17 +0100, Frank Arensmeier wrote:
> If you just want to test for \n\r -
>
> if ( substr ( -2, $my_string ) == "\n\r" ) { // substr with the
> negative value of 2 will give you the last two characters of your string
> // do some stuff
> }

You have your substr() parameters backwards.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Angelo Zanetti wrote:
> So is there a way to test for \r\n? or what else can I use to delimit
> these two values (last column of row and first column of next row)?
>

Since it's coming from a file, you might as well just read it with
file(), which will split each line into an array automatically. If it's
a CSV file, then fgetcsv() helps you out even more.

Arpad