php-general Digest 13 Sep 2005 17:27:51 -0000 Issue 3680

Topics (messages 222244 through 222271):

Re: xml parse engine written in php
        222244 by: Jasper Bryant-Greene

PHP 5, LDAP/Active Directory
        222245 by: Joe Wollard
        222254 by: Mark Rees
        222267 by: Joe Wollard

Re: can't connect to mysql
        222246 by: Gustav Wiberg
        222248 by: viraj

Re: Best way to mass mail
        222247 by: Joshua May

Re: Problem w/ reading a txt file.
        222249 by: David Robley
        222250 by: Burhan Khalid
        222266 by: sub.pudlz.com

[from internals] Re: ref fix revisited
        222251 by: Jochem Maas
        222252 by: Jasper Bryant-Greene

Re: PHP - LDAPS query
        222253 by: Vedanta Barooah

Re: [please ignore!] Re: [PHP] [from internals] Re: ref fix revisited
        222255 by: Jasper Bryant-Greene
        222256 by: Jochem Maas

CBL Partial Updater Released!
        222257 by: Kazuho Oku
        222259 by: Kazuho Oku

Re: STDERR not opened with php 5.0.5
        222258 by: Edin Kadribasic

Re: mktime
        222260 by: Ford, Mike

Re: incrementing in a for loop
        222261 by: Burhan Khalid

ADODB vs PHP extension
        222262 by: Dean Maunder
        222264 by: Jens Schulze

Re: Problem with PEAR:SOAP [solved]
        222263 by: -k.

Re: session.gc_maxlifetime
        222265 by: Gustav Wiberg

Modifying data in forms with values
        222268 by: Robert Sossomon
        222271 by: Murray . PlanetThoughtful

Accessing images in a protected directory
        222269 by: Brian
        222270 by: M. Sokolewicz

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


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

Will wrote:

Free for the taking, here's a simple, lenient (flawed?) xml parse engine written in php if anyone is interested in expanding such a thing.

http://fribbler.us/code/


Not to put down your efforts or anything, but what's wrong with SimpleXML, DOM XML, XML Reader, XML Parser etc. all of which are native PHP functions?

I don't know, I've not looked at them. Does offering another implementation of a concept imply that there is something wrong with existing implementations? If that is the case, I wouldn't have bothered sharing since I don't want to offend anyone. It was just a learning exercise.


No, of course the offering of a new implementation does not imply there is something wrong with the existing ones. However, re-inventing the wheel is an expensive exercise unless there is something wrong with the existing implementations.

I hope that you don't take this the wrong way; I was merely pointing out that someone else has already done this.

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

--- End Message ---
--- Begin Message ---
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=30670&edit=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

--- End Message ---
--- Begin Message ---
> 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=30670&edit=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.

--- End Message ---
--- Begin Message ---
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=30670&edit=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!

--- End Message ---
--- Begin Message ---
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: <[email protected]>
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

--- End Message ---
--- Begin Message ---
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: <[email protected]>
> 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
> 
>

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


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

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

--- End Message ---
--- Begin Message ---
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: <[email protected]>
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
>
>

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


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

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

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


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

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

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

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

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

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

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

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

Jens

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

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

----- Original Message ----- From: "Shaw, Chris - Accenture" <[EMAIL PROTECTED]> To: "Gustav Wiberg" <[EMAIL PROTECTED]>; "PHP General" <[email protected]>
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/

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

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

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

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

--- End Message ---

Reply via email to