[PHP] PHP 5, LDAP/Active Directory

2005-09-13 Thread Joe Wollard

Greetings all:

I've looked through php.net and scoured Google for a solution to an  
issue I'm having with PHP and LDAP but have so far found nothing. I'm  
trying to build an intranet site that uses the company LDAP (Active  
Directory really) service but I can't seem to get around the  
Operations error and other such messages when trying to bind.


On my server I'm running:
Fedora Core 4
Apache 2
PHP 5 compiled with OpenLDAP

I must confess that I'm very new to LDAP so it is likely that my  
problem is inexperience, but it seems that this issue has been  
resolved by others so I'm trying to figure out what I'm doing wrong.


To shed more light on the topic, bug #30670 [ http://bugs.php.net/ 
bug.php?id=30670edit=0 ] seems to fit my situation perfectly. As  
some of the posts on that bug suggest, I've tried using

ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION,3);
ldap_set_option($ldap, LDAP_OPT_REFERRALS,0);
between ldap_connect and ldap_bind but I still get the Operations  
error message. Everyone seems to be able to get this to work as long  
as they are running PHP4, but I have yet to see (or realize I've  
seen) a solution from someone using PHP5. I've also found where  
blizzards at libero dot it has posted When querying a windows  
2000/2003 AD you MUST use only SASL and not TLS (non supported).

- Is this true?

Another thing worth mentioning here is that the company I work for  
has allowed us to build our own intranet system for our Dept and  
offers little to no support for server specs and settings, but I will  
try to get any information to the list that might be helpful.


Thanks in advance for any advice or direction you can provide on this  
topic.

-Joe W

Re: [PHP] can't connect to mysql

2005-09-13 Thread Gustav Wiberg

Hi there!

What code are you using? Try with the mysqli...
http://se2.php.net/manual/en/ref.mysqli.php

/G

- Original Message - 
From: blackwater dev [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Tuesday, September 13, 2005 3:09 AM
Subject: [PHP] can't connect to mysql


I finally got php5 compiled with mysql but now I can't connect using
mysql_connect without getting the error of:

Warning: mysql_connect() [function.mysql-connect]: Can't connect to
local MySQL server through socket '/tmp/mysql.sock' (2) in...

I can ssh into the box and log in to mysql so I think it's running. 
Plus if I try to run mysqld, I get this error:


ning] Asked for 196608 thread stack, but got 126976
050912 19:57:04 [ERROR] Can't start server: Bind on TCP/IP port:
Address already in use
050912 19:57:04 [ERROR] Do you already have another mysqld server
running on port: 3306 ?
050912 19:57:04 [ERROR] Aborting

050912 19:57:04 [Note] mysqld: Shutdown complete

What could be wrong??

Thanks!

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



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.21/96 - Release Date: 2005-09-10

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



[PHP] Re: Best way to mass mail

2005-09-13 Thread Joshua May

You have to be careful, though, because I had this problem..

I had PHP running as a CGI on the host with Apache, and Apache had a
nasty habit of terminating the CGI communicationg before PHP had
finished mailing everyone, even if set_time_limit(0); was set (well,
even if set_time_limit(arbitrarily_big_number); was used).

I ended up using an exec call to a shell script, which executed the PHP
CLI binary with a custom php.ini, and as a background process. The mails
successfully send, now. And yes, it's a convoluted way, but as it turns
out, it was the only way to properly background it and run all the way
until it ends.

So be careful if you decide to rely on set_time_limit()..

Josh.

Manuel Lemos wrote:

Hello,

on 09/12/2005 10:50 AM Ryan A said the following:

The thing that bothers me the most is if the program times out..., how 
do I

start again from
the ones that have not been sent?



Use set_time_limit(0); and your script will never timeout. Anyway, long 
standing scripts should be run off your Web server, maybe started from 
by cron.




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



Re: [PHP] can't connect to mysql

2005-09-13 Thread viraj
if i'm not mistaken, there is nothing to do with the php coding. this
is totally because of your mysql server, simply your mysql server is
not started yet.

sometimes this may be a bug.
http://bugs.mysql.com/bug.php?id=11380

or try this
http://www.faqts.com/knowledge_base/view.phtml/aid/3948


~viraj.



On 9/13/05, Gustav Wiberg [EMAIL PROTECTED] wrote:
 Hi there!
 
 What code are you using? Try with the mysqli...
 http://se2.php.net/manual/en/ref.mysqli.php
 
 /G
 
 - Original Message -
 From: blackwater dev [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Sent: Tuesday, September 13, 2005 3:09 AM
 Subject: [PHP] can't connect to mysql
 
 
 I finally got php5 compiled with mysql but now I can't connect using
 mysql_connect without getting the error of:
 
 Warning: mysql_connect() [function.mysql-connect]: Can't connect to
 local MySQL server through socket '/tmp/mysql.sock' (2) in...
 
 I can ssh into the box and log in to mysql so I think it's running.
 Plus if I try to run mysqld, I get this error:
 
 ning] Asked for 196608 thread stack, but got 126976
 050912 19:57:04 [ERROR] Can't start server: Bind on TCP/IP port:
 Address already in use
 050912 19:57:04 [ERROR] Do you already have another mysqld server
 running on port: 3306 ?
 050912 19:57:04 [ERROR] Aborting
 
 050912 19:57:04 [Note] mysqld: Shutdown complete
 
 What could be wrong??
 
 Thanks!
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 --
 No virus found in this incoming message.
 Checked by AVG Anti-Virus.
 Version: 7.0.344 / Virus Database: 267.10.21/96 - Release Date: 2005-09-10
 
 --
 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] Re: Problem w/ reading a txt file.

2005-09-13 Thread David Robley
[EMAIL PROTECTED] wrote:

 
  Problem w/ reading a txt file.
  
  The error I get is Warning: opendir(/home/pudlz/public_html ): failed to
  open dir: No such file or directory 
  
  Here's my code::
  
  $main = file('folders.txt');
  $counter = count($main);
  
  for($i=0;$i$counter;$i++)
  {
   if ($handle = opendir($main[$i]))
   {
  $b=0;
}
  }
  
  
  It's reading and extra space at the end of all my lines. How do I prevent
  that?

From the docs on file: ...file() returns the file in an array. Each element
of the array corresponds to a line in the file, with the newline still
attached.

So you actually get the text plus a newline character which can be removed
with trim. Simply replace

   if ($handle = opendir($main[$i]))

with

   if ($handle = opendir( trim($main[$i]) ))

You don't need the quotes in opendir in this case.

Cheers
-- 
David Robley

Put on your seatbelt. I'm gonna try something new.

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



Re: [PHP] Problem w/ reading a txt file.

2005-09-13 Thread Burhan Khalid

[EMAIL PROTECTED] wrote:

 Problem w/ reading a txt file.
 
 The error I get is Warning: opendir(/home/pudlz/public_html ): failed to

 open dir: No such file or directory 
 
 Here's my code::
 
 $main = file('folders.txt');

 $counter = count($main);
 
 for($i=0;$i$counter;$i++)

 {
  if ($handle = opendir($main[$i]))
  {
 $b=0;
   }
 }
 
 
 It's reading and extra space at the end of all my lines. How do I prevent

 that?


$main = file('folders.txt');
foreach($main as $folder)
{
   if ($handle = opendir(trim($folder))
   {
   $b = 0;
   }
}

I really don't see the point in this loop, but maybe you gave a very 
simple example.


Warmly,
Burhan

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



[PHP] [from internals] Re: ref fix revisited

2005-09-13 Thread Jochem Maas

hello Rasmus,

sorry to interrupt ... but ... could you possibly
spare a moment to explain why the SquirrelMail example you gave
is 'dumb' code? (I for one would like to avoid writing dumb code
wherever possible, and it looks a lot like I line I could have written!)

many thanks and regards,
jochem

Rasmus Lerdorf wrote:

...



SquirrelMail has code like this all over the place:

   $value = strtolower(array_shift(split('/\w/',trim($value;

Here array_shift() does of course change the arg, so that is a potential
problem.  And yes, that's a dumb way to do this, but people write code
like this.  In some of these array manipulation calls, which seems to
account for a number of the BC problems we are having, we could check
for a non-ref and behave slightly differently.  In the case of
array_shift() we could return the first arg and throw a notice.  Same
would go for reset(), end(), next(), prev() and probably a few others.

-Rasmus



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



Re: [PHP] [from internals] Re: ref fix revisited

2005-09-13 Thread Jasper Bryant-Greene

Jochem Maas wrote:

hello Rasmus,

sorry to interrupt ... but ... could you possibly
spare a moment to explain why the SquirrelMail example you gave
is 'dumb' code? (I for one would like to avoid writing dumb code
wherever possible, and it looks a lot like I line I could have written!)

many thanks and regards,
jochem

Rasmus Lerdorf wrote:

...


SquirrelMail has code like this all over the place:

   $value = strtolower(array_shift(split('/\w/',trim($value;



I know I'm not Rasmus ... but I thought he already explained it pretty 
well in the email you quoted. By the way, please don't top-post.


array_shift [1] receives its first argument as a reference (and modifies 
it), but because you're not actually passing a variable here, but 
actually the result of split(), what exactly is array_shift meant to modify?


A better way to write that would be:

?php
$value_parts = split('/\w/', trim($value));
$value = strtolower($value_parts[0]);
?

... which has the advantage of being a bit more readable too.

[1] http://php.net/array_shift
--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

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



[PHP] Re: PHP - LDAPS query

2005-09-13 Thread Vedanta Barooah
is it a wrong question?
please help...

On 9/12/05, Vedanta Barooah [EMAIL PROTECTED] wrote:
 Hello All,
 
 I think documentation is very sparse on PHP LDAPS (LDAP over SSL). I
 am in a situation where I need to auth against the LDAP server over
 SSL. I have the server's certificate database in the form of a
 cert7.db  file containing the appropriate CA certificates and a
 key3.db file. How do I make use of these from PHP?
 
 Any clues/links to documentation will be of great help...
 
 Thanks,
 Vedanta


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



[PHP] Re: PHP 5, LDAP/Active Directory

2005-09-13 Thread Mark Rees
 I've looked through php.net and scoured Google for a solution to an
 issue I'm having with PHP and LDAP but have so far found nothing. I'm
 trying to build an intranet site that uses the company LDAP (Active
 Directory really) service but I can't seem to get around the
 Operations error and other such messages when trying to bind.

 On my server I'm running:
 Fedora Core 4
 Apache 2
 PHP 5 compiled with OpenLDAP

I have this working with PHP5, Apache2 and Windows 2000


 I must confess that I'm very new to LDAP so it is likely that my
 problem is inexperience, but it seems that this issue has been
 resolved by others so I'm trying to figure out what I'm doing wrong.

Same here!


 To shed more light on the topic, bug #30670 [ http://bugs.php.net/
 bug.php?id=30670edit=0 ] seems to fit my situation perfectly. As
 some of the posts on that bug suggest, I've tried using
 ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION,3);
 ldap_set_option($ldap, LDAP_OPT_REFERRALS,0);
 between ldap_connect and ldap_bind but I still get the Operations
 error message. Everyone seems to be able to get this to work as long
 as they are running PHP4, but I have yet to see (or realize I've
 seen) a solution from someone using PHP5. I've also found where
 blizzards at libero dot it has posted When querying a windows
 2000/2003 AD you MUST use only SASL and not TLS (non supported).
 - Is this true?

Are you doing an anonymous bind? If you are supplying login credentials, be
sure that you are supplying them correctly. This was the problem I had. If
this doesn't help, how about supplying some code?

I found this to be a very useful resouce
http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.
htm

 Another thing worth mentioning here is that the company I work for
 has allowed us to build our own intranet system for our Dept and
 offers little to no support for server specs and settings, but I will
 try to get any information to the list that might be helpful.

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



[PHP] Re: [please ignore!] Re: [PHP] [from internals] Re: ref fix revisited

2005-09-13 Thread Jasper Bryant-Greene

Jochem Maas wrote:

Jasper Bryant-Greene wrote:


?php
$value_parts = split('/\w/', trim($value));
$value = strtolower($value_parts[0]);
?

... which has the advantage of being a bit more readable too.



debatable ... no bog deal either way ...

$value = split('/\w/', trim($value));
$value = strtolower($value[0]);

... saves a var, no?


Yeah, but not as readable. $value is first a string, then an array, then 
a string again. At one point it contains the whole value, then the 
string split into words, then the first word in lowercase. The simple 
name 'value' doesn't really explain what it's standing for in all those 
situations.


But yeah, no big deal either way.

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/


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



[PHP] [please ignore!] Re: [PHP] [from internals] Re: ref fix revisited

2005-09-13 Thread Jochem Maas

Rasmus please ignore my last mail, I was being blind and stupid.

Jasper Bryant-Greene wrote:

Jochem Maas wrote:


hello Rasmus,

sorry to interrupt ... but ... could you possibly
spare a moment to explain why the SquirrelMail example you gave
is 'dumb' code? (I for one would like to avoid writing dumb code
wherever possible, and it looks a lot like I line I could have written!)

many thanks and regards,
jochem

Rasmus Lerdorf wrote:

...



SquirrelMail has code like this all over the place:

   $value = strtolower(array_shift(split('/\w/',trim($value;



I know I'm not Rasmus ... but I thought he already explained it pretty 
well in the email you quoted. By the way, please don't top-post.


only if Rasmus asks ;-)! normally I don't top-post but in this case I figured
I save Rasmus the effort of scrolling ... I figured he'd remember the gist
of a email he himself wrote less than a day ago...



array_shift [1] receives its first argument as a reference (and modifies 
it), but because you're not actually passing a variable here, but 
actually the result of split(), what exactly is array_shift meant to 
modify?


ok it's too early I guess, I looked right past it - I was thinking to complex,
thanks for the heads up...



A better way to write that would be:

?php
$value_parts = split('/\w/', trim($value));
$value = strtolower($value_parts[0]);
?

... which has the advantage of being a bit more readable too.


debatable ... no bog deal either way ...

$value = split('/\w/', trim($value));
$value = strtolower($value[0]);

... saves a var, no?



[1] http://php.net/array_shift


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



[PHP] CBL Partial Updater Released!

2005-09-13 Thread Kazuho Oku
Hi all,

This is the initial announcement of CBL Partial Updater, an PHP/AJAX
library.

Unlike other libraries, all operations are controlled at the server side.
BY using the library, you can convert existing PHP scripts into AJAX apps in
less than a minute, just by adding a few lines of code.

For more information please visit the following websites.

The project page: http://cbl-updater.sourceforge.net/
My weblog:
http://labs.cybozu.co.jp/blog/kazuhoatwork/2005/09/cbl_partial_updater.php

I hope others will find the library useful as well.

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



Re: [PHP] STDERR not opened with php 5.0.5

2005-09-13 Thread Edin Kadribasic
Hi,

Perhaps your /usr/local/bin/php505 is a cgi instead of cli?

Edin


Florent Monnier wrote:
 Hi,
 
 on http://www.php.net/manual/en/features.commandline.php is writen:
 STDERR - An already opened stream to stderr. This saves opening it with:
 ?php
 $stderr = fopen('php://stderr', 'w');
 ?
 
 
 But this does not work:
 #! /usr/local/bin/php505 -q
 ?php
 fwrite(STDERR, error!\n);
 ?
 
 
 This does work:
 #! /usr/local/bin/php505 -q
 ?php
 define('STDERR', fopen('php://stderr', 'w'));
 fwrite(STDERR, error!\n);
 ?
 
 
 Is the manual wrong or does php 5.0.5 have change this property ?
 
 Thanks
 

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



[PHP] CBL Partial Updater Released!

2005-09-13 Thread Kazuho Oku
Hi all,

This is the initial announcement of CBL Partial Updater, an PHP/AJAX
library.

Unlike other libraries, all operations are controlled at the server side.
BY using the library, you can convert existing PHP scripts into AJAX apps in
less than a minute, just by adding a few lines of code.

For more information please visit the following websites.

The project page: http://cbl-updater.sourceforge.net/
My weblog:
http://labs.cybozu.co.jp/blog/kazuhoatwork/2005/09/cbl_partial_updater.php

I hope others will find the library useful as well.

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



RE: [PHP] mktime

2005-09-13 Thread Ford, Mike
On 13 September 2005 00:08, Dan Brow wrote:

 A little confused with mktime, I'm trying to get how many
 days are in a
 year.
 
 $year = 2006;
 $epoch = mktime(0, 0, 0, 1, 0, $year); // I have to have 1

You're asking for the 0th day of the first month here, which is (guess what!) 
the last day of *last* year.  If you want to get the last day of *this* year, 
you need to ask for the 0th day of *next* year; or, more trickily, the 0th day 
of the 13th month of *this* year! (Note: I haven't tested this, but logically 
it should work... ;)  So, either of these should get what you want:

  $epoch = mktime(0, 0, 0, 1, 0, $year+1); 
  $epoch = mktime(0, 0, 0, 13, 0, $year); 

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] incrementing in a for loop

2005-09-13 Thread Burhan Khalid

Peppy wrote:

I've searched online and am unable to find how to increment by more than one in 
a for loop.

for ($i = 1; $i = 6; $i++) {

Is it possible to increment $i by 5?


Everyone has responded with the correct answer, but you do realize that 
this loop will only run twice? It will print 1, then 6.


If you change it to $i  6, then it will print 1.

And just because its Tuesday, and if you happen to be using PHP 5.0.0+:

$numbers = range(1,100,5);
foreach($numbers as $number)
{
   echo $number.\n;
}

And now, back to your regularly scheduled programming

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



[PHP] ADODB vs PHP extension

2005-09-13 Thread Dean Maunder
Hi,
Can someone tell me what are the differences between ADODB and using the 
compiled-in MSSQL extension?  Which one is faster?  What are the 
benefits/pitfalls of using either?
Thanks
Dean.
 


Re: [PHP] Problem with PEAR:SOAP [solved]

2005-09-13 Thread -k.
--- Jasper Bryant-Greene [EMAIL PROTECTED] wrote:
 Install the HTTP_Request package.

That did it. Anyone know why the SOAP package didn't complain about this when i 
installed it?




-k.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



[PHP] Re: ADODB vs PHP extension

2005-09-13 Thread Jens Schulze
Do you mean the ADODB database abstraction layer for PHP or the original
ADODB technology of Microsoft?

Jens

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



Re: [PHP] session.gc_maxlifetime

2005-09-13 Thread Gustav Wiberg


- Original Message - 
From: Shaw, Chris - Accenture [EMAIL PROTECTED]
To: Gustav Wiberg [EMAIL PROTECTED]; PHP General 
php-general@lists.php.net

Sent: Friday, September 09, 2005 7:21 PM
Subject: RE: [PHP] session.gc_maxlifetime




-Original Message-
From: Gustav Wiberg [mailto:[EMAIL PROTECTED]
Sent: 09 September 2005 14:40
To: PHP General
Subject: [PHP] session.gc_maxlifetime











*




This e-mail has been received by the Revenue Internet e-mail service.




*




Hi there!




This setting...
session.gc_maxlifetime can only be set in php.ini
Default = 1440 = 24 minutes
is the time before a cookie expires? Is this right?




I don't have access to php.ini because it's not my server



(it's my webhost)
What's the solution to that? I want the cookie to last as



long as set inte



setcookie...




Please help... I'm a little confused here...


Surely it is:

session.cookie_lifetime: specifies the lifetime of the cookie in seconds
which is sent to the browser. The value 0 means until the browser is
closed. Defaults to 0.

Also, I thought you could use ini_set to change your php.ini configuration
for your current script.

But I could be wrong... Did I miss read the manual?




This message has been delivered to the Internet by the Revenue Internet 
e-mail service


*

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



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.19/93 - Release Date: 2005-09-08

Hi again!

Yes, I were able to change with ini_set...

I wrote it like this... Is it good? or bad?
ini_set('session.cookie_lifetime',2147483647);

I wrote that code in a script... But that won't effect the server 
configruation would it? Because when I try to get values from phpinfo() then 
'session.cookie_lifetime' is still 0.


How do I know that it works? Is there any way of viewing the new value?

/G
http://www.varupiraten.se/

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



Re: [PHP] Problem w/ reading a txt file.

2005-09-13 Thread sub
Yeah, I just cut out almost the code that was working fine. My the full code
does a bit more than than that.

Thanks all,

Andrew Darrow
Kronos1 Productions
www.pudlz.com


- Original Message - 
From: Burhan Khalid [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Tuesday, September 13, 2005 12:45 AM
Subject: Re: [PHP] Problem w/ reading a txt file.


 [EMAIL PROTECTED] wrote:
   Problem w/ reading a txt file.
 
   The error I get is Warning: opendir(/home/pudlz/public_html ): failed
to
   open dir: No such file or directory 
 
   Here's my code::
 
   $main = file('folders.txt');
   $counter = count($main);
 
   for($i=0;$i$counter;$i++)
   {
if ($handle = opendir($main[$i]))
{
   $b=0;
 }
   }
 
 
   It's reading and extra space at the end of all my lines. How do I
prevent
   that?

 $main = file('folders.txt');
 foreach($main as $folder)
 {
 if ($handle = opendir(trim($folder))
 {
 $b = 0;
 }
 }

 I really don't see the point in this loop, but maybe you gave a very
 simple example.

 Warmly,
 Burhan

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





 -- 
 No virus found in this incoming message.
 Checked by AVG Anti-Virus.
 Version: 7.0.344 / Virus Database: 267.10.23/99 - Release Date: 9/12/2005



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



Re: [PHP] Re: PHP 5, LDAP/Active Directory

2005-09-13 Thread Joe Wollard

On Sep 13, 2005, at 4:17 AM, Mark Rees wrote:


I've looked through php.net and scoured Google for a solution to an
issue I'm having with PHP and LDAP but have so far found nothing. I'm
trying to build an intranet site that uses the company LDAP (Active
Directory really) service but I can't seem to get around the
Operations error and other such messages when trying to bind.

On my server I'm running:
Fedora Core 4
Apache 2
PHP 5 compiled with OpenLDAP



I have this working with PHP5, Apache2 and Windows 2000




I must confess that I'm very new to LDAP so it is likely that my
problem is inexperience, but it seems that this issue has been
resolved by others so I'm trying to figure out what I'm doing wrong.



Same here!




To shed more light on the topic, bug #30670 [ http://bugs.php.net/
bug.php?id=30670edit=0 ] seems to fit my situation perfectly. As
some of the posts on that bug suggest, I've tried using
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION,3);
ldap_set_option($ldap, LDAP_OPT_REFERRALS,0);
between ldap_connect and ldap_bind but I still get the Operations
error message. Everyone seems to be able to get this to work as long
as they are running PHP4, but I have yet to see (or realize I've
seen) a solution from someone using PHP5. I've also found where
blizzards at libero dot it has posted When querying a windows
2000/2003 AD you MUST use only SASL and not TLS (non supported).
- Is this true?



Are you doing an anonymous bind? If you are supplying login  
credentials, be
sure that you are supplying them correctly. This was the problem I  
had. If

this doesn't help, how about supplying some code?
I found this to be a very useful resouce
http://www.computerperformance.co.uk/Logon/ 
LDAP_attributes_active_directory.

htm



Another thing worth mentioning here is that the company I work for
has allowed us to build our own intranet system for our Dept and
offers little to no support for server specs and settings, but I will
try to get any information to the list that might be helpful.



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




Mark:

First off, thanks for the quick response! You asked if I am using an  
anonymous  bind or if my credentials are being passed correctly. I've  
been trying anonymous right now as I'm only testing at this point and  
wanted read only access. But, I have tried passing credentials as  
well to see if our admin just doesn't allow anonymous binds. Of  
course I could be doing this wrong, but I couldn't be sure. What did  
you mean by 'be sure you are supplying them correctly'? I assumed  
that the following would be fine:



?php
$ds = ldap_connect('ad.server.com');
$lb = ldap_bind($ds, 'username', 'password');

// At this point the bind looks successful
// so we'll try a query

$res = ldap_search($ds, 'o=My Company,c=US','sn=S*');

// Now it will output the 'Operations error' message
// Could this happen if I specify directory entries that don't exists?
...
?


As far as code examples go, I'm simply copying and pasting multiple  
examples from multiple message threads that say something like  
Fixed or Got it - as well as the examples from php.net.


So since you've got it working with PHP5 can you verify that SASL is/ 
is not needed to communicate to an AD 2003 server from linux? I keep  
leaning towards the possibility that I need that, but can't seem to  
find any way to tell for sure since the ldap_sasl_bind()  function  
isn't documented yet.


Thanks again!

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



[PHP] Modifying data in forms with values

2005-09-13 Thread Robert Sossomon
I have to create registration forms all the time for people in the office and
what I keep running into is that I need a way for when they edit a field that
the drop-down list of choices is automatically set for the right now.

I have 100+ counties in one list, but I don't want to write 100+ if statements
for checking to see if the value of $county equals the value of the field I am
drop down choice.

Anyone have some quick solutions?

I have radio buttons as well, but going to use a drop-down list for the editing
pages to make it all simple.

Thanks!
Robert



-- 
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
512 BrickHaven Drive Suite 220L, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax:   919/515-7812
[EMAIL PROTECTED]

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



[PHP] Accessing images in a protected directory

2005-09-13 Thread Brian

I haven't used .htaccess before and am currently having an issue with it.

I have a site that has photos from various events on it.  Some of the 
events need to be password protected to view the photos.  They enter a 
password, it gets checked in the MYSQL database and then the php page 
tries to pull the protected photos from the directory that has .htaccess 
on it.  Yet, everytime it tries to pull an image a username and password 
dialog comes up.


How do I pass this information automatically when I try to get the 
images so the dialog doesn't come up?  Or am I approaching this wrong?


Thanks in advance for the help...

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



[PHP] Re: Accessing images in a protected directory

2005-09-13 Thread M. Sokolewicz

Brian wrote:

I haven't used .htaccess before and am currently having an issue with it.

I have a site that has photos from various events on it.  Some of the 
events need to be password protected to view the photos.  They enter a 
password, it gets checked in the MYSQL database and then the php page 
tries to pull the protected photos from the directory that has .htaccess 
on it.  Yet, everytime it tries to pull an image a username and password 
dialog comes up.


How do I pass this information automatically when I try to get the 
images so the dialog doesn't come up?  Or am I approaching this wrong?


Thanks in advance for the help...


Unfortunately, you can't pass along a username/password to apache in a 
simple way. However, a different approach would be to create a script in 
the same directory as your main script is in. And then call all images 
via that script (eg. image.php?img=abc123.png). Then in that script that 
recieves all requests for the images, basically file_get_contents() (or 
whatever) the actual image file from the protected directory, set the 
right headers (content-type mainly), and echo/print out the image.


Another way would be to limit the .htaccess allow to allow only images 
without getting the user/pass dialog. I'm sure it's possible, but I 
can't really recall how that is done. It will probably be explained in 
the Apache Documentation :)


- tul

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



RE: [PHP] Modifying data in forms with values

2005-09-13 Thread Murray @ PlanetThoughtful
 I have to create registration forms all the time for people in the office
 and
 what I keep running into is that I need a way for when they edit a field
 that
 the drop-down list of choices is automatically set for the right now.
 
 I have 100+ counties in one list, but I don't want to write 100+ if
 statements
 for checking to see if the value of $county equals the value of the field
 I am
 drop down choice.
 
 Anyone have some quick solutions?
 
 I have radio buttons as well, but going to use a drop-down list for the
 editing
 pages to make it all simple.

Hi Robert,

As a suggestion, why not put your counties in an array (are you taking them
from a recordset? If so, same idea applies) and use foreach() to iterate
through the array, building the select list. When $county equals the current
value of the array, include  SELECTED in the select HTML you are building.
One if statement should handle the situation nicely.

Much warmth,

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

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



[PHP] Re: Modifying data in forms with values

2005-09-13 Thread Aaron Greenspan

Robert,

The Lampshade framework (and I'm sure others, too) handles pretty much 
all of the form controls for you. There' also a specific country() 
function used to make a drop-down of countries. Using Lampshade, you 
would only need one line of code in your form:


dropdownBox('country', country(), $myrow['country'], 'Country');

The first parameter is the name of the field in the form. The second 
provides the list of items to display in the drop-down box. The third is 
the present value of the box (so it handles the if statements you were 
talking about), and the fourth is the label that shows up on the form on 
the user's screen.


You should try it out, and I'd be happy to help you get set up.

http://www.thinkcomputer.com/software/lampshade/index.html

Aaron

Aaron Greenspan
President  CEO
Think Computer Corporation

http://www.thinkcomputer.com

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



[PHP] Entering foreign characters into MySQL

2005-09-13 Thread php @ net mines

Hi all

I have a bulgarian/spanish excel file that I have to import to a mysql 
database.
Since I can't save it as csv without replacing the foreign chars with 
(???) I saved it as unicode text. Next, I thought I would replace the 
(\t) with (;) and all the foreign chars with the #xxx;.
The problem is that I still get () instead of the 
#xxx;#xxx;#xxx;#xxx;#xxx; word.




Can anyone help

Thanks

Mario 


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



[PHP] date parsing

2005-09-13 Thread Philippe Reynolds


Greetings all,

I am trying to find a function or a way to parse a date that has the 
following format 2005124 or 20051204.


When I have a date that has a single digit (ie month, day) all the date/time 
function seem to go bizarre.


When it is a full 8 digit string everything is fine.
When there are delimiters between year month day (ie 2005-4-23) everything 
is fine.


I tried strtotime(%Y/%m/%d, 2005124) and this is the result:
1970/01/23.

Any thoughts?

Thanks for the aid!!
Phil

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



RE: [PHP] date parsing

2005-09-13 Thread Jim Moseby
 
 Greetings all,
 
 I am trying to find a function or a way to parse a date that has the 
 following format 2005124 or 20051204.
 
 When I have a date that has a single digit (ie month, day) 
 all the date/time 
 function seem to go bizarre.
 
 When it is a full 8 digit string everything is fine.
 When there are delimiters between year month day (ie 
 2005-4-23) everything 
 is fine.
 
 I tried strtotime(%Y/%m/%d, 2005124) and this is the result:
 1970/01/23.
 
 Any thoughts?

Hi Phil,

There is no programmatic way to know.  in the case of your example above,
2005124, how would the program know whether it is supposed to be
2005-12-04 or 2005-1-24?

JM

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



[PHP] Generating PHP (Admin) Tables

2005-09-13 Thread Lst Recv
One usage of PHP I find over and over is to create table interfaces,
usually used by the admin if a site.

It's really a shame to have to redo this code over and over.  Is there
any library or class that can handle it?

Good features would include:
* Given a SQL SELECT, create an HTML table
* Paginate (with links)
* Allow sorting ascending, descending (with links)
* HTML Escaping of contents

Other nice features would be:
* Allow editing
* Color coding
* Filtering

Any ideas?

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



Re: [PHP] date parsing

2005-09-13 Thread Dragan Stanojevic - Nevidljivi

Philippe Reynolds wrote:


Greetings all,

I am trying to find a function or a way to parse a date that has the 
following format 2005124 or 20051204.


Well, the truth is, computers are stupid, and you need to explain this 
kind of date format to him by rewriting such date in a way that a 
computer can understand...


From where do you get such string? Can you ask the sender to send 
more uniform/standard date?



I tried strtotime(%Y/%m/%d, 2005124) and this is the result:
1970/01/23.


Look again at the function definition http://www.php.net/strtotime
The second argument is timestamp (number of seconds since the unix 
epoch). So if you count 2005124 seconds from January 1 1970 00:00:00 GMT 
you would get to January 23 1970.


hope this will help you a little,
N::


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [PHP] Modifying data in forms with values

2005-09-13 Thread Al

Murray @ PlanetThoughtful wrote:

I have to create registration forms all the time for people in the office
and
what I keep running into is that I need a way for when they edit a field
that
the drop-down list of choices is automatically set for the right now.

I have 100+ counties in one list, but I don't want to write 100+ if
statements
for checking to see if the value of $county equals the value of the field
I am
drop down choice.

Anyone have some quick solutions?

I have radio buttons as well, but going to use a drop-down list for the
editing
pages to make it all simple.



Hi Robert,

As a suggestion, why not put your counties in an array (are you taking them
from a recordset? If so, same idea applies) and use foreach() to iterate
through the array, building the select list. When $county equals the current
value of the array, include  SELECTED in the select HTML you are building.
One if statement should handle the situation nicely.

Much warmth,

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


Here is an example of what Murray suggested. $sort_options is an array [list]of 
counties in your case.

$report .=
div style=\font-weight:bold; margin-top:2em\Sort the index by:
select name=\sort_by\\n;

$sort_by= foo;

foreach($sort_options as $option= $label){

$sel=($option== $sort_by)? 'SELECTED' : '';
$report .=  option value=\$option\ $sel$label/option\n;
}//end foreach
$report .= /select\n;

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



[PHP] ini_set()

2005-09-13 Thread Gustav Wiberg

Hi there!

I don't get it...



From the manual...


string ini_set ( string varname, string newvalue )

Sets the value of the given configuration option. Returns the old value on 
success, FALSE on failure. The configuration option will keep this new value 
during the script's execution, and will be restored at the script's ending.


Does this mean that:

File phpcode1.php handles cookies and has the code 
ini_set('session.cookie_lifetime',2147483647); ini it.

File phpcode2.php has nothing to do with cookies

When user goes TO phpcode2.php FROM phpcode1.php, session.cookie_lifetime 
would be zero and ended when browser is closed...?


/G
http://www.varupiraten.se/

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



Re: [PHP] date parsing

2005-09-13 Thread Philippe Reynolds

Much appreciated all,

I was kindda hopping that I missed something, some mysterious function...

My solution to this is: if a value like 2005416 to ignore it and only look 
for 2005/4/16 or 20050416.


Cheers
Phil

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



Re: [PHP] Re: Accessing images in a protected directory

2005-09-13 Thread Niels Ganser
 Unfortunately, you can't pass along a username/password to apache in a
 simple way.

Well, what about http://user:[EMAIL PROTECTED] I personally wouldn't send 
cleartext passwords to a client's browser which might cache them and 
stuff, but possible it is.

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



[PHP] glob behavior on OSX

2005-09-13 Thread Luis Magaña
Hi, am using glob in linux to match files like this with no problems:

glob(../dbimages/banners/{*.[jJ][pP][gG],*.[gG][iI][fF]},GLOB_BRACE);

that matches gif o jpg case insensitive, now this works on linux with no
problems, but it does not in OSX.

//This works nice in OSX
glob(../dbimages/banners/*.[jJ][pP][gG]); 
//This also works but not case insensistive
glob(../dbimages/banners/{*.jpg,*.gif},GLOB_BRACE); 
//This does not work at all 
glob(../dbimages/banners/{*.[jJ][pP][gG],*.[gG][iI][fF]},GLOB_BRACE);

It seem that GLOB_BRACE + the complex regexp does not work in OSX.

PHP is 4.3.11
OSX is 8.2.0

Thanks

-- 
Luis Magaña
Gnovus Networks  Software
www.gnovus.com


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


Re: [PHP] ini_set()

2005-09-13 Thread Richard Lynch
On Tue, September 13, 2005 2:11 pm, Gustav Wiberg wrote:
 Hi there!

 I don't get it...


 From the manual...

 string ini_set ( string varname, string newvalue )

 Sets the value of the given configuration option. Returns the old
 value on
 success, FALSE on failure. The configuration option will keep this new
 value
 during the script's execution, and will be restored at the script's
 ending.

 Does this mean that:

 File phpcode1.php handles cookies and has the code
 ini_set('session.cookie_lifetime',2147483647); ini it.
 File phpcode2.php has nothing to do with cookies

 When user goes TO phpcode2.php FROM phpcode1.php,
 session.cookie_lifetime
 would be zero and ended when browser is closed...?

No.

It means that *IF* you do that ini_set() before you do session_start()
*THEN* the Cookie sent out in phpcode1.php will have a theortical
lifetime of about 33 years.

phpcode2.php would be affected only if it did session_start(), and the
effect would be that the cookie would be theoretically available (and
the session tied to it) for 33 years.

I say THEORETICAL above because browsers are allowed to discard cookie
life-times longer than 2 years (??? check specs ???) on the assumption
that 33 year life-time cookies are just plain stupid mistakes on
somebody's part.

YMMV
NAIAA
IANAL

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

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



[PHP] Deny access from certain hosts

2005-09-13 Thread David Pollack
Hello,
   I have a problem where someone is illegally linking to my site.
There site is in another language so I'm having trouble contacting
them. Is there any way that I can use PHP or Apache to stop them from
linking to these files directly on there website. This is an example
of a log entry that I get from their link:

85.65.154.185 - - [04/Sep/2005:06:52:40 -0700] GET
/fonts/images/austrise.jpg HTTP/1.1 200 6094
http://www.tipo.co.il/zone/page.asp?zone=41611880647891pid=1044663;
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

I've tried using mod_access with a simple directive in my VirtualHost like: 

Directory /home/da3/public_html/fonts
   Deny from 85.65.154
/Directory


And that does not seem to work. I have mod_access installed and PHP 4.

I'm sorry if this is more of an apache question but it just seems like
it should be so easy and I can't find a single example of how to stop
this.

-- 
David Pollack
[EMAIL PROTECTED]

www.atlspecials.com
www.da3.net

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



Re: [PHP] Deny access from certain hosts

2005-09-13 Thread Jordan Miller

you need to do it like this:

Order Allow,Deny
Allow from all
Deny from 85.65.154

http://httpd.apache.org/docs/1.3/mod/mod_access.html


Jordan



On Sep 13, 2005, at 2:30 PM, David Pollack wrote:



Hello,
   I have a problem where someone is illegally linking to my site.
There site is in another language so I'm having trouble contacting
them. Is there any way that I can use PHP or Apache to stop them from
linking to these files directly on there website. This is an example
of a log entry that I get from their link:

85.65.154.185 - - [04/Sep/2005:06:52:40 -0700] GET
/fonts/images/austrise.jpg HTTP/1.1 200 6094
http://www.tipo.co.il/zone/page.asp?zone=41611880647891pid=1044663;
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

I've tried using mod_access with a simple directive in my  
VirtualHost like:


Directory /home/da3/public_html/fonts
   Deny from 85.65.154
/Directory


And that does not seem to work. I have mod_access installed and PHP 4.

I'm sorry if this is more of an apache question but it just seems like
it should be so easy and I can't find a single example of how to stop
this.

--
David Pollack
[EMAIL PROTECTED]

www.atlspecials.com
www.da3.net

--
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] trying to figure out the best/efficient way to tell who is logged into a site..

2005-09-13 Thread bruce
hi...

anybody have pointers to trying to tell who/how long someone is logged into
a system/site. i've thought about setting a session var, but i'm not sure
how to read/tabulate this var across the entire group of people who'd be
logged in. i've also thought about keeping track in a db tbl.. however, i'm
still not sure that i've got a good way of tracking who's logged in, and
still on...

a possible approach would be to have the app periodically update the system
whenever a logged in user goes from page to page...

so, any thoughts/ideas/etc...

-thanks

bruce
[EMAIL PROTECTED]

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



RE: [PHP] Deny access from certain hosts

2005-09-13 Thread Jim Moseby
 Hello,
I have a problem where someone is illegally linking to my site.
 There site is in another language so I'm having trouble contacting
 them. Is there any way that I can use PHP or Apache to stop them from
 linking to these files directly on there website. This is an example
 of a log entry that I get from their link:
 
 85.65.154.185 - - [04/Sep/2005:06:52:40 -0700] GET
 /fonts/images/austrise.jpg HTTP/1.1 200 6094
 http://www.tipo.co.il/zone/page.asp?zone=41611880647891pid=1044663;
 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
 
 I've tried using mod_access with a simple directive in my 
 VirtualHost like: 
 
 Directory /home/da3/public_html/fonts
Deny from 85.65.154
 /Directory
 
 
 And that does not seem to work. I have mod_access installed and PHP 4.
 
 I'm sorry if this is more of an apache question but it just seems like
 it should be so easy and I can't find a single example of how to stop
 this.
 
Look at it this way, they have graciously given you full control over a
small portion of their website.  You should reciprocate with some creative
ideas.

What I would do first is replace /fonts/images/austrise.jpg on my site with
a picture of something REALLY disgusting, and use a different file for my
site.

Then, after I have had a few chuckles, and I'm convinced that the bandwidth
bandito has learned a lesson, fix it as Jordan Miller has suggested.

JM

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



Re: [PHP] Deny access from certain hosts

2005-09-13 Thread Aaron Greenspan

Jordan,

I have a similar problem where someone is using copyrighted images on my 
site in a bulletin board. It's not that one specific host is requesting 
the files--it's people from all over--but rather that I want to block 
one referring URL using Apache, rather than PHP, since the images are 
GIF files.


Can you do that with .htaccess?

Thanks,

Aaron

Aaron Greenspan
President  CEO
Think Computer Corporation

http://www.thinkcomputer.com

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



Re: [PHP] Deny access from certain hosts

2005-09-13 Thread David Pollack
 Look at it this way, they have graciously given you full control over a
 small portion of their website.  You should reciprocate with some creative
 ideas.
 
 What I would do first is replace /fonts/images/austrise.jpg on my site with
 a picture of something REALLY disgusting, and use a different file for my
 site.
 
 Then, after I have had a few chuckles, and I'm convinced that the bandwidth
 bandito has learned a lesson, fix it as Jordan Miller has suggested.
 
 JM
 

This is really not a bad idea, but I have a script that creates all of
my images so it'd be annoying to change just one of them. If it
happens again I will definitely give that a shot. Is there any way
that I can redirect all requests from this guy to a different file?
That'd be nice. That way my site would be unaffected and he'd get...
well, I'd think of something.

Anyway, thanks for the quick responses. This was really frustrating me
because I knew it was something small I was over looking.

-- 
David Pollack
[EMAIL PROTECTED]

www.atlspecials.com
www.da3.net

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



Re: [PHP] ini_set()

2005-09-13 Thread Gustav Wiberg
- Original Message - 
From: Richard Lynch [EMAIL PROTECTED]

To: Gustav Wiberg [EMAIL PROTECTED]
Cc: PHP General php-general@lists.php.net
Sent: Tuesday, September 13, 2005 9:26 PM
Subject: Re: [PHP] ini_set()



On Tue, September 13, 2005 2:11 pm, Gustav Wiberg wrote:

Hi there!

I don't get it...


From the manual...

string ini_set ( string varname, string newvalue )

Sets the value of the given configuration option. Returns the old
value on
success, FALSE on failure. The configuration option will keep this new
value
during the script's execution, and will be restored at the script's
ending.

Does this mean that:

File phpcode1.php handles cookies and has the code
ini_set('session.cookie_lifetime',2147483647); ini it.
File phpcode2.php has nothing to do with cookies

When user goes TO phpcode2.php FROM phpcode1.php,
session.cookie_lifetime
would be zero and ended when browser is closed...?


No.

It means that *IF* you do that ini_set() before you do session_start()
*THEN* the Cookie sent out in phpcode1.php will have a theortical
lifetime of about 33 years.

phpcode2.php would be affected only if it did session_start(), and the
effect would be that the cookie would be theoretically available (and
the session tied to it) for 33 years.

I say THEORETICAL above because browsers are allowed to discard cookie
life-times longer than 2 years (??? check specs ???) on the assumption
that 33 year life-time cookies are just plain stupid mistakes on
somebody's part.

YMMV
NAIAA
IANAL

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




--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.23/99 - Release Date: 2005-09-12



Thanx a lot! I think it is clearer now... :-)

What happens if ini_set AFTER session_start(). Doesn't it affect anything 
then?


/G
http://www.varupiraten.se/

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



[PHP] error message while mysqling on php

2005-09-13 Thread Michal Krezolek
I have received an error: Warning: mysql_num_rows(): supplied argument is
not a valid MySQL result resource in /home/www/mksystem.net when trying to
execute $num = mysql_num_rows($result);

Please go to http://mksystem.net/phpinfo.php and tell me whether it is due
to the version of php I have on server and an easy workaround would be
appreciated.



RE: [PHP] error message while mysqling on php

2005-09-13 Thread Jay Blanchard
[snip]
I have received an error: Warning: mysql_num_rows(): supplied argument is
not a valid MySQL result resource in /home/www/mksystem.net when trying to
execute $num = mysql_num_rows($result);
[/snip]

Post a little code and we might be able to help you. It is likely that
$result is not the variable holding the resources from the query.

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



RE: [PHP] error message while mysqling on php

2005-09-13 Thread Murray @ PlanetThoughtful
 I have received an error: Warning: mysql_num_rows(): supplied argument is
 not a valid MySQL result resource in /home/www/mksystem.net when trying to
 execute $num = mysql_num_rows($result);
 
 Please go to http://mksystem.net/phpinfo.php and tell me whether it is due
 to the version of php I have on server and an easy workaround would be
 appreciated.

Check the syntax of your SQL statement, it's very possible you have an error
in it somewhere. If you have PHPMyAdmin, or some other interface to MySQL
such as MySQL Query Browser, etc, try executing the SQL statement in one of
them directly, to see if they return a valid resultset.

Much warmth,

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

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



[PHP] array simple question

2005-09-13 Thread matt VanDeWalle

hello,
I have a simple question, not really a problem this time.
I know that the function print_r() will print an array but if that array 
has sub-arrays it prints everything and if you don't use more command or a 
pipe of some kind that could be useless in some cases, but I am just 
wondering, for an array that has several arrays in it, is there a way to 
print the array names that are contained in the main array but not the 
contents of each?

thanks
matt

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



[PHP] asynchronous PHP to PHP call

2005-09-13 Thread James
I have a PHP script running on server 1.  I want it to call another 
script on server 2 to clean up some files.  There may be tons of 
files and I don't want to wait until the second script is finished.


Is there a way to asynchronously call the second PHP script?

Right now I'm using fopen() to call the script on the second server.
--
-James

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



Re: [PHP] array simple question

2005-09-13 Thread [EMAIL PROTECTED]

tray print the array this way:

echo 'pre';
print_r($array);
echo '/pre';

-afan


matt VanDeWalle wrote:


hello,
I have a simple question, not really a problem this time.
I know that the function print_r() will print an array but if that 
array has sub-arrays it prints everything and if you don't use more 
command or a pipe of some kind that could be useless in some cases, 
but I am just wondering, for an array that has several arrays in it, 
is there a way to print the array names that are contained in the 
main array but not the contents of each?

thanks
matt



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



Re: [PHP] asynchronous PHP to PHP call

2005-09-13 Thread Jasper Bryant-Greene

James wrote:
I have a PHP script running on server 1.  I want it to call another 
script on server 2 to clean up some files.  There may be tons of files 
and I don't want to wait until the second script is finished.


Is there a way to asynchronously call the second PHP script?

Right now I'm using fopen() to call the script on the second server.


Set ignore_user_abort in the second script and close the socket 
immediately. Untested, but conceptually it should work.


--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

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



Re: [PHP] trying to figure out the best/efficient way to tell who is logged into a site..

2005-09-13 Thread Jason Barnett
Close: You mix both of these ideas.

Create a custom session handler. This handler creates user entries in a 
database. Then when you want to know how many are online you do a count on 
the number of user entries in the table. Play around with different 
gc_probability values to tune the efficiency.



On 9/13/05, bruce [EMAIL PROTECTED] wrote:
 
 hi...
 
 anybody have pointers to trying to tell who/how long someone is logged 
 into
 a system/site. i've thought about setting a session var, but i'm not sure
 how to read/tabulate this var across the entire group of people who'd be
 logged in. i've also thought about keeping track in a db tbl.. however, 
 i'm
 still not sure that i've got a good way of tracking who's logged in, and
 still on...
 
 a possible approach would be to have the app periodically update the 
 system
 whenever a logged in user goes from page to page...
 
 so, any thoughts/ideas/etc...
 
 -thanks
 
 bruce
 [EMAIL PROTECTED]
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



RE: [PHP] error message while mysqling on php

2005-09-13 Thread Alan Fullmer
I see two things that could be it.

#1 your $result is not $result = mysql_query(queryline);

Or #2  your syntax on your query line is bad.

You can try doing something like this:

$query = SELECT * FROM table etc blah;
$result = mysql_query($query) or die(mysql_error());
$num = mysql_num_rows($result);


Sometimes the error message can be more explicit if you tell it to print it.
If you get no error on that query statement, then your query is fine.

-Original Message-
From: Murray @ PlanetThoughtful [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 13, 2005 3:05 PM
To: 'Michal Krezolek'; php-general@lists.php.net
Subject: RE: [PHP] error message while mysqling on php

 I have received an error: Warning: mysql_num_rows(): supplied argument is
 not a valid MySQL result resource in /home/www/mksystem.net when trying to
 execute $num = mysql_num_rows($result);
 
 Please go to http://mksystem.net/phpinfo.php and tell me whether it is due
 to the version of php I have on server and an easy workaround would be
 appreciated.

Check the syntax of your SQL statement, it's very possible you have an error
in it somewhere. If you have PHPMyAdmin, or some other interface to MySQL
such as MySQL Query Browser, etc, try executing the SQL statement in one of
them directly, to see if they return a valid resultset.

Much warmth,

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

-- 
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] array simple question

2005-09-13 Thread Jordan Miller
please provide code and an example output, and say how this is  
different than you would like. what you describe is unclear.


Jordan



On Sep 13, 2005, at 4:04 PM, matt VanDeWalle wrote:



hello,
I have a simple question, not really a problem this time.
I know that the function print_r() will print an array but if that  
array has sub-arrays it prints everything and if you don't use more  
command or a pipe of some kind that could be useless in some cases,  
but I am just wondering, for an array that has several arrays in  
it, is there a way to print the array names that are contained in  
the main array but not the contents of each?

thanks
matt

--
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] array simple question

2005-09-13 Thread Jasper Bryant-Greene

matt VanDeWalle wrote:

hello,
I have a simple question, not really a problem this time.
I know that the function print_r() will print an array but if that array 
has sub-arrays it prints everything and if you don't use more command or 
a pipe of some kind that could be useless in some cases, but I am just 
wondering, for an array that has several arrays in it, is there a way to 
print the array names that are contained in the main array but not the 
contents of each?


Note: untested code, and this preserves keys, which you might not want. 
It's reasonably simple to change it to not preserve keys.


?php

$array = array( 'this', 'is', 'my', array( 'array' ) );
$newArray = array();

foreach( $array as $key=$value ) {
if( !is_array( $value ) ) {
$newArray[$key] = $value;
}
}

print( 'pre' . print_r( $newArray, true ) . '/pre' );

?

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s

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



Re: [PHP] array simple question

2005-09-13 Thread Mike Bellerby
If you want to print the keys for all the arrays in the main array then 
use allkeys.




matt VanDeWalle wrote:


hello,
I have a simple question, not really a problem this time.
I know that the function print_r() will print an array but if that 
array has sub-arrays it prints everything and if you don't use more 
command or a pipe of some kind that could be useless in some cases, 
but I am just wondering, for an array that has several arrays in it, 
is there a way to print the array names that are contained in the 
main array but not the contents of each?

thanks
matt



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



Re: [PHP] trying to figure out the best/efficient way to tell who is logged into a site..

2005-09-13 Thread Gustav Wiberg
- Original Message - 
From: Jason Barnett [EMAIL PROTECTED]

Cc: php-general@lists.php.net
Sent: Tuesday, September 13, 2005 11:25 PM
Subject: Re: [PHP] trying to figure out the best/efficient way to tell who 
is logged into a site..



Close: You mix both of these ideas.

Create a custom session handler. This handler creates user entries in a
database. Then when you want to know how many are online you do a count on
the number of user entries in the table. Play around with different
gc_probability values to tune the efficiency.



On 9/13/05, bruce [EMAIL PROTECTED] wrote:


hi...

anybody have pointers to trying to tell who/how long someone is logged
into
a system/site. i've thought about setting a session var, but i'm not sure
how to read/tabulate this var across the entire group of people who'd be
logged in. i've also thought about keeping track in a db tbl.. however,
i'm
still not sure that i've got a good way of tracking who's logged in, and
still on...

a possible approach would be to have the app periodically update the
system
whenever a logged in user goes from page to page...

so, any thoughts/ideas/etc...

-thanks

bruce
[EMAIL PROTECTED]

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









No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.23/99 - Release Date: 2005-09-12

Hi there!

Giving you a bit code... It might come in handy... :-)
I don't have time to explain it, but it may be good for experimenting...

All you guys, please comment if the code is well or bad written and why... 
:-)




?php

function chkIfPasswordTrue($un, $pw, $typeUser) {

//Make username and password in-casesensitive
//
$un = strtolower($un);

$pw = strtolower($pw);

$typeUser = strtolower($typeUser);

require(phpfunctions/opendb.php);



//Get ID for user based on username and password from database

//

$sql = ;

$sql = $sql . SELECT IDAnvandare FROM tbanvandare WHERE;

$sql = $sql .  Anvandarnamn= . safeQuote($un) .  AND;

$sql = $sql .  Losenord= . safeQuote($pw) .  AND;

if ($typeUser == customer) {

   $sql = $sql .  Kund='Y';

}
   else if ($typeUser == reseller) {

   $sql = $sql .  Af='Y';

}
   else  {

   $sql = $sql .  Kund='Y';

}

//echo SQL = $sql;

$querys = mysql_query($sql);

$toarray = mysql_fetch_array($querys);



$id = $toarray[IDAnvandare];

if ($id == Null or strlen($id)==0) {$id = 0;}



mysql_close();



//Return id for user, zero if incorrect login

//

return $id;

}





function getusername() {



//Get username from form if form have sent anything

//if there is an active usernamesession, then use session-variable

//to identifiy user

//

$un = ;



if (isset($_REQUEST[frmUsername])) {

$un = $_REQUEST[frmUsername];

}



 if (isset($_SESSION[unBuy])) {

$un = $_SESSION[unBuy];

}



return $un;



}



function getpassword() {

//Get password from form if form have sent anything

//if there is an active passwordsession, then use session-variable

//to identifiy user

//

$pw = ;



if (isset($_REQUEST[frmPassword])) {

$pw = $_REQUEST[frmPassword];

}



 if (isset($_SESSION[pwBuy])) {

$pw = $_SESSION[pwBuy];

}



return $pw;



}



function setsessions($username, $password, $typeUser) {

$userid = 0;
$username = trim($username);
$password = trim($password);
$typeUser = trim($typeUser);

if (strlen($username)0 AND strlen($password)0 AND strlen($typeUser)0) {

   $userid = chkIfPasswordTrue($username, $password, $typeUser);

   }



//Set session-variable for user-identification

//

if ($userid0) {

$_SESSION[unBuy] = $username;
$_SESSION[pwBuy] = $password;
$_SESSION{typeUser} = $typeUser;

}



return $userid;



}



?



/G
http://www.varupiraten.se/

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



RE: [PHP] trying to figure out the best/efficient way to tell who is logged into a site..

2005-09-13 Thread bruce
any code/pointers to this...

i've been doing the google/search thing and haven't come across anything
which relates to what i'm searching for...

so.. any help in this area would be greatly appreciated!!

i would have thought there would be articles/open course code/apps on this!!

-thanks

bruce


-Original Message-
From: Jason Barnett [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 13, 2005 2:25 PM
Cc: php-general@lists.php.net
Subject: Re: [PHP] trying to figure out the best/efficient way to tell
who is logged into a site..


Close: You mix both of these ideas.

Create a custom session handler. This handler creates user entries in a
database. Then when you want to know how many are online you do a count on
the number of user entries in the table. Play around with different
gc_probability values to tune the efficiency.



On 9/13/05, bruce [EMAIL PROTECTED] wrote:

 hi...

 anybody have pointers to trying to tell who/how long someone is logged
 into
 a system/site. i've thought about setting a session var, but i'm not sure
 how to read/tabulate this var across the entire group of people who'd be
 logged in. i've also thought about keeping track in a db tbl.. however,
 i'm
 still not sure that i've got a good way of tracking who's logged in, and
 still on...

 a possible approach would be to have the app periodically update the
 system
 whenever a logged in user goes from page to page...

 so, any thoughts/ideas/etc...

 -thanks

 bruce
 [EMAIL PROTECTED]

 --
 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] array question: fixed

2005-09-13 Thread matt VanDeWalle
hey, thanks for jogging my memory about the array_keys ; that was exactly 
what i wanted,
now I don't have to run the program through the more program now, and i 
got all the names of the arrays in the big array without having half of 
the info scrolling off the screen.

thanks
matt

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



[PHP] string tokenization

2005-09-13 Thread babu
Hi,
 
I have different types of main strings seperated by commas(,). I want to 
tokenize the main string using php's string token function.
I have substrings in the main string which are seperated by -.
examples:
1.  20,21-24
2. 21-24,20
3. 10,20,21-24,25,26,30
 
so on the whole the main string is seperated by comma and some of the 
substrings(tokes) are seperated by hypen.
can some one give me an idea how to implement in php.
 
Thanks
babu.
 


-
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre.

Re: [PHP] string tokenization

2005-09-13 Thread Luis Magaña
Git the first set of tokens to an array, then walk that array retrieving 
the subtokens.


Regards

babu wrote:

Hi,
 
I have different types of main strings seperated by commas(,). I want to tokenize the main string using php's string token function.

I have substrings in the main string which are seperated by -.
examples:
1.  20,21-24
2. 21-24,20
3. 10,20,21-24,25,26,30
 
so on the whole the main string is seperated by comma and some of the substrings(tokes) are seperated by hypen.

can some one give me an idea how to implement in php.
 
Thanks

babu.
 



-
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre.


--
Luis Magaña
Gnovus Networks  Software
www.gnovus.com

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



[PHP] Quick Poll: PHP 4 / 5

2005-09-13 Thread Ryan A
Hi,
I work for a company that makes websites and does custom programming for
private indviduals and
companies, I also freelance (like many on this list)

I'm a bit curious, so far I have had no need to upgrade my skills or use the
slightly different format /
functions of PHP 5.x.infact I have not seen all that many hosts actually
having support for it, so I
thought of this little poll :-)

Simply cross all the boxes that applies and reply to the list (along with
your name on top)
eg:
[x] blah blah


[] I am still working on PHP 4
[] I never work with PHP 4 anymore, all my work is with PHP 5
[] Oops, call me old fashioned but i am still with 3!

[] I have no problems finding a host with PHP 5 support
[] I can handle PHP 5, but I only work with PHP 4
[] Nah, will wait till PHP 6 is out, theres not much diff between 4 and 5
[] PHP 5 sounds / looks too hard to learn

[] Other




As for the Other box, well, this poll can hardly be close to perfect as i
thought of it
while writing this, so add your own comment there if you want :-)

Cheers,
Ryan

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



RE: [PHP] trying to figure out the best/efficient way to tell who is logged into a site..

2005-09-13 Thread Philip Hallstrom

any code/pointers to this...

i've been doing the google/search thing and haven't come across anything
which relates to what i'm searching for...

so.. any help in this area would be greatly appreciated!!

i would have thought there would be articles/open course code/apps on this!!

-thanks

bruce


http://www.php.net/manual/en/function.session-set-save-handler.php

Also try zend.com in the tips/articles/code-snippets section.




-Original Message-
From: Jason Barnett [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 13, 2005 2:25 PM
Cc: php-general@lists.php.net
Subject: Re: [PHP] trying to figure out the best/efficient way to tell
who is logged into a site..


Close: You mix both of these ideas.

Create a custom session handler. This handler creates user entries in a
database. Then when you want to know how many are online you do a count on
the number of user entries in the table. Play around with different
gc_probability values to tune the efficiency.



On 9/13/05, bruce [EMAIL PROTECTED] wrote:


hi...

anybody have pointers to trying to tell who/how long someone is logged
into
a system/site. i've thought about setting a session var, but i'm not sure
how to read/tabulate this var across the entire group of people who'd be
logged in. i've also thought about keeping track in a db tbl.. however,
i'm
still not sure that i've got a good way of tracking who's logged in, and
still on...

a possible approach would be to have the app periodically update the
system
whenever a logged in user goes from page to page...

so, any thoughts/ideas/etc...

-thanks

bruce
[EMAIL PROTECTED]

--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[suspicious - maybe spam] [PHP] [suspicious - maybe spam] Issues with News sites again...

2005-09-13 Thread Death Gauge
I tried what people recommended but I am having major issues because 
everyone misunderstood about what I was trying to do. My site has a What's 
New news poster, which is on every page and just posts two things at a time. 
Then a have a comic book site, game site, novel site, animation site, and 
movie site and each site has their own News poster page. I need to make a 
page where I select Comics books News from a combo box and it loads the 
poster for Comics Books below the combo box (with ? include 
(comicposter.php); ? or the same with the other site. I can't seem to get 
it to work properly because when I do include (); I fill out the stuff 
that I want to put in and click submit and nothing the site says it submits 
but when I load my main site it displays a blank screen. Any ideas how to 
fix this? I don't want to mess with Java/Javascript/XmlHTTPREQUEST or 
anything like that. I just want to use HTML/PHP/MySQL nothing majorly 
complicated.


--Death Gauge
How do you gauge your death?!

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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



[PHP] Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] Issues with News sites again...

2005-09-13 Thread Jasper Bryant-Greene

Death Gauge wrote:
I tried what people recommended but I am having major issues because 
everyone misunderstood about what I was trying to do. My site has a 
What's New news poster, which is on every page and just posts two things 
at a time. Then a have a comic book site, game site, novel site, 
animation site, and movie site and each site has their own News poster 
page. I need to make a page where I select Comics books News from a 
combo box and it loads the poster for Comics Books below the combo box 
(with ? include (comicposter.php); ? or the same with the other 
site. I can't seem to get it to work properly because when I do include 
(); I fill out the stuff that I want to put in and click submit and 
nothing the site says it submits but when I load my main site it 
displays a blank screen. Any ideas how to fix this? I don't want to mess 
with Java/Javascript/XmlHTTPREQUEST or anything like that. I just want 
to use HTML/PHP/MySQL nothing majorly complicated.


I dunno, maybe if you provided some code so we could understand what 
you're actually doing...


--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

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



[PHP] Re: Quick Poll: PHP 4 / 5

2005-09-13 Thread Manuel Lemos

Hello,

on 09/13/2005 07:52 PM Ryan A said the following:

I'm a bit curious, so far I have had no need to upgrade my skills or use the
slightly different format /
functions of PHP 5.x.infact I have not seen all that many hosts actually
having support for it, so I
thought of this little poll :-)


I think this survey already answers your doubts:

http://www.nexen.net/interview/index.php?id=49


It shows there only 3.5% of the polled servers are exposing the use of 
PHP 5, against the use of PHP 4 in 95% of the servers.


Personally I keep using PHP 4 and do not see the motivation to upgrade. 
First because, for me, PHP 4 is already a feature complete language for 
Web development. Second, because I do not have the time nor the patience 
to chase all the backward incompatibilities of PHP 5 that will break the 
code of my sites.


Actually I am even scared to try PHP 5 in sites that I have with large 
code bases because it is very hard to fully test them in development 
environment.


It is not impossible to test a large site in development environment to 
find the possible problems, but it would take a lot of time and still 
many details could escape, so I am not interested to risk and put a site 
up malfunctioning due to PHP 5 incompatibilities, especially when PHP 4 
worked so well for all these years.


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

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



RE: [PHP] trying to figure out the best/efficient way to tell who is logged into a site..

2005-09-13 Thread bruce
ok

still have questions regarding how to handle a user/session of a user who
kills their browser. in this case, the user's session information would
still be in the db for the session handler...

am i correct in understanding/assuming that i could iterate through the list
of sessions in the session handler, and the session information for users
who aren't on the site, will essentially be invalid???

also, i'm trying to get my hands around the garbage collection function, as
it relates to users who aren't on the system any more...

information that i've seen in the articles haven't given me insight for this
isssue... if i can see how to deal with this situation, then i can craft a
way for an admin to more or less be able to generate a list of users/people
who are actually on the system/site.

as an exercise, i took a look at mambo (the cms) and realized that it
doesn't handle users who simply shut down their browser while on the
system...

thoughts/comments...

-bruce


-Original Message-
From: Philip Hallstrom [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 13, 2005 3:43 PM
To: bruce
Cc: [EMAIL PROTECTED]; php-general@lists.php.net
Subject: RE: [PHP] trying to figure out the best/efficient way to tell
who is logged into a site..


 any code/pointers to this...

 i've been doing the google/search thing and haven't come across anything
 which relates to what i'm searching for...

 so.. any help in this area would be greatly appreciated!!

 i would have thought there would be articles/open course code/apps on
this!!

 -thanks

 bruce

http://www.php.net/manual/en/function.session-set-save-handler.php

Also try zend.com in the tips/articles/code-snippets section.



 -Original Message-
 From: Jason Barnett [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, September 13, 2005 2:25 PM
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] trying to figure out the best/efficient way to tell
 who is logged into a site..


 Close: You mix both of these ideas.

 Create a custom session handler. This handler creates user entries in a
 database. Then when you want to know how many are online you do a count on
 the number of user entries in the table. Play around with different
 gc_probability values to tune the efficiency.



 On 9/13/05, bruce [EMAIL PROTECTED] wrote:

 hi...

 anybody have pointers to trying to tell who/how long someone is logged
 into
 a system/site. i've thought about setting a session var, but i'm not sure
 how to read/tabulate this var across the entire group of people who'd be
 logged in. i've also thought about keeping track in a db tbl.. however,
 i'm
 still not sure that i've got a good way of tracking who's logged in, and
 still on...

 a possible approach would be to have the app periodically update the
 system
 whenever a logged in user goes from page to page...

 so, any thoughts/ideas/etc...

 -thanks

 bruce
 [EMAIL PROTECTED]

 --
 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Quick Poll: PHP 4 / 5

2005-09-13 Thread Dragan Stanojevic - Nevidljivi

Ryan A wrote:

I'm a bit curious, so far I have had no need to upgrade my skills or use the
slightly different format /
functions of PHP 5.x.infact I have not seen all that many hosts actually
having support for it, so I
thought of this little poll :-)

[x] blah blah


Don't think you'll get anything out of this. A reasonable person would 
not make a choice based on this poll, since it is biased.


I could do a lot of work in Sun StarOffice, but somehow, others have 
upgraded to OO.org, can you tell me why? It's not that they don't have 
more then enough features in StarOffice to do their daily job 
successfully...


Any PHP developer has to choose for herself will she use PHP 4 or 5...

This has been throughly debated on this list. PHP4 has it's purposes, 
and any PHP developer would be nuts to abandon it completely. The 
support for PHP4 related problems will diminish eventually...


PHP 5 is new and better, but it doesn't force you to write better code 
or OO code. That decision is yours, but there is no point not to switch 
to PHP5 for new projects.


Rewriting small parts of PHP4 to make it PHP5 compatible (if they're not 
already) can be a great practice to learn PHP5 quirks and get up to 
speed with it.


If you can't find a PHP5 hosting service, you obviously haven't even 
looked. Pick any PHP magazine, and you'll see at least 5 of them. Google 
a bit, you can't miss them.


And if I were you, I'd never say I have had no need to upgrade my 
skills. At your (probably young) age, its dangerous. You're upgrading 
your skills for yourself, not for your clients! For starters, 
familiarize yourself with code refactoring :)


bye,
N::


smime.p7s
Description: S/MIME Cryptographic Signature


[PHP] Problems with strings being handled like numbers

2005-09-13 Thread J B
 I suspect I'm far from the first person to have this problem, but I can't 
seem to find the right search terms to locate the solution. Basically, I'm 
doing a database query and dumping the results into an array. Then, later, 
when I try to display the contents of the array, I run into problems. One of 
the database fields is a very long number, basically an 18-or-so-digit 
serial number. When I tell PHP to print the array variable that corresponds 
to that field, I get what looks like a floating point number in exponent 
notation. I need to display the entire number as it appears in the database. 
Here's the code that does the db lookup and putting the info into the array:

- cut here
$con = mssql_connect($hostname, $username, $password) or die(Database 
failed to respond.);
mssql_select_db($dbName, $con) or die(Table unavailable.);

$query = SELECT * FROM Voucher WHERE (Number LIKE '% . 
$_POST['vouchernum'] . ');;

$result = mssql_query($query, $con);
$result_numrows = mssql_num_rows($result);

$tmpvar = 0;
$vouchers[] = '';
for ($i = 0; $i  $result_numrows; ++$i) {
$line = mssql_fetch_row($result);
$vouchers[$tmpvar][0] = $line[0];
$vouchers[$tmpvar][1] = $line[4];
$vouchers[$tmpvar][2] = $line[5];
$vouchers[$tmpvar][3] = $line[6];
$vouchers[$tmpvar][4] = $line[13];
$vouchers[$tmpvar][5] = $line[14];
$vouchers[$tmpvar][6] = $line[15];
$vouchers[$tmpvar][7] = $line[16];
$tmpvar++;
}
mssql_close($con);

echo(pre);
print_r($vouchers);
echo(/pre);

- cut here

Basically, $line[0] aka $vouchers[$tmpvar][0] is a really big number and 
it's being treated like a number when I need it to be treated like a string 
and just printed. I tried playing around with typecasting, but I couldn't 
get it to do anything different.
Thanks in advance for any help, and if I need to provide more info feel free 
to let me know.


[PHP] whats wrong in this program.

2005-09-13 Thread babu
$str=10,12,14-18;
 
$tok = strtok($str, ',');
while ($tok !== false) { 
 $toks[] = $tok;
  $tok = strtok(',');
   }
 
foreach ($toks as $token){
 if (strpos($token,'-')){
  stringtokenize($token);
 }else{
  $finaltokens[]= $token;
  }
}
 
function stringtokenize($nstr){
 $ntok1= strtok($nstr,'-');
 $ntok2=strtok('-');
 for($i=$ntok1;$i=$ntok2;$i++){
  $finaltokens[]= $i;
  }
 }
 
foreach ($finaltokens as $ftoken){
 echo $ftoken;
 echo br /;
 }  
 
the ouput prints only 10,12 but not 14,15,16,17,18. where is the problem.



-
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre.

Re: [PHP] trying to figure out the best/efficient way to tell who is logged into a site..

2005-09-13 Thread Ben

bruce wrote:


as an exercise, i took a look at mambo (the cms) and realized that it
doesn't handle users who simply shut down their browser while on the
system...

thoughts/comments...


The only way to deal with such situations is through a garbage 
collection routine that periodically deletes or marks as stale records 
for users who haven't requested a new page within a set period of time.


- Ben

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



Re: [PHP] Problems with strings being handled like numbers

2005-09-13 Thread Chris

Are you sure you're getting the number as you need it from the query?

PHP won't (though I guess there could be a bug) automatically convert a 
numerical string into it's numerical equivalent.


If the code you posted produces this problem, then the only possiblities 
I see are that the mssql module is returning a number, or the database 
query is returning that particular string.


Chris

J B wrote:

I suspect I'm far from the first person to have this problem, but I can't 
seem to find the right search terms to locate the solution. Basically, I'm 
doing a database query and dumping the results into an array. Then, later, 
when I try to display the contents of the array, I run into problems. One of 
the database fields is a very long number, basically an 18-or-so-digit 
serial number. When I tell PHP to print the array variable that corresponds 
to that field, I get what looks like a floating point number in exponent 
notation. I need to display the entire number as it appears in the database. 
Here's the code that does the db lookup and putting the info into the array:


- cut here
$con = mssql_connect($hostname, $username, $password) or die(Database 
failed to respond.);

mssql_select_db($dbName, $con) or die(Table unavailable.);

$query = SELECT * FROM Voucher WHERE (Number LIKE '% . 
$_POST['vouchernum'] . ');;


$result = mssql_query($query, $con);
$result_numrows = mssql_num_rows($result);

$tmpvar = 0;
$vouchers[] = '';
for ($i = 0; $i  $result_numrows; ++$i) {
$line = mssql_fetch_row($result);
$vouchers[$tmpvar][0] = $line[0];
$vouchers[$tmpvar][1] = $line[4];
$vouchers[$tmpvar][2] = $line[5];
$vouchers[$tmpvar][3] = $line[6];
$vouchers[$tmpvar][4] = $line[13];
$vouchers[$tmpvar][5] = $line[14];
$vouchers[$tmpvar][6] = $line[15];
$vouchers[$tmpvar][7] = $line[16];
$tmpvar++;
}
mssql_close($con);

echo(pre);
print_r($vouchers);
echo(/pre);

- cut here

Basically, $line[0] aka $vouchers[$tmpvar][0] is a really big number and 
it's being treated like a number when I need it to be treated like a string 
and just printed. I tried playing around with typecasting, but I couldn't 
get it to do anything different.
Thanks in advance for any help, and if I need to provide more info feel free 
to let me know.


 



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



Re: [PHP] Quick Poll: PHP 4 / 5

2005-09-13 Thread Ryan A
Hey all,

Hehe, sorry, didnt mean to ruffle anyones feathersjust reply to me and
not the list
if you want to.

Thanks to everyone who replied, esp those like Manuel Lemos who wrote a
pretty
long explanation for his reasons, as did [EMAIL PROTECTED] (sorry
mate,
you didnt leave your name in the email)
Dont get me wrong, both the above emails were very good reading but I dont
think both
were forwarded to me and the list, if anyones interested I can forward it to
them.

Manuel also gave me a very good link:
http://www.nexen.net/interview/index.php?id=49
although the percentages there might not be totally accurate as is today,
coz that may have
been a survey some time back, dont know for sure as I dont understand the
language its
written in...but the charts are kinda easy to understand.

Cheers,
Ryan

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



RE: [PHP] trying to figure out the best/efficient way to tell whois logged into a site..

2005-09-13 Thread bruce
i kind of get this!!!

however, no one has been able to point me to any kind of code sample/site
that actually illustrates how to do this. even from a psuedo code
implementation.

and as far as i can tell, i still don't have a way of knowing when a session
is valid/alive. the session handler articles i've seen talk to
writing/maintaining sessions in a db.. and the also talk about destroying
the session vars from the db. however, no article that i've run across has
discussed how you know, or can determine for a given session, whether it's
valid or not from accessing the session handler db.

my question is still how do i determine for a given session, that a user is
still on the site, or that the user is no longer on the site/system. i don't
see an automated/system way of doing this.

it appears that i might have to capture the session vars in a db, along with
the associated time creation. it then appears that i'm going to have to have
some way of continually updating the session 'time' to reflect that the user
is still on the system/site. this kind of approach could be done via some
include file for every page that the user hits on the site. i could then
trigger off this to determine who's live/on the site.

the downside to this is that i could kill someone who might be on the
system, but just not actively using the site.. maybe they stepped away...

now, if there was/is away to examine the session var that i store using the
session handler, such that i could determine which session var is still
alaive.. then that would solve my issues

however, as i've stated, i can't find any code sample/articles that get to
this point..

any code/thoughts/comments/etc...

-bruce


-Original Message-
From: Ben [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 13, 2005 5:24 PM
To: php-general@lists.php.net
Subject: Re: [PHP] trying to figure out the best/efficient way to tell
whois logged into a site..


bruce wrote:

 as an exercise, i took a look at mambo (the cms) and realized that it
 doesn't handle users who simply shut down their browser while on the
 system...

 thoughts/comments...

The only way to deal with such situations is through a garbage
collection routine that periodically deletes or marks as stale records
for users who haven't requested a new page within a set period of time.

- Ben

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



[suspicious - maybe spam] [PHP] [suspicious - maybe spam] RE: [PHP] Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] Issueswith News sites again...

2005-09-13 Thread Death Gauge
In night college courses right now. I'll supply full code and everything 
when I get home in about 2 hours or so. (Had to re-reply cause for some 
reason my mail client keeps putting the repliers email in the to box instead 
of PHP's mailing list url.


--Death Gauge
How do you gauge your death?!




Original Message Follows
From: Jasper Bryant-Greene [EMAIL PROTECTED]
To: php-general@lists.php.net
Subject: [PHP] Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] 
Issueswith News sites again...

Date: Wed, 14 Sep 2005 10:55:55 +1200

Death Gauge wrote:
I tried what people recommended but I am having major issues because 
everyone misunderstood about what I was trying to do. My site has a What's 
New news poster, which is on every page and just posts two things at a 
time. Then a have a comic book site, game site, novel site, animation site, 
and movie site and each site has their own News poster page. I need to make 
a page where I select Comics books News from a combo box and it loads the 
poster for Comics Books below the combo box (with ? include 
(comicposter.php); ? or the same with the other site. I can't seem to 
get it to work properly because when I do include (); I fill out the 
stuff that I want to put in and click submit and nothing the site says it 
submits but when I load my main site it displays a blank screen. Any ideas 
how to fix this? I don't want to mess with Java/Javascript/XmlHTTPREQUEST 
or anything like that. I just want to use HTML/PHP/MySQL nothing majorly 
complicated.


I dunno, maybe if you provided some code so we could understand what you're 
actually doing...


--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

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

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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



[PHP] .htaccess

2005-09-13 Thread blackwater dev
I am using .htaccess files throughout my code directory tree to set
certain directives such as php_value auto_prepend_file
../lib/libmatrix.php

 The problem is, they don't work.

I have this in apache:

Directory usr/local/apache/htdocs/realtors/
Options FollowSymLinks
AllowOverride None
/Directory

Where realtors is the root directory of my site...how can I get it to work?

Thanks!

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



Re: [PHP] Problems with strings being handled like numbers

2005-09-13 Thread J B
On 9/13/05, Chris [EMAIL PROTECTED] wrote:
 
 Are you sure you're getting the number as you need it from the query?
 
 PHP won't (though I guess there could be a bug) automatically convert a
 numerical string into it's numerical equivalent.
 
 If the code you posted produces this problem, then the only possiblities
 I see are that the mssql module is returning a number, or the database
 query is returning that particular string.


(Sorry to Chris for getting this twice, I accidentally didn't reply to the 
list)

First of all, thanks for the absurdly fast reply.

I've been playing with it and it looks like mssql_fetch_row may be the 
problem. Right after this line:

$line = mssql_fetch_row($result);

 ...I inserted this line:

var_dump($line[0]);

...and this is what I got back:

string(20) 3.67124100206018e+17

The actual contents of that cell should be 367124100206018209. So it looks 
like the contents of the cell have already been mangled before they're even 
assigned to the array variables (which would explain why my previous 
attempts at typecasting at assignment time weren't having any effect...it 
was already a string). Is there some way I can tell mssql_fetch_row() to 
leave the contents alone?

By the way, if I do SELECT cast(Number as char) from Voucher... and leave 
the rest of it the same, I do get the whole number...but that seems kinda 
inelegant. Is this expected behaviour for mssql_fetch_row()?


Re: [PHP] Quick Poll: PHP 4 / 5

2005-09-13 Thread Manuel Lemos

Hello,

on 09/13/2005 09:54 PM Ryan A said the following:

Manuel also gave me a very good link:
http://www.nexen.net/interview/index.php?id=49
although the percentages there might not be totally accurate as is today,
coz that may have
been a survey some time back, dont know for sure as I dont understand the
language its
written in...but the charts are kinda easy to understand.


It is in French but it says there the statistics are from July 2005, so 
it is pretty recent.


I also am a bit surprised for the tremendous lack of interest to upgrade 
to PHP 5. Ok, I expected that many people would not want to upgrade due 
to the nightmare of dealing with backwards incompatible changes, but I 
did not expect that the statistics would be so overwhealming.


I guess this should ring a lot of bells for those that expect to develop 
products targetted to PHP 5, because the numbers seem to show that PHP 5 
is a flop, despite PHP 5.0.0 was released more than 1 year ago.


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

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



RE: [PHP] Re: ADODB vs PHP extension

2005-09-13 Thread Dean Maunder
My apologies, I meant the PEAR ADODB abstraction layer/  

-Original Message-
From: Jens Schulze [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 14 September 2005 12:05 AM
To: php-general@lists.php.net
Subject: [PHP] Re: ADODB vs PHP extension

Do you mean the ADODB database abstraction layer for PHP or the original
ADODB technology of Microsoft?

Jens

--
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] Re: Quick Poll: PHP 4 / 5

2005-09-13 Thread Oliver Grätz
I've changed to PHP5 and not experienced any problems with old code. In
fact, the differences and incompatibilities are very minor and most
projects should work without any changes.

PHP5 features the new Zend Engine 2. It's not yet really faster than the
one in PHP4 but has large potential. Without going into further details:
It's better, especially if one wants to go with objects and classes.

PHP5 features SQLite. Of course you can install the PECL module and use
SQLite with PHP4 but some features like the iterators aren't available
in PHP4. As an example:

$db=new SQLiteDatabase('mydb.db');
foreach (
$db-query('SELECT * FROM adresses WHERE city=Sin City')
as $adress)
{
echo $adress['name'];
}

That's simpler than in any PHP4/MySQL implementation. SQLite stores the
database in a single file, there's no need for a server (like with
MySQL). This makes it ideal for small quick and dirty projects or
machines with old CPU and s small amount of RAM.

Furthermore, PHP5.1 will introduce PDO which unifies this database
interface for all db systems. It's a native database abstraction layer.

You see, even if you don't want to use the OOP features like classes,
interfaces and iterators you can still benefit from them in the standard
modules.


AllOlli

Coffee anyone? :-Q

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



Re: [PHP] trying to figure out the best/efficient way to tell whois logged into a site..

2005-09-13 Thread Ben

bruce wrote:


my question is still how do i determine for a given session, that a user is
still on the site, or that the user is no longer on the site/system. i don't
see an automated/system way of doing this.


The web is stateless...  There is no automated/system way of doing this. 
 You know the last time a user requested a file, that's it.  It's up to 
you to determine what's a reasonable timeout between page requests so 
that you can determine when someone has gone elsewhere.




it appears that i might have to capture the session vars in a db, along with
the associated time creation. it then appears that i'm going to have to have
some way of continually updating the session 'time' to reflect that the user
is still on the system/site. this kind of approach could be done via some
include file for every page that the user hits on the site. i could then
trigger off this to determine who's live/on the site.


You can keep doing your session variables however you're currently doing 
them, just store a timestamp for each user in a db or file and update it 
every time the user requests a file.


Your script that tells you how many users are online can then check 
against the db/file and count the timestamps less than $timeout seconds 
old, which will be your users online.  The script should also do 
garbage collection for any entries with timestamps older than your $timeout.



the downside to this is that i could kill someone who might be on the
system, but just not actively using the site.. maybe they stepped away...


So have $extended_timeout which is a ridiculously long time out period 
during which users are marked as stale, but not deleted.  If they 
request a file during the $extended_timeout you start counting them 
again, if they don't then after the $extended_timeout they are deleted.



now, if there was/is away to examine the session var that i store using the
session handler, such that i could determine which session var is still
alaive.. then that would solve my issues


Not really... Sessions are no more or less likely to be accurate for 
counting users on your site than what I've described above.  They too 
time out after a period of time (set in php.ini) and are then subject to 
garbage collection.  They hang around long after the user.




however, as i've stated, i can't find any code sample/articles that get to
this point..

any code/thoughts/comments/etc...


Most forums have some type of who is online functionality, have a look 
at how they do it.


- Ben

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



Re: [PHP] Problems with strings being handled like numbers

2005-09-13 Thread Jasper Bryant-Greene

J B wrote:
I've been playing with it and it looks like mssql_fetch_row may be the 
problem. Right after this line:


$line = mssql_fetch_row($result);

 ...I inserted this line:

var_dump($line[0]);

...and this is what I got back:

string(20) 3.67124100206018e+17

The actual contents of that cell should be 367124100206018209. So it looks 
like the contents of the cell have already been mangled before they're even 
assigned to the array variables (which would explain why my previous 
attempts at typecasting at assignment time weren't having any effect...it 
was already a string). Is there some way I can tell mssql_fetch_row() to 
leave the contents alone?


By the way, if I do SELECT cast(Number as char) from Voucher... and leave 
the rest of it the same, I do get the whole number...but that seems kinda 
inelegant. Is this expected behaviour for mssql_fetch_row()?




What datatype is Number in the database? The behaviour you're getting is 
by design if it is any number type; for the behaviour you expect you 
will need to change it to a string type or do the cast as you detailed.


--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

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



[PHP] Re: .htaccess

2005-09-13 Thread David Robley
blackwater dev wrote:

 I am using .htaccess files throughout my code directory tree to set
 certain directives such as php_value auto_prepend_file
 ../lib/libmatrix.php
 
  The problem is, they don't work.
 
 I have this in apache:
 
 Directory usr/local/apache/htdocs/realtors/
 Options FollowSymLinks
 AllowOverride None
 /Directory
 
 Where realtors is the root directory of my site...how can I get it to
 work?
 
 Thanks!

I think you need to look again at the apache documentation, especially

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


Cheers
-- 
David Robley

On the other hand, you also have 5 fingers.

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



Re: [PHP] Quick Poll: PHP 4 / 5

2005-09-13 Thread Ben

Manuel Lemos wrote:

I guess this should ring a lot of bells for those that expect to develop 
products targetted to PHP 5, because the numbers seem to show that PHP 5 
is a flop, despite PHP 5.0.0 was released more than 1 year ago.


I think it points more to hosting providers who don't want to force 
their clients to ensure their sites are php5 compatible.  I'm sure if a 
client were to ask they would host them on a machine with php5, but if 
they are already on one with php4 they won't rock your boat.  Hosting 
providers, which account for the vast majority of hosted domains, are 
pretty conservative.


Personally, SimpleXML was all I needed to switch after a particularly 
frustrating bought with php4 and xml parsing.


- Ben

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



Re: [PHP] Quick Poll: PHP 4 / 5

2005-09-13 Thread Oliver Grätz
Always this stuff about breaking backward compatibility. People seem to
think that the change from 4 to 5 means such a lot. In fact the changes
from PHP4.0 to PHP4.4 are much more numerous. The backwarr incompatible
changes between 4 and 5 fit on asingle page of screen:

  http://de.php.net/manual/en/migration5.incompatible.php

And most of these changes don't affect the normal programmer.

I think the change from 4 to 5 ist that slow because there are so many
programmers with VisualBasic (or worse) background that don't see the
benefits of OOP. Iterators and delegation via interceptors are cool
concepts but to use them you have to learn how to use them. And before
you learn how to use them you have to understand what they're for and
why they're cool. And before that you have to know that such things even
exist. And with questions like How do I increment by more than one in a
for loop on the forum this isn't very likely to be the case for a
majority of the PHP community. It's a very big community with some
experts and a lot of total beginners. And a beginner likes to stick with
what works for him.

I guess we'll have to wait for the hosters to adopt PHP5 and then for
the next generation of PHP beginners. They will not know that there was
PHP4 when they begin to learn. For example, they will use PDO for
database access right from the start and intuitively use the iterator of
PDOStatement.

AllOLLi

When you can't fix the problem, point it out and pretend it was intentional.

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



Re: [PHP] Quick Poll: PHP 4 / 5

2005-09-13 Thread Oliver Grätz
Ben schrieb:
 [...] Hosting 
 providers, which account for the vast majority of hosted domains, are 
 pretty conservative.

In Germany they're no that conservative. One of the biggest hosters in
Germany (several million domains) allows to chosse between PHP 3, 4.0.6
4.3.x and 5.x via .htaccess

 Personally, SimpleXML was all I needed to switch after a particularly 
 frustrating bought with php4 and xml parsing.

SimpleXML is a good point. How could I forget it didn't exits with PHP4?


AllOLLi

Space: It seems to go on and on forever...
[Futurama 101]

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



Re: [PHP] Re: .htaccess

2005-09-13 Thread blackwater dev
Thanks David,

I just set it to AllowOverride All and restarted apache but it still
doesn't seem to work.

On 9/13/05, David Robley [EMAIL PROTECTED] wrote:
 blackwater dev wrote:
 
  I am using .htaccess files throughout my code directory tree to set
  certain directives such as php_value auto_prepend_file
  ../lib/libmatrix.php
 
   The problem is, they don't work.
 
  I have this in apache:
 
  Directory usr/local/apache/htdocs/realtors/
  Options FollowSymLinks
  AllowOverride None
  /Directory
 
  Where realtors is the root directory of my site...how can I get it to
  work?
 
  Thanks!
 
 I think you need to look again at the apache documentation, especially
 
 http://httpd.apache.org/docs/1.3/mod/core.html#allowoverride
 
 
 Cheers
 --
 David Robley
 
 On the other hand, you also have 5 fingers.
 
 --
 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] whats wrong in this program.

2005-09-13 Thread Jordan Miller
I think I finally understand what you are trying to do. I don't see  
any reason why you need to use the token functions, and I would  
recommend using array functions instead (also, it is exceedingly easy  
to sort the elements of an array... see the end).


I believe this will do what you are trying to do:
//Tokenizer for Babu
$str = '10,12,14-18';
$commas = explode(',', $str); // $commas will be an array of three  
items in this case


// Final Values will go into the $final array
$final = array();
foreach ($commas as $value) {
// If one of the $commas elements contains a dash, we need to  
get the range between them!

if (strstr($value, '-')) {
// Explode based on the dash. This code assumes there will  
only be a single dash

$rangeValues = explode('-', $value);
foreach (range($rangeValues[0], $rangeValues[1]) as $number) {
$final[] = $number;
}
} else {
// If $value does not contain a dash, add it directly to the  
$final array

$final[] = $value;
}
}
echo All your values in the range $str are .implode(' ', $final);
// Prints All your values in the range 10,12,14-18 are 10 12 14 15  
16 17 18



In your last email, you had some of the values given out of order:
1.  20,21-24
2. 21-24,20
3. 10,20,21-24,25,26,30

To make sure the $final values are always ascending, just do this at  
the end:

sort($final);

Done!!

Jordan




On Sep 13, 2005, at 7:16 PM, babu wrote:


$str=10,12,14-18;

$tok = strtok($str, ',');
while ($tok !== false) {
 $toks[] = $tok;
  $tok = strtok(',');
   }

foreach ($toks as $token){
 if (strpos($token,'-')){
  stringtokenize($token);
 }else{
  $finaltokens[]= $token;
  }
}

function stringtokenize($nstr){
 $ntok1= strtok($nstr,'-');
 $ntok2=strtok('-');
 for($i=$ntok1;$i=$ntok2;$i++){
  $finaltokens[]= $i;
  }
 }

foreach ($finaltokens as $ftoken){
 echo $ftoken;
 echo br /;
 }

the ouput prints only 10,12 but not 14,15,16,17,18. where is the  
problem.




-
To help you stay safe and secure online, we've developed the all  
new Yahoo! Security Centre.


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



RE: [PHP] trying to figure out the best/efficient way to tell whoislogged into a site..

2005-09-13 Thread bruce
ben...

your statements/approach is pretty much what i've been thinking of. however,
with regards to the forums/cms apps.. i've yet to find one that actually
keeps a track of the logged in users, that works when the user kills the
browser..

the ones that i've seen, that allow an admin to see who's online, appear to
fail when i've killed the test user. the apps still show the killed user as
being online...

hence my isuue!

-bruce


-Original Message-
From: Ben [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 13, 2005 6:33 PM
To: php-general@lists.php.net
Subject: Re: [PHP] trying to figure out the best/efficient way to tell
whoislogged into a site..


bruce wrote:

 my question is still how do i determine for a given session, that a user
is
 still on the site, or that the user is no longer on the site/system. i
don't
 see an automated/system way of doing this.

The web is stateless...  There is no automated/system way of doing this.
  You know the last time a user requested a file, that's it.  It's up to
you to determine what's a reasonable timeout between page requests so
that you can determine when someone has gone elsewhere.


 it appears that i might have to capture the session vars in a db, along
with
 the associated time creation. it then appears that i'm going to have to
have
 some way of continually updating the session 'time' to reflect that the
user
 is still on the system/site. this kind of approach could be done via some
 include file for every page that the user hits on the site. i could then
 trigger off this to determine who's live/on the site.

You can keep doing your session variables however you're currently doing
them, just store a timestamp for each user in a db or file and update it
every time the user requests a file.

Your script that tells you how many users are online can then check
against the db/file and count the timestamps less than $timeout seconds
old, which will be your users online.  The script should also do
garbage collection for any entries with timestamps older than your $timeout.

 the downside to this is that i could kill someone who might be on the
 system, but just not actively using the site.. maybe they stepped away...

So have $extended_timeout which is a ridiculously long time out period
during which users are marked as stale, but not deleted.  If they
request a file during the $extended_timeout you start counting them
again, if they don't then after the $extended_timeout they are deleted.

 now, if there was/is away to examine the session var that i store using
the
 session handler, such that i could determine which session var is still
 alaive.. then that would solve my issues

Not really... Sessions are no more or less likely to be accurate for
counting users on your site than what I've described above.  They too
time out after a period of time (set in php.ini) and are then subject to
garbage collection.  They hang around long after the user.


 however, as i've stated, i can't find any code sample/articles that get to
 this point..

 any code/thoughts/comments/etc...

Most forums have some type of who is online functionality, have a look
at how they do it.

- Ben

--
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] launch app

2005-09-13 Thread Ed Lazor
What's the best way to send an executable to a client desktop in PHP?
 
I'm doing a project where we need to check and see which files need to be 
updated on a client-desktop.  The idea is for a user to visit the website, an 
executable launches, checks the files on the drive, and then sends the data 
back to the website.
 
It's all on the up and up - I'm not trying to do anything bad to the user.  The 
site is designed to maintain a product that they're purchasing from us.  
Screens will explain what's going on.  I also believe the browser will display 
something - not completely sure how to trigger this, but I think it's something 
to do with having executables signed - I'd appreciate if you have any advice 
on how to do this also.
 
Thanks,
 
Ed
 


Re: [PHP] Re: .htaccess

2005-09-13 Thread David Robley
blackwater dev wrote:

 Thanks David,
 
 I just set it to AllowOverride All and restarted apache but it still
 doesn't seem to work.
 
 On 9/13/05, David Robley [EMAIL PROTECTED] wrote:
 blackwater dev wrote:
 
  I am using .htaccess files throughout my code directory tree to set
  certain directives such as php_value auto_prepend_file
  ../lib/libmatrix.php
 
   The problem is, they don't work.
 
  I have this in apache:
 
  Directory usr/local/apache/htdocs/realtors/
  Options FollowSymLinks
  AllowOverride None
  /Directory
 
  Where realtors is the root directory of my site...how can I get it to
  work?
 
  Thanks!
 
 I think you need to look again at the apache documentation, especially
 
 http://httpd.apache.org/docs/1.3/mod/core.html#allowoverride

Odd - works for me (just tried it). By not working, I assume you mean the
file is not being included, but you get no error. First, check that apache
is truly reading the .htaccess file by putting a syntax error in it - if it
is being read you should get a 500 Server error when you try to hit a page
in the directory where the .htaccess file is. 




Cheers
-- 
David Robley

When you're in love, you're at the mercy of a stranger.

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



[suspicious - maybe spam] [PHP] [suspicious - maybe spam] RE: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] RE: [PHP] Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam]Issueswit

2005-09-13 Thread Death Gauge
Sorry had to eat too.  Ok here is the source that is giving me problems. I'd 
dropped a few things from it cause they weren't working either but this 
gives the just of what I'm trying to do. I'm renaming the poster.php files 
to more appropriate names but you get the idea of what I'm trying but not 
getting to work.


?php include 'pselector.php'; ?
?php
// Poster (poster.php)
switch($id)
   {
 case 'npos':
   include 'news_poster.php';
   break;
 case 'wnpos':
   include 'wt_new_poster.php';
   break;
 default:
   require 'greetsel.php';
   }
?

pselector.php is :

?php
echo form method='post';
echo select name='id' onChange='submit(); return true';
echo option value='';
echo option value='npos'News Poster;
echo option value='wnpos'What's New Poster;
echo /select;
echo /form;
?




--Death Gauge
How do you gauge your death?!




Original Message Follows
From: Death Gauge [EMAIL PROTECTED]
To: php-general@lists.php.net
Subject: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] RE: [PHP] 
Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam]Issueswith News 
sites again...

Date: Wed, 14 Sep 2005 00:40:00 +

In night college courses right now. I'll supply full code and everything 
when I get home in about 2 hours or so. (Had to re-reply cause for some 
reason my mail client keeps putting the repliers email in the to box instead 
of PHP's mailing list url.


--Death Gauge
How do you gauge your death?!

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


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



[PHP] RE: Issues with News sites again...

2005-09-13 Thread Jasper Bryant-Greene
On Wed, September 14, 2005 3:15 pm, Death Gauge said:
 Sorry had to eat too.  Ok here is the source that is giving me problems.
 I'd
 dropped a few things from it cause they weren't working either but this
 gives the just of what I'm trying to do. I'm renaming the poster.php files
 to more appropriate names but you get the idea of what I'm trying but not
 getting to work.

 ?php include 'pselector.php'; ?
 ?php
   // Poster (poster.php)
   switch($id)

Unless you have register_globals on, which you shouldn't, this should be
switch($_POST['id'])

--
Jasper Bryant-Greene

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



Re: [PHP] DOM XML compatible PHP4 PHP5

2005-09-13 Thread Stephen Leaf
On Monday 12 September 2005 02:08 pm, Florent Monnier wrote:
 Hi,

 Is there a way to make dom xml applications compatible PHP4 and PHP5?

 Thanks

You can use the PHP_VERSION predefined constant or the function_exists(string)

http://us2.php.net/manual/en/function.function-exists.php

What I did was created a Document Object. right now it only works with PHP5
I might add PHP4 support to it later tho when I have more time using this 
approach unless anyone can think of a better idea.

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



Re: [PHP] Quick Poll: PHP 4 / 5

2005-09-13 Thread Manuel Lemos

Hello,

on 09/13/2005 10:39 PM Ben said the following:
I guess this should ring a lot of bells for those that expect to 
develop products targetted to PHP 5, because the numbers seem to show 
that PHP 5 is a flop, despite PHP 5.0.0 was released more than 1 year 
ago.


I think it points more to hosting providers who don't want to force 
their clients to ensure their sites are php5 compatible.  I'm sure if a 
client were to ask they would host them on a machine with php5, but if 
they are already on one with php4 they won't rock your boat.  Hosting 
providers, which account for the vast majority of hosted domains, are 
pretty conservative.


Right, but the problem all boils down to one matter: money! What happens 
is that many hosts have hundreds (to not say thousands) of clients 
hosted per server. If they upgrade the PHP version, chances are that 
they may break the applications of many clients. Displeased clients 
leave and they loose business.


Therefore hosts are absolutely right in not messing with the servers of 
the customers that are pleased with their current setup, or else it will 
hurt their pockets big time!


OTOH clients that have their sites working fine and dandy with current 
PHP version have no reason to change, unless what they may gain can 
justify the headache of asking to switch to a server with the PHP 
version of their choice or switch to another host that provides it.


It seems that PHP 5 is not that much compelling to most people to 
justify the change.


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

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



Re: [PHP] Quick Poll: PHP 4 / 5

2005-09-13 Thread Manuel Lemos

Hello,

on 09/13/2005 10:46 PM Oliver Grätz said the following:

Always this stuff about breaking backward compatibility. People seem to
think that the change from 4 to 5 means such a lot. In fact the changes
from PHP4.0 to PHP4.4 are much more numerous. The backwarr incompatible
changes between 4 and 5 fit on asingle page of screen:

  http://de.php.net/manual/en/migration5.incompatible.php

And most of these changes don't affect the normal programmer.


In theory those are the only changes. In practice, besides the 
officially admitted changes, there are also the bugs that were not yet 
discovered or fixed.




I think the change from 4 to 5 ist that slow because there are so many
programmers with VisualBasic (or worse) background that don't see the
benefits of OOP. Iterators and delegation via interceptors are cool


!?!? You can do OOP since PHP 3. PHP 5 OOP improvements are nice but 
they will not make anybody richer .


I do not think the problem is PHP 4 vs. 5, but rather upgrading to a 
new version a deal with known and unknown changes vs. not upgrading 
and keep sites working as before.




It's a very big community with some
experts and a lot of total beginners. And a beginner likes to stick with
what works for him.


I do not think this is a beginners problem. As a matter of fact 
begginners are more likely to naively jump to newer versions just to 
ride on the top of the latest wave. More experience developers are the 
ones that tend to be wiser not delay upgrades because they know that 
new versions have new bugs.


As a matter of fact I just read this interesting article named The Six 
Dumbest Ideas in Computer Security that demonstrates what I always knew 
that upgrading to the latest versions is often a bad idea. Read the 
point #6) Action is Better Than Inaction .


http://www.ranum.com/security/computer_security/editorials/dumb/


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

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



Re: [PHP] Quick Poll: PHP 4 / 5

2005-09-13 Thread Ed Lazor

It seems that PHP 5 is not that much compelling to most people to 
justify the change.

 

I'm sure you're right, but I also think it's a question of work load for the 
ISP.  Many server upgrades don't occur unless it's urgent and even then they 
sometimes get missed.

Plus... the last time I went to lease a server, the ISP told me that RedHat 
didn't come with PHP 5.  Installing PHP 5 was at my own risk.  Maybe PHP 5 is 
now bundled with the latest version of PHP, but I know it wasn't for a while 
and I also know that this hampered PHP 5 getting out there.

Is it possible to install both PHP 4 and PHP 5 on a single web server, have 
scripts all use the php extension, and somehow specify in the script itself 
which version of PHP should be used?

-Ed

 


[suspicious - maybe spam] [PHP] [suspicious - maybe spam] RE: [PHP] RE: Issues with News sites again...

2005-09-13 Thread Death Gauge
I'll try that...But why shouldn't I have register_globals on (which my ISP 
does and every tutorial I've ever read says to do in order to use several 
different features of PHP:-/).



--Death Gauge
How do you gauge your death?!




Original Message Follows
From: Jasper Bryant-Greene [EMAIL PROTECTED]
To: php-general@lists.php.net
Subject: [PHP] RE: Issues with News sites again...
Date: Wed, 14 Sep 2005 15:21:43 +1200 (NZST)

On Wed, September 14, 2005 3:15 pm, Death Gauge said:
 Sorry had to eat too.  Ok here is the source that is giving me problems.
 I'd
 dropped a few things from it cause they weren't working either but this
 gives the just of what I'm trying to do. I'm renaming the poster.php 
files

 to more appropriate names but you get the idea of what I'm trying but not
 getting to work.

 ?php include 'pselector.php'; ?
 ?php
// Poster (poster.php)
switch($id)

Unless you have register_globals on, which you shouldn't, this should be
switch($_POST['id'])

--
Jasper Bryant-Greene

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

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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



  1   2   >