Re: [PHP] Regular expression help

2004-08-25 Thread John Holmes
Daniel Lahey wrote:
I'm trying to figure out how to formulate a regular expression that will 
get me everything following a pound sign (#) up to the first space or { 
character.  (I'm trying to parse the ids out of a style sheet.)  Can 
anyone point me in the right direction?  I've been searching on the web 
for hours and reading everything I can find on regular expressions, but 
I just can't wrap my brain around it.  Thanks.
preg_match_all('/#([^\s{]+)/',$style_sheet,$matches);
$matches[1] should have all of the matches...
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Regular expression help

2004-08-25 Thread Ramil Sagum
On Tue, 24 Aug 2004 23:53:53 -0700, Daniel Lahey <[EMAIL PROTECTED]> wrote:
> I'm trying to figure out how to formulate a regular expression that
> will get me everything following a pound sign (#) up to the first space
> or { character.  (I'm trying to parse the ids out of a style sheet.)
> Can anyone point me in the right direction?  I've been searching on the
> web for hours and reading everything I can find on regular expressions,
> but I just can't wrap my brain around it.  Thanks.
> 


Try this snippet



http://www.csszengarden.com//001/001.css";, "r");
$data = fread($css, 3);
preg_match_all("/#.+({ )/", $data, $out);
print_r($out);
?>


It gets the default css from the zengarden site. (30k is a large
buffer, but this is not a howto on buffered reads)

The regular expression 

/#.+({ )/

means, piece by piece


#  the # character
.  dot is a special character in regular expressions. it can match
any character
+  is also a special character,  it means match 1 or more times

so .+ means match any character 1 or more times

( ) are special characters, they match any single character inside them.

in the case of ({ )  , it matches either a space or a left bracket

So, the whole expression means:

match a strings where they start with #, followed by 1 or more
characters, followed by a space or a left-bracket

Note that these are very simplified explanations for regular expressions. 

Now, try the expression

/#(.+)({ )/

and instead of  print_r($out), try

print_r($out[1]);


Now you get the classnames :)  Check out the following sites for more
info (they appear first when you google regular expressions).

http://sitescooper.org/tao_regexps.html
http://etext.lib.virginia.edu/helpsheets/regex.html


Also, check out the PHP manual for the preg_* functions

---
Note that the script i gave you has problems with classnames on one line, like

#footer a:link, #footer a:visited 

But I won't spoon feed you :)



ramil

http://ramil.sagum.net

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



[PHP] Blog hosting script in php

2004-08-25 Thread Xongoo!com: Central unit
Hello,

Spent two days searching for blog hosting script
(where users can register/open their own blogs,
manage them, etc.), paid for ExpressionEngine
demo, hoping I can configure it for that, but...
So, maybe someone knows good blog hosting scripts
in php?

Best!

--
Tadas Talaikis
[EMAIL PROTECTED]
http://www.xongoo.com

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



[PHP] session cookie paths

2004-08-25 Thread Ian Firla

Dear All,

I've been trying to figure out a solution for this problem and have
googled the subject but cannot come up with anything meaningful.

I have several applications running on my server which use php and
sessions.

In each case, logging out from an application destroys the session.

The trouble is that all the applications (four of them) share the same
id: PHPSESSID and path: /

My first hunch is to try to use .htaccess in each application's root
directory to override these php.ini variables. Am I on the right track?

Regards,

Ian

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



[PHP] Destroying a Session

2004-08-25 Thread Shaun
Hi,

I am writing a shopping cart and am using a session called
$_SESSION["orderinfo"] to store the order information. I also have a
function I use to clear the session when the payment has been authorized:

function clear_orderinfo() {
  global $_SESSION;
  unset($_SESSION["orderinfo"]);
 }

However this function doesnt seem to work and the session remains active, is
there another way to clear a session?

Thanks for your help

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



Re: [PHP] Destroying a Session

2004-08-25 Thread Burhan Khalid
On Wed, 2004-08-25 at 14:34, Shaun wrote:
> I am writing a shopping cart and am using a session called
> $_SESSION["orderinfo"] to store the order information. I also have a
> function I use to clear the session when the payment has been authorized:
> 
> function clear_orderinfo() {
>   global $_SESSION;
>   unset($_SESSION["orderinfo"]);
>  }
> 
> However this function doesnt seem to work and the session remains active, is
> there another way to clear a session?

You do have a session_start() somewhere, right? Also, $_SESSION, like
$_GET, $_POST et. al. are automatically global, you don't need to
specify global $_SESSION.

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



Re: [PHP] Destroying a Session

2004-08-25 Thread john
>> function clear_orderinfo() {
>>   global $_SESSION;
>>   unset($_SESSION["orderinfo"]);
>>  }
>>
>> However this function doesnt seem to work and the session remains
>> active, is
>> there another way to clear a session?

I'm not triffically experienced, but I do have notes on the subject.
You're wanting to clear the whole session, right?

$_SESSION=array();
session_destroy();

For specific variables, try assigning FALSE to it
($_SESSION['name']=FALSE; or 'unset' works for versions >=4.2.2. Otherwise
use session_unregister. For me under 4.1.2 I had to set to null.

HTH
J



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



Re: [PHP] session cookie paths

2004-08-25 Thread Ian Firla

Answered my own question.

Creating an .htaccess file containing:

php_value session.name "uniqueSESSIONname"

takes care of the problem.


On Wed, 2004-08-25 at 12:30, Ian Firla wrote:
> Dear All,
> 
> I've been trying to figure out a solution for this problem and have
> googled the subject but cannot come up with anything meaningful.
> 
> I have several applications running on my server which use php and
> sessions.
> 
> In each case, logging out from an application destroys the session.
> 
> The trouble is that all the applications (four of them) share the same
> id: PHPSESSID and path: /
> 
> My first hunch is to try to use .htaccess in each application's root
> directory to override these php.ini variables. Am I on the right track?
> 
> Regards,
> 
> Ian

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



Re: [PHP] session cookie paths

2004-08-25 Thread John Holmes
From: "Ian Firla" <[EMAIL PROTECTED]>
Answered my own question.
Creating an .htaccess file containing:
php_value session.name "uniqueSESSIONname"
takes care of the problem.
You could also use 

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


[PHP] Is javascript enable?

2004-08-25 Thread Marcos Thiago M. Fabis
hello;

does someone know how can i check if javascript is enabled in client´s
browser using only PHP ?

thnx in advance!

[s]
Mt

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



Re: [PHP] session cookie paths

2004-08-25 Thread John Holmes
From: "Ian Firla" <[EMAIL PROTECTED]>
Answered my own question.
Creating an .htaccess file containing:
php_value session.name "uniqueSESSIONname"
takes care of the problem.
You can do this from within PHP by calling session_name() before 
session_start, also.

You could also use set_cookie_params() in each of the scripts.
http://www.php.net/manual/en/function.session-set-cookie-params.php
---John Holmes... 

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


Re: [PHP] Is javascript enable?

2004-08-25 Thread ramil
On Wed, 25 Aug 2004 09:24:41 -0300, Marcos Thiago M. Fabis
<[EMAIL PROTECTED]> wrote:
> hello;
> 
> does someone know how can i check if javascript is enabled in client´s
> browser using only PHP ?
> 
> thnx in advance!

A search using the keywords "browser" and "javascript" would have
shown you the PHP function get_browser()

http://www.php.net/manual/en/function.get-browser.php
 
and notes in the page will point you to the more full featured
javascript detection script:

http://tech.ratmachines.com/downloads/php_browser_detection.php


I hope that helps.



ramil

http://ramil.sagum.net

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



[PHP] Odd behaviour of non-existent keys?

2004-08-25 Thread Geoff Caplan
Hi folks,

Getting a result I don't understand.

Why does the non-existent key in the array below evaluate to the
first char of the array value?

$foo = '' ;
$foo['one']['two'] = 'test-value' ;

// Evaluates to: string(1) "t"
var_dump( $foo['one']['two']['three'] ) ;


// Evaluates to NULL, as expected
var_dump($foo['one']['two']['three']['four'] ) ;

Can anyone enlighten me?

I spotted this because I was getting unexpected results with isset()
used on multi-dimensional arrays.

I'm using the latest version of PHP4 on Debian.

-- 
Geoff Caplan

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



Re: [PHP] Odd behaviour of non-existent keys?

2004-08-25 Thread John Holmes
From: "Geoff Caplan" <[EMAIL PROTECTED]>
Getting a result I don't understand.
Why does the non-existent key in the array below evaluate to the
first char of the array value?
$foo = '' ;
$foo['one']['two'] = 'test-value' ;
// Evaluates to: string(1) "t"
var_dump( $foo['one']['two']['three'] ) ;
// Evaluates to NULL, as expected
var_dump($foo['one']['two']['three']['four'] ) ;
Can anyone enlighten me?
Strings are arrays. PHP probably takes the string 'three' and converts it to 
a integer to see what "key" of the string you're requesting.

$foo = 'bar';
echo $foo[1]; //should echo 'a'
Does that help or do you need a deeper explanation (that I probably can't 
provide!) ;)

---John Holmes... 

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


Re[2]: [PHP] Odd behaviour of non-existent keys?

2004-08-25 Thread Geoff Caplan
John,

>>
>> Why does the non-existent key in the array below evaluate to the
>> first char of the array value?
>>
>> $foo = '' ;
>> $foo['one']['two'] = 'test-value' ;
>>
>> // Evaluates to: string(1) "t"
>> var_dump( $foo['one']['two']['three'] ) ;
>>

JH> Strings are arrays. PHP probably takes the string 'three' and converts it to 
JH> a integer to see what "key" of the string you're requesting.

JH> $foo = 'bar';
JH> echo $foo[1]; //should echo 'a'

JH> Does that help or do you need a deeper explanation (that I probably can't 
JH> provide!) ;)

I think you are probably right - but this behaviour causes problems.
For example:

$foo['one']['two'] = "test-string" ;

// Evaluates to TRUE (not what's wanted!)
isset( $foo['one']['two']['three'] ) ;

I need a reliable way to test for the non-existence of a
multi-dimensional key. Any ideas? I guess I could convert the keys
into a string via a loop and compare that, but there must be a more
elegant way, surely?


-- 
Geoff Caplan

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



Re: Re[2]: [PHP] Odd behaviour of non-existent keys?

2004-08-25 Thread ramil
On Wed, 25 Aug 2004 14:04:51 +0100, Geoff Caplan <[EMAIL PROTECTED]> wrote:
> I think you are probably right - but this behaviour causes problems.
> For example:
> 
> $foo['one']['two'] = "test-string" ;
> 
> // Evaluates to TRUE (not what's wanted!)
> isset( $foo['one']['two']['three'] ) ;
> 
> I need a reliable way to test for the non-existence of a
> multi-dimensional key. Any ideas? I guess I could convert the keys
> into a string via a loop and compare that, but there must be a more
> elegant way, surely?
> 
> --
> Geoff Caplan
> 

How about array_key_exists?

array_key_exists('three', $foo['one']['two']);

http://jp2.php.net/manual/en/function.array-key-exists.php 




ramil

http://ramil.sagum.net

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



Re: Re[2]: [PHP] Odd behaviour of non-existent keys?

2004-08-25 Thread John Holmes
From: "Geoff Caplan" <[EMAIL PROTECTED]>
Why does the non-existent key in the array below evaluate to the
first char of the array value?
$foo = '' ;
$foo['one']['two'] = 'test-value' ;
// Evaluates to: string(1) "t"
var_dump( $foo['one']['two']['three'] ) ;
JH> Strings are arrays. PHP probably takes the string 'three' and converts 
it to
JH> a integer to see what "key" of the string you're requesting.

JH> $foo = 'bar';
JH> echo $foo[1]; //should echo 'a'
JH> Does that help or do you need a deeper explanation (that I probably 
can't
JH> provide!) ;)

I think you are probably right - but this behaviour causes problems.
For example:
$foo['one']['two'] = "test-string" ;
// Evaluates to TRUE (not what's wanted!)
isset( $foo['one']['two']['three'] ) ;
I need a reliable way to test for the non-existence of a
multi-dimensional key. Any ideas? I guess I could convert the keys
into a string via a loop and compare that, but there must be a more
elegant way, surely?
How about is_array()?
if(is_array($foo['one']['two']))
{ echo 'multi dimensional array found'; }
You also have is_string(), empty(), etc...
---John Holmes... 

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


Re: [PHP] Sessions vs. IE security

2004-08-25 Thread Stanislav Kuhn
Thanks guys for helps.. I've tried many that things and I found solution.
Solution for me was set up Privacy Policy for our site...
First time it didn't work because i haven't done Compact privacy policy
witch is optional but IE requires it ;o)

While compact policies are entirely optional for P3P-enabled web sites, IE6
relies heavily on them. This browser makes cookie-blocking decisions based
solely on compact policies. By default, IE6 blocks "third-party" cookies
that do not have compact policies.

But anyway I passed page trought w3c validator and with good settings of
privacy policy IE now allows every (inc. third party) cookies in all levels
of security (except level block all cookies of course). And it means i can
use sessions without problems.. And I recommand  to do same as soon as
possible for everyone. Microsoft going to be crazy in security. Today that
are third-party cookies tomorow may be first_party!...

S.

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



[PHP] fatal error undefined call to mysql_connect

2004-08-25 Thread Angelo Zanetti
Hi all, 

I have installed my php scripts on a new server (linux) and when
attempting to run them I get this error. Is this error a configuration
issue in my PHP.ini file or is it a user issue with mysql and connecting
to the database? 

thanks in advance
Angelo

Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



Re: [PHP] fatal error undefined call to mysql_connect

2004-08-25 Thread John Holmes
From: "Angelo Zanetti" <[EMAIL PROTECTED]>
I have installed my php scripts on a new server (linux) and when
attempting to run them I get this error. Is this error a configuration
issue in my PHP.ini file or is it a user issue with mysql and connecting
to the database?
Enable mysql support in PHP. I bet the manual has instructions on things 
like this...

---John Holmes... 

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


Re: [PHP] fatal error undefined call to mysql_connect

2004-08-25 Thread ramil
On Wed, 25 Aug 2004 16:12:53 +0200, Angelo Zanetti <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> I have installed my php scripts on a new server (linux) and when
> attempting to run them I get this error. Is this error a configuration
> issue in my PHP.ini file or is it a user issue with mysql and connecting
> to the database?
> 
> thanks in advance
> Angelo


Your PHP installation probably does not have the MySQL  extension installed.

Please read  http://www.php.net/mysql for more information on how to
enable mysql functions

HTH




ramil

http://ramil.sagum.net

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



Re: [PHP] fatal error undefined call to mysql_connect

2004-08-25 Thread Angelo Zanetti
so to include the mysql extensions to I have to reinstall PHP or can I
simply just change the values in the PHP.ini file for the mysql
entries?

Thanks to those who responded


>>> ramil <[EMAIL PROTECTED]> 8/25/2004 4:21:14 PM >>>
On Wed, 25 Aug 2004 16:12:53 +0200, Angelo Zanetti <[EMAIL PROTECTED]>
wrote:
> Hi all,
> 
> I have installed my php scripts on a new server (linux) and when
> attempting to run them I get this error. Is this error a
configuration
> issue in my PHP.ini file or is it a user issue with mysql and
connecting
> to the database?
> 
> thanks in advance
> Angelo


Your PHP installation probably does not have the MySQL  extension
installed.

Please read  http://www.php.net/mysql for more information on how to
enable mysql functions

HTH




ramil

http://ramil.sagum.net 

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


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



RE: Re[2]: [PHP] Odd behaviour of non-existent keys?

2004-08-25 Thread Michael Sims
Geoff Caplan wrote:
> I think you are probably right - but this behaviour causes problems.
> For example:
>
> $foo['one']['two'] = "test-string" ;
>
> // Evaluates to TRUE (not what's wanted!)
> isset( $foo['one']['two']['three'] ) ;
>
> I need a reliable way to test for the non-existence of a
> multi-dimensional key. Any ideas? I guess I could convert the keys
> into a string via a loop and compare that, but there must be a more
> elegant way, surely?

IMHO what you have described is a bug in PHP, and if I were you, I'd report it as
such.  If it's not a bug it at least has a very high WTF factor.  Having to use the
cumbersome:

is_array($foo['one']['two']) && array_key_exists('three', $foo['one']['two'])

instead of:

isset($foo['one']['two']['three'])

seems kinda silly to me.  I doubt that this is the intended behavior.

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



Re: [PHP] fatal error undefined call to mysql_connect

2004-08-25 Thread John Nichel
Angelo Zanetti wrote:
so to include the mysql extensions to I have to reinstall PHP or can I
simply just change the values in the PHP.ini file for the mysql
entries?
Thanks to those who responded
How did you install php?  RPM (or similiar package), or source?
If you installed from RPM, you can add the php-mysql rpm, and restart 
your web server.  If you installed from source, you'll have to recompile 
php (hopefully you're using apxs).

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] fatal error undefined call to mysql_connect

2004-08-25 Thread Angelo Zanetti
I never installed it so... here is my next question. how would I find out how it was 
installed?



>>> John Nichel <[EMAIL PROTECTED]> 8/25/2004 4:44:18 PM >>>
Angelo Zanetti wrote:
> so to include the mysql extensions to I have to reinstall PHP or can I
> simply just change the values in the PHP.ini file for the mysql
> entries?
> 
> Thanks to those who responded

How did you install php?  RPM (or similiar package), or source?

If you installed from RPM, you can add the php-mysql rpm, and restart 
your web server.  If you installed from source, you'll have to recompile 
php (hopefully you're using apxs).

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

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



Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Technikon or the sender
of this e-mail be liable to any party for any direct, indirect,
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



Re: [PHP] fatal error undefined call to mysql_connect

2004-08-25 Thread John Nichel
Angelo Zanetti wrote:
I never installed it so... here is my next question. how would I find out how it was installed?
Ask the person who set it up?
If you're on a RPM based system (Red Hat, Fedora, etc), do this at the 
command line...

rpm -qa | grep php
and if PHP is installed as an RPM, it will show up there.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] fatal error undefined call to mysql_connect

2004-08-25 Thread Ian Firla

On Wed, 2004-08-25 at 17:08, Angelo Zanetti wrote:
> I never installed it so... here is my next question. how would I find out how it was 
> installed?

Look at the output of phpinfo(). But before doing that, read the
documentation or you'll be back here in a flash with more really basic
questions.

A very good source for answers is also php.net. Try typing in some of
your problem terms like "mysql" into the search query.

Ian

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



[PHP] Communicate with Outlook

2004-08-25 Thread Shaun
Hi,

Is it possible for a PHP application to communicate with an Outlook
calendar? I would like to create a web based application that shows staff
availability...

Thanks for any advice offered.

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



[PHP] PID needed to hammer squid

2004-08-25 Thread Mário Gamito
Hi,
I need to restart squid from PHP, but my squi doesn't stop because a lot 
of stupid errors.

So, i need to kill it and then start it again.
[EMAIL PROTECTED] init.d]# ps aux | grep squid
root  9281  0.0  0.3  6124 1792 ?S16:04   0:00 squid -D
squid 9283  0.0  1.0  8392 5060 ?S16:04   0:00 (squid) -D
squid 9284  0.0  0.0  1360  264 ?S16:04   0:00 (unlinkd)
root  9288  0.0  0.1  3860  592 pts/0S16:10   0:00 grep squid
[EMAIL PROTECTED] init.d]# echo $$;
The pid i need to kill is the one from the line:
squid 9283  0.0  1.0  8392 5060 ?S16:04   0:00 (squid) -D
How can i get this pid so i can kill -9 it and then start squid again ?
Any help would be appreciated.
Warm Regards,
Mário Gamito
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] PID needed to hammer squid

2004-08-25 Thread Jay Blanchard
[snip]
I need to restart squid from PHP, but my squi doesn't stop because a lot 
of stupid errors.

So, i need to kill it and then start it again.

[EMAIL PROTECTED] init.d]# ps aux | grep squid
root  9281  0.0  0.3  6124 1792 ?S16:04   0:00 squid -D
squid 9283  0.0  1.0  8392 5060 ?S16:04   0:00 (squid) -D
squid 9284  0.0  0.0  1360  264 ?S16:04   0:00 (unlinkd)
root  9288  0.0  0.1  3860  592 pts/0S16:10   0:00 grep squid
[EMAIL PROTECTED] init.d]# echo $$;

The pid i need to kill is the one from the line:

squid 9283  0.0  1.0  8392 5060 ?S16:04   0:00 (squid) -D

How can i get this pid so i can kill -9 it and then start squid again ?
[/snip]

Start here http://www.php.net/exec
To get the PID you may be able to place the output of ps -aux in an array, regex for 
what you want, then exec

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



[PHP] PHP Login Script

2004-08-25 Thread Chuck
Could anyone let me know or point me to where I could find out how to setup
a login for my php site.  I've been looking around and found plenty of stuff
for PHP/Apache, but nothing for just PHP.

Any help or info about this would be appreciated.

Thanks,
Chuck

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



Re: [PHP] Destroying a Session

2004-08-25 Thread Shaun

<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >> function clear_orderinfo() {
> >>   global $_SESSION;
> >>   unset($_SESSION["orderinfo"]);
> >>  }
> >>
> >> However this function doesnt seem to work and the session remains
> >> active, is
> >> there another way to clear a session?
>
> I'm not triffically experienced, but I do have notes on the subject.
> You're wanting to clear the whole session, right?
>
> $_SESSION=array();
> session_destroy();
>
> For specific variables, try assigning FALSE to it
> ($_SESSION['name']=FALSE; or 'unset' works for versions >=4.2.2. Otherwise
> use session_unregister. For me under 4.1.2 I had to set to null.
>
> HTH
> J
>
>

Hi,

Thank you for your replies. I am using version 4.3.3 yet unset() doesn't
seem to work. To test this I have placed this line of code in my footer.php
file that appears at the bottom of every page:

echo 'load_orderinfo() = '.load_orderinfo();

Here is the load_orderinfo() function:

function load_orderinfo() {
  global $_SESSION;
  if (empty($_SESSION["orderinfo"])) {
   return false;
  } else {
   return $_SESSION["orderinfo"];
  }
 }

Before the $_SESSION["orderinfo"] is created the output in the footer reads:

load_orderinfo() =

When it has been created it reads:

load_orderinfo() = Object;

On the complete_order.php page where I call the clear_orderinfo() function
it goes back to:

load_orderinfo() =

but it on any subsequent page the output returns to:

load_orderinfo() = Object;

But after calling the clear_orderinfo() function surely the
$_SESSION["orderinfo"] should have been destroyed. I hope this makes sense!

Thanks for your help

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



Re: [PHP] PID needed to hammer squid

2004-08-25 Thread raditha dissanayake
Mário Gamito wrote:
Hi,
I need to restart squid from PHP, but my squi doesn't stop because a 
lot of stupid errors.

So, i need to kill it and then start it again.
killing a process owned by another user is a tough ask. The squid docs 
say you shouldn't run it as root and it also advice against using nobody 
- the user that typically own the apache process. How to make use of 
sudo/suexec/cron to overcome these issues have been discussed often in 
the past and you will find it in the archives.

To answer your specific question on getting the PID. I would try looking 
in /var/run/squid.pid or executing `pidof squid`
instead of trying to parse the output of ps.


squid 9283  0.0  1.0  8392 5060 ?S16:04   0:00 (squid) -D

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Login Script

2004-08-25 Thread raditha dissanayake
Chuck wrote:
Could anyone let me know or point me to where I could find out how to setup
a login for my php site.  I've been looking around and found plenty of stuff
for PHP/Apache, but nothing for just PHP.
 

You need to store user information somewhere and apache .htpasswd files 
and mysql databases are popular choices.
Shamless plug:  I can direct you to a php and mysql login system at 
http://www.radinks.net/user/

Any help or info about this would be appreciated.
Thanks,
Chuck
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Communicate with Outlook

2004-08-25 Thread raditha dissanayake
Shaun wrote:
Hi,
Is it possible for a PHP application to communicate with an Outlook
calendar? I would like to create a web based application that shows staff
availability...
 

If you are talking about acessing the outlook calendar on a client 
machine you cannot.
If you are talking about outlook web access with exchange yes you can 
connect to the exchange server but how to do it you will have to ask in 
a microsoft support group.

Thanks for any advice offered.
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PID needed to hammer squid

2004-08-25 Thread Mário Gamito
Hi,
I need to kill (squid) -D
pidof (squid) -D gives an error :(
Regards,
Mário Gamito
raditha dissanayake wrote:
Mário Gamito wrote:
Hi,
I need to restart squid from PHP, but my squi doesn't stop because a 
lot of stupid errors.

So, i need to kill it and then start it again.

killing a process owned by another user is a tough ask. The squid docs 
say you shouldn't run it as root and it also advice against using nobody 
- the user that typically own the apache process. How to make use of 
sudo/suexec/cron to overcome these issues have been discussed often in 
the past and you will find it in the archives.

To answer your specific question on getting the PID. I would try looking 
in /var/run/squid.pid or executing `pidof squid`
instead of trying to parse the output of ps.


squid 9283  0.0  1.0  8392 5060 ?S16:04   0:00 (squid) -D

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


Re: [PHP] PID needed to hammer squid

2004-08-25 Thread raditha dissanayake
Mário Gamito wrote:
Hi,
I need to kill (squid) -D
pidof (squid) -D gives an error :(
man pidof
we have nowed moved to off topic territory.
--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Communicate with Outlook

2004-08-25 Thread Miles Thompson
Did you try Google? It turned this up ...
http://lists.ximian.com/archives/public/evolution/2000-May/026035.html
The trick, I think, would be knowing the schema of the .pst. In early 
versions you could use Access to open the .pst.

MT
At 12:16 PM 8/25/2004, Shaun wrote:
Hi,
Is it possible for a PHP application to communicate with an Outlook
calendar? I would like to create a web based application that shows staff
availability...
Thanks for any advice offered.
--
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


Re: [PHP] Destroying a Session

2004-08-25 Thread Torsten Roehr
"Shaun" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > >> function clear_orderinfo() {
> > >>   global $_SESSION;
> > >>   unset($_SESSION["orderinfo"]);
> > >>  }
> > >>
> > >> However this function doesnt seem to work and the session remains
> > >> active, is
> > >> there another way to clear a session?
> >
> > I'm not triffically experienced, but I do have notes on the subject.
> > You're wanting to clear the whole session, right?
> >
> > $_SESSION=array();
> > session_destroy();
> >
> > For specific variables, try assigning FALSE to it
> > ($_SESSION['name']=FALSE; or 'unset' works for versions >=4.2.2.
Otherwise
> > use session_unregister. For me under 4.1.2 I had to set to null.
> >
> > HTH
> > J
> >
> >
>
> Hi,
>
> Thank you for your replies. I am using version 4.3.3 yet unset() doesn't
> seem to work. To test this I have placed this line of code in my
footer.php
> file that appears at the bottom of every page:
>
> echo 'load_orderinfo() = '.load_orderinfo();
>
> Here is the load_orderinfo() function:
>
> function load_orderinfo() {
>   global $_SESSION;
>   if (empty($_SESSION["orderinfo"])) {
>return false;
>   } else {
>return $_SESSION["orderinfo"];
>   }
>  }
>
> Before the $_SESSION["orderinfo"] is created the output in the footer
reads:
>
> load_orderinfo() =
>
> When it has been created it reads:
>
> load_orderinfo() = Object;
>
> On the complete_order.php page where I call the clear_orderinfo() function
> it goes back to:
>
> load_orderinfo() =
>
> but it on any subsequent page the output returns to:
>
> load_orderinfo() = Object;
>
> But after calling the clear_orderinfo() function surely the
> $_SESSION["orderinfo"] should have been destroyed. I hope this makes
sense!
>
> Thanks for your help

Hi,

remove the global $_SESSION; lines in your functions - they are uneccessary.
Have you tried resetting $_SESSION instead of unset()?:

$_SESSION = array();

Regards, Torsten Roehr

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



Re: [PHP] Is javascript enable?

2004-08-25 Thread Marcos Thiago M. Fabis
Hi ramil;

thnx, but this is not what i´m looking for.

i want to retrieve this information (javascript enabled or not) from the
browser in execution time.

the get_browser function return me a value that simply means that the
browser itself is capable of execute javascript and does not mean the user
has enabled it in the browser.

Anyone else ? = )

[s]

- Original Message - 
From: "ramil" <[EMAIL PROTECTED]>
To: "Marcos Thiago M. Fabis" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, August 25, 2004 9:36 AM
Subject: Re: [PHP] Is javascript enable?


> On Wed, 25 Aug 2004 09:24:41 -0300, Marcos Thiago M. Fabis
> <[EMAIL PROTECTED]> wrote:
> > hello;
> >
> > does someone know how can i check if javascript is enabled in client´s
> > browser using only PHP ?
> >
> > thnx in advance!
>
> A search using the keywords "browser" and "javascript" would have
> shown you the PHP function get_browser()
>
> http://www.php.net/manual/en/function.get-browser.php
>
> and notes in the page will point you to the more full featured
> javascript detection script:
>
> http://tech.ratmachines.com/downloads/php_browser_detection.php
>
>
> I hope that helps.
>
> 
>
> ramil
>
> http://ramil.sagum.net

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



[PHP] Re: PHP Login Script

2004-08-25 Thread Torsten Roehr
"Chuck" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Could anyone let me know or point me to where I could find out how to
setup
> a login for my php site.  I've been looking around and found plenty of
stuff
> for PHP/Apache, but nothing for just PHP.
>
> Any help or info about this would be appreciated.
>
> Thanks,
> Chuck

Hi Chuck,

you could try those two PEAR packages:
http://pear.php.net/package/Auth
http://pear.php.net/package/LiveUser

If you have any questions about those packages that the docs and the source
code can't answer there is the PEAR general mailing list to help ;)

Best regards, Torsten Roehr

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



Re: [PHP] Is javascript enable?

2004-08-25 Thread John Holmes
From: "Marcos Thiago M. Fabis" <[EMAIL PROTECTED]>
i want to retrieve this information (javascript enabled or not) from the
browser in execution time.
the get_browser function return me a value that simply means that the
browser itself is capable of execute javascript and does not mean the user
has enabled it in the browser.
So set a form/URL variable with JavaScript and see if your PHP page receives 
it. Hidden  would probably work, or image, etc... You'll need a page 
refresh or redirect in between though to detect it.

---John Holmes... 

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


Re: [PHP] Destroying a Session

2004-08-25 Thread Andre Dubuc
On Wednesday 25 August 2004 12:27 pm, Shaun wrote:
> <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
> > >> function clear_orderinfo() {
> > >>   global $_SESSION;
> > >>   unset($_SESSION["orderinfo"]);
> > >>  }
> > >>
> > >> However this function doesnt seem to work and the session remains
> > >> active, is
> > >> there another way to clear a session?
> >
> > I'm not triffically experienced, but I do have notes on the subject.
> > You're wanting to clear the whole session, right?
> >
> > $_SESSION=array();
> > session_destroy();
> >
> > For specific variables, try assigning FALSE to it
> > ($_SESSION['name']=FALSE; or 'unset' works for versions >=4.2.2.
> > Otherwise use session_unregister. For me under 4.1.2 I had to set to
> > null.
> >
> > HTH
> > J
>
> Hi,
>
> Thank you for your replies. I am using version 4.3.3 yet unset() doesn't
> seem to work. To test this I have placed this line of code in my footer.php
> file that appears at the bottom of every page:
>
> echo 'load_orderinfo() = '.load_orderinfo();
>
> Here is the load_orderinfo() function:
>
> function load_orderinfo() {
>   global $_SESSION;
>   if (empty($_SESSION["orderinfo"])) {
>return false;
>   } else {
>return $_SESSION["orderinfo"];
>   }
>  }
>
> Before the $_SESSION["orderinfo"] is created the output in the footer
> reads:
>
> load_orderinfo() =
>
> When it has been created it reads:
>
> load_orderinfo() = Object;
>
> On the complete_order.php page where I call the clear_orderinfo() function
> it goes back to:
>
> load_orderinfo() =
>
> but it on any subsequent page the output returns to:
>
> load_orderinfo() = Object;
>
> But after calling the clear_orderinfo() function surely the
> $_SESSION["orderinfo"] should have been destroyed. I hope this makes sense!
>
> Thanks for your help


Shaun,

For what its worth, I experienced probs with destroying sessions until I added 
another page. On the page in question, I called the 'logout' function and 
redirected to that page:

[logout.php]
http://your_site.back_to_page_that_is not_logged in.php");
?>

Note that I used an absolute url -- it seems to make a difference. [Btw, I 
note that you use double quotes for $_SESSION['orderinfo'] -- just wondering 
. . . .

HTh,
Andre

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



Re: [PHP] fatal error undefined call to mysql_connect

2004-08-25 Thread Jason Wong
On Wednesday 25 August 2004 23:09, Ian Firla wrote:
> On Wed, 2004-08-25 at 17:08, Angelo Zanetti wrote:
> > I never installed it so... here is my next question. how would I find out
> > how it was installed?
>
> Look at the output of phpinfo(). But before doing that, read the
> documentation or you'll be back here in a flash with more really basic
> questions.
>
> A very good source for answers is also php.net. Try typing in some of
> your problem terms like "mysql" into the search query.

And as this this type of question gets asked every other day searching the 
archives for "error undefined call to mysql_connect" would give all the 
various ways to:

- enable mysql functions in Windows systems
- recompile PHP include support for mysql functions
- install the relevant RPM package for RPM based systems

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
HOST SYSTEM RESPONDING, PROBABLY UP...
*/

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



[PHP] change for exec function and safe_mode between win32 command line interface php 4.3.4 -> php 4.3.7 ?

2004-08-25 Thread Daniel Gaddis

We upgraded from win32 php 4.3.4 to 4.3.7 and my php command line script
broke. 

I am using safe_mode=on. If I use safe_mode=off instead of safe_mode=on
it works. Why
would my php command line script work with win32 php 4.3.4 with
safe_mode=on but not
with 4.3.7?

For a test I created a file f:\batfiles\batch\today.bat that contains
the following line:
date /t

I can then run the following command to test:
php -c F:\batfiles\batch\php.ini -r
print_r(exec('f:\batfiles\batch\today.bat'));

with win32 php 4.3.7 with safe_mode=on  I get nothing
with win32 php 4.3.7 with safe_mode=off I get Wed 08/25/2004

with win32 php 4.3.4 with safe_mode=on  I get Wed 08/25/2004
with win32 php 4.3.4 with safe_mode=off I get Wed 08/25/2004

In case you are wondering php.ini also contains:

safe_mode_exec_dir = f:\batfiles\batch
open_basedir = f:\batfiles\batch

Any suggestions?

Thanks,
Daniel

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



[PHP] Array?

2004-08-25 Thread Nathan Mealey
I cannot seem to access elements inside of the array $things in the 
code below.  All of the errors say "Undefined offset:  7 in 
/Library/WebServer/Documents/lis/check.php on line 26"  I don't see 
why...

The code is:
	
	$q = "select * from users where email='".$email."' and 
password='".$pass."'";
	$results = mysql_query($q);
	if ($results) {
		while ($list=mysql_fetch_assoc($results)) {
			$things[]=$list;
		}
	}
	//$things[7] is a MySQL timestamp column named "last_login"
	$date = strtotime($things[7]);

Thanks in advance,
Nathan
--
Nathan Mealey
Director of Operations
Cycle-Smart, Inc.
P.O. Box 1482
Northampton, MA
01061-1482
[EMAIL PROTECTED]
(413) 587-3133
(413) 210-7984 Mobile
(512) 681-7043 Fax
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Is javascript enable?

2004-08-25 Thread Marcos Thiago M. Fabis
hi John;

i saw that solution in one of the google results, but this way i´ll be still
using javascript and i´ll need one user action.

i realy wanted only a header exchange or something like.

[s]
Mt

- Original Message - 
From: "John Holmes" <[EMAIL PROTECTED]>
To: "Marcos Thiago M. Fabis" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, August 25, 2004 3:11 PM
Subject: Re: [PHP] Is javascript enable?


> From: "Marcos Thiago M. Fabis" <[EMAIL PROTECTED]>
> > i want to retrieve this information (javascript enabled or not) from the
> > browser in execution time.
> >
> > the get_browser function return me a value that simply means that the
> > browser itself is capable of execute javascript and does not mean the
user
> > has enabled it in the browser.
>
> So set a form/URL variable with JavaScript and see if your PHP page
receives
> it. Hidden  would probably work, or image, etc... You'll need a
page
> refresh or redirect in between though to detect it.
>
> ---John Holmes...
>

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



[PHP] summarized results

2004-08-25 Thread Erik Meyer
I have a function loosely based on the following tutorial from zend.com.
(http://www.zend.com/zend/tut/tutorial-brogdon2.php)
However, instead of using plain-text I am using results with html tags.

 For example, the results may have Thisis some text that has been
inputted from a form.  When I use my function it simply takes this string
and counts  the number of words and then stops at a length desired and
returns the text.  Now, here is my problem.  If I don't call my function it
displays fine, but I have to display the entire result since I do not want
to stop in the middle of a word.  If I call my function it displays the
summary correctly if there are no html tags in it.  However, if I call my
function and there are html tags then it strips the < > off of the html tag
and displays the text in between the angle brackets.

Here is my function (forgive me if I am taking the wrong way this is my baby
step at php)

If anybody has a better way I would appreciate it,

Thank you,

Erik  Meyer

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



Re: [PHP] Array?

2004-08-25 Thread John Holmes
From: "Nathan Mealey" <[EMAIL PROTECTED]>
I cannot seem to access elements inside of the array $things in the code 
below.  All of the errors say "Undefined offset:  7 in 
/Library/WebServer/Documents/lis/check.php on line 26"  I don't see why...

The code is:
$q = "select * from users where email='".$email."' and 
password='".$pass."'";
$results = mysql_query($q);
if ($results) {
while ($list=mysql_fetch_assoc($results)) {
$things[]=$list;
}
}
//$things[7] is a MySQL timestamp column named "last_login"
$date = strtotime($things[7]);
You're creating a two dimensional array. $things[0][7] is the first row, 
eight column, which is what you're after if this only returns one row.

if you want to use $things[7], then within your while loop, use $things = 
$list;, for example. Although, if you're only getting one row, there's no 
need for a while loop and you can just say $things = 
mysql_fetch_assoc($results);

Oh, one more thing. fetch_assoc() returns an array with the keys named after 
the columns, not as numbers. So $things[0]['last_login'] or 
$things['last_login'] is what you're after. Or use mysql_fetch_row(), which 
will return keys as number... or use mysql_fetch_array(), which will do 
both.

have fun. Don't break anything.
---John Holmes... 

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


Re: [PHP] Is javascript enable?

2004-08-25 Thread John Holmes
From: "Marcos Thiago M. Fabis" <[EMAIL PROTECTED]>
i saw that solution in one of the google results, but this way i´ll be 
still
using javascript and i´ll need one user action.

i realy wanted only a header exchange or something like.
I wanted the Army to pay me $25,000 for the program I wrote.
Sometimes you don't get what you want.
---John Holmes... 

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


[PHP] Re [PHP] Odd behaviour of non-existent keys?

2004-08-25 Thread Geoff Caplan
Michael,

MS> IMHO what you have described is a bug in PHP, and if I were you, I'd report it as
MS> such.  If it's not a bug it at least has a very high WTF factor.

You are right - it does seem like a bug. But I assumed that something
as basic as this would have been spotted by now. I don't suppose it
would do any harm for me to report it, though, now there are at least
2 of us that think it looks odd.

-- 
Geoff Caplan
Vario Software Ltd
(+44) 121-515 1154 

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



Re: [PHP] Array?

2004-08-25 Thread Jason Wong
On Thursday 26 August 2004 02:17, Nathan Mealey wrote:

> I cannot seem to access elements inside of the array $things in the
> code below.  All of the errors say "Undefined offset:  7 in
> /Library/WebServer/Documents/lis/check.php on line 26"  I don't see
> why...
>
> The code is:
>
>   $q = "select * from users where email='".$email."' and
> password='".$pass."'";
>   $results = mysql_query($q);
>   if ($results) {
>   while ($list=mysql_fetch_assoc($results)) {
>   $things[]=$list;
>   }
>   }
>   //$things[7] is a MySQL timestamp column named "last_login"
>   $date = strtotime($things[7]);

  print_r($things); var_dump($things)

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Dealing with failure is easy:
Work hard to improve.
Success is also easy to handle:
You've solved the wrong problem.
Work hard to improve.
*/

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



Re: [PHP] Array?

2004-08-25 Thread Craig Brothers
how many elements are returned by the sql statement?

If you want the 7th item returned in the sql statement would need to
code $things[6]

Just a hunch...

--
Craig Brothers
@utoRevenue
[EMAIL PROTECTED]
(413) 528-8000 x105



On Wed, 2004-08-25 at 14:17, Nathan Mealey wrote:
> I cannot seem to access elements inside of the array $things in the 
> code below.  All of the errors say "Undefined offset:  7 in 
> /Library/WebServer/Documents/lis/check.php on line 26"  I don't see 
> why...
> 
> The code is:
>   
>   $q = "select * from users where email='".$email."' and 
> password='".$pass."'";
>   $results = mysql_query($q);
>   if ($results) {
>   while ($list=mysql_fetch_assoc($results)) {
>   $things[]=$list;
>   }
>   }
>   //$things[7] is a MySQL timestamp column named "last_login"
>   $date = strtotime($things[7]);
> 
> 
> Thanks in advance,
> Nathan
> --
> Nathan Mealey
> Director of Operations
> Cycle-Smart, Inc.
> P.O. Box 1482
> Northampton, MA
> 01061-1482
> [EMAIL PROTECTED]
> (413) 587-3133
> (413) 210-7984 Mobile
> (512) 681-7043 Fax

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



Re: [PHP] Is javascript enable?

2004-08-25 Thread Marcos Thiago M. Fabis

hehehe... = )
do u have this problem too?
and still have to work in 3 projects at same time to deliver in few days ?
me too!!! rs..

Let me explain better:
i need this because i´m developing a system that require some security, but
i appreciate your help.
i´ll see what  i can do here.

[s]
Mt

- Original Message - 
From: "John Holmes" <[EMAIL PROTECTED]>
To: "Marcos Thiago M. Fabis" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, August 25, 2004 3:44 PM
Subject: Re: [PHP] Is javascript enable?


> From: "Marcos Thiago M. Fabis" <[EMAIL PROTECTED]>
> > i saw that solution in one of the google results, but this way i´ll be
> > still
> > using javascript and i´ll need one user action.
> >
> > i realy wanted only a header exchange or something like.
>
> I wanted the Army to pay me $25,000 for the program I wrote.
> Sometimes you don't get what you want.
>
> ---John Holmes...
>

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



Re: [PHP] Array?

2004-08-25 Thread Robert Cummings
On Wed, 2004-08-25 at 14:17, Nathan Mealey wrote:
> I cannot seem to access elements inside of the array $things in the 
> code below.  All of the errors say "Undefined offset:  7 in 
> /Library/WebServer/Documents/lis/check.php on line 26"  I don't see 
> why...
> 
> The code is:
>   
>   $q = "select * from users where email='".$email."' and 
> password='".$pass."'";
>   $results = mysql_query($q);
>   if ($results) {
>   while ($list=mysql_fetch_assoc($results)) {
>   $things[]=$list;
>   }
>   }
>   //$things[7] is a MySQL timestamp column named "last_login"
>   $date = strtotime($things[7]);

You are fetching an association... use the following instead:

$date = strtotime($things['last_login']);

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.  |
`'

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



RE: [PHP] summarized results w/function

2004-08-25 Thread Erik Meyer

Here is function

function shorten_news_results ($input_text, $ending_text) {
$news_strip=str_word_count($input_text, 1);
$news_split=array_splice($news_strip, 0, 40);
$news_split[]=$ending_text;
$news_story=implode(' ', $news_split);
echo "$news_story";
}

Sorry about that..
-Original Message-
From: Erik Meyer [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 25, 2004 1:29 PM
To: Php-General
Subject: [PHP] summarized results


I have a function loosely based on the following tutorial from zend.com.
(http://www.zend.com/zend/tut/tutorial-brogdon2.php)
However, instead of using plain-text I am using results with html tags.

 For example, the results may have Thisis some text that has been
inputted from a form.  When I use my function it simply takes this string
and counts  the number of words and then stops at a length desired and
returns the text.  Now, here is my problem.  If I don't call my function it
displays fine, but I have to display the entire result since I do not want
to stop in the middle of a word.  If I call my function it displays the
summary correctly if there are no html tags in it.  However, if I call my
function and there are html tags then it strips the < > off of the html tag
and displays the text in between the angle brackets.

Here is my function (forgive me if I am taking the wrong way this is my baby
step at php)

If anybody has a better way I would appreciate it,

Thank you,

Erik  Meyer

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



Re: [PHP] summarized results

2004-08-25 Thread John Holmes
From: "Erik Meyer" <[EMAIL PROTECTED]>
Here is my function
Where?
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Array?

2004-08-25 Thread Michal Migurski
> I cannot seem to access elements inside of the array $things in the code
> below.  All of the errors say "Undefined offset:  7 in
> /Library/WebServer/Documents/lis/check.php on line 26"  I don't see
> why...

print_r is your bestest buddy.

>   $results = mysql_query($q);
>   if ($results) {
>   while ($list=mysql_fetch_assoc($results)) {
>   $things[]=$list;
>   }
>   }
>   //$things[7] is a MySQL timestamp column named "last_login"

$things[7] is actually an associative array containing the seventh result
row from your query. If you check out the results of print_r($things),
you'd see the array structure immediately.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



Re: [PHP] Is javascript enable?

2004-08-25 Thread John Holmes
From: "Marcos Thiago M. Fabis" <[EMAIL PROTECTED]>
i need this because i´m developing a system that require some security
I surely wouldn't rely on JavaScript, something that can be turned on and 
off, to have anything to do with security.

---John Holmes... 

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


Re: [PHP] summarized results w/function

2004-08-25 Thread John Holmes
From: "Erik Meyer" <[EMAIL PROTECTED]>
Here is function
function shorten_news_results ($input_text, $ending_text) {
$news_strip=str_word_count($input_text, 1);
$news_split=array_splice($news_strip, 0, 40);
$news_split[]=$ending_text;
$news_story=implode(' ', $news_split);
echo "$news_story";
   }
Trying to split a string down the middle and not break up any kind of HTML 
that's present is difficult without looping through each character and 
keeping track of whether you're in an HTML element or not.

Your original messages says  can be used. Is that the only tag? Is it a 
limited set of HTML or can anything be in the text?

---John Holmes... 

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


Re: [PHP] Is javascript enable?

2004-08-25 Thread Marcos Thiago M. Fabis

i share your opinion, but belive-me when i say that this situation requires
it.

i have to check if it´s inside frames, pass values for only one a respective
frame that is responsable for logging, start procedures with setTimeOut,
etc...

maybe next time the project can be better planned, but i can´t see how at
this time!

[s]
Mt


- Original Message - 
From: "John Holmes" <[EMAIL PROTECTED]>
To: "Marcos Thiago M. Fabis" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, August 25, 2004 4:31 PM
Subject: Re: [PHP] Is javascript enable?


> From: "Marcos Thiago M. Fabis" <[EMAIL PROTECTED]>
>
> > i need this because i´m developing a system that require some security
>
> I surely wouldn't rely on JavaScript, something that can be turned on and
> off, to have anything to do with security.
>
> ---John Holmes...
>

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



RE: [PHP] summarized results w/function

2004-08-25 Thread Erik Meyer
Anything can be used, I was using that as an example.  The information in
the database contains html elements that were passed through a form.  For
example a user would type in some and then the mysql field would
contain some.

-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 25, 2004 2:42 PM
To: Erik Meyer; Php-General
Subject: Re: [PHP] summarized results w/function


From: "Erik Meyer" <[EMAIL PROTECTED]>

> Here is function
>
> function shorten_news_results ($input_text, $ending_text) {
> $news_strip=str_word_count($input_text, 1);
> $news_split=array_splice($news_strip, 0, 40);
> $news_split[]=$ending_text;
> $news_story=implode(' ', $news_split);
> echo "$news_story";
>}

Trying to split a string down the middle and not break up any kind of HTML
that's present is difficult without looping through each character and
keeping track of whether you're in an HTML element or not.

Your original messages says  can be used. Is that the only tag? Is it a
limited set of HTML or can anything be in the text?

---John Holmes...

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



[PHP] Caching Database Information

2004-08-25 Thread Paul Higgins
Hello all,
I have some questions regarding caching information with PHP.  I was 
thinking that I might cache all information that won't be changing for long 
periods of time...possibly only once a day or so, instead of querying the 
database for information every time.  My question is:  is there such as 
thing as too much caching?

Can I cache too much and therefore negate the advantages of caching?
Thanks,
Paul
_
Is your PC infected? Get a FREE online computer virus scan from McAfee® 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

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


[PHP] mail functions help

2004-08-25 Thread AceZero2790
I'm trying to make sure that my mail functons are on for a script I need to 
work. I run an Apache 1.3.31, so I am my own webhost. Now I just need to know 
how to make sure my mailfunctions are on.
Here is the mail functions part of php.ini pertaining to me (the windows part 
because I am on XP):

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = [EMAIL PROTECTED]

There is no reference to sendmail_path and stuff in the windows section, only 
under Unix. I was told that I didn't need it for my particular background, is 
that true?

I've been told stuff about how I need to make sure that my SMTP server 
(whatever that is??) is accepting stuff from localhost, etc, etc. If someone could 
clarify that'd be great.

-Andrew



Re: [PHP] Caching Database Information

2004-08-25 Thread Greg Donald
On Wed, 2004-08-25 at 14:52, Paul Higgins wrote:
> Hello all,
> 
> I have some questions regarding caching information with PHP.  I was 
> thinking that I might cache all information that won't be changing for long 
> periods of time...possibly only once a day or so, instead of querying the 
> database for information every time.  My question is:  is there such as 
> thing as too much caching?
> 
> Can I cache too much and therefore negate the advantages of caching?

As long as the overhead in caching remains less than the overhead in not
caching, I would say maybe.  :)

A single database query returns an array.  You use the array to build a
page.  You cache the page.  The cached version of the page gets hit 100
times.  Is the overhead in pulling the file from your cache 100 times
less than re-doing the query 100 times?  That depends.  Some databases
have query caching, and so do most file systems.  There are also PHP
caching tools like TurkeMM Cache and Zend that cache byte code only.

I'd bench it both ways and then decide based on the queries, the
development environment, and the cache timeout limitations/requirements.


-- 
Greg Donald

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



Re: [PHP] mail functions help

2004-08-25 Thread Greg Donald
On Wed, 2004-08-25 at 15:11, [EMAIL PROTECTED] wrote:
> I'm trying to make sure that my mail functons are on for a script I need to 
> work. I run an Apache 1.3.31, so I am my own webhost. Now I just need to know 
> how to make sure my mailfunctions are on.
> Here is the mail functions part of php.ini pertaining to me (the windows part 
> because I am on XP):
> 
> [mail function]
> ; For Win32 only.
> SMTP = localhost
> smtp_port = 25
> 
> ; For Win32 only.
> ;sendmail_from = [EMAIL PROTECTED]
> 
> There is no reference to sendmail_path and stuff in the windows section, only 
> under Unix. I was told that I didn't need it for my particular background, is 
> that true?
> 
> I've been told stuff about how I need to make sure that my SMTP server 
> (whatever that is??) is accepting stuff from localhost, etc, etc. If someone could 
> clarify that'd be great.
> 
> -Andrew

If you just want to see if mail() works try it.



If it doesn't work then your mail setup is not working.  Setting up an
SMTP server has nothing to do with PHP.  Google will probably help you
if that's your issue.


-- 
Greg Donald

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



[PHP] Re: summarized results

2004-08-25 Thread Matthew Weier O'Phinney
* Erik Meyer <[EMAIL PROTECTED]>:
> I have a function loosely based on the following tutorial from zend.com.
> (http://www.zend.com/zend/tut/tutorial-brogdon2.php)
> However, instead of using plain-text I am using results with html tags.
>
>  For example, the results may have Thisis some text that has been
> inputted from a form.  When I use my function it simply takes this string
> and counts  the number of words and then stops at a length desired and
> returns the text.  Now, here is my problem.  If I don't call my function it
> displays fine, but I have to display the entire result since I do not want
> to stop in the middle of a word.  If I call my function it displays the
> summary correctly if there are no html tags in it.  However, if I call my
> function and there are html tags then it strips the < > off of the html tag
> and displays the text in between the angle brackets.
>
> Here is my function (forgive me if I am taking the wrong way this is my baby
> step at php)
>
> If anybody has a better way I would appreciate it,

I can think of a number of them. 

1) pipe your results through striptags() to remove all HTML formatting
   *before* you shorten the string
2) use a templating engine. Smarty has some incredible functions such as
   truncate() which can not only take care of the HTML formatting but
   also make sure that truncation ends with a word or sentence boundary
3) look at code such as the above-mentioned Smarty to see how others
   have successfully resolved this.

I use (2) with a number of systems, and love it.

-- 
Matthew Weier O'Phinney   | WEBSITES:
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org

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



Re: [PHP] mail functions help

2004-08-25 Thread Matthew Sims


> I've been told stuff about how I need to make sure that my SMTP server
> (whatever that is??)
> -Andrew
>
>


My guess is that you may need to think about setting up a mail server
first before you can get mail functions to work. If you don't know what an
SMTP server is, first thing to do is to get to know what it is. You can't
send mail without one.

First thing:
http://www.webopedia.com/TERM/S/SMTP.html

I'm not too familiar with what MTA's are out there for windows that are
free.  All I know is Exchange for windows and I don't think it's free.

-- 
--Matthew Sims
--

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



[PHP] crypt()

2004-08-25 Thread Aaron Todd
I have developed a PHP based site that requires users to login.  Their login 
information is kept in a MYSQL database.  Currently, I am using an IF 
statement to verify what the user enters as their password with what is in 
the the database.  If they are the same a session is created and they have 
access to the content of the site.

As far as I know the password is being sent to the script in clear text and 
I was wondering what a good way would be to get this to be encrypted.  My 
first thought is to encrypt the password in the database using crypt().  So 
if I view the table I will see the encrypted characters.  Then change the IF 
statement to encrypt the password that the user enters and then just check 
if its the same as what is in the database.  That sounds like the same as I 
am doing now only instead of checking a password that is a name, its 
checking the encrypted characters of the name.

So it seems my idea would hide the real characters.

Can anyone tell me if this is a bad idea.  And maybe point me toward a good 
one.

Thanks,

Aaron 

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



[PHP] Determine if a property in a class is public, protected or private in PHP 5?

2004-08-25 Thread Erik Franzén
Is it possible to determine if a property inside a object is public, 
protected or private in PHP 5?

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


RE: [PHP] crypt()

2004-08-25 Thread Afan Pasalic
Hi everyone!

My hosting company has global turned on. But I want to code using more safe
global off. My question though is how I can do it "locally", in my script?
I tried to use 
ini_set("register_globals", FALSE);
but it still doesn't work.
On php.net manual I can find WHAT I have to do and reasons but not HOW.

Thanks for any help!

Afan

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



RE: [PHP] crypt()

2004-08-25 Thread Greg Donald
On Wed, 2004-08-25 at 16:18, Afan Pasalic wrote:
> Hi everyone!
> 
> My hosting company has global turned on. But I want to code using more safe
> global off. My question though is how I can do it "locally", in my script?
> I tried to use 
> ini_set("register_globals", FALSE);
> but it still doesn't work.
> On php.net manual I can find WHAT I have to do and reasons but not HOW.

Make an .htaccess file:

php_flag register_globals off


-- 
Greg Donald

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



RE: [PHP] Caching Database Information

2004-08-25 Thread Greg Donald
On Wed, 2004-08-25 at 16:32, Scott Hyndman wrote:
> I've found that caching LARGE datasets can be really useful. Filesystem
> access is blazing fast, and at least in my case, I've found it to be
> significantly faster than the time it takes to process a query and
> return the dataset.
> 
> Too much caching? I don't think so. Just use it in the right places. You
> don't want to be caching something that needs to show change from second
> to second.

Just a hint.. You might try your "Reply to all" option next time. 
Especially since it's a list serve, and especially since I'm not the
poster of the original question.


-- 
Greg Donald

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



[PHP] exploding

2004-08-25 Thread Jake McHenry
Hi everyone.

Is there a way to explode by every character in the variable?

Example:

$var = "8";
$test = explode("", $var);

output would be

$test[0] = 0;
$test[1] = 0;
$test[2] = 0;
$test[3] = 0;
$test[4] = 8;


Can I get an array like that?



Thanks,
Jake McHenry

MIS Coordinator
Nittany Travel
http://www.nittanytravel.com
570.748.6611 x108





RE: [PHP] crypt()

2004-08-25 Thread Afan Pasalic
Thanks Greg.


-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 25, 2004 4:38 PM
To: Afan Pasalic
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] crypt()

On Wed, 2004-08-25 at 16:18, Afan Pasalic wrote:
> Hi everyone!
> 
> My hosting company has global turned on. But I want to code using more
safe
> global off. My question though is how I can do it "locally", in my script?
> I tried to use 
> ini_set("register_globals", FALSE);
> but it still doesn't work.
> On php.net manual I can find WHAT I have to do and reasons but not HOW.

Make an .htaccess file:

php_flag register_globals off


-- 
Greg Donald

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



[PHP] imap_search and results

2004-08-25 Thread Nicolas Diez
Hello,

I'm trying to make a small script to show mails on a imap server with
a criteria.


Here is my code :
/---/
$mails = imap_search($mbox, 'TO "[EMAIL PROTECTED]"',SE_UID);
echo sizeof($mails);
/--/

The connection to the server is the working, the search also, the size
returned is not equal to 0.

But now I don't know how to retrieve the number of the messages in the array.
How can I do that ?

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



[PHP] Re: Determine if a property in a class is public, protected or private

2004-08-25 Thread M. Sokolewicz
Erik franzén wrote:
Is it possible to determine if a property inside a object is public, 
protected or private in PHP 5?

/Erik
use the (undocumented) Reflection API
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: exploding

2004-08-25 Thread M. Sokolewicz
Jake McHenry wrote:
Hi everyone.
Is there a way to explode by every character in the variable?
Example:
$var = "8";
$test = explode("", $var);
output would be
$test[0] = 0;
$test[1] = 0;
$test[2] = 0;
$test[3] = 0;
$test[4] = 8;
Can I get an array like that?

Thanks,
Jake McHenry
MIS Coordinator
Nittany Travel
http://www.nittanytravel.com
570.748.6611 x108


well, you can access strings like arrays already. So instead of 
exploding you can already do something like
$var = "15 is a number";
$var[2] = 7;

echo $var;
// will output: 17 is a number
same way goes for accessing them
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: exploding

2004-08-25 Thread Peter Brodersen
Hi,

On Wed, 25 Aug 2004 18:00:49 -0400, in php.general
[EMAIL PROTECTED] (Jake McHenry) wrote:

>Hi everyone.
>
>Is there a way to explode by every character in the variable?
>
>Example:
>
>$var = "8";
>$test = explode("", $var);

Use preg_split(): http://php.net/preg_split - example 2.



Or, a possible faster method, using str_split() (only available in
PHP5): http://php.net/str_split



-- 
- Peter Brodersen

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



Re: [PHP] Re: exploding

2004-08-25 Thread Felix
Try this:

$array = explode( ' ', chunk_split( $sting, 1, ' ' ) );

http://www.php.net/manual/de/function.explode.php
http://www.php.net/manual/de/function.chunk-split.php



On Thu, 26 Aug 2004 00:50:09 +0200, Peter Brodersen <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> On Wed, 25 Aug 2004 18:00:49 -0400, in php.general
> [EMAIL PROTECTED] (Jake McHenry) wrote:
> 
> >Hi everyone.
> >
> >Is there a way to explode by every character in the variable?
> >
> >Example:
> >
> >$var = "8";
> >$test = explode("", $var);
> 
> Use preg_split(): http://php.net/preg_split - example 2.
> 
>  $var = "8";
> $test = preg_split('//', $var,-1,PREG_SPLIT_NO_EMPTY);
> print_r($test);
> ?>
> 
> Or, a possible faster method, using str_split() (only available in
> PHP5): http://php.net/str_split
> 
>  $var = "8";
> $test = str_split($var); // requires PHP5
> print_r($test);
> ?>
> 
> --
> - Peter Brodersen
> 
> 
> 
> --
> 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



Re: [PHP] Re: exploding

2004-08-25 Thread Peter Brodersen
On Thu, 26 Aug 2004 00:57:43 +0200, in php.general
[EMAIL PROTECTED] (Felix) wrote:

>$array = explode( ' ', chunk_split( $sting, 1, ' ' ) );
>
>http://www.php.net/manual/de/function.explode.php
>http://www.php.net/manual/de/function.chunk-split.php

Well, that would leave a blank entry end of the array:

array(6) {
  [0]=>
  string(1) "0"
  [1]=>
  string(1) "0"
  [2]=>
  string(1) "0"
  [3]=>
  string(1) "0"
  [4]=>
  string(1) "8"
  [5]=>
  string(0) ""
}


Besides, strings containing spaces could also produce unexpected
results (like "foo bar baz"):

array(14) {
  [0]=>
  string(1) "f"
  [1]=>
  string(1) "o"
  [2]=>
  string(1) "o"
  [3]=>
  string(0) ""
  [4]=>
  string(0) ""
  [5]=>
  string(1) "b"
  [6]=>
  string(1) "a"
  [7]=>
  string(1) "r"
  [8]=>
  string(0) ""
  [9]=>
  string(0) ""
  [10]=>
  string(1) "b"
  [11]=>
  string(1) "a"
  [12]=>
  string(1) "z"
  [13]=>
  string(0) ""
}

I would still suggest str_split() if available, otherwise
preg_split().

-- 
- Peter Brodersen

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



Re: [PHP] Re: Determine if a property in a class is public, protected or private

2004-08-25 Thread Curt Zirzow
* Thus wrote M. Sokolewicz:
> Erik franzén wrote:
> >Is it possible to determine if a property inside a object is public, 
> >protected or private in PHP 5?
> >
> >/Erik
> use the (undocumented) Reflection API

http://php.net/oop5.reflection


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



[PHP] checking for utilities/applications in the PATH

2004-08-25 Thread Chris Wagner
hi,

i am trying to do a simple check for archiving utilities (zip, unzip,
...), to make sure they exist within the PATH, and are executable by
PHP.

i could not find a better way to do this through php, so i went ahead
and did an

exec('which ' . $utility, $output, $return_value);

then, i check the $return_value for a non-zero value, which would
indicate that the utility was not found.  using GNU/Linux this seems to
work fine, but i wouldn't mind keeping my work cross-platform.

so, my question is, is there a better way to do this?

and, if not, what i have done, for now is the following:

$result = exec('which ' . $utility, $output, $return_val);
return( $result  &&  !$return_val );

from one quick test i ran, i determined that exec() simply returns NULL
or nothing if the given utility/command doesn't exist (`which`, in this
case).

so, i expect the above code to simply return true, or skip the test for
my $utility rather, if the `which` utility is not present on the system.

will this work as expected in all cases/systems?

thanks a lot.

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



Re: [PHP] checking for utilities/applications in the PATH

2004-08-25 Thread Michal Migurski
> i am trying to do a simple check for archiving utilities (zip, unzip,
> ...), to make sure they exist within the PATH, and are executable by
> PHP.
>
> i could not find a better way to do this through php, so i went ahead
> and did an
>
> exec('which ' . $utility, $output, $return_value);
>
> then, i check the $return_value for a non-zero value, which would
> indicate that the utility was not found.  using GNU/Linux this seems to
> work fine, but i wouldn't mind keeping my work cross-platform.
>
> so, my question is, is there a better way to do this?

If you don't want to use the shell, you can check the $_SERVER['PATH']
environment variable. On my (linux) system it looks like
"sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin", so you could explode() that
on ':' and then cycle through the files in each directory using readdir(),
checking each with is_executable().

You could also just check the output of your exec() call - it should be
the full path of the executable you're looking for. An empty return would
imply that there isn't a matching executable. I think which always returns
just the first match, since it's meant to show what would get called if
you were to use that command.

Personally I love using exec() to make php behave like bash at times, but
posts on this list from pparently knowledgeable people occasionally imply
that it's not the best/fastest/most stable method to use, so I try not to.

-mike.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



[PHP] Looking for help with Forms and Mailing them

2004-08-25 Thread Bradleigh Simms
Alright I'm apparently a complete dunce where PHP is concerned. I've
tried to read the tutorials and am just getting completely mixed up. 
 
What I want: I want the form at
http://ussblackwell.devermore.net/join.html to send as an email to myself
and the GM of the game when the "apply" button is hit, without having to
go through something like OE or Juno. 
 
What I don't know is *anything* at *all* about PHP. Can somebody help me?
 
-- Linds


The best thing to hit the Internet in years - Juno SpeedBand!
Surf the Web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!

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



Re: [PHP] Is javascript enable?

2004-08-25 Thread Thomas Goyne
On Wed, 25 Aug 2004 16:36:41 -0300, Marcos Thiago M. Fabis  
<[EMAIL PROTECTED]> wrote:

i share your opinion, but belive-me when i say that this situation  
requires
it.

It is quite literally impossible to enforce security with JS.  Anything  
you try to do I could get around with Proxomitron and/or Opera.
--

Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] open_basedir "/" not working after upgrade

2004-08-25 Thread Federico Petronio
Hello all...
I just upgrade PHP from version 4.3.4 to version 4.3.8. After the 
upgrade, almost everything worked fine but the open_basedir directive.

The server I administer provides hosting for several domains, all of 
those with its own homedir restricted using open_basedir  in 
a  scope. Some especial directories, for example the 
webmail directory, is there only one, but it is shared by all the 
virtualhosts (http:///webmail/). I achieve that using (en 
httpd.conf):

Alias /webmail "/apache2/htdocs/horde/imp"

   php_admin_flag safe_mode off
   php_admin_value upload_tmp_dir /tmp
   php_admin_value open_basedir "/"

This worked fine until the upgrade. After it, I get a message claiming 
that the open_basedir directive is in use, and that 
"/apache2/htdocs/horde/imp" is not in (/).

I guess this could be an error in the open_basedir implementation (or 
just a change), but I am not sure. What I saw is that in recent version 
there were a lot of "move" around open_basedir code.

Can anybody help me with this? is there any patch I could apply to solve 
this?

Thank you!
--
--
   Federico Petronio
   [EMAIL PROTECTED]
   Linux User #129974
---
There are only 10 types of people in the world:
 Those who understand binary and those who don't.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Looking for a "TODO:" parser.

2004-08-25 Thread Daevid Vincent
I, like many other people I'm sure, put //TODO: comments in my code (inspite
of M$ patent on the idea!).

http://yro.slashdot.org/article.pl?sid=04/06/08/2319254&tid=155&tid=109&tid=
156&tid=17

I'm looking for a program that will run through a directory tree and parse
all the files (ideally by extension, like *.php, *.js, *.html, *.c) and give
me a formatted output (or HTML table or something useful).

It should include the //TODO of course, the path/file, the line(s), and
perhaps other things I'm overlooking. Maybe last time file changed/file
date, and possibly the comments immediately below the //TODO: (as sometimes
they take up more than a single line).

Anyone know of or have built something like this... That is before I go and
re-invent the wheel.

D.

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



Re: [PHP] Looking for a "TODO:" parser.

2004-08-25 Thread Jim Grill
Not sure about other file types, but phpdoc includes a tag for "todo". It
also makes nice documentation on the fly based on your comments.

http://phpdoc.org/docs/HTMLSmartyConverter/default/phpDocumentor/tutorial_tags.todo.pkg.html

Jim Grill

- Original Message - 
From: "Daevid Vincent" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 25, 2004 8:55 PM
Subject: [PHP] Looking for a "TODO:" parser.


> I, like many other people I'm sure, put //TODO: comments in my code
(inspite
> of M$ patent on the idea!).
>
>
http://yro.slashdot.org/article.pl?sid=04/06/08/2319254&tid=155&tid=109&tid=
> 156&tid=17
>
> I'm looking for a program that will run through a directory tree and parse
> all the files (ideally by extension, like *.php, *.js, *.html, *.c) and
give
> me a formatted output (or HTML table or something useful).
>
> It should include the //TODO of course, the path/file, the line(s), and
> perhaps other things I'm overlooking. Maybe last time file changed/file
> date, and possibly the comments immediately below the //TODO: (as
sometimes
> they take up more than a single line).
>
> Anyone know of or have built something like this... That is before I go
and
> re-invent the wheel.
>
> D.
>
> -- 
> 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



Re: [PHP] mail functions help

2004-08-25 Thread enijmax
Hello Andrew:
SMTP server can be retrieved from your ISP provider. The function of
SMTP server is sending the mail to other SMTP server. For example, if you
want send a e-mail [EMAIL PROTECTED] , the SMTP server A will send this mail to
SMTP server B, and SMTP server B will send to SMTP server C, and so on.
Finally, the mail will send to yahoo.com (it is a SMTP server, too) and wait
for xxx to download the mail.
I hope that the explanation can help you to setup your mail
function.

Jeffrey
- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 26, 2004 4:11 AM
Subject: [PHP] mail functions help


> I'm trying to make sure that my mail functons are on for a script I need
to
> work. I run an Apache 1.3.31, so I am my own webhost. Now I just need to
know
> how to make sure my mailfunctions are on.
> Here is the mail functions part of php.ini pertaining to me (the windows
part
> because I am on XP):
>
> [mail function]
> ; For Win32 only.
> SMTP = localhost
> smtp_port = 25
>
> ; For Win32 only.
> ;sendmail_from = [EMAIL PROTECTED]
>
> There is no reference to sendmail_path and stuff in the windows section,
only
> under Unix. I was told that I didn't need it for my particular background,
is
> that true?
>
> I've been told stuff about how I need to make sure that my SMTP server
> (whatever that is??) is accepting stuff from localhost, etc, etc. If
someone could
> clarify that'd be great.
>
> -Andrew
>
>

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



[PHP] imap_fetch_overview() increases traffic to NFS server

2004-08-25 Thread Kathie Grigg
Hi,

We have a linux server running a customised webmail application
based on Horde. This server communicates with a seperate NFS server
to access user's email data.

We noticed that the traffic between the servers quickly rose from
under 200k/s to 3Mb/s when we made some modifications and we
found it was due to this function call:

$mailList = imap_fetch_overview($stream, $messages, FT_UID);

When we removed the FT_UID flag from the call the traffic 
returned to normal. I don't understand why this extra flag would
cause such a huge rise in traffic- from what I understand this flag
merely causes UIDs to be returned for the array of messages.

The versions we are using are:
Redhat Enterprise Linux ES Release 3
php 4.3.2-11
php-imap 4.3.2-11
Apache 2.0.46-32

Has anyone else had this problem? Is this a bug or am I doing something
wrong?

Thanks for your help!
Kathie





This message has passed through an insecure network.
Please direct all enquires to the message author.

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



Re: [PHP] Caching Database Information

2004-08-25 Thread raditha dissanayake
Paul Higgins wrote:
Hello all,
I have some questions regarding caching information with PHP.  I was 
thinking that I might cache all information that won't be changing for 
long periods of time...possibly only once a day or so, instead of 
querying the database for information every time.  My question is:  is 
there such as thing as too much caching?

Take a look at running Squid in httpd accelarator mode as well. Other 
options to look at include installing turck (this only caches the 
compiled version of the script - not the scripts output). also i believe 
there is an extension named memcached or something similar which may be 
what you want.

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Get Value

2004-08-25 Thread Syed Ghouse
Hi All
(B
(BWill anybody tell me how to extract the value (say Google)
(B from the code below:
(B
(BGoogle(value to extract)
(B
(BThanks and Regards
(B
(BSyed

Re: [PHP] Get Value

2004-08-25 Thread Robby Russell
On Wed, 2004-08-25 at 21:11, Syed Ghouse wrote:
> Hi All
> 
> Will anybody tell me how to extract the value (say Google)
>  from the code below:
> 
> Google(value to extract)
> 
> Thanks and Regards
> 
> Syed

You can use regular expressions for this.

$in = 'meep';

preg_match("|>(.*)|", $in, $out);

$foo = $out[1];

print $foo;

...prints: meep

This is just a quick and dirty example of how this can be done.

-Robby


-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
/



signature.asc
Description: This is a digitally signed message part


Re: [PHP] Get Value

2004-08-25 Thread Jim Grill
Google(value to extract)';
(Becho preg_replace('/\(.*)\<\/a\>/i', "$1", $link);
(B?>
(B
(BJim Grill
(B
(B- Original Message - 
(BFrom: "Syed Ghouse" <[EMAIL PROTECTED]>
(BTo: "php mailinglists" <[EMAIL PROTECTED]>
(BSent: Wednesday, August 25, 2004 11:11 PM
(BSubject: [PHP] Get Value
(B
(B
(BHi All
(B
(BWill anybody tell me how to extract the value (say Google)
(B from the code below:
(B
(BGoogle(value to extract)
(B
(BThanks and Regards
(B
(BSyed
(B
(B-- 
(BPHP General Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Is javascript enable?

2004-08-25 Thread php-list
Try phpsniff at http://phpsniff.sourceforge.net/. It not only detects
javascript using PHP, but many other things as well. You will wonder how you
lived without it. It's pretty cool...

Navid

-Original Message-
From: Thomas Goyne [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 25, 2004 8:35 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Is javascript enable?

On Wed, 25 Aug 2004 16:36:41 -0300, Marcos Thiago M. Fabis  
<[EMAIL PROTECTED]> wrote:

>
> i share your opinion, but belive-me when i say that this situation  
> requires
> it.
>

It is quite literally impossible to enforce security with JS.  Anything  
you try to do I could get around with Proxomitron and/or Opera.
-- 

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

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



Re: [PHP] Looking for help with Forms and Mailing them

2004-08-25 Thread Justin Patrin
On Wed, 25 Aug 2004 19:13:08 -0600, Bradleigh Simms
<[EMAIL PROTECTED]> wrote:
> Alright I'm apparently a complete dunce where PHP is concerned. I've
> tried to read the tutorials and am just getting completely mixed up.
> 
> What I want: I want the form at
> http://ussblackwell.devermore.net/join.html to send as an email to myself
> and the GM of the game when the "apply" button is hit, without having to
> go through something like OE or Juno.
> 
> What I don't know is *anything* at *all* about PHP. Can somebody help me?
> 

http:://www.php.net/mail

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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



Re: [PHP] Get Value

2004-08-25 Thread Syed Ghouse
Thankyou. i got the solution
(B
(BThanks & Regards
(Bsyed
(B- Original Message - 
(BFrom: "Robby Russell" <[EMAIL PROTECTED]>
(BTo: "Syed Ghouse" <[EMAIL PROTECTED]>
(BCc: "php mailinglists" <[EMAIL PROTECTED]>
(BSent: Thursday, August 26, 2004 AM 09:48
(BSubject: Re: [PHP] Get Value
(B
(B-- 
(BPHP General Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Another Help

2004-08-25 Thread Syed Ghouse
Hi 
(B
(BAlso pls tell me how to extract the href value of the code below
(B
(Bhttp://www.google.com">
(B
(B
(B
(B
(B
(Bi m weak in regular expression in php and tell me how to learn easily.
(B
(BRegards
(BSyed

Re: [PHP] Another Help

2004-08-25 Thread David Bevan
On Thu, 2004-08-26 at 01:27, Syed Ghouse wrote:
> Hi 
> 
> Also pls tell me how to extract the href value of the code below
> 
> http://www.google.com";>
> 
> 
> 
> 
> 
> i m weak in regular expression in php and tell me how to learn easily.
> 
> Regards
> Syed

Is it just that you're lazy and don't want to search the archives for
something which is asked all the time, or just naive enough to think
that the people on this list will do your work for you?

Try one of the following:

1. Search google:
http://groups.google.ca/groups?q=href+group:php.general&start=50&hl=en&lr=&ie=UTF-8&group=php.general&selm=01c1ba53%24dd9c6270%24e2563944%40cc1966780a&rnum=57
2. Search the archives of this mailing list
3. Buy a book
4. If all of the above fail, turn off your confuser/computer and walk
away

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



  1   2   >