php-general Digest 7 Sep 2005 08:27:20 -0000 Issue 3668

Topics (messages 221926 through 221945):

Re: php equivalent for cut
        221926 by: Michelle Konzack
        221928 by: Philip Hallstrom
        221930 by: Michelle Konzack

really basic question
        221927 by: Adi Zebic
        221935 by: Miles Thompson

Re: Session expires randomly
        221929 by: Mauricio Pellegrini
        221931 by: Philip Hallstrom

Sending different languages to GD
        221932 by: Graham Anderson
        221934 by: Chris
        221936 by: Graham Anderson

Re: Sending different languages to GD [apologize for resend]
        221933 by: Graham Anderson

Installing 4.3.0 and Apache 2.0.54 DSO
        221937 by: Rob Tanner

Uploading a file
        221938 by: Josh

Re: Sessions , expiry times and different time zones
        221939 by: Dan Rossi
        221945 by: Mark Rees

Re: AND OR NOT
        221940 by: John Taylor-Johnston

Re: 302 Responses (Was: session cookies)
        221941 by: Rasmus Lerdorf

Re: PHP/MySQL offline
        221942 by: Joe Wollard

Parsing MS-WORD docs
        221943 by: Shafiq Rehman

[Mail]mb_encode_mimeheader
        221944 by: Sylvain Gourvil

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

Am 2005-09-06 12:18:18, schrieb [EMAIL PROTECTED]:

> $etcpasswd = "username:passwd:123:345::/home/username:/bin/sh";
> $pwdarr = explode(":", $etcpasswd);
> echo $pwdarr[4];

OK, this works now.

But can I read a whome /etc/passwd into an 3d array ?
This would avoid multiple reads...

I know, that I can have a file as array with file() but
whats the best solution to put it into 3D style ?

I need only to extract the $USER, $GEKO and $HOMEDIR for
UID >= 1000.

Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


--- End Message ---
--- Begin Message ---
Am 2005-09-06 12:18:18, schrieb [EMAIL PROTECTED]:

$etcpasswd = "username:passwd:123:345::/home/username:/bin/sh";
$pwdarr = explode(":", $etcpasswd);
echo $pwdarr[4];

OK, this works now.

But can I read a whome /etc/passwd into an 3d array ?
This would avoid multiple reads...

I know, that I can have a file as array with file() but
whats the best solution to put it into 3D style ?

I need only to extract the $USER, $GEKO and $HOMEDIR for
UID >= 1000.

Why not use posix_getpwuid()?

http://us2.php.net/manual/en/function.posix-getpwuid.php

-philip

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

Am 2005-09-06 15:14:59, schrieb Philip Hallstrom:

> Why not use posix_getpwuid()?

Good question...  :-)

> http://us2.php.net/manual/en/function.posix-getpwuid.php

This was a great IDEA...

> -philip

Thanks and good night
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


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

It is permited to do something like this in the functions "body"

<?
function test()
{
    print("tralala");
    do_some_stuff();
?>
<table id="conex" width="167" border="0" cellspacing="0" cellpadding="0">
<?
print("test function continue here or not?");
waiting_answer();
print("thanks a lot");
}
?>

Thanks a lot,

ADI

--- End Message ---
--- Begin Message ---
Adi,

Every time I was about to ask a question along the lines of "Can you do ...?" or "Is it possible to ...", and really embarrass myself, this thought popped up: "Self, why don't you just try it, and see if it works."

After you try it, and it breaks, that's the time to ask. After all, to the PHP Engine a script is essentially a bunch of functions, or maybe one longish function.

Cheers - Miles


At 06:50 PM 9/6/2005, Adi Zebic wrote:
Hi folks,

It is permited to do something like this in the functions "body"

<?
function test()
{
    print("tralala");
    do_some_stuff();
?>
<table id="conex" width="167" border="0" cellspacing="0"
cellpadding="0">
<?
print("test function continue here or not?");
waiting_answer();
print("thanks a lot");
}
?>

Thanks a lot,

ADI

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


--- End Message ---
--- Begin Message ---
You were right! That was exactly the problem
after reading your message, I 've verified the value for gc_maxlifetime
and found that it was set to 1440 secs in other words 24 minutes.

Thank you for that.

But, now I need to come up with something to avoid this behaviour.

The problem is that there's a second php application ruuning on the same
server and I don't want to change the default for gc_maxlilfetime,

So I was thinking on implementing some sort of automatic session refresh
after a short period, let's say every 20 minutes of inactivity.

And of course I should provide the users with a manual way to make
session end, sort of a logout from the application.( no problem with
that)

My question is:

         Is there a way to set sort of a timer as to invoke an hipothetical
"refresh_session.php" without reloading the current page on the client?

Thanks
 Mauricio.



On Fri, 2005-09-02 at 14:20, [EMAIL PROTECTED] wrote:
> > On Fri, 2 Sep 2005, Mauricio Pellegrini wrote:
> > 
> > > Hi, I have this problem , When I start a Session everything seems to 
> be
> > > ok but sometimes with no reason the session vanishes.
> > >
> > > All settings are default , I mean session_cache_expire is 180 min.
> > > I understand that this setting should make sessions last for at least 
> 3
> > > hours but in my case it seems not to be true since the real duration
> > > varies from 20 minutes to an hour
> 
> I think the parameter you need to look at in php.ini is 
> session.gc_maxlifetime. It sets the session lifetime, not 
> session_cache_expire. The default lifetime is probably 1440 seconds, 
> roughly 20 minutes, so the behavior you are seeing is completely normal - 
> it's all working as it should.
> 
> Kirk

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


On Tue, 6 Sep 2005, Mauricio Pellegrini wrote:

You were right! That was exactly the problem
after reading your message, I 've verified the value for gc_maxlifetime
and found that it was set to 1440 secs in other words 24 minutes.

Thank you for that.

But, now I need to come up with something to avoid this behaviour.

The problem is that there's a second php application ruuning on the same
server and I don't want to change the default for gc_maxlilfetime,


Why not just change it on your pages? The manual says it can get changed anywhere... so just make a call to ini_set() on your pages and other scripts will remain unaffected.

?





So I was thinking on implementing some sort of automatic session refresh
after a short period, let's say every 20 minutes of inactivity.

And of course I should provide the users with a manual way to make
session end, sort of a logout from the application.( no problem with
that)

My question is:

         Is there a way to set sort of a timer as to invoke an hipothetical
"refresh_session.php" without reloading the current page on the client?

Thanks
Mauricio.



On Fri, 2005-09-02 at 14:20, [EMAIL PROTECTED] wrote:
On Fri, 2 Sep 2005, Mauricio Pellegrini wrote:

Hi, I have this problem , When I start a Session everything seems to
be
ok but sometimes with no reason the session vanishes.

All settings are default , I mean session_cache_expire is 180 min.
I understand that this setting should make sessions last for at least
3
hours but in my case it seems not to be true since the real duration
varies from 20 minutes to an hour

I think the parameter you need to look at in php.ini is
session.gc_maxlifetime. It sets the session lifetime, not
session_cache_expire. The default lifetime is probably 1440 seconds,
roughly 20 minutes, so the behavior you are seeing is completely normal -
it's all working as it should.

Kirk

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


--- End Message ---
--- Begin Message ---
How can I get Polish , iso-8859-2, text,  to output properly ?
PHP is reading the accent characters as blocks

I tried this, but it did not work...

// Set up text for a 'Polish' button
$text = "rozwiązania";
$text = mb_convert_encoding($text, "iso-8859-2","Auto");

//  Composit the text over a button image and output it
imagettftext($im, $fontSize, 0, 11, 16, $white, $font, $text);

Ultimately, I want to pass a $language variable to the script to get it to output to any number of supported languages
is there a simple function that does this ?

many thanks in advance :)
g

--- End Message ---
--- Begin Message --- Note: I haven't actually ever tried to put non-latin character s in an image, but I think this is the proper thing to do.

First of all, I believe imagettftext() accepts string in the UTF-8 encoding. SO, the first thing to try would be to convert to UTF-8l

mb_convert_encoding($text, 'UTF-8','iso-8859-2');

And, if that doesn't work. Ensure the font you're specifying can handle the characters you're giving it. (Arial Unicode would probably be a safe test font)

hope this helped.

Chris

Graham Anderson wrote:

How can I get Polish , iso-8859-2, text,  to output properly ?
PHP is reading the accent characters as blocks

I tried this, but it did not work...

// Set up text for a 'Polish' button
$text = "rozwiązania";
$text = mb_convert_encoding($text, "iso-8859-2","Auto");

//  Composit the text over a button image and output it
imagettftext($im, $fontSize, 0, 11, 16, $white, $font, $text);

Ultimately, I want to pass a $language variable to the script to get it to output to any number of supported languages
is there a simple function that does this ?

many thanks in advance :)
g


--- End Message ---
--- Begin Message ---
Now, I think it is a text editor problem......

My text editor, BBedit, is set to utf8 encoding .
When I set encoding to utf-8, php outputs a blank screen...

If I set BBedit to Unix with Mac-Roman encoding, the php script executes but screws up the Polish language

Regardless, the php script looks fine within BBedit regardless of the text encode value...


If I use a  Simple/Free Text editor:
If I copy the BBedit text into a simple/free text editor, and then copy/paste this text to the original php script on the server...
everything renders properly....no problems at all

anyone know what this could be ?

g

On Sep 6, 2005, at 4:46 PM, Chris wrote:

Note: I haven't actually ever tried to put non-latin character s in an image, but I think this is the proper thing to do.

First of all, I believe imagettftext() accepts string in the UTF-8 encoding. SO, the first thing to try would be to convert to UTF-8l

mb_convert_encoding($text, 'UTF-8','iso-8859-2');

And, if that doesn't work. Ensure the font you're specifying can handle the characters you're giving it. (Arial Unicode would probably be a safe test font)

hope this helped.

Chris

Graham Anderson wrote:

How can I get Polish , iso-8859-2, text,  to output properly ?
PHP is reading the accent characters as blocks

I tried this, but it did not work...

// Set up text for a 'Polish' button
$text = "rozwiązania";
$text = mb_convert_encoding($text, "iso-8859-2","Auto");

//  Composit the text over a button image and output it
imagettftext($im, $fontSize, 0, 11, 16, $white, $font, $text);

Ultimately, I want to pass a $language variable to the script to get it to output to any number of supported languages
is there a simple function that does this ?

many thanks in advance :)
g


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


--- End Message ---
--- Begin Message ---
sorry about that

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

I'm trying to build PHP 4.3.0 as a DSO for Apache 2.0.54, and I get the following error running configure:

checking for Apache 2.0 module support via DSO through APXS...
Sorry, I cannot run apxs.  Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)

The output of /usr/local/apache2/bin/apxs follows:
Usage: apxs -g [-S <var>=<val>] -n <modname>
      apxs -q [-S <var>=<val>] <query> ...
      apxs -c [-S <var>=<val>] [-o <dsofile>] [-D <name>[=<value>]]
              [-I <incdir>] [-L <libdir>] [-l <libname>] [-Wc,<flags>]
              [-Wl,<flags>] [-p] <files> ...
      apxs -i [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...
      apxs -e [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...
configure: error: Aborting


The configure option is --with-apxs2=/usr/local/apache2/bin/apxs. The file does exist and the path to perl is correct and apache was explicitly build with --enable-so (and when I invoke apache with the -l option to list the built-in modules, mod.so.c shows up).

So, having satisfied myself that reasons 1 thru 3 don't apply, any idea what else might be causing this problem?

Thanks,
Rob

--

Rob Tanner
UNIX Services Manager
Linfield College, McMinnville OR

--- End Message ---
--- Begin Message ---
Hi
I have recently been working on a site which allows the user to upload a file to the site. Originally calling the $_FILES['file']['tmp_name'] worked fine, however the web host has now disabled all global variables and if I'm not mistaken $_FILES is global. Does anyone know of a work around for this?

Cheers.
Josh

--- End Message ---
--- Begin Message ---
client cookie expires hence no more session ...

On 07/09/2005, at 1:57 AM, Jordan Miller wrote:

Hi  Dan,

Couldn't you store an expiration time directly in the $_SESSION variable, rather than relying on cookie expiration (if I understand your question correctly)? Each time a page is loaded, update the expiration time in this variable to +24hr from the current time (all times relative to the server's time). Then, it shouldn't matter from which time zone the user is browsing.

Jordan



On Sep 6, 2005, at 10:37 AM, Dan Rossi wrote:


hi there I have run into problems with sessions , cookies and expiryt times with different time zones. Ie our server is in the States however I am browsing from Koala land downunder. I have been trying to get the session to expire in a day, however for ppl in the states this is ok, but for me its already expired so i have been experiencing issues. How do i solve this ?

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








--- End Message ---
--- Begin Message ---
Dan Rossi" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> client cookie expires hence no more session ...
>
> On 07/09/2005, at 1:57 AM, Jordan Miller wrote:
>
> > Hi  Dan,
> >
> > Couldn't you store an expiration time directly in the $_SESSION
> > variable, rather than relying on cookie expiration (if I  understand
> > your question correctly)?  Each time a page is loaded, update the
> > expiration time in this variable to +24hr from the current time (all
> > times relative to the server's time). Then, it shouldn't matter from
> > which time zone the user is browsing.


Read what he said again. Instead of expiring the session itself, store the
time of session expiry in the session (with a longer expiry time than 1 day)
and check that.

When you say a day, do you mean 24 hours or a calendar day? Are you trying
to say:

"Today is Tuesday, so expire this session at midnight on Tuesday?"

If that's what you need to do, you need to use a client-side solution -
after all, only the client knows what time it is where the client is! Be
prepared for people who have their time zone set incorrectly.

> >
> > Jordan
> >
> >
> >
> > On Sep 6, 2005, at 10:37 AM, Dan Rossi wrote:
> >
> >
> >> hi there I have run into problems with sessions , cookies and expiryt
> >> times with different time zones. Ie our server is in the States
> >> however I am browsing from Koala land downunder. I have been trying
> >> to get the session to expire in a day, however for ppl in the states
> >> this is ok, but for me its already expired so i have been
> >> experiencing issues. How do i solve this ?
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> >>
> >>
> >
> >

--- End Message ---
--- Begin Message ---
Jasper Bryant-Greene wrote:

John Taylor-Johnston wrote:

I'm under pressure to permit AND, OR & NOT. My research group insists that MySQL 4 syntax is "not good enough". An idea of what one might enter is here (on the bottom): http://compcanlit.usherbrooke.ca/advanced.html I was hoping to get away with replacing " AND " with "+", " NOT " with "-" and " OR " with " ".
I use this as SQL:
SELECT *,MATCH (YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,JR,KW,AUS,TUS,GEO,AN,SA,RB)
AGAINST ('$mydata->searchenquiry' IN BOOLEAN MODE)
AS relevancy FROM ccl_main
WHERE MATCH (YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,JR,KW,AUS,TUS,GEO,AN,SA,RB)
AGAINST ('$mydata->searchenquiry' IN BOOLEAN MODE)
ORDER BY relevancy DESC;-->

Please don't top-post [1]. Nice cryptic column names, by the way :)
Your research group obviously haven't researched very carefully, as "+term" is exactly equal to " AND term", "-term" to " NOT term" and simply "term" to " OR term". So there's no point in complicating the syntax. Not only that, but MySQL's boolean mode fulltext search offers many more great possibilities like truncation ("app*" will match "apple", "application"...) and in-query relevance altering. Take a look at the BOOLEAN MODE section of the MySQL manual [2]; maybe print it and give it to your research group :)
[1] http://en.wikipedia.org/wiki/Top-posting
[2] http://dev.mysql.com/doc/mysql/en/fulltext-boolean.html

Jasper,

God only knows I have tried. They're old school, what more can I say. If you knew how hard it was to sell them on using PHP-MySQL, when the project was floundering on a MS-Access & ASP server ! They insist on AND, OR & NOT - I have tried. Heck, I have an advanced page with it all spelled out. But it is a good project to hone my owns skills on.

So ... a simple str_replace will work. str_replace is case sensitive, if I read the manual correctly?

I can get away with: " AND " with "+", " NOT " with "-" and " OR " with " " ?

Top-posting? Oh, sorry. I guess I'm old school and stubborn myself. Ok, I'll try working on the bottom of the page.

John

--- End Message ---
--- Begin Message ---
Chris Shiflett wrote:
> Rasmus Lerdorf wrote:
> 
>> This redirects right away for me. Try it:
>>
>> http://lerdorf.com/cs.php
>>
>> Code at: http://lerdorf.com/cs.phps
> 
> 
> Thanks, that works. :-)
> 
> For reference, here's mine (temporary URL, of course):
> 
> http://shiflett.org/cs.php
> http://shiflett.org/cs.phps
> 
> It's the same code, but it behaves differently. I don't have time to
> compare the responses, but I will later. My first instinct is that my
> server is buffering the response, but that was the first thing I checked
> when I was testing this locally.

Are you using mod_gzip perhaps?

--- End Message ---
--- Begin Message ---
... an automated script that creates a static site that will allow me to do
that?
If all you're really looking for is a static version of your site then you could simply use wget. This will crawl all of the links on your site and generate the static version you wanted.

On Sep 5, 2005, at 11:11 PM, viraj wrote:

On 9/4/05, John Taylor-Johnston
<[EMAIL PROTECTED]> wrote:

This is maybe what you want:
http://www.indigostar.com/
http://www.indigostar.com/microweb.htm


another good method is a "Live Linux CD". you can find a light weight
live linux distro and remaster it to include your live web site. so
your client can put boot his/her pc with this cd and start browsing
the site.

this way you can use whatever the LAMP combination!

http://www.google.com/search?hl=en&q=howto+remaster&spell=1
http://taprobane.org/

~viraj.


Runs an apache server, php & all, from a CD. (windows app.)
John

Mario netMines wrote:


Hi all

I have a project where I'm using PHP/Mysql. The client wants to run
that project to a cd.
Does anyone know of a trick either by using javascript, XML or an
automated script that creates a static site that will allow me to do
that?

Many Thanks

M


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



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

I want to parse the .doc files with PHP. Anybody have some idea regarding 
this problem.

Your help regarding this matter is really appreciated

Regards
-- 

PHP is too logical for my brain (http://www.phpgurru.com)

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

I need some help for mail's encoding structure.
I use this code for encoding french character like 'é' or 'è':

           mb_language('uni');
           mb_internal_encoding(mb_detect_encoding($this->subject));
$res = mail('[EMAIL PROTECTED]', mb_encode_mimeheader($this->subject), $this->msgTxt.$this->msgHTML, $this->entete, '[EMAIL PROTECTED]');

It is working fine unless if my first word is not containing one of those multi-bites characters!

For example :
Subject : êtes vous francais ou étranger ? => It is well encode and all is fine on differents mail software and webmail Subject : Bonjour, êtes vous francais ? => It is encode at the beginnning of the second word. So it is not well written on some softwre like Incredimail for example.

Does someone know where i am wrong ?
Thanks a lot for your help

Sylvain Gourvil


        

        
                
___________________________________________________________________________ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com


--- End Message ---

Reply via email to