php-general Digest 6 Sep 2005 20:12:34 -0000 Issue 3667

Topics (messages 221890 through 221925):

Re: suggestions needed to use "session"
        221890 by: viraj
        221891 by: Nahalingam Kanakavel

Re: 302 Responses (Was: session cookies)
        221892 by: Rasmus Lerdorf
        221893 by: Robin Vickery
        221903 by: Chris Shiflett
        221913 by: Robin Vickery

owner of files created by fopen() become wrong?
        221894 by: Wong HoWang
        221898 by: Robin Vickery

php/mysql web question
        221895 by: bruce
        221896 by: Mikey
        221897 by: Mikey
        221921 by: Murray . PlanetThoughtful

Problem with Apache+Fedora Core 4 + PHP Installation
        221899 by: Feris Thia C.

Apache Linux question
        221900 by: Feris Thia C.
        221901 by: John Nichel
        221902 by: Georgi Ivanov
        221908 by: Jason Davidson

Confused about how to best execute php scripts in /cgi-bin/
        221904 by: KEVIN ZEMBOWER

Object Scope
        221905 by: Chuck Brockman
        221907 by: Jason Davidson

Sessions , expiry times and different time zones
        221906 by: Dan Rossi
        221909 by: Jordan Miller

php equivalent for cut
        221910 by: Michelle Konzack
        221912 by: tg-php.gryffyndevelopment.com
        221917 by: Matthew Weier O'Phinney
        221920 by: Philip Hallstrom
        221923 by: Michelle Konzack

Sessions, URL, --enable-trans-id
        221911 by: Dan Baker

Re: FTP Chmod problem
        221914 by: Al

Create a new $_COOKIE["PHPSESSID"] in  PHP4.3.1
        221915 by: zzapper

regular expression for integer range
        221916 by: babu
        221918 by: Philip Hallstrom
        221919 by: John Nichel

php  mailing list/email app
        221922 by: bruce
        221925 by: Rory Browne

Sending different languages to GD
        221924 by: Graham Anderson

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
another good one, but for intermediates

http://www.zend.com/zend/tut/session.php

~viraj.


On 9/6/05, Robert Graham <[EMAIL PROTECTED]> wrote:
> Nahalingam Kanakavel wrote:
> 
> >Hi all,
> >
> >I am new to PHP.
> >I know some thing about SESSIONS in PHP, I am in need of your suggestions.
> >how to use sessions ?
> >what is an efficient way to handle session_id ? like that.
> >How efficiently we can use session concept in our web site development ?
> >how it is helpful.
> >
> >thanks in advance.
> >
> >
> >
> Good day
> 
> Have a look at the following:
> http://www.sitepoint.com/article/users-php-sessions-mysql
> 
> Regards
> Robert
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
Hi all once again,

Thanks for all,

your suggestions made me to know about sessions and about the functions 
needed to handle sessions.

but I have some doubts plz clarify those things

what for the session Id is ?.
what is SID ? I saw this in some example codings but it is not working in my 
machine !

The coding which is using SID & failed in my system is as follows
-------- coding start --------------
<?php
if (!session_is_registered('count')) {
session_register('count');
$count = 1;
} else {
$count++;
}
?>

<p>
Hello visitor, you have seen this page <?php echo $count; ?> times.
</p>

<p>
To continue, <a href="nextpage.php?<?php echo strip_tags(SID); ?>">click
here</a>.
</p>
---------------- end -----------------
That echo statement is not working and my count also not gets increment.

On 9/6/05, viraj <[EMAIL PROTECTED]> wrote:
> 
> another good one, but for intermediates
> 
> http://www.zend.com/zend/tut/session.php
> 
> ~viraj.
> 
> 
> On 9/6/05, Robert Graham <[EMAIL PROTECTED]> wrote:
> > Nahalingam Kanakavel wrote:
> >
> > >Hi all,
> > >
> > >I am new to PHP.
> > >I know some thing about SESSIONS in PHP, I am in need of your 
> suggestions.
> > >how to use sessions ?
> > >what is an efficient way to handle session_id ? like that.
> > >How efficiently we can use session concept in our web site development 
> ?
> > >how it is helpful.
> > >
> > >thanks in advance.
> > >
> > >
> > >
> > Good day
> >
> > Have a look at the following:
> > http://www.sitepoint.com/article/users-php-sessions-mysql
> >
> > Regards
> > Robert
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 



-- 
with regds,
Nahalingam.

--- End Message ---
--- Begin Message ---
Chris Shiflett wrote:
> 3. Chris's modified test script:
> 
> header('Location: http://www.php.net/');
> $fp = fopen('/tmp/log.txt', 'w');
> for ($i = 0; $i < 30; $i++)
> {
>     $str = "Count $i\n";
>     echo str_repeat($str, 1000);
>     fputs($fp, $str);
>     sleep(1);
>     flush();
> }

This redirects right away for me.  Try it:

http://lerdorf.com/cs.php

Code at: http://lerdorf.com/cs.phps

No idea what you are doing on your end to get a different result.

-Rasmus

--- End Message ---
--- Begin Message ---
On 9/6/05, Rasmus Lerdorf <[EMAIL PROTECTED]> wrote:
> Chris Shiflett wrote:
> > 3. Chris's modified test script:
> >
> > header('Location: http://www.php.net/');
> > $fp = fopen('/tmp/log.txt', 'w');
> > for ($i = 0; $i < 30; $i++)
> > {
> >     $str = "Count $i\n";
> >     echo str_repeat($str, 1000);
> >     fputs($fp, $str);
> >     sleep(1);
> >     flush();
> > }
> 
> This redirects right away for me.  Try it:

And me, with Firefox, Links and wget:

[EMAIL PROTECTED]:~$ wget -S http://localhost/redir.php
--11:50:33--  http://localhost/redir.php
           => `redir.php'
Resolving localhost... 127.0.0.1
Connecting to localhost[127.0.0.1]:80... connected.
HTTP request sent, awaiting response...
 1 HTTP/1.1 302 Found
 2 Date: Tue, 06 Sep 2005 10:50:33 GMT
 3 Server: Apache/2.0.53 (Ubuntu) PHP/4.3.10-10ubuntu4.1
 4 X-Powered-By: PHP/4.3.10-10ubuntu4.1
 5 Location: http://www.php.net/
 6 Connection: close
 7 Content-Type: text/html; charset=UTF-8
Location: http://www.php.net/ [following]
--11:50:34--  http://www.php.net/
           => `index.html.1'
Resolving www.php.net... 64.246.30.37
Connecting to www.php.net[64.246.30.37]:80... connected.
HTTP request sent, awaiting response...
 1 HTTP/1.1 200 OK
 2 Date: Tue, 06 Sep 2005 10:35:07 GMT
 3 Server: Apache/1.3.26 (Unix) mod_gzip/1.3.26.1a PHP/4.3.3-dev
 4 X-Powered-By: PHP/4.3.3-dev
 5 Last-Modified: Tue, 06 Sep 2005 10:12:46 GMT
 6 Content-language: en
 7 Set-Cookie: COUNTRY=GBR%2C195.224.112.192; expires=Tue, 13-Sep-05
10:35:07 GMT; path=/; domain=.php.net
 8 Connection: close
 9 Content-Type: text/html;charset=ISO-8859-1

    [    <=>                                                          
                               ] 38,675        30.18K/s

11:50:37 (30.13 KB/s) - `index.html.1' saved [38,675]

--- End Message ---
--- Begin Message ---
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.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

--- End Message ---
--- Begin Message ---
On 9/6/05, Chris Shiflett <[EMAIL PROTECTED]> 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.
> 

You've got mod_gzip installed. 

If you send a GET request without  "Accept-Encoding: gzip,deflate
" then you'll get an immediate redirect from your server as well.

-robin

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

I am so sorry that I have a lot of questions... This time I got a special 
issue... I have set up a VirtualHost for the domain that have problem. Since 
I am using Apache/1.3.33 , I have set the User & Group inside & outside the 
<VirtualHost ...> ... </VirtualHost>  tags. As you know, the user & group 
set outside VirtualHost will be the user & group that the main server run 
with. And the one inside will be used for that domain only. The question 
comes, when I trying to run a script that use fopen('xxxx.xxx','w'); to 
create a file(or even create a dir), the file owner & group is 'apache', 
that is the user & group I run apache with, but NOT the one inside the 
<VirtualHost>!!! I have tried to restart my server and make sure the 
httpd.conf loaded corrrectly, but the question is still there, can anyone 
tell me how to solve this problem? Plesae help!

Thx! 

--- End Message ---
--- Begin Message ---
On 9/6/05, Wong HoWang <[EMAIL PROTECTED]> wrote:
> I have set up a VirtualHost for the domain that have problem. Since
> I am using Apache/1.3.33 , I have set the User & Group inside & outside the
> <VirtualHost ...> ... </VirtualHost>  tags. As you know, the user & group
> set outside VirtualHost will be the user & group that the main server run
> with. And the one inside will be used for that domain only.

Only for CGI requests. 

If you've configured PHP as an Apache module, it should still run as
the user that you specified in the main User directive.

http://httpd.apache.org/docs/1.3/mod/core.html#user

(read the "special note")

  -robin

--- End Message ---
--- Begin Message ---
hi...

if an app has a webpage that has to interface/display data from a mysql db,
does the app have to essentially do a new db_connection for each time that a
user accesses the page during the session.

as far as i can tell, it does.

in other words, the page would need to look something like:

  <?
    start the page
    do the db_connect
    do the db_query
    process the information from the db/tbl
    close the db_connection
  ?>

the only reason i ask is that it would be nice/good if there was some way of
opening a connetion once for a given session (save bandwidth) as well as
somehow saving data from the db/tbl (short of using session vars)

thanks

-bruce
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
bruce wrote:

hi...

if an app has a webpage that has to interface/display data from a mysql db,
does the app have to essentially do a new db_connection for each time that a
user accesses the page during the session.

as far as i can tell, it does.

in other words, the page would need to look something like:

 <?
   start the page
   do the db_connect
   do the db_query
   process the information from the db/tbl
   close the db_connection
 ?>

the only reason i ask is that it would be nice/good if there was some way of
opening a connetion once for a given session (save bandwidth) as well as
somehow saving data from the db/tbl (short of using session vars)

thanks

-bruce
[EMAIL PROTECTED]

What you should use is a persistent connection - mysql_pconnect() - IIRC

HTH,

Mikey

--- End Message ---
--- Begin Message ---
Mikey wrote:

bruce wrote:

hi...

if an app has a webpage that has to interface/display data from a mysql db, does the app have to essentially do a new db_connection for each time that a
user accesses the page during the session.

as far as i can tell, it does.

in other words, the page would need to look something like:

 <?
   start the page
   do the db_connect
   do the db_query
   process the information from the db/tbl
   close the db_connection
 ?>

the only reason i ask is that it would be nice/good if there was some way of
opening a connetion once for a given session (save bandwidth) as well as
somehow saving data from the db/tbl (short of using session vars)

thanks

-bruce
[EMAIL PROTECTED]

What you should use is a persistent connection - mysql_pconnect() - IIRC

HTH,

Mikey

Ooops, forgot the second part of your question - if you want to save the data from a query then you will have to use session vars, although only do this with data that you know will not change during the lifetime of a user session.

Mikey

--- End Message ---
--- Begin Message ---
> hi...
> 
> if an app has a webpage that has to interface/display data from a mysql
> db,
> does the app have to essentially do a new db_connection for each time that
> a
> user accesses the page during the session.
> 
> as far as i can tell, it does.
> 
> in other words, the page would need to look something like:
> 
>   <?
>     start the page
>     do the db_connect
>     do the db_query
>     process the information from the db/tbl
>     close the db_connection
>   ?>
> 
> the only reason i ask is that it would be nice/good if there was some way
> of
> opening a connetion once for a given session (save bandwidth) as well as
> somehow saving data from the db/tbl (short of using session vars)

Hi Bruce,

Basically what you're asking about is persistent connections from PHP to
MySQL, which are performed using mysql_pconnect().

In the pseudo-code outline you have above, you don't need to perform the
'close the db_connection' step. Each time a page loads that has a
mysql_pconnect statement, it will check to see if an existing (or persisted)
connection is available, and will use it instead of creating a new
connection, if one does. If no persisted connection is found to be
available, mysql_pconnect goes ahead and creates the connection, and
persists it for future connection attempts.

Each page should still probably perform the mysql_pconnect function, since
unless you have a very statically defined interaction of pages, you may not
be able to guarantee that a connection already exists when a particular page
is loaded.

Don't forget that while closing the db connection isn't necessary on a
page-by-page basis when using persistent connections, you should still
habitually free recordsets either at the bottom of the page, or at a point
in your code where you know they are no longer needed.

Hope this helps a little.

Much warmth,

Murray
---
"Lost in thought..."
http://www.planetthoughtful.org

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

I'm using Fedora Core 4 (kernell 2.6.11-1.1369_FC4) and having problem when 
installing Apache + PHP... the configuration that I'm using :

1. Apache 2.0.54
./configure --prefix=/usr/local/apache2 --enable-so
make
make install
2. PHP 4.3.1
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
make
make install

In Apache configuration file (httpd.conf) I adding these :

LoadModule php4_module modules/libphp4.so ===> line 232
AddType application/x-httpd-php .php

from compiling and installing process ... all run well... but when I'm 
starting apache

/usr/local/apache2/bin/apachectl start

I got this error :

Syntax error on line 232 of /usr/local/apache2/conf/httpd.conf

Cannot load /usr/local/apache2/modules/libphp4.so into server: 
/usr/local/apache2/modules/libphp4.so: cannot restore segement prot after 
reloc : Permission denied

I already consult documentation for LoadModule syntax and it looks ok.

Has the error something to do with SE Linux ??

Please give me some advices to resolve this :)

Best Regards,

Feris

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

If I already install my Apache on linux system, then is it possible to check 
what configuration settings I provided when compiling the source ?? 

Regards,

Feris

--- End Message ---
--- Begin Message ---
Feris Thia C. wrote:
Hi All,

If I already install my Apache on linux system, then is it possible to check what configuration settings I provided when compiling the source ??

/path/to/httpd -V

If that's not the info you're looking for, check the Apache docs.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
It is no clear which option you are looking for.
If it's PHP compile options use :
<?php
echo phpinfo();
?>
This will give you information you need.

On Tuesday 06 September 2005 16:39, Feris Thia C. wrote:
> Hi All,
>
> If I already install my Apache on linux system, then is it possible to
> check what configuration settings I provided when compiling the source ??
>
> Regards,
>
> Feris

--- End Message ---
--- Begin Message ---
If you compiled it, you can goto the src directory, and log under config.log
Jason

On 9/6/05, Georgi Ivanov <[EMAIL PROTECTED]> wrote:
> 
> It is no clear which option you are looking for.
> If it's PHP compile options use :
> <?php
> echo phpinfo();
> ?>
> This will give you information you need.
> 
> On Tuesday 06 September 2005 16:39, Feris Thia C. wrote:
> > Hi All,
> >
> > If I already install my Apache on linux system, then is it possible to
> > check what configuration settings I provided when compiling the source 
> ??
> >
> > Regards,
> >
> > Feris
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
I'm trying to allow php scripts to execute from the /cgi-bin/ directory, which 
is currently set up as a ScriptAlias in my Apache2 configuration. I've found 
lots of references to this, but there seems to be a couple of different ways to 
accomplish this, and I can't tell which one is recommended or safest. There 
seems to be lots of security risks associated with some of the solutions 
proposed.

I'm using Debian woody. This was working under Apache 1, but somehow upgrading 
to Apache 2 broke it, and I haven't been able to fix it.

I've found solutions involving changing the ScriptAlias directory to just an 
Alias, with ExecuteCGI turned on in the Apache2 configuration. I've also found 
adding an alias to the php4 executable in the cgi-bin directory and adding an 
Action and AddHandler to the configuration, but I wasn't able to get this 
working. I get the sense that changing the SafeMode section of 
/etc/php4/apache2/php.ini is the recommended, safest way, but I haven't been 
able to find any cookbook-style directions on what to change to allow the 
execution of the php scripts from /cgi-bin/.

Can anyone help me get this set up? Searching the archives of this list 
produced some information that seemed contradictory and I couldn't understand 
which methods were recommended.

Thank you for your help and advice.

-Kevin Zembower

-----
E. Kevin Zembower
Internet Systems Group manager
Johns Hopkins University
Bloomberg School of Public Health
Center for Communications Programs
111 Market Place, Suite 310
Baltimore, MD  21202
410-659-6139

--- End Message ---
--- Begin Message ---
What is the best practice for calling objects that are to be used
throughout a users site visit.  For example, I have a members class
with two classes that extend this class.  Is it best to instantiate
the object in the $_Session scope or make individual calls to the
class/object.

For example:

class members {
        var $iMemberID;
        var $iProfileID;
        var $dbServer;
        var $dbUser;
        var $dbPassword;
        var $dbDSN;
        var $_dbServer;
        var $_dbUser;
        var $_dbPassword;
        var $_dbDSN;
        
        function members($dbServer, $dbUser, $dbPassword, $dbDSN){
                $this->_dbServer = $dbServer;
                $this->_dbUser = $dbUser;
                $this->_dbPassword = $dbPassword;
                $this->_dbDSN = $dbDSN;
        }
}

I have created a _global.php file that instantiates the object such as:

if(!isset($_SESSION["objMember"])){
     $_SESSION["objMember"] = new members($aSiteSettings["sDBServer"],
$aSiteSettings["sDBLogin"], $aSiteSettings["sDBPassword"],
$aSiteSettings["sDSN"]);
}

Or am I way off base altogether (wouldn't be too suprises)?

Thanks!

--- End Message ---
--- Begin Message ---
I prefer to make the object on each page load, passing only the member id 
thru the session. 

Jason

On 9/6/05, Chuck Brockman <[EMAIL PROTECTED]> wrote:
> 
> What is the best practice for calling objects that are to be used
> throughout a users site visit. For example, I have a members class
> with two classes that extend this class. Is it best to instantiate
> the object in the $_Session scope or make individual calls to the
> class/object.
> 
> For example:
> 
> class members {
> var $iMemberID;
> var $iProfileID;
> var $dbServer;
> var $dbUser;
> var $dbPassword;
> var $dbDSN;
> var $_dbServer;
> var $_dbUser;
> var $_dbPassword;
> var $_dbDSN;
> 
> function members($dbServer, $dbUser, $dbPassword, $dbDSN){
> $this->_dbServer = $dbServer;
> $this->_dbUser = $dbUser;
> $this->_dbPassword = $dbPassword;
> $this->_dbDSN = $dbDSN;
> }
> }
> 
> I have created a _global.php file that instantiates the object such as:
> 
> if(!isset($_SESSION["objMember"])){
> $_SESSION["objMember"] = new members($aSiteSettings["sDBServer"],
> $aSiteSettings["sDBLogin"], $aSiteSettings["sDBPassword"],
> $aSiteSettings["sDSN"]);
> }
> 
> Or am I way off base altogether (wouldn't be too suprises)?
> 
> Thanks!
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message --- 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 ?
--- End Message ---
--- Begin Message ---
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 ---
Hello, 

I am searching for the right equivalent for "cut -d : -f5"
but it must work with php4.

Since the website <http://www.php.net/manual/de/> has no
seperated manuals for php4 and php5, it is not easy to
find the right stuff.

Greetings and good evening
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 ---
The closest you get to 'cut' in PHP is probably the 'explode' command.  It 
splits a string by a delimiter like 'cut' does, only it dumps the results into 
an array:

$etcpasswd = "username:passwd:123:345::/home/username:/bin/sh";

$pwdarr = explode(":", $etcpasswd);

echo $pwdarr[4];

That should give you the 5th 'column' of the $etcpasswd string.

OR.. you could do this:

list($username, $passwd, $userid, $groupid, $something, $homedir, $defshell) = 
explode(":", $etcpasswd);

That'll take the array returned from explode() and put it into the variables 
used in $list.  It's been ages since I've messed with *nix /etc/passwd files, 
so forgive any inaccuracies in the field names I've used above.  You get the 
idea though.

Good luck Michelle!

-TG

= = = Original message = = =

Hello, 

I am searching for the right equivalent for "cut -d : -f5"
but it must work with php4.

Since the website <http://www.php.net/manual/de/> has no
seperated manuals for php4 and php5, it is not easy to
find the right stuff.

Greetings and good evening
Michelle


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---
--- Begin Message ---
* Michelle Konzack <[EMAIL PROTECTED]>:
> I am searching for the right equivalent for "cut -d : -f5"
> but it must work with php4.

$fields = explode(':', $string, 5);

> Since the website <http://www.php.net/manual/de/> has no
> seperated manuals for php4 and php5, it is not easy to
> find the right stuff.

explode() works the same in both PHP4 and PHP5. Additionally, the manual
is very good at detailing in what versions of PHP a function is valid.

-- 
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

--- End Message ---
--- Begin Message ---
I am searching for the right equivalent for "cut -d : -f5"
but it must work with php4.

$fields = explode(':', $string, 5);

Hmmm.. that's going to create a 5 element array assigned to $fields. So, using /etc/passwd as an example...

philip:*:1000:1000:Philip Hallstrom:/local/home/philip:/bin/tcsh

$fields is going to look like this:

0 = philip
1 = *
2 = 1000
3 = 1000
4 = Philip Hallstrom:/local/home/philip:/bin/tcsh

I think what he really wants is:

$fields = explode(':', $string);
$fullname = $fields[4]; // Philip Hallstrom


-philip

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

Am 2005-09-06 11:22:11, schrieb Philip Hallstrom:

> Hmmm.. that's going to create a 5 element array assigned to $fields.  So, 
> using /etc/passwd as an example...

:-)

> $fields = explode(':', $string);
> $fullname = $fields[4]; // Philip Hallstrom

Thanks.

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 ---
I am using sessions, but every relative URL gets a "?PHPSESSID=..." appended 
to it.  I'm assuming this is happening because of some setting that has been 
set in PHP. I work on an ISP server, so I don't have much control over the 
PHP configuration.

Is there any way I can turn this "feature" off, even though I don't have 
access to the configuration files?

Thanks
DanB

PS I'm using cookies to propagate the SID (which works), but the argument is 
still appended to every URL.

--- End Message ---
--- Begin Message ---
Matt Palermo wrote:
Hello everyone. I have a script where I am using FTP functions to chmod files/folders. I'm running into a problem with the ftp_chmod() function when trying to change the permissions of a directory. Here is the code I'm using:

ftp_chmod($connId, 0777, $folder);

The function almost works, but when I check the permission of the folder after it's run, the folder has 410 for permissions instead of 777. So, it is changing the permissions, but not to the correct value. Now when I use the following code, it seems to work fine:

$chmodCmd = "CHMOD 0777 ".$file;
ftp_site($connId, $chmodCmd);

This properly changes the folder permissions to 777. Does anyone know why the ftp_chmod() function doesn't work correctly? As a side note, the ftp_chmod() function works correctly on a file, but not a directory. Any help is appreciated.

Thanks,

Matt Palermo
http://sweetphp.com


Which php version are you using?  PHP 4x does not have ftp_chmod(); It does 
have ftp_site()

--- End Message ---
--- Begin Message ---
Hi,
Php 4,3,2 has a regenerate session id function session_regenerate_id

un4tunately I 'm stuck with 4.3.1

The following doesn't seem to work

// Unset session data
$_SESSION=array();
// Clear cookie
unset($_COOKIE[session_name()]);
// Destroy session data
session_destroy();


Unless I close and reopen IE I always get the same session Id

Can ye help?

-- 
zzapper
Success for Techies and Vim,Zsh tips
http://SuccessTheory.com/

--- End Message ---
--- Begin Message ---
Hi all,
 
 
I want to write regular expression for checking the string format entered by 
user.
 
the allowed formats are
 
examples:
10
10,
10,12-10
12-10
 
that is the valid strings are:
1. only integer
2. an integer, range of integers example 3
 
and no other characters must be allowed.
 
thanks
babu.
 

                
---------------------------------
How much free photo storage do you get? Store your holiday snaps for FREE with 
Yahoo! Photos. Get Yahoo! Photos

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



On Tue, 6 Sep 2005, babu wrote:

Hi all,


I want to write regular expression for checking the string format entered by 
user.

the allowed formats are

examples:
10
10,
10,12-10
12-10

that is the valid strings are:
1. only integer
2. an integer, range of integers example 3

and no other characters must be allowed.

ereg("^[-0-9,]+$"...

would do it, but it would also allow "10,-" as a valid expression as well.. so if you want to check for valid ranges you'll want to beef that up a bit...

-philip

--- End Message ---
--- Begin Message ---
babu wrote:
Hi all,
I want to write regular expression for checking the string format entered by user. the allowed formats are examples:
10
10,
10,12-10
12-10
that is the valid strings are:
1. only integer
2. an integer, range of integers example 3
and no other characters must be allowed.

Crude, but it will work....

preg_match ( "/^[-0-9,]+$/", $value )

It will also match just dashes and/or just comma's with no numbers.

http://us2.php.net/manual/en/reference.pcre.pattern.syntax.php

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
hey,

can anyone tell me if there's a good/serious email/newsletter list manager
app for php similar to 'python/mailman'

thanks

bruce
[EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
try hotscripts.com

On 9/6/05, bruce <[EMAIL PROTECTED]> wrote:
> hey,
> 
> can anyone tell me if there's a good/serious email/newsletter list manager
> app for php similar to 'python/mailman'
> 
> thanks
> 
> bruce
> [EMAIL PROTECTED]
> 
> 
> --
> 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 ---

Reply via email to