RE: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Daevid Vincent
> -Original Message-
> while(foo){
> $tr = (0 == $trColor % 2)? "#E8E8E8" : "#FF";
> echo "";
> ...

Don't do this modulus (%) math Just toggle a boolean!!

">


smime.p7s
Description: S/MIME cryptographic signature


[PHP] Re: CURL cannot connect to URL - IP address - after successful connection

2010-04-30 Thread Pete Ford

On 25/04/10 14:17, ioan...@btinternet.com wrote:

I can return a target page - once, but then on refresh within a few
hours the script curl_error is that it cannot connect to the host and
return is empty. The target URL is an ip address, not a named url, so
maybe it has something to do with DNS. I am on a shared server. Any
ideas on why this happens?

John


I've been watching this thread for a few days, and seen the various responses. 
It seems to me you should be asking the provider of the target page what the 
problem is! If you are consuming this service legitimately then they will tell 
you, and possibly provide a workaround. If not, then you probably shouldn't be 
doing what you are trying to do anyway - there a reason why they are blocking 
bots...


Cheers
Pete

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



Re: [PHP] Re: CURL cannot connect to URL - IP address - after successful connection

2010-04-30 Thread ioan...@btinternet.com



On 2010/04/30 17:02, Pete Ford wrote:

On 25/04/10 14:17, ioan...@btinternet.com wrote:

I can return a target page - once, but then on refresh within a few
hours the script curl_error is that it cannot connect to the host and
return is empty. The target URL is an ip address, not a named url, so
maybe it has something to do with DNS. I am on a shared server. Any
ideas on why this happens?

John


I've been watching this thread for a few days, and seen the various
responses. It seems to me you should be asking the provider of the
target page what the problem is! If you are consuming this service
legitimately then they will tell you, and possibly provide a workaround.
If not, then you probably shouldn't be doing what you are trying to do
anyway - there a reason why they are blocking bots...

Cheers
Pete

That may work in theory but not in business terms.  I am too small a 
mite to even get a hearing. It is not for a bot but to provide the 
information publicly available in response to human requests on another 
site.




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



Re: [PHP] In need of CVS/SVN checkout script for Production servers

2010-04-30 Thread David Otton
On 29 April 2010 20:32, Daevid Vincent  wrote:

> I'm looking for a script (bash or php) that I would run on my production
> web server that would do this or close to it:
>
>        1. do a CVS/SVN checkout to a new timestamped directory
>        2. change the symlink from the old directory
>        3. change permissions to www-data:www-data on new directory
>        4. and possibly tarball up the old directory.

Phing has SVN tools out-of-the-box.

http://phing.info/
http://morethanseven.net/2008/01/30/simple-deployment-with-svn-and-phing.html

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



Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Richard Quadling
On 30 April 2010 08:40, Daevid Vincent  wrote:
>> -Original Message-
>> while(foo){
>> $tr = (0 == $trColor % 2)? "#E8E8E8" : "#FF";
>> echo "";
>> ...
>
> Don't do this modulus (%) math Just toggle a boolean!!
>
> ">
>

The modulus is a good option when there are more than 2 states.

Say a 5 row fade ...

$a=0;
while ($row=mysql_fetch_...){
echo "<..."
}

giving alternate-row-1, alternate-row-2, alternate-row-3,
alternate-row-4 and alternate-row-5


-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



RE: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Jay Blanchard
[snip]
Don't do this modulus (%) math Just toggle a boolean!!

">
[/snip]

What is wrong with modulus math

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



[PHP] ldap add Invalid DN syntax

2010-04-30 Thread Manolis Vlachakis
Hallo there everyone
although i have built my code correctly according to the examples i found on
the net..
i get Invalid DN syntax error when i try to insert some attributes with ldap
add..

i get and read a csv file where i get the data correctly as i can see on the
echos that follow:

   *$data=split("[;\r]",$data);*
*
*
* **$info["cn"]= $data[$c];*
* **echo "|onoma-->";*
* **echo $info["cn"] ;//*
*** **   $c++;*
* **$info["sn"]= $data[$c];*
* **echo "|epwnimo-->";*
* **echo $info["sn"] ;*
* *
* **$info["objectclass"][0] = "top";*
*  ** **$info["objectclass"][1] = "organizationalPerson";*
* *
* ** *
* ** $r = ldap_add($ldapconn,
"cn=".$info['cn'].",cn=*,ou=@@@,ou=.,ou=,dc=.dc=",
$info);*

funny thing is that when i put them absolute like *$info["sn"]= "bla
bla";* it works fine...
any ideas?


Re: [PHP] ldap add Invalid DN syntax

2010-04-30 Thread Ashley Sheridan
On Fri, 2010-04-30 at 14:34 +0300, Manolis Vlachakis wrote:

> Hallo there everyone
> although i have built my code correctly according to the examples i found on
> the net..
> i get Invalid DN syntax error when i try to insert some attributes with ldap
> add..
> 
> i get and read a csv file where i get the data correctly as i can see on the
> echos that follow:
> 
>*$data=split("[;\r]",$data);*
> *
> *
> * **$info["cn"]= $data[$c];*
> * **echo "|onoma-->";*
> * **echo $info["cn"] ;//*
> *** **   $c++;*
> * **$info["sn"]= $data[$c];*
> * **echo "|epwnimo-->";*
> * **echo $info["sn"] ;*
> * *
> * **$info["objectclass"][0] = "top";*
> *  ** **$info["objectclass"][1] = "organizationalPerson";*
> * *
> * ** *
> * ** $r = ldap_add($ldapconn,
> "cn=".$info['cn'].",cn=*,ou=@@@,ou=.,ou=,dc=.dc=",
> $info);*
> 
> funny thing is that when i put them absolute like *$info["sn"]= "bla
> bla";* it works fine...
> any ideas?


Are you using the correct split() delimiter? What happens if you just
output that array with print_r() or var_dump()? I see the delimiter as:

[;
]

Because the \r is recognised as a carriage return because your string is
in double quotes.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] ldap add Invalid DN syntax

2010-04-30 Thread Manolis Vlachakis
on the array and on the server side i can see the names are added normally
and with the correct encode(despite what i show you )
and the only thing is tha i get that DN not valid...
i used the \r cause i use it on my csv file at least one...
but i am sure (i used a counter for the letters + i compered the name they
are the same)

so it is pretty strange why is not working...


1.trust me after many times faced problems with delimiters i can tell you
the correct is with [ ] and your delimiter in between
2.print_r seems good exactly what i have in csv file..
3.var_dump works fine counts everything and stuff but even though i get the
right attributes ...
i still have the same error(see below)
it's made me crazy



onoma-->���|epwnimo-->��
*Warning*: ldap_add()
[function.ldap-add]:
Add: Invalid DN syntax

Thank you for your answer


On 30 April 2010 16:53, Ashley Sheridan  wrote:

>  On Fri, 2010-04-30 at 14:34 +0300, Manolis Vlachakis wrote:
>
> Hallo there everyone
> although i have built my code correctly according to the examples i found on
> the net..
> i get Invalid DN syntax error when i try to insert some attributes with ldap
> add..
>
> i get and read a csv file where i get the data correctly as i can see on the
> echos that follow:
>
>*$data=split("[;\r]",$data);*
> *
> *
> * **$info["cn"]= $data[$c];*
> * **echo "|onoma-->";*
> * **echo $info["cn"] ;//*
> *** **   $c++;*
> * **$info["sn"]= $data[$c];*
> * **echo "|epwnimo-->";*
> * **echo $info["sn"] ;*
> * *
> * **$info["objectclass"][0] = "top";*
> *  ** **$info["objectclass"][1] = "organizationalPerson";*
> * *
> * ** *
> * ** $r = ldap_add($ldapconn,
> "cn=".$info['cn'].",cn=*,ou=@@@,ou=.,ou=,dc=.dc=",
> $info);*
>
> funny thing is that when i put them absolute like *$info["sn"]= "bla
> bla";* it works fine...
> any ideas?
>
>
> Are you using the correct split() delimiter? What happens if you just
> output that array with print_r() or var_dump()? I see the delimiter as:
>
> [;
> ]
>
> Because the \r is recognised as a carriage return because your string is in
> double quotes.
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


-- 
Manolis Vlachakis

Nelly's Family Hotel
Visit:   www.nellys-hotel.gr
  www.nellys.gr
Skype : manolis.vlachakis


Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Paul M Foster
On Thu, Apr 29, 2010 at 05:34:38PM -0400, tedd wrote:

> At 11:01 AM -0300 4/29/10, Juan Rodriguez Monti wrote:



>>
>> Tedd,
>> Thanks. I'm gonna check it. I finally solved it using:
>>
>> if ( CONDITIONS )) {
>>
>>   $results = query( QUERY );
>>   $colors = array('#97b7cd','#96bf8c');
>>   $index= 0;
>>  echo "";
>>  echo "";
>>  echo '';
>>  echo "";
>>  echo "";
>>  echo '';
>>
>>echo "";
>>  echo "a1 a2
>> a3  a4
>> a5 ";
>>
>>   while ($row = CONDITIONS )) {
>>  echo '';
>>  echo "$row[0]$row[1] $row[2]
>> $row[3]$row[4] ";
>>}
>>  echo "";
>>  echo "";
>>  echo "";
>>  echo 'back';
>>  echo "";
>>  echo "";
>>
>> This solution was the best for me. It's solved with your help.
>>
>> Thanks a lot!.
>>
>> Juan
>
> The above is far more complicated than it has to be.
>
> Please critically review my example.

+1

This thread came up before, and tedd's solution was the least complex,
as far as I could tell. I shamelessly stole his code and regularly use
it in my own projects. ;-}

Paul

-- 
Paul M. Foster

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



RE: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Ashley Sheridan
On Fri, 2010-04-30 at 06:14 -0500, Jay Blanchard wrote:

> [snip]
> Don't do this modulus (%) math Just toggle a boolean!!
> 
> ">
> [/snip]
> 
> What is wrong with modulus math
> 


Modulus is the most elegant solution I reckon. Imagine if you only
needed to highlight every 3rd row, or 4th? Easy to change the modulus
for it, not so easy to re-work a binary switch. 

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Jay Ess

Paul M Foster wrote:

+1

This thread came up before, and tedd's solution was the least complex,
as far as I could tell. I shamelessly stole his code and regularly use
it in my own projects. ;-}
  

Or if one choose to use Smarty template.


http://www.smarty.net/manual/en/language.function.cycle.php

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



Re: [PHP] Getting root privs

2010-04-30 Thread Paul M Foster
On Fri, Apr 30, 2010 at 12:11:17PM +0530, Nilesh Govindarajan wrote:

> On 04/30/2010 11:26 AM, Jim Lucas wrote:
>> Nilesh Govindarajan wrote:
>>> Hi,
>>>
>>> As you know there are lot of control panels lying around like Cpanel,
>>> Lxadmin, most of them based on PHP. The control panels allow editing of
>>> system files which requires root privileges, can somebody tell me how to
>>> gain root privileges inside the script so that it can be useful if I
>>> want to give my users a DNS editing interface instead of loading a big
>>> bloated control panel.
>>>
>>
>> We use an interface that writes everything to a DB. Then, every 5
> minutes, a
>> cron job comes around and dumps the db and builds the zone files for us.
>>
>> Might try something similar.  It would be a lot safer then giving
> root access
>> via PHP... :)
>>
>
> Hmm that's a great idea. But my question is in general, suppose I get
> some freelance job to write a control panel for managing httpd, etc.
>
> Same procedure can be used ? I think so ?

If you can find an open source control panel (like webmin), you could
download the code and examine it.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Getting root privs

2010-04-30 Thread Ashley Sheridan
On Fri, 2010-04-30 at 10:40 -0400, Paul M Foster wrote:

> On Fri, Apr 30, 2010 at 12:11:17PM +0530, Nilesh Govindarajan wrote:
> 
> > On 04/30/2010 11:26 AM, Jim Lucas wrote:
> >> Nilesh Govindarajan wrote:
> >>> Hi,
> >>>
> >>> As you know there are lot of control panels lying around like Cpanel,
> >>> Lxadmin, most of them based on PHP. The control panels allow editing of
> >>> system files which requires root privileges, can somebody tell me how to
> >>> gain root privileges inside the script so that it can be useful if I
> >>> want to give my users a DNS editing interface instead of loading a big
> >>> bloated control panel.
> >>>
> >>
> >> We use an interface that writes everything to a DB. Then, every 5
> > minutes, a
> >> cron job comes around and dumps the db and builds the zone files for us.
> >>
> >> Might try something similar.  It would be a lot safer then giving
> > root access
> >> via PHP... :)
> >>
> >
> > Hmm that's a great idea. But my question is in general, suppose I get
> > some freelance job to write a control panel for managing httpd, etc.
> >
> > Same procedure can be used ? I think so ?
> 
> If you can find an open source control panel (like webmin), you could
> download the code and examine it.
> 
> Paul
> 
> -- 
> Paul M. Foster
> 


You could use exce() to run a sudo command (piping the password through
to it or add the apache user into the sudoers list) to run things at the
root level. You must be very very careful with this though, and only use
it as a last resort if you absolutely have to, as any sort of
vulnerability in your script could compromise your entire server.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Getting root privs

2010-04-30 Thread Nilesh Govindarajan

On 04/30/2010 08:10 PM, Paul M Foster wrote:

On Fri, Apr 30, 2010 at 12:11:17PM +0530, Nilesh Govindarajan wrote:


On 04/30/2010 11:26 AM, Jim Lucas wrote:

Nilesh Govindarajan wrote:

Hi,

As you know there are lot of control panels lying around like Cpanel,
Lxadmin, most of them based on PHP. The control panels allow editing of
system files which requires root privileges, can somebody tell me how to
gain root privileges inside the script so that it can be useful if I
want to give my users a DNS editing interface instead of loading a big
bloated control panel.



We use an interface that writes everything to a DB. Then, every 5

minutes, a

cron job comes around and dumps the db and builds the zone files for us.

Might try something similar.  It would be a lot safer then giving

root access

via PHP... :)



Hmm that's a great idea. But my question is in general, suppose I get
some freelance job to write a control panel for managing httpd, etc.

Same procedure can be used ? I think so ?


If you can find an open source control panel (like webmin), you could
download the code and examine it.

Paul



Webmin is written in perl. I will see the code of web-cp which is php based.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

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



Re: [PHP] Getting root privs

2010-04-30 Thread Nilesh Govindarajan

On 04/30/2010 08:12 PM, Ashley Sheridan wrote:

On Fri, 2010-04-30 at 10:40 -0400, Paul M Foster wrote:


On Fri, Apr 30, 2010 at 12:11:17PM +0530, Nilesh Govindarajan wrote:


On 04/30/2010 11:26 AM, Jim Lucas wrote:

Nilesh Govindarajan wrote:

Hi,

As you know there are lot of control panels lying around like Cpanel,
Lxadmin, most of them based on PHP. The control panels allow editing of
system files which requires root privileges, can somebody tell me how to
gain root privileges inside the script so that it can be useful if I
want to give my users a DNS editing interface instead of loading a big
bloated control panel.



We use an interface that writes everything to a DB. Then, every 5

minutes, a

cron job comes around and dumps the db and builds the zone files for us.

Might try something similar.  It would be a lot safer then giving

root access

via PHP... :)



Hmm that's a great idea. But my question is in general, suppose I get
some freelance job to write a control panel for managing httpd, etc.

Same procedure can be used ? I think so ?


If you can find an open source control panel (like webmin), you could
download the code and examine it.

Paul

--
Paul M. Foster




You could use exce() to run a sudo command (piping the password through
to it or add the apache user into the sudoers list) to run things at the
root level. You must be very very careful with this though, and only use
it as a last resort if you absolutely have to, as any sort of
vulnerability in your script could compromise your entire server.

Thanks,
Ash
http://www.ashleysheridan.co.uk





That was what my basic idea about implementing it, but just put up a 
discussion here to see if there is really any other method except sudo- 
and there is that cron one as suggested by Jim Lucas.


--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

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



Re: [PHP] Getting root privs

2010-04-30 Thread Ashley Sheridan
On Fri, 2010-04-30 at 20:23 +0530, Nilesh Govindarajan wrote:

> On 04/30/2010 08:12 PM, Ashley Sheridan wrote:
> > On Fri, 2010-04-30 at 10:40 -0400, Paul M Foster wrote:
> >
> >> On Fri, Apr 30, 2010 at 12:11:17PM +0530, Nilesh Govindarajan wrote:
> >>
> >>> On 04/30/2010 11:26 AM, Jim Lucas wrote:
>  Nilesh Govindarajan wrote:
> > Hi,
> >
> > As you know there are lot of control panels lying around like Cpanel,
> > Lxadmin, most of them based on PHP. The control panels allow editing of
> > system files which requires root privileges, can somebody tell me how to
> > gain root privileges inside the script so that it can be useful if I
> > want to give my users a DNS editing interface instead of loading a big
> > bloated control panel.
> >
> 
>  We use an interface that writes everything to a DB. Then, every 5
> >>> minutes, a
>  cron job comes around and dumps the db and builds the zone files for us.
> 
>  Might try something similar.  It would be a lot safer then giving
> >>> root access
>  via PHP... :)
> 
> >>>
> >>> Hmm that's a great idea. But my question is in general, suppose I get
> >>> some freelance job to write a control panel for managing httpd, etc.
> >>>
> >>> Same procedure can be used ? I think so ?
> >>
> >> If you can find an open source control panel (like webmin), you could
> >> download the code and examine it.
> >>
> >> Paul
> >>
> >> --
> >> Paul M. Foster
> >>
> >
> >
> > You could use exce() to run a sudo command (piping the password through
> > to it or add the apache user into the sudoers list) to run things at the
> > root level. You must be very very careful with this though, and only use
> > it as a last resort if you absolutely have to, as any sort of
> > vulnerability in your script could compromise your entire server.
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >
> 
> That was what my basic idea about implementing it, but just put up a 
> discussion here to see if there is really any other method except sudo- 
> and there is that cron one as suggested by Jim Lucas.
> 
> -- 
> Nilesh Govindarajan
> Site & Server Administrator
> www.itech7.com
> मेरा भारत महान !
> मम भारत: महत्तम भवतु !
> 


To make things a little bit more secure when using exec() you could call
a series of custom Bash scripts which you can have set up to only accept
certain ranges of parameters, which would avoid someone passing a string
like "&& nasty_command here" to the command line.

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] How to simplify the management of 250+ nodes and 1000+ users , in Drupal

2010-04-30 Thread ebhakt
Hi,

I have written this tool : < Portal Manager :: Drupal Management Assembly >
which is to remotely manage a drupal based website
You can manage and edit user properties
You can manage and edit posts
you can sort posts on the bases of taxonomies and then manage and edit
posts


The tool is written in C# WPF and needs .net framework 3.5 to be
pre-installed
Please find the software here: LINK <
http://ebhakt.com/content/portal-manager-drupal-

management-assembly  >

Please give your valuable feedback, its highly welcome...


NOTE: For working of this software you need to download and install services
module and

configure it to give permissions to anonymous users


-- 
Bhaskar Tiwari
GTSE Generalist
Directory Services
Microsoft


All we have to decide is what to do with the time that has been given to us


http://www.ebhakt.com/
http://fytclub.net/
http://ebhakt.info/


[PHP] How to Force IE to download text file?

2010-04-30 Thread Ali Asghar Toraby Parizy
I have written this code to export data to a text file and asks user
to save generated file. It works with Firefox perfectly, but IE shows
content of file instead of prompting the download window.
How can I force IE to show the download dialog?



-- 
Ali Asghar Torabi

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



Re: [PHP] How to Force IE to download text file?

2010-04-30 Thread Andre Polykanine
Hello Ali,

It's attachment, not attachement. Maybe here's the reason? Just a
thought.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Ali Asghar Toraby Parizy 
To: php-general@lists.php.net 
Date: Friday, April 30, 2010, 7:19:38 PM
Subject: [PHP] How to Force IE to download text file?

I have written this code to export data to a text file and asks user
to save generated file. It works with Firefox perfectly, but IE shows
content of file instead of prompting the download window.
How can I force IE to show the download dialog?



-- 
Ali Asghar Torabi

-- 
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] How to Force IE to download text file?

2010-04-30 Thread Michael Shadle
On Fri, Apr 30, 2010 at 9:19 AM, Ali Asghar Toraby Parizy
 wrote:
> I have written this code to export data to a text file and asks user
> to save generated file. It works with Firefox perfectly, but IE shows
> content of file instead of prompting the download window.
> How can I force IE to show the download dialog?
>
>  Header("Content-disposition: attachement; filename=data.txt");
> Header("Content-type: text/plain");
> echo $some_data;
> ?>

We usually do something like this. Although I am not sure about text files.

header("Content-Disposition: attachment;
filename=\"".urldecode(basename($file))."\";");
header("Content-Type: application/force-download");

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



Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread tedd

At 10:34 AM -0400 4/30/10, Paul M Foster wrote:

On Thu, Apr 29, 2010 at 05:34:38PM -0400, tedd wrote:

 > Please critically review my example.

+1

This thread came up before, and tedd's solution was the least complex,
as far as I could tell. I shamelessly stole his code and regularly use
it in my own projects. ;-}

Paul


Paul:

Thanks for the plug.

All the code I provide on this list and on my various web sites is 
for free for anyone, except for "governments" (i.e., local, state, 
federal, other), to use, review, and/or comment as they wish without 
any obligation to me. Oh, as for "governments" if you want a copy of 
anything please contact me directly, I have a few forms for you to 
fill out.


The point of sharing is to improve product -- agile works.

My livelihood is not compromised because someone is using a small 
snip-it of mine. Hopefully my real code (the stuff I sell to clients) 
is more involved and has more value than that.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread tedd

At 4:37 PM +0200 4/30/10, Jay Ess wrote:

Paul M Foster wrote:

+1

This thread came up before, and tedd's solution was the least complex,
as far as I could tell. I shamelessly stole his code and regularly use
it in my own projects. ;-}


Or if one choose to use Smarty template.


http://www.smarty.net/manual/en/language.function.cycle.php


Yeah, like that keeps presentation separate from data while making 
things simpler, right? I don't think so.


Embedding styling attributes in html is simply not following "best practices".

For example, if you have 100 pages of the above embedded code and the 
client says "Hey, let's change the color of that table" -- then you 
are going to have to change 100 pages of code whereas if you followed 
"best practices" then you would change only one rule in css.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Ashley Sheridan
On Fri, 2010-04-30 at 13:59 -0400, tedd wrote:

> At 4:37 PM +0200 4/30/10, Jay Ess wrote:
> >Paul M Foster wrote:
> >>+1
> >>
> >>This thread came up before, and tedd's solution was the least complex,
> >>as far as I could tell. I shamelessly stole his code and regularly use
> >>it in my own projects. ;-}
> >>
> >Or if one choose to use Smarty template.
> >
> >
> >http://www.smarty.net/manual/en/language.function.cycle.php
> 
> Yeah, like that keeps presentation separate from data while making 
> things simpler, right? I don't think so.
> 
> Embedding styling attributes in html is simply not following "best practices".
> 
> For example, if you have 100 pages of the above embedded code and the 
> client says "Hey, let's change the color of that table" -- then you 
> are going to have to change 100 pages of code whereas if you followed 
> "best practices" then you would change only one rule in css.
> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 


I agree. Inline styles are useful in a few fringe cases, but if you can
avoid them then it's best practice to do so.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread tedd

At 7:26 PM +0100 4/30/10, Ashley Sheridan wrote:

On Fri, 2010-04-30 at 13:59 -0400, tedd wrote:
At 4:37 PM +0200 4/30/10, Jay Ess wrote:

Paul M Foster wrote:

+1

This thread came up before, and tedd's solution was the least complex,
as far as I could tell. I shamelessly stole his code and regularly use
it in my own projects. ;-}


Or if one choose to use Smarty template.


http://www.smarty.net/manual/en/language.function.cycle.php


Yeah, like that keeps presentation separate from data while making
things simpler, right? I don't think so.

Embedding styling attributes in html is simply not following "best 
practices".


For example, if you have 100 pages of the above embedded code and the
client says "Hey, let's change the color of that table" -- then you
are going to have to change 100 pages of code whereas if you followed
"best practices" then you would change only one rule in css.

Cheers,

tedd


I agree. Inline styles are useful in a few fringe cases, but if you 
can avoid them then it's best practice to do so.


Thanks,
Ash
http://www.ashleysheridan.co.uk


Ash:

The only "fringe" cases I can think of are those that could be solved 
by using a  tag.


Do you have any examples otherwise?

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



RE: [PHP] Two color rows in table inside while iteration -- just say no to mod

2010-04-30 Thread Daevid Vincent
> -Original Message-
> From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
> 
> Modulus is the most elegant solution I reckon. Imagine if you only
> needed to highlight every 3rd row, or 4th? Easy to change the modulus
> for it, not so easy to re-work a binary switch. 
>
> -Original Message-
> From: Richard Quadling [mailto:rquadl...@googlemail.com] 
> 
> The modulus is a good option when there are more than 2 states.
> 
> Say a 5 row fade ...
> 
> $a=0;
> while ($row=mysql_fetch_...){
> echo "<..."
> }
> 
> giving alternate-row-1, alternate-row-2, alternate-row-3,
> alternate-row-4 and alternate-row-5

Okay, how many tables do you EVER see with more than TWO colors? Come on
now.

Show me some URL's to REAL sites (not some contrived examples) that use
multiple row colors or fades in a rotating fashion. Not talking about a
highlight roll-over, nor am I talking about highlighting rows of certain
criteria in different colors, as both of those are not the problem for this
solution. I'm talking about a straight up table that cycles each row more
than 2 colors.

99% of your tables are 2 colors, and flipping a bit (i.e. Boolean) is WAY
faster to compute than modulus and also easier to understand.

http://www.youtube.com/watch?v=pXhKzY0BKwY  ;-) (I say that out of love!)

d


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



Re: [PHP] Two color rows in table inside while iteration

2010-04-30 Thread Ashley Sheridan
On Fri, 2010-04-30 at 15:59 -0400, tedd wrote:

> At 7:26 PM +0100 4/30/10, Ashley Sheridan wrote:
> >>On Fri, 2010-04-30 at 13:59 -0400, tedd wrote:
> >>At 4:37 PM +0200 4/30/10, Jay Ess wrote:
> >>>Paul M Foster wrote:
> +1
> 
> This thread came up before, and tedd's solution was the least complex,
> as far as I could tell. I shamelessly stole his code and regularly use
> it in my own projects. ;-}
> 
> >>>Or if one choose to use Smarty template.
> >>>
> >>>
> >>>http://www.smarty.net/manual/en/language.function.cycle.php
> >>
> >>Yeah, like that keeps presentation separate from data while making
> >>things simpler, right? I don't think so.
> >>
> >>Embedding styling attributes in html is simply not following "best 
> >>practices".
> >>
> >>For example, if you have 100 pages of the above embedded code and the
> >>client says "Hey, let's change the color of that table" -- then you
> >>are going to have to change 100 pages of code whereas if you followed
> >>"best practices" then you would change only one rule in css.
> >>
> >>Cheers,
> >>
> >>tedd
> 
> >I agree. Inline styles are useful in a few fringe cases, but if you 
> >can avoid them then it's best practice to do so.
> >
> >Thanks,
> >Ash
> >http://www.ashleysheridan.co.uk
> 
> Ash:
> 
> The only "fringe" cases I can think of are those that could be solved 
> by using a  tag.
> 
> Do you have any examples otherwise?
> 
> Cheers,
> 
> tedd


I can't think of any right now, but I know that on occassion I've used
inline styles where I know that the style will never be repeated and was
a one-off style to just perform a quick fix. I know it's a messy thing
to do, but I'm sure there must be a good reason for them somewhere!

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] multi dimensional array question

2010-04-30 Thread Nick Balestra
hello everybody here is my array(s)


$us_census = array('NY' => array('New York' => 8008278),
   'CA' => array('Los Angeles' => 3694820,
 'San Diego' => 
1223400),
   'IL' => array('Chicago' => 2896016),
   'TX' => array('Houston' => 1953631,
 'Dallas' => 
1188580,
 'San Antonio' 
=> 1144646),
   'PA' => array('Philadelphia' => 1517550),
   'AZ' => array('Phoenix' => 1321045),
   'MI' => array('Detroit' => 951270)); 



print 
"StateCityPopulationTotal";

   
// $state is the key and $states is the value 
foreach ($us_census as $state => $cities) {

// $state is the key and $habitant is the value
foreach ($cities as $city => $habitants){



print 
"$state$city$habitants";


}
}


Now i also want to be able to count the total population per state, i am 
stucked...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Two color rows in table inside while iteration -- just say no to mod

2010-04-30 Thread Jason Pruim


On Apr 30, 2010, at 4:20 PM, Daevid Vincent wrote:


-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]

Modulus is the most elegant solution I reckon. Imagine if you only
needed to highlight every 3rd row, or 4th? Easy to change the modulus
for it, not so easy to re-work a binary switch.

-Original Message-
From: Richard Quadling [mailto:rquadl...@googlemail.com]

The modulus is a good option when there are more than 2 states.

Say a 5 row fade ...

$a=0;
while ($row=mysql_fetch_...){
echo "<..."
}

giving alternate-row-1, alternate-row-2, alternate-row-3,
alternate-row-4 and alternate-row-5


Okay, how many tables do you EVER see with more than TWO colors?  
Come on

now.

Show me some URL's to REAL sites (not some contrived examples) that  
use
multiple row colors or fades in a rotating fashion. Not talking  
about a
highlight roll-over, nor am I talking about highlighting rows of  
certain
criteria in different colors, as both of those are not the problem  
for this
solution. I'm talking about a straight up table that cycles each row  
more

than 2 colors.

99% of your tables are 2 colors, and flipping a bit (i.e. Boolean)  
is WAY

faster to compute than modulus and also easier to understand.

http://www.youtube.com/watch?v=pXhKzY0BKwY  ;-) (I say that out of  
love!)



A bit of a contrived example... BUT... I could envision having  
multiple (more then 2) colors on a blog with comments...


Maybe it's a patriotic blog and they want the comments to cycle  
between red, white & blue... (Or your countries colors) And yes I know  
that you could assume white is a default... But I know some people who  
have the default color of their web browser set to bright pink to  
point out where rules aren't specifically assigned :)


And unless we are adding a multiple seconds to the load time is anyone  
going to notice a difference of 1 second? Or am I wrong?


Also... I'm not trying to start a fight... Just trying to understand  
the different possibilities and the impact :) Hoping to write the next  
facebook eventually But aren't we all? ;)




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



Re: [PHP] multi dimensional array question

2010-04-30 Thread Piero Steinger
Am 01.05.2010 00:57, schrieb Nick Balestra:
> hello everybody here is my array(s)
>
>
> $us_census = array('NY' => array('New York' => 8008278),
>  'CA' => array('Los Angeles' => 3694820,
>'San Diego' => 
> 1223400),
>  'IL' => array('Chicago' => 2896016),
>  'TX' => array('Houston' => 1953631,
>'Dallas' => 
> 1188580,
>'San Antonio' 
> => 1144646),
>  'PA' => array('Philadelphia' => 1517550),
>  'AZ' => array('Phoenix' => 1321045),
>  'MI' => array('Detroit' => 951270)); 
>
>
>
> print 
> "StateCityPopulationTotal";
>
>  
> // $state is the key and $states is the value 
> foreach ($us_census as $state => $cities) {
>
>   // $state is the key and $habitant is the value
>   foreach ($cities as $city => $habitants){
>
>
>   
>   print 
> "$state$city$habitants";
>   
>   
>   }
>   }
>
>
> Now i also want to be able to count the total population per state, i am 
> stucked...
>   

array_sum() should do it :)


foreach ($us_census as $state => $cities) {
$population_per_state = array_sum($cities);
}




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



Re: [PHP] multi dimensional array question

2010-04-30 Thread Nick Balestra
thanks Piero!

i was trying to solve an excercise on "learning php5" (O'reilyl) book.

I am happy abotut his solution with the array_sum funtion you suggested, and my 
multidimensional array make much more sense to mee then they suggested solution 
that also much more line of code comapred... 

look: my solution (with Piero suggeston): and ont he bottom the book solution. 
what do u say is the best one? why? i am learning so i am interested in 
understanding why a solution can be better then an other...

$us_census = array('NY' => array('New York' => 8008278),
   'CA' => array('Los Angeles' => 3694820,
 'San Diego' => 
1223400),
   'IL' => array('Chicago' => 2896016),
   'TX' => array('Houston' => 1953631,
 'Dallas' => 
1188580,
 'San Antonio' 
=> 1144646),
   'PA' => array('Philadelphia' => 1517550),
   'AZ' => array('Phoenix' => 1321045),
   'MI' => array('Detroit' => 951270)); 
   


print 
"StateCityPopulationTotal";


foreach ($us_census as $state => $cities) {

foreach ($cities as $city => $habitants){

$tothabitants += $habitants;

print 
"$state$city$habitants";
}
}

print "$tothabitants";


foreach ($us_census as $state => $cities) {
$population_per_state = array_sum($cities);
print "$state $population_per_state";
}

--
the book solution:


$population = array('New York' => array('state' => 'NY', 'pop' => 8008278),
'Los Angeles' => array('state' => 'CA', 'pop' => 3694820),
'Chicago' => array('state' => 'IL', 'pop' => 2896016),
'Houston' => array('state' => 'TX', 'pop' => 1953631),
'Philadelphia' => array('state' => 'PA', 'pop' => 1517550),
'Phoenix' => array('state' => 'AZ', 'pop' => 1321045),
'San Diego' => array('state' => 'CA', 'pop' => 1223400),
'Dallas' => array('state' => 'TX', 'pop' => 1188580),
'San Antonio' => array('state' => 'TX', 'pop' => 1144646),
'Detroit' => array('state' => 'MI', 'pop' => 951270));

$state_totals = array( );
$total_population = 0;
print "CityPopulation\n";
foreach ($population as $city => $info) {


$total_population += $info['pop'];

$state_totals[$info['state']] += $info['pop'];
print "$city, {$info['state']}{$info['pop']}\n";
}

foreach ($state_totals as $state => $pop) {
print "$state$pop\n";
}
print "Total$total_population\n";
print "\n";






[PHP] Any One See where this is going wrong?

2010-04-30 Thread Gary
I have this duplicate code on another site and it works fine.  The image is 
uploaded to the images folder, the information is not submitted to the 
database.  I get the error

Some Error Occured While Inserting Records

This is only on a local machine so I have not yet included and safegaurds 
like stripslashes or my_real_escape_string.

Thanks for your help

Gary

300) {

class ImgResizer {
 private $originalFile = 'image_file';
 public function __construct($originalFile = 'image_file') {
  $this -> originalFile = $originalFile;
 }
 public function resize($newWidth, $targetFile) {
  if (empty($newWidth) || empty($targetFile)) {
   return false;
  }
  $src = imagecreatefromjpeg($this -> originalFile);
  list($width, $height) = getimagesize($this -> originalFile);
  $newHeight = ($height / $width) * $newWidth;
  $tmp = imagecreatetruecolor($newWidth, $newHeight);
  imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newWidth, $newHeight, $width, 
$height);
  if (file_exists($targetFile)) {
   unlink($targetFile);
  }
  imagejpeg($tmp, $targetFile, 85); // 85 is my choice, make it between 0 - 
100 for output image quality with 100 being the most luxurious
 }
}
}
if (!empty($type) && !empty($image_file)) {
  if (($image_type == 'image/gif') || ($image_type == 'image/jpeg') || 
($image_type == 'image/pjpeg') || ($image_type == 'image/png') && 
($image_size <300))  {
if ($_FILES['image_file']['error'] == 0) {
  // Move the file to the target upload folder
  $target = 'images/' . $image_file;
  if (move_uploaded_file($_FILES['image_file']['tmp_name'], 
$target)){
$batchconnection;

 $sqlStatements = "INSERT INTO guns( id,manufacturer, type, model, 
caliber, condition, price, description, image_file_name,submitted 
,available) VALUES ('','$manufacturer', '$type', '$model', '$caliber', 
'$condition', '$price', '$description','$image_file_name', ' ', 
'$available');

INSERT INTO images (id, image_file) VALUES('','$image_file')";

 $sqlResult = $batchconnection->multi_query($sqlStatements);
   if($sqlResult == true) {
   echo "Successfully Inserted Records";
   } else {
   echo "Some Error Occured While Inserting Records";
}



   }

}
 }
}
mysqli_close($batchconnection);
}
?> 



__ Information from ESET Smart Security, version of virus signature 
database 5076 (20100430) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Any One See where this is going wrong?

2010-04-30 Thread Ashley Sheridan
On Fri, 2010-04-30 at 20:43 -0400, Gary wrote:

> I have this duplicate code on another site and it works fine.  The image is 
> uploaded to the images folder, the information is not submitted to the 
> database.  I get the error
> 
> Some Error Occured While Inserting Records
> 
> This is only on a local machine so I have not yet included and safegaurds 
> like stripslashes or my_real_escape_string.
> 
> Thanks for your help
> 
> Gary
> 
>  if (isset($_POST['submit']))  {
> $manufacturer=($_POST['manufacturer']);
> $type=($_POST['type']);
> $model=($_POST['model']);
> $caliber=($_POST['caliber']);
> $condition=($_POST['condition']);
> $price=($_POST['price']);
> $description=($_POST['description']);
> $image_file_name=($_POST['image_file_name']);
> $image_file=($_FILES['image_file']);
> $available=($_POST['available']);
> 
> $image_file = $_FILES['image_file']['name'];
> $image_type = $_FILES['image_file']['type'];
> $image_size = $_FILES['image_file']['size'];
> 
> include ('includes/connect_local.inc.php');
> 
> if(image_size >300) {
> 
> class ImgResizer {
>  private $originalFile = 'image_file';
>  public function __construct($originalFile = 'image_file') {
>   $this -> originalFile = $originalFile;
>  }
>  public function resize($newWidth, $targetFile) {
>   if (empty($newWidth) || empty($targetFile)) {
>return false;
>   }
>   $src = imagecreatefromjpeg($this -> originalFile);
>   list($width, $height) = getimagesize($this -> originalFile);
>   $newHeight = ($height / $width) * $newWidth;
>   $tmp = imagecreatetruecolor($newWidth, $newHeight);
>   imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newWidth, $newHeight, $width, 
> $height);
>   if (file_exists($targetFile)) {
>unlink($targetFile);
>   }
>   imagejpeg($tmp, $targetFile, 85); // 85 is my choice, make it between 0 - 
> 100 for output image quality with 100 being the most luxurious
>  }
> }
> }
> if (!empty($type) && !empty($image_file)) {
>   if (($image_type == 'image/gif') || ($image_type == 'image/jpeg') || 
> ($image_type == 'image/pjpeg') || ($image_type == 'image/png') && 
> ($image_size <300))  {
> if ($_FILES['image_file']['error'] == 0) {
>   // Move the file to the target upload folder
>   $target = 'images/' . $image_file;
>   if (move_uploaded_file($_FILES['image_file']['tmp_name'], 
> $target)){
> $batchconnection;
> 
>  $sqlStatements = "INSERT INTO guns( id,manufacturer, type, model, 
> caliber, condition, price, description, image_file_name,submitted 
> ,available) VALUES ('','$manufacturer', '$type', '$model', '$caliber', 
> '$condition', '$price', '$description','$image_file_name', ' ', 
> '$available');
> 
> INSERT INTO images (id, image_file) VALUES('','$image_file')";
> 
>  $sqlResult = $batchconnection->multi_query($sqlStatements);
>if($sqlResult == true) {
>echo "Successfully Inserted Records";
>} else {
>echo "Some Error Occured While Inserting Records";
> }
> 
> 
> 
>}
> 
> }
>  }
> }
> mysqli_close($batchconnection);
> }
> ?> 
> 
> 
> 
> __ Information from ESET Smart Security, version of virus signature 
> database 5076 (20100430) __
> 
> The message was checked by ESET Smart Security.
> 
> http://www.eset.com
> 
> 
> 
> 
> 


Is it possible that this server doesn't like batch queries? Try
splitting them out into individual queries and seeing if that helps. If
that doesn't do the trick, print out the SQL query string to see if it's
what you expect. It might be working fine on the other server, but I've
seen enough strange things happen before to know that sometimes 'poo'
happens.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Any One See where this is going wrong?

2010-04-30 Thread Gary
utput image quality with 100 being the most luxurious
>>  }
>> }
>> }
>> if (!empty($type) && !empty($image_file)) {
>>   if (($image_type == 'image/gif') || ($image_type == 'image/jpeg') 
>> ||
>> ($image_type == 'image/pjpeg') || ($image_type == 'image/png') &&
>> ($image_size <300))  {
>> if ($_FILES['image_file']['error'] == 0) {
>>   // Move the file to the target upload folder
>>   $target = 'images/' . $image_file;
>>   if (move_uploaded_file($_FILES['image_file']['tmp_name'],
>> $target)){
>> $batchconnection;
>>
>>  $sqlStatements = "INSERT INTO guns( id,manufacturer, type, model,
>> caliber, condition, price, description, image_file_name,submitted
>> ,available) VALUES ('','$manufacturer', '$type', '$model', '$caliber',
>> '$condition', '$price', '$description','$image_file_name', ' ',
>> '$available');
>>
>> INSERT INTO images (id, image_file) VALUES('','$image_file')";
>>
>>  $sqlResult = $batchconnection->multi_query($sqlStatements);
>>if($sqlResult == true) {
>>echo "Successfully Inserted Records";
>>} else {
>>echo "Some Error Occured While Inserting Records";
>> }
>>
>>
>>
>>}
>>
>> }
>>  }
>> }
>> mysqli_close($batchconnection);
>> }
>> ?>
>>
>>
>>
>> __ Information from ESET Smart Security, version of virus 
>> signature database 5076 (20100430) __
>>
>> The message was checked by ESET Smart Security.
>>
>> http://www.eset.com
>>
>>
>>
>>
>>
>
>
> Is it possible that this server doesn't like batch queries? Try
> splitting them out into individual queries and seeing if that helps. If
> that doesn't do the trick, print out the SQL query string to see if it's
> what you expect. It might be working fine on the other server, but I've
> seen enough strange things happen before to know that sometimes 'poo'
> happens.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
>
>
> __ Information from ESET Smart Security, version of virus 
> signature database 5076 (20100430) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
> 



__ Information from ESET Smart Security, version of virus signature 
database 5076 (20100430) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Any One See where this is going wrong?

2010-04-30 Thread kranthi
may be it is not the error with the code. The problem may be with some
'  in the input. Print out the mysql error and/or the sql query to see
what is going wrong.

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



[PHP] SharePoint

2010-04-30 Thread Robbert van Andel
I've been trying to connect to our SharePoint server's webservices
with PHP. I downloaded the nusoap library and have been trying to make
a connection using sample code from various websites. I keep getting
the following error:

You are not authorized to view this page
You do not have permission to view this directory or page using the
credentials that you supplied because your Web browser is sending a
WWW-Authenticate header field that the Web server is not configured to
accept.
HTTP Error 401.2 - Unauthorized: Access is denied due to server
configuration.Internet Information Services (IIS)

My code looks like this:

require_once('/usr/share/php/nusoap/nusoap.php');

/*  Your username and password, separated by a colon
    Domain may be optional, depending on your setup */
$auth = "username:password";

/*  Location of the Lists.asmx file
    If the list is in a subsite, the subsite must be in the path */
$wsdl = "http://domain.com/depts/is/private/_vti_bin/Lists.asmx?WSDL";;

/*  GUID of the list */
$guid = "Shared Documents";

/* Setup NuSOAP
   Sharepoint requires NTLM Authorization
   You need a fairly recent version of CURL installed for this  */
try {
    $client = new nusoap_client($wsdl,true);
    $client->setCredentials("","","ntlm");
    $client->setUseCurl(true);
    $client->useHTTPPersistentConnection();
    $client->setCurlOption(CURLOPT_USERPWD, $auth);
    //$client->soap_defencoding = 'UTF-8';


    $xml = '
http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
  
    http://schemas.microsoft.com/sharepoint/soap/";>
  ' . $guid . '
  All Documents
  
    schemaxml
  
    schemaxml
  string
  
    schemaxml
  string
    
  

    ';

    $result = $client->call("GetListItems",$xml);
    if(isset($fault)) {
    echo "Error: " . $fault . "\n";
    }
    echo "\$result = " .
htmlspecialchars(print_r($result,true)) . "\n";
 }
catch(Exception $e) {

    echo "" . $e->getMessage() . "\n";
}


Our SharePoint server uses integrated authentication. I've tried
several permutations of the username, including just the username,
domain\username and usern...@domain. All are returning the same error.
My guess is that PHP is sending the username/password combination in a
way that SharePoint doesn't like.

Has anyone been able to connect to SharePoint's web services and if so, how?

Thanks

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