php-general Digest 27 Oct 2005 17:26:18 -0000 Issue 3761

Topics (messages 224707 through 224730):

Re: zipped files
        224707 by: Clive
        224709 by: Clive
        224723 by: James Lobley
        224725 by: Clive
        224727 by: Clive

Re: Perl style
        224708 by: Søren Schimkat

Re: regex and global vars problem
        224710 by: Richard Heyes
        224711 by: Jochem Maas
        224712 by: Richard Heyes
        224713 by: Jasper Bryant-Greene

Problem upgrading from 5.0.2 and 5.05
        224714 by: Karlos Zafra

Detailed Report
        224715 by: Danny
        224716 by: Adrian Bruce
        224717 by: Danny
        224718 by: Adrian Bruce
        224719 by: tomasz abramowicz
        224720 by: Danny

Sending E-Mail - Setting O/S User
        224721 by: Cabbar Duzayak

compiling php5 on winxp
        224722 by: Luka

Re: php session variables limited to 1 character -- please help
        224724 by: Oliver Grätz

php / openLdap
        224726 by: Poil
        224728 by: Björn Bartels

Using PHP for accsess control, preventing access to static files
        224729 by: Dan Trainor
        224730 by: Jason Motes

Administrivia:

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

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

To post to the list, e-mail:
        php-general@lists.php.net


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

I found that class but could not get it to work. Well it seem to work, as I could view the files information, but the extract() didn't do anything. I checked the writes for the directory the zip file was in and it did have wright rights. Maybe you can post a code snippet.

thanks

clive

James Lobley wrote:
This is the class I use:
http://www.phpconcept.net/pclzip/man/en/index.php


 On 10/26/05, Clive <[EMAIL PROTECTED]> wrote:

Hi

does any one have code/examples for unzipping a file thats been uploaded
to a server. I would prefer a class rather than something that uses
zip.lib as it may not be configured on the server.

clive

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





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


Richard Lynch wrote:
On Wed, October 26, 2005 5:44 am, Clive wrote:

does any one have code/examples for unzipping a file thats been
uploaded
to a server. I would prefer a class rather than something that uses
zip.lib as it may not be configured on the server.


$path = "/full/path/to/uploaded/file.zip";
exec("/full/path/to/bin/unzip $path", $output, $error);
if ($error){
  die("OS Error: $error<br />\n" . nl2br($output));
}
$unzipped = str_replace(".zip", '', $path);
$file = file_get_contents($unzipped);


Is the unzip command standerd on linux systems?

What happens if the app is run on a windows machine. I Suppose I will have to include support for pkunzip or whatever its called nowadays.

clive

--- End Message ---
--- Begin Message ---
These are the relevant sections from my code:

include("e:/bin/pclzip.php");
$provpath_dec = 'E:/Prov/Processed_Files/';
$provpath_unzip = 'E:/data/prov/';

$filename = '20051026202333.zip';

$archive = new PclZip($provpath_dec . $filename);
$archive->extract(PCLZIP_OPT_PATH, $provpath_unzip);

 As you'd probably guess from the paths shown, this is running on a windoze
box.
 James

 On 10/27/05, Clive <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I found that class but could not get it to work. Well it seem to work,
> as I could view the files information, but the extract() didn't do
> anything. I checked the writes for the directory the zip file was in and
> it did have wright rights. Maybe you can post a code snippet.
>
> thanks
>
> clive
>
> James Lobley wrote:
> > This is the class I use:
> > http://www.phpconcept.net/pclzip/man/en/index.php
> >
> >
> > On 10/26/05, Clive <[EMAIL PROTECTED]> wrote:
> >
> >>Hi
> >>
> >>does any one have code/examples for unzipping a file thats been uploaded
> >>to a server. I would prefer a class rather than something that uses
> >>zip.lib as it may not be configured on the server.
> >>
> >>clive
> >>
> >>--
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

Im going to give it a try.

clive

James Lobley wrote:
These are the relevant sections from my code:

include("e:/bin/pclzip.php");
$provpath_dec = 'E:/Prov/Processed_Files/';
$provpath_unzip = 'E:/data/prov/';

$filename = '20051026202333.zip';

$archive = new PclZip($provpath_dec . $filename);
$archive->extract(PCLZIP_OPT_PATH, $provpath_unzip);

 As you'd probably guess from the paths shown, this is running on a windoze
box.
 James

 On 10/27/05, Clive <[EMAIL PROTECTED]> wrote:

Hi,

I found that class but could not get it to work. Well it seem to work,
as I could view the files information, but the extract() didn't do
anything. I checked the writes for the directory the zip file was in and
it did have wright rights. Maybe you can post a code snippet.

thanks

clive

James Lobley wrote:

This is the class I use:
http://www.phpconcept.net/pclzip/man/en/index.php


On 10/26/05, Clive <[EMAIL PROTECTED]> wrote:


Hi

does any one have code/examples for unzipping a file thats been uploaded
to a server. I would prefer a class rather than something that uses
zip.lib as it may not be configured on the server.

clive

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




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





--- End Message ---
--- Begin Message ---
Thanks its working

clive

James Lobley wrote:
These are the relevant sections from my code:
include("e:/bin/pclzip.php");
$provpath_dec = 'E:/Prov/Processed_Files/';
$provpath_unzip = 'E:/data/prov/';

$filename = '20051026202333.zip';

$archive = new PclZip($provpath_dec . $filename);
$archive->extract(PCLZIP_OPT_PATH, $provpath_unzip);


As you'd probably guess from the paths shown, this is running on a windoze box. James

On 10/27/05, *Clive* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Hi,

    I found that class but could not get it to work. Well it seem to work,
    as I could view the files information, but the extract() didn't do
    anything. I checked the writes for the directory the zip file was in and
    it did have wright rights. Maybe you can post a code snippet.

    thanks

    clive

    James Lobley wrote:
     > This is the class I use:
     > http://www.phpconcept.net/pclzip/man/en/index.php
     >
     >
     >  On 10/26/05, Clive <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>> wrote:
     >
     >>Hi
     >>
     >>does any one have code/examples for unzipping a file thats been
    uploaded
     >>to a server. I would prefer a class rather than something that uses
     >> zip.lib as it may not be configured on the server.
     >>
     >>clive
     >>
     >>--
     >>PHP General Mailing List (http://www.php.net/)
     >>To unsubscribe, visit: http://www.php.net/unsub.php
     >>
     >>
     >
     >

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



--

--- End Message ---
--- Begin Message ---
Quoting rouvas <[EMAIL PROTECTED]>:

> Simpler(?) approach:
>
> $element5 = current(array_splice(split(',',$csvstring),5,1));
>
> This is fun!


Indeed... and this looks just fine. A great solution. Thanks. :-)


-Søren


>
> -Stathis
>
> On Wednesday 26 October 2005 17:08, Jochem Maas wrote:
> > Søren Schimkat wrote:
> > > Hi guys
> > >
> > > I would like to convert this ..
> > >
> > >
> > > $tmparray = split(',', $csvstring);
> >
> > don't use split() here - there is no need for regexp.
> > use explode() instead.
> >
> > > $element5 = $tmparray[5];
> > >
> > >
> > > . to something like this:
> > >
> > >
> > > $element5 = (split(',', $csvstring))[5];
> >
> > $csvstring = "1,2,3,4,5,6";
> > echo "route "; // humor me
> > echo $element5 = current(array_reverse(array_slice(explode(",",
> > $csvstring), 0, 6))); echo $element5 = end(array_slice(explode(",",
> > $csvstring), 0, 6));
> >
> > not as short as perl - unfortunately there is no valid
> > syntax that allows dereferenced access to array elements (AFAIK).
> >
> > > . but I just can't find the correct syntax. It is Perl style - i know,
> > > but I just love this syntax. :-)
> > >
> > > Does anyonw know the correct syntax?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
mvh Søren Schimkat
www.schimkat.dk

---------------------------------------
www.dyrenes-venner.dk/densorteliste.asp

--- End Message ---
--- Begin Message ---
Jochem Maas wrote:
> gonna jump on your thread there Jasper, I would
> like to comment on your function and ask you a question:
>
> which is 'better' (for what), preg_*() or ereg[i]*()?

preg_*, for anything. They're faster, and more versatile.

--
Richard Heyes
http://www.phpguru.org

--- End Message ---
--- Begin Message ---
Richard Heyes wrote:
Jochem Maas wrote:
 > gonna jump on your thread there Jasper, I would
 > like to comment on your function and ask you a question:
 >
 > which is 'better' (for what), preg_*() or ereg[i]*()?

preg_*, for anything. They're faster, and more versatile.

cool cheers.

I guess your the same Richard Heyes of 'TreeMenu' class 'fame'?
still use that very often :-)



--- End Message ---
--- Begin Message ---
Jochem Maas wrote:
Richard Heyes wrote:

Jochem Maas wrote:
 > gonna jump on your thread there Jasper, I would
 > like to comment on your function and ask you a question:
 >
 > which is 'better' (for what), preg_*() or ereg[i]*()?

preg_*, for anything. They're faster, and more versatile.


cool cheers.

I guess your the same Richard Heyes of 'TreeMenu' class 'fame'?
still use that very often :-)

Dunno about "fame", some would say "Infamy", but yes, the very same.

--
Richard Heyes
http://www.phpguru.org

--- End Message ---
--- Begin Message ---
On Thu, 2005-10-27 at 00:00 +0200, Jochem Maas wrote:
> gonna jump on your thread there Jasper, I would
> like to comment on your function and ask you a question:
> 
> which is 'better' (for what), preg_*() or ereg[i]*()?

I prefer preg_*(), but I used eregi() because I couldn't be bothered
figuring out his regexp (it looked right, and it worked) and that's what
he used :)

It's a matter of personal taste, mainly.

[snip]
> > <?php
> > function fix_mac( $mac ) {
> > 
> >     if( eregi(
> > 
> >             "^[0-9A-Fa-f]{2}\-" .
> >             "[0-9A-Fa-f]{2}\-" .
> >             "[0-9A-Fa-f]{2}\-" .
> >             "[0-9A-Fa-f]{2}\-" .
> >             "[0-9A-Fa-f]{2}\-" .
> >             "[0-9A-Fa-f]{2}$",
> 
> this string concatenation looks a bit naff.
> although on second thoughts I can see why you did it this way.
> down to personal choice :-).

I don't like it either, but that bit already worked, so I left it
functionally as-is, and I had to make it shorter so as to not wrap
stupidly in the email.

> the use of double quotes means strictly speaking
> you should be escaping the backslash and dollar sign (and the
> parentheseses?) although i would recommend single quotes.

Agreed.

> I would have used preg_match(), something like
[snip]

So would I, if I had been writing the function from scratch.

> white space is nice but too many blank lines lead to overscroll ;-)

Another matter of personal taste. I love whitespace and my scroll wheel
has its acceleration turned up very high, so scrolling doesn't really
bother me :)

-- 
Jasper Bryant-Greene
General Manager
Album Limited

e: [EMAIL PROTECTED]
w: http://www.album.co.nz/
b: http://jbg.name/
p: 0800 4 ALBUM (0800 425 286) or +64 21 232 3303
a: PO Box 579, Christchurch 8015, New Zealand

--- End Message ---
--- Begin Message ---
My system was runig apache 2.0.52+php5.0.2 under Windows Xp without any
problem. Today i've decided to upgrade to 5.0.5 but after unzipping the
files in the C:\php folder where it was installed de .0.2 version Apache
complained about not finding "php5apache2.dll".

The message from the command line:

Syntax error on line 179 of C:/'...'/Apache2/conf/httpd.conf: Cannot load
C:/PHP/php5apache2.dll into server: Especified process not found.

--- End Message ---
--- Begin Message ---
Hi All,
 I´ve got a connection, to a MySQL db, and get the following
ResultSet(Category | Name | Code | City)
 Customers | John | A36 | New York
Customers | Jason | B45 | Los Angeles
Customers | Max | A36 | Paris
Providers | John | A36 | London
Providers | Mark | B67 | Madrid
And I need the report in the following format:
 Customers
John - A36 - New York
Jason - B45 - Los Angeles
Max - A36 - Paris
 Providers
John - A36 - London
Mark - B67 - Madrid
 Any one can help? I´m a bit stalled
 thx
regards.
--

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

load each row of the resultset into an array $row using mysql_fetch_array(), each field in the result set row will be held in the corresponding array element.

while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){
   echo"$row[0] | $row[1] | $row[2]";
}

Hope this helps,
Ade

Danny wrote:

Hi All,
I´ve got a connection, to a MySQL db, and get the following
ResultSet(Category | Name | Code | City)
Customers | John | A36 | New York
Customers | Jason | B45 | Los Angeles
Customers | Max | A36 | Paris
Providers | John | A36 | London
Providers | Mark | B67 | Madrid
And I need the report in the following format:
Customers
John - A36 - New York
Jason - B45 - Los Angeles
Max - A36 - Paris
Providers
John - A36 - London
Mark - B67 - Madrid
Any one can help? I´m a bit stalled
thx
regards.
--


--- End Message ---
--- Begin Message ---
Thanks for your help Adrian, but the problem is that I need to show row[0]
once (Customers text are repeated), and below the details of the records
 Your solution shows:
 Customers | John | A36 | New York
Customers | Jason | B45 | Los Angeles
(...)
And I need
Customers<BR>
John | A36 | New York
Jason | B45 | Los Angeles
 (...)
   (...)


 On 10/27/05, Adrian Bruce <[EMAIL PROTECTED]> wrote:
>
>
> load each row of the resultset into an array $row using
> mysql_fetch_array(), each field in the result set row will be held in
> the corresponding array element.
>
> while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){
> echo"$row[0] | $row[1] | $row[2]";
> }
>
> Hope this helps,
> Ade
>
> Danny wrote:
>
> >Hi All,
> > I´ve got a connection, to a MySQL db, and get the following
> >ResultSet(Category | Name | Code | City)
> > Customers | John | A36 | New York
> >Customers | Jason | B45 | Los Angeles
> >Customers | Max | A36 | Paris
> >Providers | John | A36 | London
> >Providers | Mark | B67 | Madrid
> >And I need the report in the following format:
> > Customers
> >John - A36 - New York
> >Jason - B45 - Los Angeles
> >Max - A36 - Paris
> > Providers
> >John - A36 - London
> >Mark - B67 - Madrid
> > Any one can help? I´m a bit stalled
> > thx
> >regards.
> >--
> >
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
dpc

--- End Message ---
--- Begin Message --- ok, so i assume that customers is a grouping of some sort and that in some cases you may come accross a row like "Staff | John | A36 |LA ". It may not be a perfect way of doinig it but this is what i would generally try:

  while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){
       if($row[0] == $group){
echo" $row[1] | $row[2]"; }
      else{
         echo"$row[0]<br/><br/>$row[1] | $row[2] | $row[3]";
      }
   $group = $row[0];
}

Ade

Danny wrote:

Thanks for your help Adrian, but the problem is that I need to show row[0] once (Customers text are repeated), and below the details of the records Your solution shows: Customers | John | A36 | New York
Customers | Jason | B45 | Los Angeles
(...)
And I need
Customers<BR>
John | A36 | New York
Jason | B45 | Los Angeles
(...) (...)

On 10/27/05, *Adrian Bruce* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:


    load each row of the resultset into an array $row using
    mysql_fetch_array(), each field in the result set  row will  be
    held in
    the corresponding array element.

    while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){
       echo"$row[0] | $row[1] | $row[2]";
    }

    Hope this helps,
    Ade

    Danny wrote:

    >Hi All,
    > I´ve got a connection, to a MySQL db, and get the following
    >ResultSet(Category | Name | Code | City)
    > Customers | John | A36 | New York
    >Customers | Jason | B45 | Los Angeles
    >Customers | Max | A36 | Paris
    >Providers | John | A36 | London
    >Providers | Mark | B67 | Madrid
    >And I need the report in the following format:
    > Customers
    >John - A36 - New York
    >Jason - B45 - Los Angeles
    >Max - A36 - Paris
    > Providers
    >John - A36 - London
    >Mark - B67 - Madrid
    > Any one can help? I´m a bit stalled
    > thx
    >regards.
    >--
    >
    >
    >

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




--
dpc

--- End Message ---
--- Begin Message ---
if your db is built correctly you could use
UNION or JOIN(S) to build the correct query.
otherwise look into DISTINCT(ROW) and/or creating
temporary tables.
formatting the info later is, as adrian illustrated,
up to you.

t.

ps. all the above depends on your mysql server version and
configuration.

Danny wrote:
Thanks for your help Adrian, but the problem is that I need to show row[0]
once (Customers text are repeated), and below the details of the records
 Your solution shows:
 Customers | John | A36 | New York
Customers | Jason | B45 | Los Angeles
(...)
And I need
Customers<BR>
John | A36 | New York
Jason | B45 | Los Angeles
 (...)
   (...)


 On 10/27/05, Adrian Bruce <[EMAIL PROTECTED]> wrote:


load each row of the resultset into an array $row using
mysql_fetch_array(), each field in the result set row will be held in
the corresponding array element.

while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){
echo"$row[0] | $row[1] | $row[2]";
}

Hope this helps,
Ade

Danny wrote:


Hi All,
I´ve got a connection, to a MySQL db, and get the following
ResultSet(Category | Name | Code | City)
Customers | John | A36 | New York
Customers | Jason | B45 | Los Angeles
Customers | Max | A36 | Paris
Providers | John | A36 | London
Providers | Mark | B67 | Madrid
And I need the report in the following format:
Customers
John - A36 - New York
Jason - B45 - Los Angeles
Max - A36 - Paris
Providers
John - A36 - London
Mark - B67 - Madrid
Any one can help? I´m a bit stalled
thx
regards.
--




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





--
dpc


--- End Message ---
--- Begin Message ---
Thank you very much
I think it will work, because my problem seems to be with "if" operators and
order...
 Thanks again

 On 10/27/05, Adrian Bruce <[EMAIL PROTECTED]> wrote:
>
> ok, so i assume that customers is a grouping of some sort and that in
> some cases you may come accross a row like "Staff | John | A36 |LA ".
> It may not be a perfect way of doinig it but this is what i would
> generally try:
>
> while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){
> if($row[0] == $group){
> echo" $row[1] | $row[2]";
> }
> else{
> echo"$row[0]<br/><br/>$row[1] | $row[2] | $row[3]";
> }
> $group = $row[0];
> }
>
> Ade
>
> Danny wrote:
>
> > Thanks for your help Adrian, but the problem is that I need to show
> > row[0] once (Customers text are repeated), and below the details of
> > the records
> >
> > Your solution shows:
> >
> > Customers | John | A36 | New York
> > Customers | Jason | B45 | Los Angeles
> > (...)
> > And I need
> > Customers<BR>
> > John | A36 | New York
> > Jason | B45 | Los Angeles
> >
> > (...)
> >
> >
> >
> > (...)
> >
> >
> >
> >
> >
> >
> > On 10/27/05, *Adrian Bruce* <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> >
> > load each row of the resultset into an array $row using
> > mysql_fetch_array(), each field in the result set row will be
> > held in
> > the corresponding array element.
> >
> > while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){
> > echo"$row[0] | $row[1] | $row[2]";
> > }
> >
> > Hope this helps,
> > Ade
> >
> > Danny wrote:
> >
> > >Hi All,
> > > I´ve got a connection, to a MySQL db, and get the following
> > >ResultSet(Category | Name | Code | City)
> > > Customers | John | A36 | New York
> > >Customers | Jason | B45 | Los Angeles
> > >Customers | Max | A36 | Paris
> > >Providers | John | A36 | London
> > >Providers | Mark | B67 | Madrid
> > >And I need the report in the following format:
> > > Customers
> > >John - A36 - New York
> > >Jason - B45 - Los Angeles
> > >Max - A36 - Paris
> > > Providers
> > >John - A36 - London
> > >Mark - B67 - Madrid
> > > Any one can help? I´m a bit stalled
> > > thx
> > >regards.
> > >--
> > >
> > >
> > >
> >
> > --
> > PHP General Mailing List ( http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> >
> > --
> > dpc
>
>


--
dpc

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

When someone sends an e-mail using php, exim sets the following 2
headers (along with others of course):

Received:        from x.x.x.x (EHLO host.mydomain.com) (x.x.x.x) by
mta151.mail.dcn.yahoo.com with SMTP; Wed, 24 Sep 2005 10:29:04 -0700

Received:       from <O/S User> by host.mydomain.com with local (Exim 4.52)
id 3ABiAO-00019o-KL for [EMAIL PROTECTED]; Thu, 27 Oct 2005 13:29:03
+0300

Here, the <O/S User> is picked up from the operation system, and it is
the user that owns the process, which is the process that initiates
sending out this e-mail.

Is there a way to specify a certain user instead of the owner of the
current process, or is there a way to configure exim such that, it
won't pick up the owner of that process for this header, but a
specific user that I explicitly specify through configuration?

Thanks...

--- End Message ---
--- Begin Message ---
I'm using VC6++ and the VC2003 Toolkit

I downloaded a dev tree from:

http://ftp.emini.dk/pub/php/win32/dev/php_build/

the compile keeps failing with:

 Creating library Release_TS\php5ts.lib and object Release_TS\php5ts.exp

sunfuncs.obj : error LNK2001: unresolved external symbol __ftol2

uuencode.obj : error LNK2001: unresolved external symbol __ftol2



now the only post about this that i could find was this being related to the toolkit



and that this could shoult be added to the beginning of a number of your C++ files:



#if (_MSC_VER >= 1300) && (WINVER < 0x0500)
//VC7 or later, building with pre-VC7 runtime libraries
extern "C" long _ftol( double ); //defined by VC6 C libs
extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
#endif</scode>

the other post said that adding CFLAGS=/QIfist

does anyone know to do any of the following
or fix the above problem.
the basic compilation faq under windows just isn't...helping me a lot.
So if anyone has a link with perhaps a downloadable sourcetree with the needed headers and libraries
to compile the php5 and php4 branch do help :)

well any help on the above problem would be greatly appreciated.
#endif</scode>






--- End Message ---
--- Begin Message ---
Zac Smith schrieb:
> http://www.triptrivia.com/step2-debug.php?State=abc

404

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

I have a problem with ldap function :/

Here is my ldap :
-    dc=arzur,dc=local
   -     ou=Annuaire
       +     cn=Benjamin DUPUIS
       +     cn=Emeric GIRARD
       +     cn=Fabrice DEPIL
       +     cn=Fabrice GAUSSEN
       +     cn=Jérôme LE MANSEC
       +     cn=Olivier MATHE
       +     cn=Sylvain BOUBOUNELLE

Here is a LDIF file, (export of phpldapadmin) :*
*dn:cn=Benjamin1 DUPUIS1,ou=Annuaire,dc=arzur,dc=local
cn: Benjamin1 DUPUIS1
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: mozillaAbPersonObsolete
sn: DUPUIS

/***************************************************************/
My connection/search work fine
$ds = @ldap_connect("localhost");
@ldap_set_option( $ds, LDAP_OPT_PROTOCOL_VERSION, 3 );
@ldap_set_option( $ds, LDAP_OPT_REFERRALS, 0);

if ($ds) {
   $r=ldap_bind($ds,"cn=Manager,dc=arzur,dc=local","toto");
   $sr=ldap_search($ds,"ou=Exterieur,dc=arzur,dc=local", "mail=*");
   $info = ldap_get_entries($ds, $sr);

   echo '<table><tr><td>Nom Prénom</td><td>Mail</td></tr>';
   for ($i=0; $i<$info["count"]; $i++) {
       echo '<tr>';
       echo '<td>' . $info[$i]["cn"][0] . '</td>';
       echo '<td>' . $info[$i]["mail"][0] . '</td';
   }
   ldap_close($ds);
} else {
   echo '<h4>Impossible de se connecter au serveur LDAP.</h4>';
}
/***************************************************************/
But ldap_add not working with error Warning: ldap_add(): Add: Undefined attribute type in /srv/www/htdocs/gestioninterne/CLDAP.php on line 70

Here's the code :
if ( (isset ($_POST['envoi']) ) && ($_POST['envoi']=="ok")) {
   $ds = ldap_connect("localhost");
   ldap_set_option( $ds, LDAP_OPT_PROTOCOL_VERSION, 3 );
   ldap_set_option( $ds, LDAP_OPT_REFERRALS, 0);
   $r=ldap_bind($ds,"cn=Manager,dc=arzur,dc=local","toto");

$cn=$_POST['givenName'].' '.$_POST['sn']; $info["cn"]="$cn"; // Prenom NOM
   $info["objectClass"][0]="mozillaAbPersonObselete";
   /*$info["objectClass"][0]="top";
   $info["objectClass"][1]="person";
   $info["objectClass"][2]="organizationalPerson";
   $info["objectClass"][3]="inetOrgPerson";
   $info["objectClass"][4]="mozillaAbPersonObselete";*/
   $info["sn"]=$_POST['sn']; // Nom

   $cn.=",ou=Exterieur,dc=arzur,dc=local";
   $cnFinal="cn=".$cn;
echo $cnFinal,'<br>$info[objectClass]',$info["objectClass"],'<br>$info[sn]=',$info["sn"],'<br>$info[cn]=',$info["cn"];
   $r=ldap_add($ds,$cnFinal,$info);
   ldap_close($ds);
}

/*****************************************************************/
Here's the result of my echo :
cn=Benjamin BOUBOUNELLE,ou=Exterieur,dc=arzur,dc=local
$info[objectClass]Array
$info[sn]=BOUBOUNELLE
$info[cn]=Benjamin BOUBOUNELLE
*Warning*: ldap_add(): Add: Undefined attribute type in */srv/www/htdocs/gestioninterne/CLDAP.php* on line *70

*/*****************************************************************/

Anyone can help me, I'm on since 10 hours :(

Regards

--- End Message ---
--- Begin Message ---
Hello !

ldap_add is expecting an ARRAY OF STRINGS (according to LDAP-specs) as
third parameter.
but your $info["objectclass"] is an array itself... maybe you try to
implode it into one string...

cheers, hope that helps...

bb

>Hello all,
>
>I have a problem with ldap function :/
>
>Here is my ldap :
>- dc=arzur,dc=local
>- ou=Annuaire
>+ cn=Benjamin DUPUIS
>+ cn=Emeric GIRARD
>+ cn=Fabrice DEPIL
>+ cn=Fabrice GAUSSEN
>+ cn=Jérôme LE MANSEC
>+ cn=Olivier MATHE
>+ cn=Sylvain BOUBOUNELLE
>
>Here is a LDIF file, (export of phpldapadmin) :*
>*dn:cn=Benjamin1 DUPUIS1,ou=Annuaire,dc=arzur,dc=local
>cn: Benjamin1 DUPUIS1
>objectClass: top
>objectClass: person
>objectClass: organizationalPerson
>objectClass: inetOrgPerson
>objectClass: mozillaAbPersonObsolete
>sn: DUPUIS
>
>/***************************************************************/
>My connection/search work fine
>$ds = @ldap_connect("localhost");
>@ldap_set_option( $ds, LDAP_OPT_PROTOCOL_VERSION, 3 );
>@ldap_set_option( $ds, LDAP_OPT_REFERRALS, 0);
>
>if ($ds) {
>$r=ldap_bind($ds,"cn=Manager,dc=arzur,dc=local","toto");
>$sr=ldap_search($ds,"ou=Exterieur,dc=arzur,dc=local", "mail=*");
>$info = ldap_get_entries($ds, $sr);
>
>echo '<table><tr><td>Nom Prénom</td><td>Mail</td></tr>';
>for ($i=0; $i<$info["count"]; $i++) {
>echo '<tr>';
>echo '<td>' . $info[$i]["cn"][0] . '</td>';
>echo '<td>' . $info[$i]["mail"][0] . '</td';
>}
>ldap_close($ds);
>}
>else {
>echo '<h4>Impossible de se connecter au serveur LDAP.</h4>';
>}
>/***************************************************************/
>But ldap_add not working with error Warning: ldap_add(): Add: Undefined
>attribute type in /srv/www/htdocs/gestioninterne/CLDAP.php on line 70
>
>Here's the code :
>if ( (isset ($_POST['envoi']) ) && ($_POST['envoi']=="ok")) {
>$ds = ldap_connect("localhost");
>ldap_set_option( $ds, LDAP_OPT_PROTOCOL_VERSION, 3 );
>ldap_set_option( $ds, LDAP_OPT_REFERRALS, 0);
>$r=ldap_bind($ds,"cn=Manager,dc=arzur,dc=local","toto");
>
>$cn=$_POST['givenName'].' '.$_POST['sn'];
>$info["cn"]="$cn"; // Prenom NOM
>$info["objectClass"][0]="mozillaAbPersonObselete";
>/*$info["objectClass"][0]="top";
>$info["objectClass"][1]="person";
>$info["objectClass"][2]="organizationalPerson";
>$info["objectClass"][3]="inetOrgPerson";
>$info["objectClass"][4]="mozillaAbPersonObselete";*/
>$info["sn"]=$_POST['sn']; // Nom
>
>$cn.=",ou=Exterieur,dc=arzur,dc=local";
>$cnFinal="cn=".$cn;
>echo

>>$cnFinal,'<br>$info[objectClass]',$info["objectClass"],'<br>$info[sn]=',$info["sn"],'<br>$info[cn]=',$info["cn"];
>$r=ldap_add($ds,$cnFinal,$info);
>ldap_close($ds);
>}
>
>/*****************************************************************/
>Here's the result of my echo :
>cn=Benjamin BOUBOUNELLE,ou=Exterieur,dc=arzur,dc=local
>$info[objectClass]Array
>$info[sn]=BOUBOUNELLE
>$info[cn]=Benjamin BOUBOUNELLE
>*Warning*: ldap_add(): Add: Undefined attribute type in
>*/srv/www/htdocs/gestioninterne/CLDAP.php* on line *70
>
>*/*****************************************************************/
>
>Anyone can help me, I'm on since 10 hours :(
>
>Regards
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Björn Bartels
-Development/IT-Services-

----------------------------------------------
dbusiness.de gmbh
digital business & printing gmbh

Greifswalder Str. 152
D-10409 Berlin

Fon: [0.30] 4.21.19.95
Fax: [0.30] 4.21.19.74

www.dbusiness.de
[EMAIL PROTECTED]
ftp://dbusiness.dyndns.org

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

I'm designing a controlled access system in PHP, and it's coming along
quite well.  It's very simple, and just sets a session varibale, such as
$_SESSION['authenticated'] = 1, not a whole lot.

Now I run a small sniplet of code on the top of each HTML and PHP file,
which checks for this variable, and either allows or denys access to the
page.

However, how do people protect against the downloading of real files,
ones which are not parsed by PHP?  .WMV, .MOV, .ZIP, .EXE and so on?  I
want to protect access to these as well, and if a visitor just types in
a URL and is able to access the file because my access control mechanism
simply doesn't work on those types of files, what should be the solution
here?

It's been suggested to use readfile() to accomplish this, by forwarding
content from outside of the document root - but this just sounds odd.
On top of being (what I think would be) incredibly slow, it just doesn't
sound "right".

Thanks!
-dant

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

I'm designing a controlled access system in PHP, and it's coming along
quite well.  It's very simple, and just sets a session varibale, such as
$_SESSION['authenticated'] = 1, not a whole lot.

Now I run a small sniplet of code on the top of each HTML and PHP file,
which checks for this variable, and either allows or denys access to the
page.

However, how do people protect against the downloading of real files,
ones which are not parsed by PHP?  .WMV, .MOV, .ZIP, .EXE and so on?  I
want to protect access to these as well, and if a visitor just types in
a URL and is able to access the file because my access control mechanism
simply doesn't work on those types of files, what should be the solution
here?

It's been suggested to use readfile() to accomplish this, by forwarding
content from outside of the document root - but this just sounds odd.
On top of being (what I think would be) incredibly slow, it just doesn't
sound "right".


I had a similar issue. I ended up using a .htaccess so that you could not open the file directly. If checked for the referrer. This is not the most secure way to do it. I know it can be spoofed.

IndexIgnore *
SetEnvIfNoCase Referer "^http://example.com/viewer.php"; local_ref=1
Order Allow,Deny
Allow from env=local_ref

Jason Motes
php at imotes.com

--- End Message ---

Reply via email to