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

2010-05-01 Thread Paul M Foster
On Fri, Apr 30, 2010 at 01:52:25PM -0400, tedd wrote:

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

If you think about it, that's pretty hilarious. Normally, doing anything
with the government requires *you* to fill out a few forms. Making
*them* do it to use your stuff is humorously appropriate.

Paul

-- 
Paul M. Foster

-- 
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-05-01 Thread Brandon Rampersad
yeah, try using the PDO instead

On Sat, May 1, 2010 at 9:14 PM, Adam Richardson wrote:

> On Sat, May 1, 2010 at 6:54 PM, Gary  wrote:
>
> >
> > "Adam Richardson"  wrote in message
> > news:aanlktinqixxb9oipu4op2xztrze_vwpbymaywziwb...@mail.gmail.com...
> > > >
> > >>  $sqlStatements = "INSERT INTO guns (manufacturer, type, model,
> caliber,
> > >>
> > > condition, price, description, image_file_name, available) VALUES
> > >
> > > ('$manufacturer',
> > >> '$type',
> > >>
> >
> '$model','$caliber','$condition','$price','$description','$image_file_name','$available');
> > >
> > > INSERT INTO images(id, image_file) VALUES ('', '$image_file')";
> > >
> > >
> > > Gary, the second insert has what appears to be a troublesome bit of
> code:
> > >
> > > VALUES ('', '$image_file')";
> > >
> > > Shouldn't it read:
> > >
> > > INSERT INTO images(image_file) VALUES ('$image_file')";
> > >
> > > That's assuming you have id set to auto-increment, so no id in the
> first
> > > or
> > > second set of parentheses.  Additionally, the ", before the $image_file
> > > var
> > > would cause issues, too.
> > >
> > > Adam
> > > --
> > > Nephtali:  PHP web framework that functions beautifully
> > > http://nephtaliproject.com
> > >
> > >
> > >
> > > __ Information from ESET Smart Security, version of virus
> > > signature database 5078 (20100501) __
> > >
> > > The message was checked by ESET Smart Security.
> > >
> > > http://www.eset.com
> > >
> > >
> >
> > Adam
> >
> > The second INSERT is part of a multi_query, and yes there is a
> > auto-increment field in front named id,  it is the foreign key that links
> > the tables.
> >
> > I had removed, and just tried again, but the same result.
> >
> > I have tried it so many ways my fingers and eyes are about to bleed. It
> > makes not sense how it works in one but not the other.
> >
> > I cant see to get the error called out.
> >
> > Thanks again.
> >
> > Gary
> >
> >
> >
> >
> > __ Information from ESET Smart Security, version of virus
> signature
> > database 5078 (20100501) __
> >
> > 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
> >
> >
> And you also removed the double quote and the comma next to it (sorry, just
> making sure?)  That is to say, you copied the line of code I sent?
>
> $sqlStatements = "INSERT INTO guns( *id,*manufacturer, type, model, //
> *id,*should be removed
> caliber, condition, price, description, image_file_name,submitted
> ,available) VALUES ('*',*'$manufacturer', '$type', '$model', '$caliber',
>   // the *",* combo should be removed
> '$condition', '$price', '$description','$image_file_name', ' ',
> '$available');
>
> INSERT INTO images (*id,* image_file) VALUES('','$image_file')";
>  //
> the *id,* should be removed AND the *",* combo should be removed
>
> Also, have you tried directly echoing out the error (e.g., *echo
> mysql_error();*  if it's mysql you're using, or the comparable method in
> the
> library you're using.)
>
> If that didn't work, I'd break up the multi-query into 2 separate queries
> to
> better troubleshoot the issue.  I like using PDO and setting it up so it
> throws exceptions when something goes wrong (additionally, I like using the
> prepared statements, too.)  Have you been trying that?
>
> I'm still hopeful you'll get this figured out before there's any blood-loss
> ;)
>
> Feel free to send back the new code after the edits if you still have
> issues.
>
> Adam
>
> --
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
>



-- 
A Brandon_R Production


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

2010-05-01 Thread Adam Richardson
On Sat, May 1, 2010 at 6:54 PM, Gary  wrote:

>
> "Adam Richardson"  wrote in message
> news:aanlktinqixxb9oipu4op2xztrze_vwpbymaywziwb...@mail.gmail.com...
> > >
> >>  $sqlStatements = "INSERT INTO guns (manufacturer, type, model, caliber,
> >>
> > condition, price, description, image_file_name, available) VALUES
> >
> > ('$manufacturer',
> >> '$type',
> >>
> '$model','$caliber','$condition','$price','$description','$image_file_name','$available');
> >
> > INSERT INTO images(id, image_file) VALUES ('', '$image_file')";
> >
> >
> > Gary, the second insert has what appears to be a troublesome bit of code:
> >
> > VALUES ('', '$image_file')";
> >
> > Shouldn't it read:
> >
> > INSERT INTO images(image_file) VALUES ('$image_file')";
> >
> > That's assuming you have id set to auto-increment, so no id in the first
> > or
> > second set of parentheses.  Additionally, the ", before the $image_file
> > var
> > would cause issues, too.
> >
> > Adam
> > --
> > Nephtali:  PHP web framework that functions beautifully
> > http://nephtaliproject.com
> >
> >
> >
> > __ Information from ESET Smart Security, version of virus
> > signature database 5078 (20100501) __
> >
> > The message was checked by ESET Smart Security.
> >
> > http://www.eset.com
> >
> >
>
> Adam
>
> The second INSERT is part of a multi_query, and yes there is a
> auto-increment field in front named id,  it is the foreign key that links
> the tables.
>
> I had removed, and just tried again, but the same result.
>
> I have tried it so many ways my fingers and eyes are about to bleed. It
> makes not sense how it works in one but not the other.
>
> I cant see to get the error called out.
>
> Thanks again.
>
> Gary
>
>
>
>
> __ Information from ESET Smart Security, version of virus signature
> database 5078 (20100501) __
>
> 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
>
>
And you also removed the double quote and the comma next to it (sorry, just
making sure?)  That is to say, you copied the line of code I sent?

$sqlStatements = "INSERT INTO guns( *id,*manufacturer, type, model, //
*id,*should be removed
caliber, condition, price, description, image_file_name,submitted
,available) VALUES ('*',*'$manufacturer', '$type', '$model', '$caliber',
   // the *",* combo should be removed
'$condition', '$price', '$description','$image_file_name', ' ',
'$available');

INSERT INTO images (*id,* image_file) VALUES('','$image_file')";  //
the *id,* should be removed AND the *",* combo should be removed

Also, have you tried directly echoing out the error (e.g., *echo
mysql_error();*  if it's mysql you're using, or the comparable method in the
library you're using.)

If that didn't work, I'd break up the multi-query into 2 separate queries to
better troubleshoot the issue.  I like using PDO and setting it up so it
throws exceptions when something goes wrong (additionally, I like using the
prepared statements, too.)  Have you been trying that?

I'm still hopeful you'll get this figured out before there's any blood-loss
;)

Feel free to send back the new code after the edits if you still have
issues.

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


[PHP] pecl install pam and the current bug

2010-05-01 Thread fakessh
hello list
hello guru of php


it is php pecl install pam.
and bugs that prevented the driver from running pam
the driver does not work
I site bug
http://pecl.php.net/bugs/bug.php?id=16995

thanks for advice

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



[PHP] Re: Object or such for building a directory tree?

2010-05-01 Thread Michelle Konzack
Hello tedd,

Am 2010-05-01 11:54:45, hacktest Du folgendes herunter:
> Now on to your problem. You want to take a multidimensional array
> that contains the names of directories and names of the files
> contained therein and show them in a file tree where you can open
> and close the nodes of the tree to show contents -- is that correct?

Yes for the File-Browser.  The IMAP  Browser  need  only  the  directory
structure, but...

> It's pretty simple to populate an array in PHP to contain
> directories and files. To do this via PHP can produce something like
> this:
> 
> http://php1.net/b/file-browser

But where is the PHP script?  There is no link to download the ZIP.

> I'm not happy with the result because it doesn't show a file tree
> complete with clickable nodes.

Yeah...  This is what I am missing too.

> While I am sure it's possible to do this in PHP, I was thinking that
> javascript might provide a better functional solution (i.e.,
> client-side with less trips to the server). Namely have PHP create
> the array and then have javascript show it.
> 
> This is what I found:
> 
> http://labs.abeautifulsite.net/projects/js/jquery/fileTree/demo/

But it uses AJAX which I can not use.  I must check it again, because  I
need a custom connector and have only to output this:


Folder 
Name
(additional folders here)
filename.txt
(additional files here)


which I, more or less, have already.
This mean, for IMAP I have simply to s/./_/g

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator

-- 
# Debian GNU/Linux Consultant ##
   Development of Intranet and Embedded Systems with Debian GNU/Linux

  
 


signature.pgp
Description: Digital signature


[PHP] Re: wondering how to catch notice errors properly

2010-05-01 Thread Rene Veerman
On Sun, May 2, 2010 at 1:06 AM, Rene Veerman  wrote:
> I have an custom error handler that i initialize as such;
>
> error_reporting(E_ALL);
> $oldError_handler = set_error_handler("nonFatalErrorHandler");
>
> with this, notices are still displayed as single line visible html.
> i'd like to catch the notices and push them into a db.
> any ideas on how i do that?
>
http://www.codeunit.co.za/2009/09/09/php-how-to-catch-a-script-warning-or-notice/

has the answer :)


> --
> -
> Greetings from Rene7705,
>
> My free open source webcomponents:
>  http://code.google.com/u/rene7705/
>  http://mediabeez.ws/downloads (and demos)
>
> http://www.facebook.com/rene7705
> -
>



-- 
-
Greetings from Rene7705,

My free open source webcomponents:
  http://code.google.com/u/rene7705/
  http://mediabeez.ws/downloads (and demos)

http://www.facebook.com/rene7705
-

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



[PHP] wondering how to catch notice errors properly

2010-05-01 Thread Rene Veerman
I have an custom error handler that i initialize as such;

error_reporting(E_ALL);
$oldError_handler = set_error_handler("nonFatalErrorHandler");

with this, notices are still displayed as single line visible html.
i'd like to catch the notices and push them into a db.
any ideas on how i do that?

-- 
-
Greetings from Rene7705,

My free open source webcomponents:
  http://code.google.com/u/rene7705/
  http://mediabeez.ws/downloads (and demos)

http://www.facebook.com/rene7705
-

-- 
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-05-01 Thread Gary

"Adam Richardson"  wrote in message 
news:aanlktinqixxb9oipu4op2xztrze_vwpbymaywziwb...@mail.gmail.com...
> >
>>  $sqlStatements = "INSERT INTO guns (manufacturer, type, model, caliber,
>>
> condition, price, description, image_file_name, available) VALUES
>
> ('$manufacturer',
>> '$type', 
>> '$model','$caliber','$condition','$price','$description','$image_file_name','$available');
>
> INSERT INTO images(id, image_file) VALUES ('', '$image_file')";
>
>
> Gary, the second insert has what appears to be a troublesome bit of code:
>
> VALUES ('', '$image_file')";
>
> Shouldn't it read:
>
> INSERT INTO images(image_file) VALUES ('$image_file')";
>
> That's assuming you have id set to auto-increment, so no id in the first 
> or
> second set of parentheses.  Additionally, the ", before the $image_file 
> var
> would cause issues, too.
>
> Adam
> -- 
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
>
>
>
> __ Information from ESET Smart Security, version of virus 
> signature database 5078 (20100501) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>

Adam

The second INSERT is part of a multi_query, and yes there is a 
auto-increment field in front named id,  it is the foreign key that links 
the tables.

I had removed, and just tried again, but the same result.

I have tried it so many ways my fingers and eyes are about to bleed. It 
makes not sense how it works in one but not the other.

I cant see to get the error called out.

Thanks again.

Gary




__ Information from ESET Smart Security, version of virus signature 
database 5078 (20100501) __

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-05-01 Thread Adam Richardson
>
>  $sqlStatements = "INSERT INTO guns (manufacturer, type, model, caliber,
>
condition, price, description, image_file_name, available) VALUES

('$manufacturer',
> '$type', 
> '$model','$caliber','$condition','$price','$description','$image_file_name','$available');

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


Gary, the second insert has what appears to be a troublesome bit of code:

VALUES ('', '$image_file')";

Shouldn't it read:

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

That's assuming you have id set to auto-increment, so no id in the first or
second set of parentheses.  Additionally, the ", before the $image_file var
would cause issues, too.

Adam
-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re[4]: [PHP] A stupid question about classes

2010-05-01 Thread Andre Polykanine
Hello Richard,

thanks a lot!

-- 
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: Richard Quadling 
To: Andre Polykanine 
Date: Saturday, May 1, 2010, 10:49:49 PM
Subject: [PHP] A stupid question about classes

On 1 May 2010 20:38, Andre Polykanine  wrote:
> Hello Nilesh,
>
> So could you illustrate a bit the __construct() function, please?
> Should I pass those variables as parameters of that function? And what
> if I need to change their values?)
> Thanks!

stmp_server = $smtp_server;
$this->domain = $domain;
$this->from = $from;
$this->login = $login;
$this->pass = $pass;
}
}

// Let's create a generic email class and supply all the params.
$Mail = new OireMail('Server', 'Domain', 'f...@domain.com', 'login',
'Passw0rd');


// A more specialised version of the class with all the required params pre set.
Class SpecialisedOireMail extends OireMail {
public function __construct() {
parent::__construct('SpecServer', 'SpecDomain',
's...@specdomain.com', 'SpecLogin', 'SpecPassw0rd');
}
}

// Let's create a specialised version. Note - no need to supply params
as the sub-class deals with that.
$SpecMail = new SpecialisedOireMail();

var_dump($Mail, $SpecMail);
?>

outputs ...

object(OireMail)#1 (6) {
  ["smtp_server"]=>
  string(0) ""
  ["domain"]=>
  string(6) "Domain"
  ["from"]=>
  string(15) "f...@domain.com"
  ["login"]=>
  string(5) "login"
  ["pass"]=>
  string(8) "Passw0rd"
  ["stmp_server"]=>
  string(6) "Server"
}
object(SpecialisedOireMail)#2 (6) {
  ["smtp_server"]=>
  string(0) ""
  ["domain"]=>
  string(10) "SpecDomain"
  ["from"]=>
  string(19) "s...@specdomain.com"
  ["login"]=>
  string(9) "SpecLogin"
  ["pass"]=>
  string(12) "SpecPassw0rd"
  ["stmp_server"]=>
  string(10) "SpecServer"
}


Hope that helps.

-- 
-
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] Any One See where this is going wrong?

2010-05-01 Thread tedd

At 3:18 PM -0400 5/1/10, Gary wrote:

As far as the whole "top posting".  I have been posting on this board for 2
years (give or take), in fact have had a number of exchanges with tedd, (so
I was a little surprised at his response). I have never heard the term top
posting, I had not been asked not to top post.


Okay, so now you know and everything is peachy.

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] Project TIME calculated, in PHP

2010-05-01 Thread Richard Quadling
On 1 May 2010 18:48, justino garcia  wrote:
> tImeArrived = CDate(InputBox("Enter START time:", "Start time", "9:00 AM"))
> TimeLeft = CDate(InputBox("Enter END time:", "End time", "1:24 PM"))
> Minutes = DateDiff("n", TimeArrived, TimeLeft)
> Hours = Int(Minutes / 60)
> Minutes = Minutes - (Hours * 60)
> TotalTime = Format(Hours, "0") & ":" & Format(Minutes, "00")
>
> I did something like this in VBA, but I want to create something for PHP.
>
> How can  extract an am or pm from the input string, convert to 24 hours for
> calculations, then convert back to 12 hour am/pm format in PHP?
>

$Start_AM_PM = date('A', strtotime($_POST['StartTime']));
$End_am_pm = date('a', strtotime($_POST['EndTime']));

http://docs.php.net/manual/en/function.date.php
and
http://docs.php.net/manual/en/function.strtotime.php
>
> I want to be able to put 9:00 am as Time Arrived, and 1:00 PM as Time Left,
> then it puts in the subject the total time i worked on X project.
>
> IN VBA thier is time diff function, how do I create something like that that
> will create a email message, that is then sent to a suplied email, (i.e. our
> ticket system).
>
> Basically I want to transform my VBA code to PHP, so I can run a similar
> idea on my Blackberry so other technicians in our office can send a proper
> email on a blackberry while on call in the road.
>
>
>
> This is what I did in VBA
>
> " Dim OutlookMessage As Outlook.MailItem
> Set OutlookMessage = Application.CreateItem(olMailItem)
> MsgBox ("Welecome To Support Email")
> custname = InputBox("Enter Cust name ", "Enter Cust Name", "Put Cust Name")
> job = InputBox("Work done", "Work", "Short Discrption")
>
> TimeArrived = CDate(InputBox("Enter START time:", "Start time", "9:00 AM"))
> TimeLeft = CDate(InputBox("Enter END time:", "End time", "1:24 PM"))
> Minutes = DateDiff("n", TimeArrived, TimeLeft)
> Hours = Int(Minutes / 60)
> Minutes = Minutes - (Hours * 60)
> TotalTime = Format(Hours, "0") & ":" & Format(Minutes, "00")
>
>
> OutlookMessage.Subject = custname & ": " & Date & "  " & job
> OutlookMessage.To = "b...@blah.com"
> OutlookMessage.CC = "bla...@blah.com"
> OutlookMessage.Body = custname & " " & Chr(13) & Date & Chr(13) & "A: " &
> TimeArrived & Chr(13) & "E:" & TimeLeft & Chr(13) & "Total: " & TotalTime &
> " " & Chr(13)
>
> --
> "
> THanks
> Justin
> IT-TECH
>



-- 
-
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] multi dimensional array question

2010-05-01 Thread Richard Quadling
On 30 April 2010 23:57, Nick Balestra  wrote:
> 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));



outputs ...

23899236

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


Re: Re[2]: [PHP] A stupid question about classes

2010-05-01 Thread Richard Quadling
On 1 May 2010 20:38, Andre Polykanine  wrote:
> Hello Nilesh,
>
> So could you illustrate a bit the __construct() function, please?
> Should I pass those variables as parameters of that function? And what
> if I need to change their values?)
> Thanks!

stmp_server = $smtp_server;
$this->domain = $domain;
$this->from = $from;
$this->login = $login;
$this->pass = $pass;
}
}

// Let's create a generic email class and supply all the params.
$Mail = new OireMail('Server', 'Domain', 'f...@domain.com', 'login',
'Passw0rd');


// A more specialised version of the class with all the required params pre set.
Class SpecialisedOireMail extends OireMail {
public function __construct() {
parent::__construct('SpecServer', 'SpecDomain',
's...@specdomain.com', 'SpecLogin', 'SpecPassw0rd');
}
}

// Let's create a specialised version. Note - no need to supply params
as the sub-class deals with that.
$SpecMail = new SpecialisedOireMail();

var_dump($Mail, $SpecMail);
?>

outputs ...

object(OireMail)#1 (6) {
  ["smtp_server"]=>
  string(0) ""
  ["domain"]=>
  string(6) "Domain"
  ["from"]=>
  string(15) "f...@domain.com"
  ["login"]=>
  string(5) "login"
  ["pass"]=>
  string(8) "Passw0rd"
  ["stmp_server"]=>
  string(6) "Server"
}
object(SpecialisedOireMail)#2 (6) {
  ["smtp_server"]=>
  string(0) ""
  ["domain"]=>
  string(10) "SpecDomain"
  ["from"]=>
  string(19) "s...@specdomain.com"
  ["login"]=>
  string(9) "SpecLogin"
  ["pass"]=>
  string(12) "SpecPassw0rd"
  ["stmp_server"]=>
  string(10) "SpecServer"
}


Hope that helps.

-- 
-
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] Any One See where this is going wrong?

2010-05-01 Thread Richard Quadling
Top Posting is putting your reply BEFORE the question.

A bit like this!



On 1 May 2010 17:37, Gary  wrote:
> What is top posting?
>
> Gary

Why is it bad?

Because you read the reply before the reason for the reply and that
makes our head hurt.

Eventually people actually stop replying to known top posters.

It makes their heads hurt.

So.

In the interest of not hurting any, intentional or otherwise, please
bottom post.

And snip out non relevant content in your reply as not everyone is on
super fast broadband and downloading the many many layers of reply can
be annoying.

Regards,

Richard.

--
-
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[2]: [PHP] A stupid question about classes

2010-05-01 Thread Andre Polykanine
Hello Nilesh,

So could you illustrate a bit the __construct() function, please?
Should I pass those variables as parameters of that function? And what
if I need to change their values?)
Thanks!
-- 
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: Nilesh Govindarajan 
To: php-general@lists.php.net 
Date: Saturday, May 1, 2010, 8:16:37 PM
Subject: [PHP] A stupid question about classes

On 05/01/2010 10:23 PM, Andre Polykanine wrote:
> Hello everyone,
> Just a basic question.
> I have my class starting like this:
>
> Class OireMail {
> // these are required
> public $smtp_server="";
> public $domain="";
> public $from="";
> public $login="";
> public $pass="";
>
> And then go the function themselves.
> I was told that it's better to put the initial variables in the
> __construct() function. What are the advantages of doing that and if I
> need to do it, how would I call the class from another file then?
> Thanks!
>

The advantages of initializing the variables in __construct() is that 
whenever an object of the class is created, the variables have the 
values you expect.

If you don't put them in __construct(), you will have to create another 
method which will have to be called after you have created the object 
using the new operator.

Ultimately its the same thing, __construct() is called automatically, 
only that's the difference.

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


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



Re: [PHP] SharePoint

2010-05-01 Thread Richard Quadling
On 1 May 2010 07:59, Robbert van Andel  wrote:
> 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
>
>

I've not tried cURL, but I have managed to get PHP to talk through an
NTLM proxy.

See my user note on
http://docs.php.net/manual/en/function.stream-context-get-default.php

Unfortunately, the link to an old site I had is dead.

But it was just some long windedness about http://ntlmaps.sourceforge.net/

Though you can use the Way Back When Machine (please make sure your ad
blockers are working - sorry) :
http://web.archive.org/web/20080427012158/http://rquadling.php1h.com/php_ntlm.php

If you go down this route, then also take a look at
http://web.archive.org/web/20080501043118/rquadling.php1h.com/python_ntlm.php
which is more on the same.


What this all means that you use the NTLMAPS proxy to do the NTLM
authentication for you.


But, hopefully, all of this isn't needed and that PHP now supports
NTLM authentication within cURL. Ideally, it should also be available
for regular stream contexts.

Richard.

-- 
-
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] Any One See where this is going wrong?

2010-05-01 Thread Gary

"Adam Richardson"  wrote in message 
news:aanlktil-gwsrxmbbwkcv7gic_ybzv9t4s7eurhpyd...@mail.gmail.com...
> >
>> If the OP does clean his $_POST before putting the results in his 
>> database,
>> his database will look like 'poo' if the wrong person comes along.
>
>
> Gary had mentioned in his initial post he was testing on a local machine 
> and
> would add the checks after resolving this issue.
>
>
>>
>
> Also, the OP's code reads:
>
>  ($image_type == 'image/pjpeg') || ($image_type == 'image/png') &&
>
> That should be:
>
>  ($image_type == 'image/jpeg') || ($image_type == 'image/png') &&
>
>
> Tedd, Gary's original code does include jpeg AND pjpeg types (if you omit
> pjpeg's, you'll miss some images.)
>
> That said, Gary, Tedd did point out some important issues with the logic 
> in
> your code.
>
> Additionally, you were asked politely to not top post, but you continued 
> to
>> do so. If you expect us to help you but you won't accommodate a simple, 
>> and
>> appropriate request, then don't expect any more help from me.
>
>
>> bye!
>
>
> Where was he asked to avoid top-posting in this thread?
>
> What is top posting?
>
>
> Gary, top-posting is when you add your content to an email thread at the 
> top
> (as opposed to the bottom) of the email message.  The preferred method of
> this list's admins is that you add your reply to the bottom of the message
> thread.  So, in future posts, please try to remember to add your message 
> to
> the bottom of the thread instead of the top.  Thanks :)
>
> Gary, what is the INSERT line for the images table supposed to be (it 
> looks
> like it got mangled in your copying and pasting?)
>
> $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";
>
> }
>
>
> Adam
>
> -- 
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com
>
>
>
> __ Information from ESET Smart Security, version of virus 
> signature database 5077 (20100501) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>

Adam

Thank thank you for your reply.

This is the code for the INSERT

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

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

This seems to be the stopping point because when I intentionaly create 
errors (connecting to db) then the error message I created shows up.  None 
of the data is being inserted into the DB.

This script works fine in another DB on the same server.

 $sqlStatements = "INSERT INTO images(caption, where_taken,description, 
file_name, image_file) VALUES ('$caption','$where_taken','$description', 
'$file_name','$image_file');

INSERT INTO keywords (image_id,fox, wolves, wildlife, scenic, birds, eagles, 
deer, small_mammals, large_mammals, dogs, cats, flowers, insects, bear, 
moose) 
VALUES('','$fox','$wolves','$wildlife','$scenic','$birds','$eagles','$deer', 
'$small_mammals', '$large_mammals','$dogs', '$cats', '$flowers', '$insects', 
'$bear', '$moose')";

As far as the whole "top posting".  I have been posting on this board for 2 
years (give or take), in fact have had a number of exchanges with tedd, (so 
I was a little surprised at his response). I have never heard the term top 
posting, I had not been asked not to top post.  Jim Lucas had at the bottom 
of his reply.

Jim Lucas

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

However I read that as a signature line, not a request.

So, sorry if I offended.

Adam

Again, thank you for your response, I appriciate any help you might be able 
to offer.

Gary 



__ Information from ESET Smart Security, version of virus signature 
database 5077 (20100501) __

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] Two color rows in table inside while iteration -- just say no to mod

2010-05-01 Thread Richard Quadling
On 30 April 2010 21:20, 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!)
>
> d
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Ha. OK, I actually do use a bit toggle for assigning a CSS class to
the alternative rows. But I did once use % where the table represented
a top10 list.



-- 
-
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] Getting root privs

2010-05-01 Thread Shawn McKenzie
On 04/30/2010 09:53 AM, Nilesh Govindarajan wrote:
> 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.
> 

Use the sudoers file to allow your apache user to run specific commands
with optional wildcard parameters:

http://linuxmanpages.com/man5/sudoers.5.php

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] multi dimensional array question

2010-05-01 Thread Nick Balestra
Thanks! I'll agree with you abotu ur points, i just started php few days 
ago..so i am in the first phase of learnign it...and this list is so gr8! 
thanks evrybody 

cheers, Nick
On May 1, 2010, at 6:11 PM, Programming Guides wrote:

> On Fri, Apr 30, 2010 at 7:33 PM, Nick Balestra  wrote:
> 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";
> 
> 
> 
> 
> 
> I actually prefer your solution - it's easier to read and understand. On the 
> other hand the solution the book offers has the advantage of being more 
> extensible in that more pieces of information can be added per city.
> 
> One thing I dont like about both solutions is that they both intertwine 
> computation logic with presentation. A *much* better approach in this case is 
> to first calculate all population data you need and put together one data 
> structure that has all of that. Only after you have that ready do you begin 
> to output HTML. And while outputting HTML the only PHP you should need is to 
> iterate over your data structure and output.
> 
> -- 
> http://programming-guides.com



[PHP] Project TIME calculated, in PHP

2010-05-01 Thread justino garcia
tImeArrived = CDate(InputBox("Enter START time:", "Start time", "9:00 AM"))
TimeLeft = CDate(InputBox("Enter END time:", "End time", "1:24 PM"))
Minutes = DateDiff("n", TimeArrived, TimeLeft)
Hours = Int(Minutes / 60)
Minutes = Minutes - (Hours * 60)
TotalTime = Format(Hours, "0") & ":" & Format(Minutes, "00")

I did something like this in VBA, but I want to create something for PHP.

How can  extract an am or pm from the input string, convert to 24 hours for
calculations, then convert back to 12 hour am/pm format in PHP?


I want to be able to put 9:00 am as Time Arrived, and 1:00 PM as Time Left,
then it puts in the subject the total time i worked on X project.

IN VBA thier is time diff function, how do I create something like that that
will create a email message, that is then sent to a suplied email, (i.e. our
ticket system).

Basically I want to transform my VBA code to PHP, so I can run a similar
idea on my Blackberry so other technicians in our office can send a proper
email on a blackberry while on call in the road.



This is what I did in VBA

" Dim OutlookMessage As Outlook.MailItem
Set OutlookMessage = Application.CreateItem(olMailItem)
MsgBox ("Welecome To Support Email")
custname = InputBox("Enter Cust name ", "Enter Cust Name", "Put Cust Name")
job = InputBox("Work done", "Work", "Short Discrption")

TimeArrived = CDate(InputBox("Enter START time:", "Start time", "9:00 AM"))
TimeLeft = CDate(InputBox("Enter END time:", "End time", "1:24 PM"))
Minutes = DateDiff("n", TimeArrived, TimeLeft)
Hours = Int(Minutes / 60)
Minutes = Minutes - (Hours * 60)
TotalTime = Format(Hours, "0") & ":" & Format(Minutes, "00")


OutlookMessage.Subject = custname & ": " & Date & "  " & job
OutlookMessage.To = "b...@blah.com"
OutlookMessage.CC = "bla...@blah.com"
OutlookMessage.Body = custname & " " & Chr(13) & Date & Chr(13) & "A: " &
TimeArrived & Chr(13) & "E:" & TimeLeft & Chr(13) & "Total: " & TotalTime &
" " & Chr(13)

-- 
"
THanks
Justin
IT-TECH


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

2010-05-01 Thread Adam Richardson
>
> If the OP does clean his $_POST before putting the results in his database,
> his database will look like 'poo' if the wrong person comes along.


Gary had mentioned in his initial post he was testing on a local machine and
would add the checks after resolving this issue.


>

Also, the OP's code reads:

  ($image_type == 'image/pjpeg') || ($image_type == 'image/png') &&

 That should be:

  ($image_type == 'image/jpeg') || ($image_type == 'image/png') &&


Tedd, Gary's original code does include jpeg AND pjpeg types (if you omit
pjpeg's, you'll miss some images.)

That said, Gary, Tedd did point out some important issues with the logic in
your code.

Additionally, you were asked politely to not top post, but you continued to
> do so. If you expect us to help you but you won't accommodate a simple, and
> appropriate request, then don't expect any more help from me.


> bye!


Where was he asked to avoid top-posting in this thread?

What is top posting?


Gary, top-posting is when you add your content to an email thread at the top
(as opposed to the bottom) of the email message.  The preferred method of
this list's admins is that you add your reply to the bottom of the message
thread.  So, in future posts, please try to remember to add your message to
the bottom of the thread instead of the top.  Thanks :)

Gary, what is the INSERT line for the images table supposed to be (it looks
like it got mangled in your copying and pasting?)

$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";

}


Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] A stupid question about classes

2010-05-01 Thread Nilesh Govindarajan

On 05/01/2010 10:23 PM, Andre Polykanine wrote:

Hello everyone,
Just a basic question.
I have my class starting like this:

Class OireMail {
// these are required
public $smtp_server="";
public $domain="";
public $from="";
public $login="";
public $pass="";

And then go the function themselves.
I was told that it's better to put the initial variables in the
__construct() function. What are the advantages of doing that and if I
need to do it, how would I call the class from another file then?
Thanks!



The advantages of initializing the variables in __construct() is that 
whenever an object of the class is created, the variables have the 
values you expect.


If you don't put them in __construct(), you will have to create another 
method which will have to be called after you have created the object 
using the new operator.


Ultimately its the same thing, __construct() is called automatically, 
only that's the difference.


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



[PHP] A stupid question about classes

2010-05-01 Thread Andre Polykanine
Hello everyone,
Just a basic question.
I have my class starting like this:

Class OireMail {
// these are required
public $smtp_server="";
public $domain="";
public $from="";
public $login="";
public $pass="";

And then go the function themselves.
I was told that it's better to put the initial variables in the
__construct() function. What are the advantages of doing that and if I
need to do it, how would I call the class from another file then?
Thanks!

-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


-- 
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-05-01 Thread Gary
What is top posting?

Gary


"tedd"  wrote in message 
news:p06240803c801ff96d...@[192.168.1.102]...
> At 11:27 AM -0400 5/1/10, Gary wrote:
>>Jim
>>
>>Thanks for your reponse.  With the variable defined. it is supposed to
>>reduce the size of the image before upload.
>>
>>Thanks again.
>>
>>Gary
>
> Gary:
>
> That is so wrong!
>
> Additionally, you were asked politely to not top post, but you continued 
> to do so. If you expect us to help you but you won't accommodate a simple, 
> and appropriate request, then don't expect any more help from me.
>
> bye!
>
> tedd
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> __ Information from ESET Smart Security, version of virus 
> signature database 5077 (20100501) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
> 



__ Information from ESET Smart Security, version of virus signature 
database 5077 (20100501) __

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-05-01 Thread Gary
Hi tedd

Thanks for your reply.

I have your http://webbytedd.com/b/thumb/ code inserted, and changed to 
this:

 if ( ! isset( $_GET['image_file'] ) ) die( 'Source image not specified' );
 $filename = $_GET['image_file'];

and I get the 'Source image not specified' error message.

I have also tried this

$sqlResult = $batchconnection->multi_query($sqlStatements);
   if($sqlResult == true) {
   echo "Successfully Inserted Records";
   } else {
   echo "mysql_error()";
}

To get the insertion error, but I dont seem to have a handle on it.

I just find it curious that the code works for one and not the other.  Both 
local servers are the same, I have compared DB parameters, looked at the 
code till by eye bleed,,, I just done see it.

Gary
"tedd"  wrote in message 
news:p06240801c801f2dad...@[192.168.1.102]...
> At 1:45 AM +0100 5/1/10, Ashley Sheridan wrote:
>>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']);
>>
>>-
>
> -snip-
>
>>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
>
> Ash:
>
> 'poo'? Wow, you're becoming quite the Hemingway  :-)
>
> If the OP does clean his $_POST before putting the results in his 
> database, his database will look like 'poo' if the wrong person comes 
> along.
>
> Also, the OP's code reads:
>
>  ($image_type == 'image/pjpeg') || ($image_type == 'image/png') &&
>
> That should be:
>
>  ($image_type == 'image/jpeg') || ($image_type == 'image/png') &&
>
> Regardless of IF the code runs OK somewhere else it won't if it's dealing 
> with a jpeg or even a jpg image.
>
> Plus, the logic is screwed because --
>
>   $src = imagecreatefromjpeg($this -> originalFile);
>
> -- always assumes the file is going to be a jpeg, but then later he test 
> for different image types. What's the reason for that?
>
> And I don't see where he provides the values for $newWidth and $newHeight 
> used in the resample.
>
> Here's a simpler example:
>
> http://webbytedd.com/b/thumb/
>
> Just add the png type to the header content.
>
> Cheers,
>
> tedd
>
>
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> __ Information from ESET Smart Security, version of virus 
> signature database 5077 (20100501) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
> 



__ Information from ESET Smart Security, version of virus signature 
database 5077 (20100501) __

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] multi dimensional array question

2010-05-01 Thread Programming Guides
On Fri, Apr 30, 2010 at 7:33 PM, Nick Balestra  wrote:

> 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";
>
>
>
>
>
I actually prefer your solution - it's easier to read and understand. On the
other hand the solution the book offers has the advantage of being more
extensible in that more pieces of information can be added per city.

One thing I dont like about both solutions is that they both intertwine
computation logic with presentation. A *much* better approach in this case
is to first calculate all population data you need and put together one data
structure that has all of that. Only after you have that ready do you begin
to output HTML. And while outputting HTML the only PHP you should need is to
iterate over your data structure and output.

-- 
http://programming-guides.com


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

2010-05-01 Thread tedd

At 11:27 AM -0400 5/1/10, Gary wrote:

Jim

Thanks for your reponse.  With the variable defined. it is supposed to
reduce the size of the image before upload.

Thanks again.

Gary


Gary:

That is so wrong!

Additionally, you were asked politely to not top post, but you 
continued to do so. If you expect us to help you but you won't 
accommodate a simple, and appropriate request, then don't expect any 
more help from me.


bye!

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] Object or such for building a directory tree?

2010-05-01 Thread tedd

At 1:59 PM +0200 5/1/10, Michelle Konzack wrote:

Hello *,

before I reinvent the wheel, I ask here, if someone know an "object"  or
"function" which build from an array of directories (filesystem or IMAP)
a directory tree which can be opened and close?

I have the need to do this for a "local and  remote  filesystem"  and  a
"courier-imap tree".

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator


Hi Michelle:

You have one of the longest signature files I've seen in a while. If 
at all possible, please trim it for the archives.


Now on to your problem. You want to take a multidimensional array 
that contains the names of directories and names of the files 
contained therein and show them in a file tree where you can open and 
close the nodes of the tree to show contents -- is that correct?


It's pretty simple to populate an array in PHP to contain directories 
and files. To do this via PHP can produce something like this:


http://php1.net/b/file-browser

I'm not happy with the result because it doesn't show a file tree 
complete with clickable nodes.


While I am sure it's possible to do this in PHP, I was thinking that 
javascript might provide a better functional solution (i.e., 
client-side with less trips to the server). Namely have PHP create 
the array and then have javascript show it.


This is what I found:

http://labs.abeautifulsite.net/projects/js/jquery/fileTree/demo/

It works for me.

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

2010-05-01 Thread Tommy Pham
> -Original Message-
> From: Robbert van Andel [mailto:swimmer1...@gmail.com]
> Sent: Friday, April 30, 2010 11:58 PM
> To: PHP list - not junk
> Subject: [PHP] SharePoint
> 
> 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)
> 
... 
> 
> 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
> 

Hi,

Is the SharePoint web app security configured as NTLM or Kerberos?  I
presume the authentication type is Windows?  Have you tried
http://user:passw...@domain.com/full/path/of/url?qryParam=value?


Regards,
Tommy


-- 
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-05-01 Thread Gary
Jim

Thanks for your reponse.  With the variable defined. it is supposed to 
reduce the size of the image before upload.

Thanks again.

Gary

"Jim Lucas"  wrote in message 
news:4bdc311b.4060...@cmsws.com...
> 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');
>>
>
> Is the following line suppose to be working with a constant or the 
> variable that you defined/extracted just above here?
>
>> 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') &&
>
> By the use of a variable below, I'm guessing it was suppose to be a 
> variable.
>
>> ($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
>>
>>
>>
>>
>>
>
>
> -- 
> Jim Lucas
>
> A: Maybe because some people are too annoyed by top-posting.
> Q: Why do I not get an answer to my question(s)?
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
>
> __ Information from ESET Smart Security, version of virus 
> signature database 5077 (20100501) __
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
> 



__ Information from ESET Smart Security, version of virus signature 
database 5077 (20100501) __

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-05-01 Thread tedd

At 1:45 AM +0100 5/1/10, Ashley Sheridan wrote:

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

 
 > $description=($_POST['description']);

-


-snip-


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


Ash:

'poo'? Wow, you're becoming quite the Hemingway  :-)

If the OP does clean his $_POST before putting the results in his 
database, his database will look like 'poo' if the wrong person comes 
along.


Also, the OP's code reads:

 ($image_type == 'image/pjpeg') || ($image_type == 'image/png') &&

That should be:

 ($image_type == 'image/jpeg') || ($image_type == 'image/png') &&

Regardless of IF the code runs OK somewhere else it won't if it's 
dealing with a jpeg or even a jpg image.


Plus, the logic is screwed because --

  $src = imagecreatefromjpeg($this -> originalFile);

-- always assumes the file is going to be a jpeg, but then later he 
test for different image types. What's the reason for that?


And I don't see where he provides the values for $newWidth and 
$newHeight used in the resample.


Here's a simpler example:

http://webbytedd.com/b/thumb/

Just add the png type to the header content.

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] Any One See where this is going wrong?

2010-05-01 Thread Jim Lucas

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



Is the following line suppose to be working with a constant or the 
variable that you defined/extracted just above here?



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') && 


By the use of a variable below, I'm guessing it was suppose to be a 
variable.



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








--
Jim Lucas

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

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



[PHP] Object or such for building a directory tree?

2010-05-01 Thread Michelle Konzack
Hello *,

before I reinvent the wheel, I ask here, if someone know an "object"  or
"function" which build from an array of directories (filesystem or IMAP)
a directory tree which can be opened and close?

I have the need to do this for a "local and  remote  filesystem"  and  a
"courier-imap tree".

Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator

-- 
# Debian GNU/Linux Consultant ##
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsyst...@tdnet France   itsyst...@tdnet UG (haftungsbeschränkt)
Gesch. Michelle Konzack  Gesch. Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz   Kinzigstraße 17
67100 Strasbourg/France 77694 Kehl/Germany
Tel: +33-6-61925193 mobil   Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

  
 

Jabber linux4miche...@jabber.ccc.de
ICQ#328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/


signature.pgp
Description: Digital signature


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

2010-05-01 Thread Ali Asghar Toraby Parizy
attachment is correct syntax and solves the problem.
Thanks

On Fri, Apr 30, 2010 at 9:44 PM, Andre Polykanine  wrote:
> 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?
>
>  Header("Content-disposition: attachement; filename=data.txt");
> Header("Content-type: text/plain");
> echo $some_data;
> ?>
>
> --
> Ali Asghar Torabi
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
Ali Asghar Torabi

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



[PHP] SharePoint

2010-05-01 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