[PHP] RE: [PHP-WIN] 5.3.9RC2 and 5.4RC2

2011-11-27 Thread Keith Davis
Thanks Pierre! And thanks Tommy for bringing that up. I've been discussing the 
Wincache issue for some time and also brought it up with the new MS person 
assigned to it, but I had completely forgot to check sqlsrv and that would have 
been a big problem for us.

Keith Davis (214) 906-5183


-Original Message-
From: Pierre Joye [mailto:pierre@gmail.com]
Sent: Sunday, November 27, 2011 9:33 AM
To: Tommy Pham
Cc: php-general@lists.php.net; php-wind...@lists.php.net
Subject: Re: [PHP-WIN] 5.3.9RC2 and 5.4RC2

hi,

I just uploaded two zip for sqlsrv and 5.4. I did not test them and they are no 
official builds, only for testing purposes (so is 5.4 :).

you can find them at http://www.php.net/~pierre/

Cheers,

On Sat, Nov 26, 2011 at 9:43 AM, Tommy Pham tommy...@gmail.com wrote:
 Hi everyone,

 5.3.9RC2 works fine with all my apps so far.  5.4RC2 broke with sqlsvr
 and its PDO in addition to Wincache, which I've already brought to MS'
 attention.  What's the estimated official release of 5.4?  I can't
 wait for the feature session.upload_progress* in 5.4 which I need to
 do some testing as how I can implement that into my existing apps!!!
 That's just awesome!!  Thanks for all your continuous hard work :)

 Platform: Win08R2/IIS7.5 SP1 with current patches running PHP as FastCGI.

 Applications:
 drupal, joomla, mediawiki, wordpress, and a few of my own :)

 Cheers,
 Tommy

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





--
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



This message (including any attachments) may contain confidential or otherwise 
privileged information and is intended only for the individual(s) to which it 
is addressed. If you are not the named addressee you should not disseminate, 
distribute or copy this e-mail. Please notify the sender immediately by e-mail 
if you have received this e-mail by mistake and delete this e-mail from your 
system. E-mail transmission cannot be guaranteed to be secured or error-free as 
information could be intercepted, corrupted, lost, destroyed, arrive late or 
incomplete, or contain viruses. The sender therefore does not accept liability 
for any errors or omissions in the contents of this message or that arise as a 
result of e-mail transmission. If verification is required please request a 
hard-copy version from the sender.

www.pridedallas.com


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



[PHP] RE: [PHP-WIN] 5.3.9RC2 and 5.4RC2

2011-11-27 Thread Keith Davis
Well, she is new to Wincache at least:

Jenny Lawrence

http://forums.iis.net/t/1174639.aspx


Keith Davis (214) 906-5183


-Original Message-
From: Pierre Joye [mailto:pierre@gmail.com]
Sent: Sunday, November 27, 2011 6:20 PM
To: Keith Davis
Cc: Tommy Pham; php-general@lists.php.net; php-wind...@lists.php.net
Subject: Re: [PHP-WIN] 5.3.9RC2 and 5.4RC2

On Mon, Nov 28, 2011 at 1:07 AM, Keith Davis keithda...@pridedallas.com wrote:
 Thanks Pierre! And thanks Tommy for bringing that up. I've been discussing 
 the Wincache issue for some time and also brought it up with the new MS 
 person assigned to it, but I had completely forgot to check sqlsrv and that 
 would have been a big problem for us.

The new person? I did not hear of a new switch lately (there was one earlier 
this year but then not).

Cheers,

 Keith Davis (214) 906-5183


 -Original Message-
 From: Pierre Joye [mailto:pierre@gmail.com]
 Sent: Sunday, November 27, 2011 9:33 AM
 To: Tommy Pham
 Cc: php-general@lists.php.net; php-wind...@lists.php.net
 Subject: Re: [PHP-WIN] 5.3.9RC2 and 5.4RC2

 hi,

 I just uploaded two zip for sqlsrv and 5.4. I did not test them and they are 
 no official builds, only for testing purposes (so is 5.4 :).

 you can find them at http://www.php.net/~pierre/

 Cheers,

 On Sat, Nov 26, 2011 at 9:43 AM, Tommy Pham tommy...@gmail.com wrote:
 Hi everyone,

 5.3.9RC2 works fine with all my apps so far.  5.4RC2 broke with
 sqlsvr and its PDO in addition to Wincache, which I've already brought to MS'
 attention.  What's the estimated official release of 5.4?  I can't
 wait for the feature session.upload_progress* in 5.4 which I need to
 do some testing as how I can implement that into my existing apps!!!
 That's just awesome!!  Thanks for all your continuous hard work :)

 Platform: Win08R2/IIS7.5 SP1 with current patches running PHP as FastCGI.

 Applications:
 drupal, joomla, mediawiki, wordpress, and a few of my own :)

 Cheers,
 Tommy

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





 --
 Pierre

 @pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



 This message (including any attachments) may contain confidential or 
 otherwise privileged information and is intended only for the individual(s) 
 to which it is addressed. If you are not the named addressee you should not 
 disseminate, distribute or copy this e-mail. Please notify the sender 
 immediately by e-mail if you have received this e-mail by mistake and delete 
 this e-mail from your system. E-mail transmission cannot be guaranteed to be 
 secured or error-free as information could be intercepted, corrupted, lost, 
 destroyed, arrive late or incomplete, or contain viruses. The sender 
 therefore does not accept liability for any errors or omissions in the 
 contents of this message or that arise as a result of e-mail transmission. If 
 verification is required please request a hard-copy version from the sender.

 www.pridedallas.com





--
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



[PHP] Up to date book on PHP security?

2011-11-11 Thread Keith Purtell
As a PHP newbie, I was advised to get a book by Chris Shiflett titled 
Essential PHP Security. I looked at Amazon.com but the book appears to 
be more than five years old. Should I get something more up to date?


- Keith


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



[PHP] Error on Signing Encrypting PayPal Website Payment Button with openssl_

2010-07-24 Thread Keith

Hi, anyone has experience creating PayPal Encrypted Website Payment button?
I follow PayPal SDK example but the encrypted value is not correct.

I think the error should be with openssl_pkcs7_sign() since PayPal can 
decrypt it with PayPal private key but does not recognize my signed data. 
PayPal also told me that it is my encryption error.


Please kindly advice on the code below.

Thanks!
Keith
___
//$buttonParams is key=value pair string with \n separation between each 
key=value pair

$mypub = 'file://'.realpath('./mypubcert.pem');
$myprv = 'file://'.realpath('./myprvkey.pem');
$paypalpubcert= 'file://'.realpath('./paypal_cert_pem.pem');

$dataStrFile  = realpath(tempnam('./tmp', 'pp_'));
$fd = fopen($dataStrFile, 'w');
fwrite($fd, $buttonParams);
fclose($fd);

$signedDataFile = realpath(tempnam('./tmp', 'pp_'));
openssl_pkcs7_sign($dataStrFile, $signedDataFile, $mypub, $myprv,array(), 
PKCS7_BINARY);

unlink($dataStrFile);

$signedData = file_get_contents($signedDataFile);
$signedDataArray = explode(\n\n, $signedData);  //I don't understand why 
this code, just follow example only.
$signedData = base64_decode($signedDataArray[1]);  //I don't understand why 
this code, just follow example only.

unlink($signedDataFile);

$decodedSignedDataFile = realpath(tempnam('./tmp', 'pp_'));
$fd = fopen($decodedSignedDataFile, 'w');fwrite($fd, 
$signedData);

fclose($fd);

$encryptedDataFile = realpath(tempnam('./tmp', 'pp_'));
openssl_pkcs7_encrypt($decodedSignedDataFile, $encryptedDataFile, 
$paypalpubcert, array(), PKCS7_BINARY);

unlink($decodedSignedDataFile);

$encryptedData = file_get_contents($encryptedDataFile);
unlink($encryptedDataFile);

$encryptedDataArray = explode(\n\n, $encryptedData);
$encryptedData = trim(str_replace(\n, '', $encryptedDataArray[1])); //why 
this?


$encryptedData = -BEGIN PKCS7-.$encryptedData.-END 
PKCS7-;
$encryptedBtn = form 
action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post'input 
type='hidden' name='cmd' value='_s-xclick'INPUT TYPE='hidden' 
NAME='encrypted' VALUE='$encryptedData'input type='image' 
src='https://www.sandbox.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif' 
border='0' name='submit' alt='PayPal - The safer, easier way to pay 
online!'img alt='' border='0' 
src='https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif' width='1' 
height='1'/form;


echo $encryptedBtn ;
_




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



[PHP] session.gc_ : maxlifetime vs probability/divisor : which has higher priority?

2010-07-22 Thread Keith
From what I read, the session will remain even after maxlifetime until the 

next round session garbage clearance.
This is fine for me.
1) However, will the garbage clearance delete the session whose maxlifetime 
not reach yet?
2) maxlifetime is referrenced to most recent script execution time which has 
session_start() statement or the first time this session id been created?


3)What does the statement below mean?
If different scripts have different values of session.gc_maxlifetime but 
share the same place for storing the session data then the script with the 
minimum value will be cleaning the data.


Does this mean that each script file called within same session, can have 
different maxlifetime? I thought each time each script been called for a 
particular session will overwrite the previous setting if I have I set it 
with ini_set().


Does the selection of minimum value of the statement above applied to 
individual session, or refer to all session within the same folder?


4) How to make sure that the PHP session remained as long as user not 
logout, and if the maxlifetime reach, I can prompt user to decide whether to 
continue the session or abort it.


Thanks for advice. 



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



[PHP] Error when execute header('location: otherpage.php') after email been sent out. Any Workaround?

2009-08-28 Thread Keith
I have a user sign up page that collects sign up information from user with 
form.
This form will then be submitted to another process.php page for setting up 
the user account and send email to the user.
After the email been sent out, the user will be directed back to homepage 
with header(location: index.php).
However, error happen with warning: [Cannot modify header information - 
headers already sent by...]

Any workaround for this?

Thanks for help!
Keith



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



Re: [PHP] Error when execute header('location: otherpage.php') after email been sent out. Any Workaround?

2009-08-28 Thread Keith

Hi all,
Yes, you are right, it was due to echo for testing purpose not been 
commented out prior to header().
However, there is hidden root cause too --  PHPMailer will echo invalid 
address to the screen.
When I have tested with 1 valid email address and 1 invalid with 
someth...@locahost, PHPMailer will echo out the invalid someth...@localhost.
However, in this case, $mail-send() still will return value of TRUE as long 
as at least 1 email been sent out.
After I have commented out all these [echo], no more header issue occur 
again.


It's works too using Floyd's recommended javascript! However, the message 
will echoed out first before redirect to index.php, but this is fast enough 
to be neglectable.


I have one more question regarding error logging.
I have set as below:

ini_set('log_errors', 1);
ini_set('error_log', http://domain.com/log/logfile.txt;);
ini_set('error_reporting', 'E_ALL');
ini_set('error_append_string', '\r\n');

I have simulated an error which can be displayed on screen because I've put 
ini_set('display_errors',1).

However, the error was not been logged.

Which format should I used for log file? *.log or *.txt?

Since I'm using third party web hosting, I can only access web directory, 
should I use

[http://domain.com/log/logfile.*] or
[C:\some_path\domain.com\log\logfile.*] or just
[/log/logfile.*]?

Thanks!
Keith


Floyd Resler fres...@adex-intl.com wrote in message 
news:a536e452-54a2-4f55-8ae0-28e875a59...@adex-intl.com...
Another solution would be to use JavaScript.  In your process.php  script 
you could do this:

printhere
script language=javascript
window.location.href=index.php
/script
here;

Not strictly a PHP solution but it works.

Take care,
Floyd

On Aug 28, 2009, at 5:34 AM, Ashley Sheridan wrote:


On Fri, 2009-08-28 at 17:32 +0800, Keith wrote:
I have a user sign up page that collects sign up information from  user 
with

form.
This form will then be submitted to another process.php page for 
setting up

the user account and send email to the user.
After the email been sent out, the user will be directed back to 
homepage

with header(location: index.php).
However, error happen with warning: [Cannot modify header  information -
headers already sent by...]
Any workaround for this?

Thanks for help!
Keith





You don't need a workaround. The header(Location...) thing will only
work if you have not sent any content to the browser yet. That  includes
even a single space or newline.

It looks like in your process.php page, something is being output to  the
browser. Are you able to do a code dump of that page?

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




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






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



[PHP] Re: [PHP-WIN] Re: [PHP] Problem outputting MySQL Date field

2009-08-28 Thread Keith Davis

But how are you getting the data from the db?

Does $rowqry represent a call using the mysql_fetch_array() function?


Sent from my magic iPhone,
Keith Davis 214-906-5183

On Aug 28, 2009, at 7:39 PM, John Meyer  
johnme...@pueblocomputing.com wrote:



Devendra Jadhav wrote:
No need to do anything special. It should display date as string.  
Can you provide little more information or code snippet?
$tweettable .= preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.] 
*(\?\S+)?)?)?)@', 'a href=$1$1/a',$row[TWEET_TEXT]) .  
br . Sent at:  . $rowqry[TWEET_CREATEDAT];
  $tweettable .= brSent Using:  . $row[TWEET_CREATEDBY] .  
/td/tr;


And I checked the database.  The date is there.

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



This message (including any attachments) may contain confidential or otherwise 
privileged information and is intended only for the individual(s) to which it 
is addressed. If you are not the named addressee you should not disseminate, 
distribute or copy this e-mail. Please notify the sender immediately by e-mail 
if you have received this e-mail by mistake and delete this e-mail from your 
system. E-mail transmission cannot be guaranteed to be secured or error-free as 
information could be intercepted, corrupted, lost, destroyed, arrive late or 
incomplete, or contain viruses. The sender therefore does not accept liability 
for any errors or omissions in the contents of this message or that arise as a 
result of e-mail transmission. If verification is required please request a 
hard-copy version from the sender.

www.pridedallas.com


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



Re: [PHP] Re: Best way to test for form submission?

2009-08-28 Thread Keith

I've encountered issue with checking $_POST['submit']
   if(isset($_POST['submit'])) {}

If the form consists of checkbox/radio and text field, some of my forms can 
be submitted by just press [ENTER] at the end of one of the text field. In 
this case, the $_POST['submit'] is set even the  submit button was not 
clicked.
However, in some of my forms, $_POST['submit'] will not be set if I submit 
the form by pressing [ENTER] in one of the text field.
So, if the later case happen, I need to remind the user to explicitly click 
the [Submit] button.
I don't know why or in what condition that pressing [ENTER] will not submit 
the whole form include the $_POST['submit'].


Keith


Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:1251467419.27899.106.ca...@localhost...

On Thu, 2009-08-27 at 23:21 -0400, Adam Jimerson wrote:

On 08/27/2009 11:09 PM, Adam Jimerson wrote:
 This question might give away the fact that I am a php noob, but I am
 looking for the best way to test for form submission in PHP.  I know in
 Perl this can be done with

 if (param)

 but I don't know if that will work with PHP.  I have read the Learning
 PHP 5 book and the only thing that was mentioned in the book was the 
 use

 of something like this

 print pHello .$_POST['username']./p;

Sorry copied and pasted the wrong line (long day)

if (array_key_exists('username',$_POST))

 I'm sure that this is not the best/recommended way to do this but I'm
 hoping someone here will point me in the right direction.




The best way I've found is to do something like this:

if(isset($_POST['submit']))
{}

Note that in-place of submit you can put the name of any form element. I
chose submit here, because every form should have a submit button. Note
also that this will only work if you have given your submit button a
name:

input type=submit name=submit value=Submit/

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





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



Re: [PHP] Error when execute header('location: otherpage.php') after email been sent out. Any Workaround?

2009-08-28 Thread Keith

Ash, Ben, Thanks!

For my web server, I can access to:
./httpdocs
./httpsdocs

all the http documents are stored inside httpdocs and SSL documents inside 
httpsdocs.
The web root you mean here is referred to ./httpdocs and ./httpsdocs or the 
parent directory of them?
If I  put the logfile inside ./log/logfile.txt where ./log is same level as 
./httpdocs, can the web users access it?


Thanks!
Keith


Ashley Sheridan a...@ashleysheridan.co.uk wrote in message 
news:1251477059.27899.117.ca...@localhost...

On Fri, 2009-08-28 at 09:28 -0700, Ben Dunlap wrote:

 Which format should I used for log file? *.log or *.txt?

Doesn't matter to PHP -- but you do need to provide a local path, not a 
URL.


 [http://domain.com/log/logfile.*] or

No...

 [C:\some_path\domain.com\log\logfile.*] or just

Yes!

Ben


You should try and put the log somewhere that is not in the web root, to
prevent anyone from accessing it and getting information which could
help a hack.


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





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



[PHP] phpmailer send() always return true even the email address is invalid

2009-08-27 Thread Keith
Due to my web hosting server implement SMTP authentication, I couldn't do it 
with PHP mail() function, so I opt for PHPMailer.
However, the $mail-Send() method always return true even I've set the 
$mail-AddAddress with invalid email address.

I've tried with valid address. It's good and I've received the email.
Then I set it with invalid x...@gmail.com, the return value is true, and I 
have received email from mailer daemon that gmail has rejected the email.
Then I set the $mail-Address with invalid name  invalid domain. This time, 
the $mail-Send() still return as true, however, I didn't receive email from 
mailer daemon this time.


Any idea why this happened? Any solution for me or suggestion to use other 
send mail class/function that support SMTP authentication?


Thanks!
Keith 



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



Re: [PHP] phpmailer send() always return true even the emailaddress is invalid

2009-08-27 Thread Keith

Ash, Viktor, Thanks!
Yes, validate the email is the preliminary solution. However, it is still 
possible that the email address is valid but is not exist in the target 
email provider.

I wish to know also if the email can reach the recipient or not.
Actually, I have tested with localhost in my computer, with ArGoSoft Mail 
Server, I'm just using php mail() function.
When the email server was off, or invalid email account of localhost, or 
sending to external email provider (which I have yet to configured the DNS, 
so ArGoSoft cannot resolve it), I'll receive false from the mail() function.
I need to use this info to inform my user whether the mail is successfully 
sent out or not.

Any idea why PHP mail() function can do this in my computer?
Thanks for your valuable advice!


Viktor Popov vpo...@neterra.net wrote in message 
news:4a9682af.7050...@neterra.net...

Ashley Sheridan wrote:

On Thu, 2009-08-27 at 20:38 +0800, Keith wrote:
Due to my web hosting server implement SMTP authentication, I couldn't 
do it with PHP mail() function, so I opt for PHPMailer.
However, the $mail-Send() method always return true even I've set the 
$mail-AddAddress with invalid email address.

I've tried with valid address. It's good and I've received the email.
Then I set it with invalid x...@gmail.com, the return value is true, and 
I have received email from mailer daemon that gmail has rejected the 
email.
Then I set the $mail-Address with invalid name  invalid domain. This 
time, the $mail-Send() still return as true, however, I didn't receive 
email from mailer daemon this time.


Any idea why this happened? Any solution for me or suggestion to use 
other send mail class/function that support SMTP authentication?


Thanks!
Keith


The return code only informs you that the mail was sent successfully,
not that it was received, so you can have invalid email addresses and
still have the function return true.

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




Exactly, you should validate the e-mail addresses before sending the mail.

Something like this:

http://php.dzone.com/news/php-email-validator-email-mx-d 



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



Re: [PHP] Is there limitation for switch case: argument's value?

2009-08-24 Thread Keith

Oh I see. I missed out one thing too.
There is no need to put the same code under both case 7  6 separately, but 
just under case 6 will do.

This is simpler in fact!
Thanks Tedd and Torben!
I'll fix to this style from now onwards.


tedd tedd.sperl...@gmail.com wrote in message 
news:p06240800c6b84328c...@[192.168.1.100]...

At 9:44 PM -0700 8/22/09, Lars Torben Wilson wrote:

Hi Keith,

Glad it works! I'm not sure how inverting the case statement helps you
minimize the code in each case. As both I and Adam showed, you can do
the same thing more efficiently (and IMHO much more readably) like
this:

switch ($sum)
{
case 8:

   break;
case 7:
case 6:
   break;
case 2:
case 1:
   break;
case 0:
   break;
default:
   break;
}



Additionally, I would argue there's nothing different below other than 
it's even more easier to read and understand:


switch ($sum)
   {
case 0:
break;

case 1:
case 2:
break;

case 6:
case 7:
break;

case 8:
break;

default:
break;
   }

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] Is there limitation for switch case: argument's value?

2009-08-22 Thread Keith

Thanks! Torben.
I got the point now and it works! :-)
I'm doing this because the statements of each cases is quite long, and I 
wish to have minimum coding without repetition.



Lars Torben Wilson larstor...@gmail.com wrote in message 
news:36d4833b0908202323p3c858b5fn6a1d6775aa7f8...@mail.gmail.com...

2009/8/20 Keith survivor_...@hotmail.com:

Hi,
I encounter a funny limitation here with switch case as below:
The value for $sum is worked as expected for 1 to 8, but not for 0.
When the $sum=0, the first case will be return, which is sum=8.
Is there any limitation / rules for switch case? Thanks for advice!

Keith


Hi Keith,

Try replacing 'switch($sum)' with 'switch(true)'.

Note that unless you have very good reasons for using a switch
statement like this, and know exactly why you're doing it, it's often
better just to use it in the normal fashion. i.e.:

  switch ($sum)
   {
   case 8:
   break;
   case 7:
   case 6:
   break;
   case 2:
   case 1:
   break;
   case 0:
   break;
default:
   break;
   }

Some people like the syntax you've presented but honestly, there's
usually a better way to do it.

This is also somewhat faster too, although you may only notice the
difference in very tight loops where you're counting every nanosecond.


Regards,

Torben


$sum=0;
switch($sum)
{
  case ($sum==8):
  echo sum=8;
  break;
  case ($sum==7 || $sum==6):
  echo sum=7 or 6;
  break;
  case ($sum==2 || $sum==1):
  echo sum=2 or 1;
  break;
  case 0:
  echo sum=0;
  break;
  default:
  echo sum=3/4/5;
  break;
}
--
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] Is there limitation for switch case: argument's value?

2009-08-22 Thread Keith

Thanks! Adam.
It works now!
Actually I thought that switch block is compatible with if/elseif/else block 
but more efficient if the cases is 3.
Because I like to have short coding without repetition, so I group the 
similar cases together.
Thanks for your explanation! I know where is my mistake already and I've 
learnt a lesson today!


Adam Randall randa...@gmail.com wrote in message 
news:b6d6f8360908202319n240bba5al6c02edb6e890b...@mail.gmail.com...

I've never understood why people use switch statements like this as in
reality you are using it more like an if/else block, but anyway.

The reason why your code is not working is that you are passing into
the switch the value of 0, or false, which means that when any of
those $sum == N conditionals comes up as false (say $sum == 8 ), then
that is what is returned because they match up. In PHP's eyes, 0 ==
false in switch statements.

To fix your code, change the switch( $sum ) to switch( true ):

switch( true )
{
case ($sum == 8):
echo sum=8\n;
break;
case ($sum == 7 || $sum == 6):
echo sum=7 or 6\n;
break;
case ($sum == 2 || $sum == 1):
echo sum=2 or 1\n;
break;
case ($sum == 0):
echo sum=0\n;
break;
default:
echo sum=3/4/5\n;
break;
}

Or, write your switch like this:

switch( $sum )
{
case 8:
echo sum=8\n;
break;
case 6:
case 7:
echo sum=7 or 6\n;
break;
case 1:
case 2:
echo sum=2 or 1\n;
break;
case 0:
echo sum=0\n;
break;
default:
echo sum=3/4/5\n;
break;
}

Regards,

Adam.

On Thu, Aug 20, 2009 at 8:40 PM, Keithsurvivor_...@hotmail.com wrote:

Hi,
I encounter a funny limitation here with switch case as below:
The value for $sum is worked as expected for 1 to 8, but not for 0.
When the $sum=0, the first case will be return, which is sum=8.
Is there any limitation / rules for switch case? Thanks for advice!

Keith

$sum=0;
switch($sum)
{
  case ($sum==8):
  echo sum=8;
  break;
  case ($sum==7 || $sum==6):
  echo sum=7 or 6;
  break;
  case ($sum==2 || $sum==1):
  echo sum=2 or 1;
  break;
  case 0:
  echo sum=0;
  break;
  default:
  echo sum=3/4/5;
  break;
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






--
Adam Randall
http://www.xaren.net
AIM: blitz574 



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



Re: [PHP] Is there limitation for switch case: argument's value?

2009-08-22 Thread Keith
Hahaha! Actually this is my first time coding, so I still adapting the 
correct way to do it.
FYI, for the sake of minimizing the coding and viewing space occupied of the 
code, I even replace the switch block with array if the cases are just 
merely selecting pool of variables/categories/parameters!

I'm still learning the best practice for coding. :-)

Daevid Vincent dae...@daevid.com wrote in message 
news:fef58898dc3544e3872458cd64661...@mascorp.com...

Whoa! I didn't even know you could use a switch statement like that. In 20
years of coding, I've never ever used a switch like that first if/else
style. PHP never ceases to amaze me in it's flexibility (and ability to
shoot yourself in the foot ;-p )

And remember, all your base are belong to Adam.


-Original Message-
From: Adam Randall [mailto:randa...@gmail.com]
Sent: Thursday, August 20, 2009 11:20 PM
To: Keith
Cc: php-general@lists.php.net
Subject: Re: [PHP] Is there limitation for switch case:
argument's value?

I've never understood why people use switch statements like this as in
reality you are using it more like an if/else block, but anyway.

The reason why your code is not working is that you are passing into
the switch the value of 0, or false, which means that when any of
those $sum == N conditionals comes up as false (say $sum == 8 ), then
that is what is returned because they match up. In PHP's eyes, 0 ==
false in switch statements.

To fix your code, change the switch( $sum ) to switch( true ):

switch( true )
{
case ($sum == 8):
echo sum=8\n;
break;
case ($sum == 7 || $sum == 6):
echo sum=7 or 6\n;
break;
case ($sum == 2 || $sum == 1):
echo sum=2 or 1\n;
break;
case ($sum == 0):
echo sum=0\n;
break;
default:
echo sum=3/4/5\n;
break;
}

Or, write your switch like this:

switch( $sum )
{
case 8:
echo sum=8\n;
break;
case 6:
case 7:
echo sum=7 or 6\n;
break;
case 1:
case 2:
echo sum=2 or 1\n;
break;
case 0:
echo sum=0\n;
break;
default:
echo sum=3/4/5\n;
break;
}

Regards,

Adam.

On Thu, Aug 20, 2009 at 8:40 PM,
Keithsurvivor_...@hotmail.com wrote:
 Hi,
 I encounter a funny limitation here with switch case as below:
 The value for $sum is worked as expected for 1 to 8, but not for 0.
 When the $sum=0, the first case will be return, which is sum=8.
 Is there any limitation / rules for switch case? Thanks for advice!

 Keith

 $sum=0;
 switch($sum)
 {
   case ($sum==8):
   echo sum=8;
   break;
   case ($sum==7 || $sum==6):
   echo sum=7 or 6;
   break;
   case ($sum==2 || $sum==1):
   echo sum=2 or 1;
   break;
   case 0:
   echo sum=0;
   break;
   default:
   echo sum=3/4/5;
   break;
 }
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





--
Adam Randall
http://www.xaren.net
AIM: blitz574

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





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



[PHP] Is there limitation for switch case: argument's value?

2009-08-20 Thread Keith

Hi,
I encounter a funny limitation here with switch case as below:
The value for $sum is worked as expected for 1 to 8, but not for 0.
When the $sum=0, the first case will be return, which is sum=8.
Is there any limitation / rules for switch case? Thanks for advice!

Keith

$sum=0; 
switch($sum)
{
   case ($sum==8):
   echo sum=8;
   break;
   case ($sum==7 || $sum==6):
   echo sum=7 or 6;
   break;
   case ($sum==2 || $sum==1):
   echo sum=2 or 1;
   break;
   case 0:
   echo sum=0;
   break;
   default:
   echo sum=3/4/5;
   break;   
} 


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



Re: [PHP] Any conflict with $_POST when 2 users concurrently submitting the same form using POST method?

2009-06-10 Thread Keith

Craige, Marc, Nitsan,Bastien,
Thanks for your reply!
This is my understanding and comment from your replies:

(1) If the web server do have assign anonymous request ID to each HTTP 
request from client browser, and assign $_POST to each request ID and works 
within request ID scope, this is fine with session or without session.


(2) If the above is not the case, then session is required. However web 
server still need to provide each session ID a $_POST array and works within 
this scope.


(3) If the web server does not work in case(1) neither case(2), then include 
user ID into $_POST is appropriate, e.g.

$_POST[userID][input_submitted_name][input_submitted_value]
instead of just
$_POST][input_submitted_name][input_submitted_value].

So, which of the 3 cases above is appropriate?

Thanks!

Craige Leeder clee...@gmail.com wrote in message 
news:4a2e85b3@gmail.com...
While yes $_POST is a supergloabal, even a superglobal has it's own scope. 
The scope of $_POST is to the call of the user to the web server. 
Therefor, no User A's information will not be overwritten by User B's 
information.


Hope this helps. Let me know if you want any further clarification. This 
was just a very simplified answer.


Keith wrote:
Let's say user A and user B submitting purchase order form with 
order.php at the same time, with method=post action='confirmation.php'.


(1)   Will $_POST['order'] submitted by user A replaced by 
$_POST['order'] submitted by user B, and the both user A  B getting the 
same order, which is made by user B? Why?


(2)Since $_POST['xxx'] is superglobal array, will $_POST['order'] 
read by users other than A  B? In shared hosting server environment, are 
all domains hosted within that server using the same $_POST array? Can 
$_POST array accessible by all domains even if not from the originating 
domain?


Thx for clarification!

Keith



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



[PHP] Re: Any conflict with $_POST when 2 users concurrently submitting the same form using POST method?

2009-06-10 Thread Keith

Thanks! Peter.
I’m very clear now.

Peter Ford p...@justcroft.com wrote in message 
news:bd.38.16665.07c6f...@pb1.pair.com...

Keith wrote:

Let's say user A and user B submitting purchase order form with
order.php at the same time, with method=post action='confirmation.php'.

(1)   Will $_POST['order'] submitted by user A replaced by
$_POST['order'] submitted by user B, and the both user A  B getting the
same order, which is made by user B? Why?

(2)Since $_POST['xxx'] is superglobal array, will $_POST['order']
read by users other than A  B? In shared hosting server environment,
are all domains hosted within that server using the same $_POST array?
Can $_POST array accessible by all domains even if not from the
originating domain?

Thx for clarification!

Keith


Other posters have explained, but I'm not sure their explanations are 
clear.

Think of it like this:

User A posts to confirmation.php. When the server receives the request, 
it
starts up a Process and fills the $_POST array with whatever came in, then 
runs

confirmation.php with that information.

User B posts to confirmation.php. When the server receives the request, 
it
starts up a Process and fills the $_POST array with whatever came in, then 
runs

confirmation.php with that information.

The KEY thing is that the process in each case is entirely separate. Each 
makes

it's own copy of the script in its own bit of memory, and each has its own
version of $_POST in its own bit of memory.

The two posts can happen at the same time and they will still be 
completely

independent.

The fact that $_POST is called superglobal does not mean that it is 
shared by
separate requests - it is not even shared by requests in the same session. 
It
just means that it is already declared and you don't need to use the 
global

keyword to access it in your PHP pages.

--
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent 



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



[PHP] Any conflict with $_POST when 2 users concurrently submitting the same form using POST method?

2009-06-09 Thread Keith
Let's say user A and user B submitting purchase order form with order.php 
at the same time, with method=post action='confirmation.php'.


(1)   Will $_POST['order'] submitted by user A replaced by $_POST['order'] 
submitted by user B, and the both user A  B getting the same order, which 
is made by user B? Why?


(2)Since $_POST['xxx'] is superglobal array, will $_POST['order'] read 
by users other than A  B? In shared hosting server environment, are all 
domains hosted within that server using the same $_POST array? Can $_POST 
array accessible by all domains even if not from the originating domain?


Thx for clarification!

Keith 



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



Re: [PHP] PHP LDAP over SSL problems (SOLVED)

2009-04-08 Thread Keith Lawson


 On Fri, Apr 3, 2009 at 10:16 AM, in message
49d5e20c.8302.00a...@sjhc.london.on.ca, Keith Lawson
keith.law...@sjhc.london.on.ca wrote: 

 
 On Thu, Apr 2, 2009 at  5:51 PM, in message 49d53344.7040...@gmail.com, 
 Chris
 dmag...@gmail.com wrote: 
 Keith Lawson wrote:
 Hello, 
 
 I have been working on this problem for some time now and I can't seem to 
 resolve it. Everything I have found on google and php.net says I can connect 
 
 to an LDAP server with SSL by setting TLS_REQCERT never in ldap.conf. I 
 want to eliminate certs from the picture for now just to confirm I can make 
 the connection which is why I have TLS_REQCERT never set. 
 
 I added that setting to my ldap.conf and my test code now works from the 
 command line but it does not work when I call it from a browser. Here is my 
 test: 
 
 ?php
 $ldaphost = ldaps://my.ldap.server;
 
 //ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
 // Connecting to LDAP
 $ldapconn = ldap_connect($ldaphost)
   or die(Could not connect to {$ldaphost});
 ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
 ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
 
 echo var_dump(@ldap_bind($ldapconn, cn=Keithl, ou=Users, o=LH));
 
 It's hard to know -   you're suppressing errors.
 
 Add these 2 lines to your script:
 error_reporting(E_ALL);
 ini_set('display_errors', true);
 
 I've done that and I get the following when I load the page in a browser: 
 Warning: ldap_bind() [function.ldap- bind]: Unable to bind to server: Can't 
 contact LDAP server in /www/doc/INTRA/ktlwiki/ldap- test.php on line 19
 bool(false)
 Can't contact LDAP server
 
 From the command line still works: 
 
 [www]/www/doc/ php ldap- test.php
 bool(true)
 brSuccessbr
 
 As I mentioned the command line call did not work until I added TLS_REQCERT 
 never to ldap.conf. I need to figure out why the apache loadable module is 
 behaving differently than the command line binary. I'm pretty sure the web 
 page is failing because it is still trying to verify the LDAP server's cert. 
 


My problem was that I had compiled Apache against the Solaris 10 openSSL 
libraries version 0.9.7. When I installed OpenLDAP and recompiled PHP I 
manually build new openSSL libs that were version 0.9.8. Rebuilding apache and 
linking to the same openSSL libraries resolved this problem for me. That 
explains why I was seeing different behavior with command line PHP than when I 
called the same code through Apache. 
 
Thanks for the suggestions Chris.

 
 Then get rid of the @ in front of ldap_bind.
 
 Use http://www.php.net/manual/en/function.ldap-  error.php to capture the 
 error message and search for it.
 
 
  
 
 
 The information transmitted is intended only for the person or entity to 
 which it is addressed and may contain confidential and/or privileged 
 material. Any review, retransmission, dissemination or other use of, or 
 taking of any action in  reliance upon, this information by persons or 
 entities other  than the intended recipient is prohibited. If you received 
 this  in error, please contact the sender and delete the material from any 
 computer. 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 


The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential and/or privileged material. Any 
review, retransmission, dissemination or other use of, or taking of any action 
in  reliance upon, this information by persons or entities other  than the 
intended recipient is prohibited. If you received this  in error, please 
contact the sender and delete the material from any computer. 


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



Re: [PHP] PHP module ignores ldap.conf (SOLVED)

2009-04-08 Thread Keith Lawson


 On Mon, Apr 6, 2009 at  7:02 PM, in message 49da8a1b.5070...@gmail.com, 
 Chris
dmag...@gmail.com wrote: 
 Keith Lawson wrote:
 Hello, 
 
 I'm trying to connect to and LDAP server using PHP over SSL. I compiled 
 Openldap from source, installed it and then compiled PHP against that 
 install. I have a tiny PHP script for testing that I have been calling from 
 the command line (php scriptname). Before adding TLS_REQCERT never to 
 ldap.conf that script was failing. After I set that setting in ldap.conf 
 ldaps:// connections work from the command line but when I call the exact 
 same code in a browser it fails. 
 
 (I assume ldap.conf refers to the config for openldap).
 
 PHP doesn't know what ldap.conf is or what it does.
 
 Are you sure you're connecting to the same ldap server? (Stupid question 
 but worth checking).
 
 If you could run apache in standalone mode (see 
 http://bugs.php.net/bugs- generating- backtrace.php for some info about 
 that) you might be able to strace the process to see what's going on.

My problem was that I had compiled Apache against the Solaris 10 openSSL 
libraries version 0.9.7. When I installed OpenLDAP and recompiled PHP I 
manually build new openSSL libs that were version 0.9.8. Rebuilding apache and 
linking to the same openSSL libraries resolved this problem for me. That 
explains why I was seeing different behavior with command line PHP than when I 
called the same code through Apache. 
 
truss (Solaris strace) brought this to my attention, thanks for the suggestions 
Chris.


 


The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential and/or privileged material. Any 
review, retransmission, dissemination or other use of, or taking of any action 
in  reliance upon, this information by persons or entities other  than the 
intended recipient is prohibited. If you received this  in error, please 
contact the sender and delete the material from any computer. 


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



[PHP] PHP module ignores ldap.conf

2009-04-06 Thread Keith Lawson
Hello, 

I'm trying to connect to and LDAP server using PHP over SSL. I compiled 
Openldap from source, installed it and then compiled PHP against that install. 
I have a tiny PHP script for testing that I have been calling from the command 
line (php scriptname). Before adding TLS_REQCERT never to ldap.conf that 
script was failing. After I set that setting in ldap.conf ldaps:// connections 
work from the command line but when I call the exact same code in a browser it 
fails. 

ldd libphp5.so shows that the Apache PHP module is linked to the proper 
openldap library: 

libldap-2.4.so.2 =  /opt/lib/libldap-2.4.so.2

ldd `which php` shows the same library:

libldap-2.4.so.2 =  /opt/lib/libldap-2.4.so.2

Is there any reason the apache loadable module would be ignoring the settings 
in ldap.conf while the CLI works fine? 

Here is my build command for PHP: 
'./configure' '--prefix=/opt' '--with-apxs=/www/apache/bin/apxs' 
'--with-libxml-dir=/usr' '--with-oci8=instantclient,/opt/instantclient_10_2' 
'--with-mysql=/opt/mysql' '--with-mssql=/opt' '--with-gettext' '--enable-ftp' 
'--enable-bcmath' '--disable-debug' '--enable-shared' '--with-ldap=/opt' 
'--with-openssl=/opt' '--enable-sockets' '--with-jpeg-dir=/usr' 
'--enable-gd-native-ttf' '--with-freetype-dir=/usr/sfw' '--with-gdbm=/opt' 
'--with-png-dir=/usr'

TIA
Keith.

 


The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential and/or privileged material. Any 
review, retransmission, dissemination or other use of, or taking of any action 
in  reliance upon, this information by persons or entities other  than the 
intended recipient is prohibited. If you received this  in error, please 
contact the sender and delete the material from any computer. 


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



Re: [PHP] PHP LDAP over SSL problems

2009-04-03 Thread Keith Lawson


 On Thu, Apr 2, 2009 at  5:51 PM, in message 49d53344.7040...@gmail.com, 
 Chris
dmag...@gmail.com wrote: 
 Keith Lawson wrote:
 Hello, 
 
 I have been working on this problem for some time now and I can't seem to 
 resolve it. Everything I have found on google and php.net says I can connect 
 to an LDAP server with SSL by setting TLS_REQCERT never in ldap.conf. I 
 want to eliminate certs from the picture for now just to confirm I can make 
 the connection which is why I have TLS_REQCERT never set. 
 
 I added that setting to my ldap.conf and my test code now works from the 
 command line but it does not work when I call it from a browser. Here is my 
 test: 
 
 ?php
 $ldaphost = ldaps://my.ldap.server;
 
 //ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
 // Connecting to LDAP
 $ldapconn = ldap_connect($ldaphost)
   or die(Could not connect to {$ldaphost});
 ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
 ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
 
 echo var_dump(@ldap_bind($ldapconn, cn=Keithl, ou=Users, o=LH));
 
 It's hard to know -  you're suppressing errors.
 
 Add these 2 lines to your script:
 error_reporting(E_ALL);
 ini_set('display_errors', true);

I've done that and I get the following when I load the page in a browser: 
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Can't 
contact LDAP server in /www/doc/INTRA/ktlwiki/ldap-test.php on line 19
bool(false)
Can't contact LDAP server

From the command line still works: 

[www]/www/doc/ php ldap-test.php
bool(true)
brSuccessbr

As I mentioned the command line call did not work until I added TLS_REQCERT 
never to ldap.conf. I need to figure out why the apache loadable module is 
behaving differently than the command line binary. I'm pretty sure the web page 
is failing because it is still trying to verify the LDAP server's cert. 


 
 Then get rid of the @ in front of ldap_bind.
 
 Use http://www.php.net/manual/en/function.ldap- error.php to capture the 
 error message and search for it.


 


The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential and/or privileged material. Any 
review, retransmission, dissemination or other use of, or taking of any action 
in  reliance upon, this information by persons or entities other  than the 
intended recipient is prohibited. If you received this  in error, please 
contact the sender and delete the material from any computer. 


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



[PHP] PHP LDAP over SSL problems

2009-04-02 Thread Keith Lawson
Hello, 

I have been working on this problem for some time now and I can't seem to 
resolve it. Everything I have found on google and php.net says I can connect to 
an LDAP server with SSL by setting TLS_REQCERT never in ldap.conf. I want to 
eliminate certs from the picture for now just to confirm I can make the 
connection which is why I have TLS_REQCERT never set. 

I added that setting to my ldap.conf and my test code now works from the 
command line but it does not work when I call it from a browser. Here is my 
test: 

?php
$ldaphost = ldaps://my.ldap.server;

//ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
// Connecting to LDAP
$ldapconn = ldap_connect($ldaphost)
  or die(Could not connect to {$ldaphost});
ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);

echo var_dump(@ldap_bind($ldapconn, cn=Keithl, ou=Users, o=LH));
?

This returns true when called from the command line: 
[www]/www/doc/ktlwiki  php ldap-test.php
bool(true)

But when I load the same code through a browser it fails. 

I'm using php 5.2.6, openldap 2.4.11 and openssl 0.9.8i on Solaris 10. I built 
everything from source, PHP has LDAP and SSL support compiled in.

My openldap install is in /opt. Trussing the command line process and the 
apache process shows similar results: 

Command line: 
26651:  open(/opt/lib/libldap-2.4.so.2, O_RDONLY) = 3
26651:  open(ldap-test.php, O_RDONLY) = 4
26651:  resolvepath(/www/doc/INTRA/ktlwiki/ldap-test.php, 
/www/doc/INTRA/ktlwiki/ldap-test.php, 1024) = 36
26651:  open(/opt/etc/openldap/ldap.conf, O_RDONLY)   = 4

Apache process: 
24656:  open(/opt/lib/libldap-2.4.so.2, O_RDONLY) = 6
24818:  open(/www/doc/INTRA/ktlwiki/ldap-test.php, O_RDONLY) = 45
24818:  open(/opt/etc/openldap/ldap.conf, O_RDONLY)   = 4

Any idea why the same code served by apache would ignore the TLS_REQCERT 
setting?!

TIA
Keith

 


The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential and/or privileged material. Any 
review, retransmission, dissemination or other use of, or taking of any action 
in  reliance upon, this information by persons or entities other  than the 
intended recipient is prohibited. If you received this  in error, please 
contact the sender and delete the material from any computer. 


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



[PHP] mysql_query() vs query_database()

2008-10-01 Thread Keith Spiller
Hi,

RE:  mysql_query() vs query_database()

What is the differences between mysql_query and query_database?
Are both compatible with PHP 5 and MySQL 5?
Is one faster than the other?

Thank you for your help.

Keith

[PHP] Restore Leading Zeros in Zip Codes

2008-08-21 Thread Keith Spiller
Hi,

RE:  Restore Leading Zeros in Zip Codes

Does anyone happen to have a script that will restore the leading zeros in a 
mixed data set of 5 digit zip codes and 10 digit zip+4 codes?  Any suggestions?

Thanks,


Keith

Re: [PHP] regex

2008-01-21 Thread Keith Roberts
Can yo upost the code you have got to do the conversion 
so far please?


Regards

Keith

-
Websites:
http://www.karsites.net
http://www.php-debuggers.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-

On Mon, 21 Jan 2008, Peter wrote:


To: php-general@lists.php.net
From: Peter [EMAIL PROTECTED]
Subject: [PHP] regex

I am trying to convert ms access sql to postgresql using php.

I have a sql statement in the form ;-
$sql = SELECT DISTINCT [Table Name].[Column.Name], [Table Name 1].[Column
Name 2] etc.

what I want to end up with is $sql = SELECT DISTINCT table_name.column_name,
table_name_1.column_name_2, 

I have managed to get the caps to lower but I cant work out how to put the _
in place of spaces if the spaces are between [  ].   I either end up with
S_E_L_E_C . or SELECT_DISTINCT_ etc... .

Naturally I have only used part of sql statement and table, column names
have been changed. (Think the one I'm trying on is 2000+ characters. So its
not a case of set number of words/numbers between [] it could be 2 or it
could be 4 etc)

Anyone workout what I am talking about and can help would be appreciated.

Peter

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

2008-01-21 Thread Keith Roberts
Hi Peter. Is this what you want to do. Copy this into a 
*.php page, and then look at it with your browser.


I just refactored one of my heredoc queries to handle your 
problem.


!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 
Transitional//EN

 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;

html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en

head
titleSQL Regex Tester/title
/head

body

?php

echo Version 1 br /;

$this_table = 'MSS TABLE NAME';
$this_id = 5;

$sql = OUT
select * from $this_table
where ID = $this_id
OUT;

echo Contents of \$sql: br /$sql;



echo br /br / Version 2 br /;

$sql = SELECT DISTINCT [Table Name].[Column.Name], [Table Name1].[Column Name 
2];

echo Contents of \$sql: br /$sql;



echo br /br / Version 3 br /;


$this_table = 'MSS TABLE NAME';
$this_id = 5;

$sql = OUT
SELECT DISTINCT
[Table Name].[Column.Name],
[Table Name1].[Column Name 2]
OUT;

echo Contents of \$sql: br /$sql;



echo br /br / Version 4 br /;

$tbl_name  = [Table Name];
$col_name  = [Column Name];

$tbl_name1 = [Table Name1];
$col_name2 = [Column Name 2];


$sql = OUT
SELECT DISTINCT
$tbl_name.$col_name,
$tbl_name1.$col_name2
OUT;

echo Contents of \$sql: br /$sql;


echo br /br / Version 5 br /;

$sql_query = SELECT DISTINCT;

$tbl_name  = [Table Name];
$col_name  = [Column Name];

$tbl_name1 = [Table Name1];
$col_name2 = [Column Name 2];


$tbl_name = strtolower($tbl_name);
$col_name = strtolower($col_name);

$tbl_name1 = strtolower($tbl_name1);
$col_name2 = strtolower($col_name2);


$sql = OUT
$sql_query
$tbl_name.$col_name,
$tbl_name1.$col_name2
OUT;

echo Contents of \$sql: br /$sql;



echo br /br / Version 6 br /;

$sql_query = SELECT DISTINCT;

$tbl_name  = [Table Name];
$col_name  = [Column Name];

$tbl_name1 = [Table Name1];
$col_name2 = [Column Name 2];


// convert to lower case
$tbl_name = strtolower($tbl_name);
$col_name = strtolower($col_name);

$tbl_name1 = strtolower($tbl_name1);
$col_name2 = strtolower($col_name2);


// remove '[]' characters
$tbl_name = trim($tbl_name, []);
$col_name = trim($col_name, []);

$tbl_name1 = trim($tbl_name1, []);
$col_name2 = trim($col_name2, []);


// replace space with '_' character
$tbl_name = preg_replace('/\s/', '_', $tbl_name);
$col_name = preg_replace('/\s/', '_', $col_name);

$tbl_name1 = preg_replace('/\s/', '_', $tbl_name1);
$col_name2 = preg_replace('/\s/', '_', $col_name2);


$sql = OUT
$sql_query
$tbl_name.$col_name,
$tbl_name1.$col_name2
OUT;

echo Contents of \$sql: br /$sql;

?

/body
/html

The above code is not optimal, but it works OK.

I use the heredoc construct to build my sql query strings. 
Saves using all those single and double quote characters.


http://uk2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

HTH

Keith Roberts

-
Websites:
http://www.karsites.net
http://www.php-debuggers.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-

On Mon, 21 Jan 2008, Peter wrote:


To: php-general@lists.php.net
From: Peter [EMAIL PROTECTED]
Subject: Re: [PHP] regex

Well actually not a real lot so far. I'm just trial and error(lots of that)
at the moment. I've only been 'playing with php for about a month or so.
$file = phptest1.txt;
$rep = array (tbl_ , _%, bool default 0, bool default 1, '?');
$wih = array (, _pc, bool DEFAULT FALSE, bool DEFAULT TRUE,  );

if (is_file($file)) :

 $fh = fopen($file, r+) or die(File does not exist);
 while (! feof($fh)) :
  $line = fgets($fh,4096);
  $str = strtolower($line);
  $str_fixed = str_replace($rep, $wih, $str);
 print $str_fixed . br /;
 endwhile;

Then as far as the regexp part for replacing the space inbetween [blah blah
blah] with _ goes it was a case of try delete try delete etc. I may need to
break the string into an array but that in its self adds its own problems.

Think one of my problems is Im try to run before I can crawl with php,
postgre regex etc. Also its fun trying to workout things when all the books
you come across are php/mysql.

Came across an old message in my trawl of the news group that 'may' help
going to give that a try as soon as I get the time. (it was more to do with
replacing | with space between   but it maybe convertable)
Keith Roberts [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

Can yo upost the code you have got to do the conversion so far please?

Regards

Keith

-
Websites:
http://www.karsites.net
http://www.php-debuggers.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-

On Mon, 21 Jan 2008, Peter wrote:


To: php-general@lists.php.net
From: Peter [EMAIL PROTECTED]
Subject: [PHP] regex

I am trying

[PHP] New website dedicated to debugging PHP.

2008-01-20 Thread Keith Roberts
Hi everyone. Please excuse me for cross posting to four 
lists, but I'm aware that not everyone subscribes to all of 
the lists, so I don't want anyone to miss this announcement.


I have written a new website that is dedicated to debugging 
PHP applications.



From the about page:

http://www.php-debuggers.net/home/anyuser/about.php

About php-debuggers

A one-stop resource for Free Open Source PHP debuggers, 
covering all operating systems. This site has been developed 
in, and is maintained in, my spare time. I hope it helps you 
with debugging your PHP applications.


Here at php-debuggers you can:

* Find details of Open Source PHP debuggers available for
  your particular OS, including screenshots, and external
  download links.

* Find download links and installation and configuration
  instructions for PHP debugger modules, such as DBG and
  Xdebug.

* Post forum help requests for problems you have
  installing and configuring DBG or Xdebug PHP modules.

* Find installation and configuration instructions for
  your OS's PHP debugger GUI programs.

* Post forum help requests for problems you have
  installing and configuring the PHP debugger GUI programs
  on your OS.

* Make forum requests for PHP debugger GUI programs to
  be ported to your OS.

* Converse with other Open Source developers to discuss
  porting a particular PHP GUI debugger from one OS to any
  other.

* Add tutorials on the forum for how install and
  configure a particular PHP debugger module, or debugger
  GUI for your OS.

* Post details of Open Source PHP Debugger Projects that
  need more help, or a new maintainer for the project.

To suggest other OS categories, more PHP debugger GUI's, or 
improvements to the website, please see the contact page.


Kind Regards and Best Wishes,

Keith Roberts.


-
Websites:
http://www.karsites.net
http://www.php-debuggers.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-

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



[PHP] RE: [Updated] Previous and Next Month and Year

2007-06-18 Thread Keith Spiller

Hi Guys,

RE:  [Updated] Previous and Next Month and Year

Here is part of my code:

 $month = 6;
 // Current month value, but changes changes with next/prev links.
 // Value used by a mini calendar script phpcalendar...
 // Originally derived via:  $month = date('n', time());
 // And updated with $month = $month +1 for next month
 // And $month = $month -1 for next month
 // So the value will be 1 through 12 for current year's months.
 // And 0, -1, -2 etc. for last year and 13, 14 etc. for next year.

 $prev_month = date('F Y', mktime(0, 0, 0, date(m)-$month, date(d), 
date(Y)));
 $next_month = date('F Y', mktime(0, 0, 0, date(m)+$month, date(d), 
date(Y)));


 echo Month: $month br / \n;
 echo Prev: $prev_month br / \n;
 echo Next: $next_month br / \n;

The result:
 Month: 6
 Prev: December 2006
 Next: December 2007

The desired results would be:
 Month: 6
 Prev: May 2007
 Next: July 2007

And needs to bear in mind the year...

The phpcalendar script is working perfectly with my own next
and prev month links using $month +1 and $month -1.  So I am
trying to get my Event boxes to work in the same way listing
the previous month, current month and next month.

Thanks,


Keith 


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



Re: [PHP] Re: Previous and Next Month and Year

2007-06-17 Thread Keith Spiller

Hi Vlad,

Thank you for taking the time to help me.

The code:
 $prev_month = date('F Y', mktime(0, 0, 0, 0, date('m') - 6, date('Y')));
 $next_month = date('F Y', mktime(0, 0, 0, 0, date('m') + 6, date('Y')));

 echo $prev_month br / \n;
 echo $next_month br / \n;

Generates:
 November 2006 
 December 2006 


The $prev_month value seems correct,
but the $next_month value should be:
 December 2008

Do you see my mistake?


Keith

- Original Message - 
From: Vlad Vlasceanu [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Sunday, June 17, 2007 12:13 AM
Subject: [PHP] Re: Previous and Next Month and Year


time() returns a unix timestamp of the current moment in time (now), so 
in effect you are adding or subtracting 6 seconds to that.

calling:
date('m/d/Y', time());
is the same as calling:
date('m/d/Y');

On the other hand:
mktime(hour, minute, second, month, day, year) generates a timestamp 
such that:

mktime(0, 0, 0, date('d'), date('m') + 6, date('Y'));
would generate a date timestamp 6 months in the future.
or
mktime(0, 0, 0, 0, date('m'), date('Y'));
would generate last day from last month this year.

Word of wisdom: don't rely solely on timestamp calculations e.g. now + 
24 hours and so on, because you may need to take into account daylight 
savings times and such otherwise your calculations may be off.


Vlad

Keith Spiller wrote:

Hi,

RE:  Previous and Next Month and Year   
This is my code:


 $next_month = date('F Y', time()+$month);
 $prev_month = date('F Y', time()-$month);

 echo $prev_month br / \n;  #Result June 2007
 echo $next_month br / \n;  #Result June 2007

What I am trying to do is get the month and year
based upon a + or - $month value.

The variable $month being 6 for the month of June of
the present year of 2007.  
For example ($month -7) would be December 2006,

and ($month +7) would be January 2006.

Please help...  Thank you.

Keith


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



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



[PHP] Appending to an Array

2007-06-16 Thread Keith Spiller

Hi Folks,

RE:  Appending to an Array

Here is my code:

 # PREVIOUS 
MONTH -

   $days = array(
   10=array(/weblog/archive/2004/Jan/02,linked-day),
   12=array(/weblog/archive/2004/Jan/03,linked-day),
   25=array(/weblog/archive/2004/Jan/08,linked-day));
   phpcalendar($year, $month-1, $days, $month_href);
 # 

 # CURRENT 
MONTH --

   $days = array(
   2=array(/weblog/archive/2004/Jan/02,linked-day),
   3=array(/weblog/archive/2004/Jan/03,linked-day),
   8=array(/weblog/archive/2004/Jan/08,linked-day),
   22=array(/weblog/archive/2004/Jan/22,linked-day));
   phpcalendar($year, $month, $days, $month_href);
 # 

 # NEXT 
MONTH -

   $days = array(
   17=array(/weblog/archive/2004/Jan/02,linked-day),
   18=array(/weblog/archive/2004/Jan/03,linked-day),
   19=array(/weblog/archive/2004/Jan/08,linked-day));
   phpcalendar($year, $month+1, $days, $month_href);
 # 


function phpcalendar($year, $month, $days, $month_href) {

 $weekday_lth = 1;

 # 
TODAY --

   $this_day = date('j',time());
   $this_month = date('n', time());
   $this_year = date('Y', time());
   $month_href = ?year=$yearmonth=$month;
   $days .= array($this_day=array(#,today-day));
 # 

 echo div class=\divfloat\;
 echo generate_calendar($year, $month, $days, $weekday_lth, $month_href);
 echo /div;
}


My problem is with the 7th line from the end:
   $days .= array($this_day=array(#,today-day));

I want to append these values to the $days array (if the month, day and year 
match)
but this technique causes a parse error.  Any ideas?  Thanks for your 
help...



Keith 


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



Re: [PHP] Re: Appending to an Array

2007-06-16 Thread Keith Spiller
Awesome Vlad.  You fixed it with your second example perfectly!  Thank you 
so much.


Keith

- Original Message - 
From: Vlad Vlasceanu [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Saturday, June 16, 2007 10:43 PM
Subject: [PHP] Re: Appending to an Array



. is the concatenation operator, usually applies only to strings

try:
$days[] = array($this_day=array(#,today-day));

or actually:
$days[$this_day] = array(#,today-day);

since it looks like you're indexing based on the day


Keith Spiller wrote:

Hi Folks,

RE:  Appending to an Array

Here is my code:

 # PREVIOUS 
MONTH -

   $days = array(
   10=array(/weblog/archive/2004/Jan/02,linked-day),
   12=array(/weblog/archive/2004/Jan/03,linked-day),
   25=array(/weblog/archive/2004/Jan/08,linked-day));
   phpcalendar($year, $month-1, $days, $month_href);
 # 


 # CURRENT 
MONTH --

   $days = array(
   2=array(/weblog/archive/2004/Jan/02,linked-day),
   3=array(/weblog/archive/2004/Jan/03,linked-day),
   8=array(/weblog/archive/2004/Jan/08,linked-day),
   22=array(/weblog/archive/2004/Jan/22,linked-day));
   phpcalendar($year, $month, $days, $month_href);
 # 


 # NEXT 
MONTH -

   $days = array(
   17=array(/weblog/archive/2004/Jan/02,linked-day),
   18=array(/weblog/archive/2004/Jan/03,linked-day),
   19=array(/weblog/archive/2004/Jan/08,linked-day));
   phpcalendar($year, $month+1, $days, $month_href);
 # 



function phpcalendar($year, $month, $days, $month_href) {

 $weekday_lth = 1;

 # 
TODAY --

   $this_day = date('j',time());
   $this_month = date('n', time());
   $this_year = date('Y', time());
   $month_href = ?year=$yearmonth=$month;
   $days .= array($this_day=array(#,today-day));
 # 


 echo div class=\divfloat\;
 echo generate_calendar($year, $month, $days, $weekday_lth, $month_href);
 echo /div;
}


My problem is with the 7th line from the end:
   $days .= array($this_day=array(#,today-day));

I want to append these values to the $days array (if the month, day and 
year match)
but this technique causes a parse error.  Any ideas?  Thanks for your 
help...



Keith


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



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



[PHP] Previous and Next Month and Year

2007-06-16 Thread Keith Spiller

Hi,

RE:  Previous and Next Month and Year


This is my code:

 $next_month = date('F Y', time()+$month);
 $prev_month = date('F Y', time()-$month);

 echo $prev_month br / \n;  #Result June 2007
 echo $next_month br / \n;  #Result June 2007

What I am trying to do is get the month and year
based upon a + or - $month value.

The variable $month being 6 for the month of June of
the present year of 2007.   


For example ($month -7) would be December 2006,
and ($month +7) would be January 2006.

Please help...  Thank you.

Keith

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



Re: [PHP] Sorting Multidimensional Array

2006-10-31 Thread Keith Spiller

Thanks Richard,

But wouldn't order by z interfere with my original order by values?

My code is as follows:

  $fields1  =  ID, Title, Label, Location, Start, End, Time, ;
  $fields1 .=  Description, Organization, Department, Contact, ;
  $fields1 .=  Phone, Email, Global, Board, Committee, Status, TBD_Time ;

  $command  =  SELECT $fields1, TO_DAYS(End) - TO_DAYS(Start) + 1 AS Days 
;

  $command .=  FROM $tablename ;
  $command .=  $WHERETXT ORDER BY $sortby $sortorder ;


I just need to add a new record, but I have to use PHP because the Start and 
End

dates for that record must match the current month...

If I could add the record to the Select statement as you suggest that would 
be wonderful.



Keith


- Original Message - 
From: Richard Lynch [EMAIL PROTECTED]

To: Keith Spiller [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Tuesday, October 31, 2006 10:48 AM
Subject: Re: [PHP] Sorting Multidimensional Array



On Tue, October 31, 2006 11:10 am, Keith Spiller wrote:

RE:  Sorting Multidimensional Array

I'm trying to sort a multidimensional array.  The data was taken from
a mysql query:

$myrow = mysql_fetch_row($result) {
  query[] = $myrow;
}

The purpose is to retrieve the table data and manually add a record,
then sort ASC by the startdate which is the forth field...

Something like:

$test = array_multisort($query, $key = '$query[4]');

Any help would be greatly appreciated.  Thanks,


Don't do that. :-)

For starters, sorting in PHP is MUCH less efficient than in a DB.

Secondly, getting multi-dimensional (sic) arrays in PHP to sort like
you want generates a ton of traffic here, so it must be hard. :-)

You can do somethig like this:

(SELECT x, y, z FROM real_data
UNION
SELECT 'manually', 'inserted', 'data' as z
)
ORDER BY z

And achieve MUCH better results with far less headache.

If 'z' is indexed in real_data, add another ORDER BY z right before
the UNION -- That will probably make it very fast/easy for the DB to
splice in your manually-inserted 'z' value.

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So? 


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



[PHP] Sorting Multidimensional Array

2006-10-31 Thread Keith Spiller

Hi,

RE:  Sorting Multidimensional Array

I'm trying to sort a multidimensional array.  The data was taken from
a mysql query:

$myrow = mysql_fetch_row($result) {
 query[] = $myrow;
}

The purpose is to retrieve the table data and manually add a record,
then sort ASC by the startdate which is the forth field...

Something like:
 
$test = array_multisort($query, $key = '$query[4]');


Any help would be greatly appreciated.  Thanks,


Keith

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



[PHP] Manually Inserted Row

2006-10-31 Thread Keith Spiller

Hi,

RE:  Manually Inserted Row

I'm using PHP to retrieve the values for the manual insert...  I originally 
tried using

an array created from the mysql query and adding one row manaually and then
sorting the multidimensional array.

As Richard pointed out, sorting using the database would be much more 
efficient.


So here I am.  Stuck again...

(SELECT ID, Title, Label, Location, Start, End, Time, Description, 
Organization,
 Department, Contact, Phone, Email, Global, Board, Committee, Status, 
TBD_Time ,

 TO_DAYS(End) - TO_DAYS(Start) + 1 AS Days
 FROM site_calendar_v2
UNION
 SELECT '9', 'No events exist for this month...', '', '', '', 
'-00-00', '00:00:00',

 '', '', '', '', '', '', '1', 'BOX', 'EOG', '', '',
 as z )
WHERE Board='BOX' AND Committee='EOG'
ORDER BY z


This fails.  Any ideas how I can fix this manually inserted row?
Thanks,


Keith 


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



[PHP] URL Rewrite???

2006-06-13 Thread Keith
Hi all

Not really a php issue per se - sorry.
But I'm sure someone here is bound to know the answer. :-)

I have a main site that is accessible at say 
http://www.somedomain.com/somedir/; but I want visitors to be able to 
access the site using simply http://www.somedomain.com; AND for the 
resulting URL displayed to STILL say http://www.somedomain.com;  and not 
http://www.somedomain.com/somedir/;.

Should this be possible using the .htaccess file and some mod_rewrite rule? 
Toyed around with that but couldn't get it to work.

ANY help would be greatly appreciated, thanks

P.S. Platform: Linux RedHat (running Apache)

scorpy 

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



Re: [PHP] Re: php4 vs. php5

2006-02-02 Thread Keith Proctor
I need to add two numbers together, unfortunately one of them is a  
string that starts with a character.  I'd like to convert a string  
such as 'x5' to the number 5.  Don't care about it's final type as  
that isn't the hard part. :)  I can't find a function to do this.  I  
looked in the math class and in the string class and there doesn't  
seem to be something to help.  I, of course, could write something to  
handle it but I would prefer to use something built in.  Any help  
would be appreciated.


Thanks,
Keith

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



[PHP] chown function

2005-10-03 Thread Keith Spiller
Hello,

I'm using:

chown($endpath, admin);

to try to change the owner of directories after using mkdir()
to create them.  It continues to fail on my remote Fedora server.

I know the path is correct because mkdir() works perfectly.
Apache sets the owner as 48 when the directory is created.

I am not running in safe mode.

The php.net documentation does not make certain things
clear to me...  For example, do I need to be using a user id
number instead of a name?  Will the chown only work if
the server is setup as a super user?

Any help would be greatly appreciated.


Larentium

Re: [PHP] chown function

2005-10-03 Thread Keith Spiller

Hi Jasper,

When using my Php script, I don't see any error messages.

I have logged in using SSH, but the directories created are
owned by 48 and not my ftp user and so I have to switch
to a super user to make any changes.

Also, even though I use:
mkdir($endpath, 0777);
The resulting directories end up as 755.

Yeah I have a feeling that you are right, that apache on
my server does not have chown permissions.

Thank you very mych for your help.


Keith

- Original Message - 
From: Jasper Bryant-Greene [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Monday, October 03, 2005 11:27 PM
Subject: Re: [PHP] chown function



Keith Spiller wrote:

I'm using:

chown($endpath, admin);

to try to change the owner of directories after using mkdir()
to create them.  It continues to fail on my remote Fedora server.


With what error message? Have you tried logging in with SSH or similar and 
trying the same command?


More than likely the user apache is running as doesn't have permissions to 
chown -- in fact I believe that in order to chown files one must be root 
(at least that's the way it seems to work on my system).


You could use chmod instead to allow the admin user access to your 
files.


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

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


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



Re: [PHP] placing values in html teaxtarea

2004-07-12 Thread Keith Greene
textareas do not use the value attribute. instead, the value is placed 
between the textarea/textarea tags:

textarea name=zoutput rows=20 cols=70 wrap /? echo $test; 
?/textarea

At 08:09 AM 7/12/2004, Hull, Douglas D wrote:
After doing calculations etc on my data I am wanting to place it in a 
textarea form in html.  I am having trouble getting my data to show up in 
my texarea.  For example, say after all my calculations I my field called 
$test ends up containing This is a test.  Here is what I tried:

textarea name=zoutput rows=20 cols=70 wrap value=? echo $test; 
? / /textarea

I can add the $test to input like this but not a textarea.
Name: input type=text name=zfname value=? echo $test; ?/ br
Is this possible?
Thanks,
Doug
--
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] OO woes

2004-07-12 Thread Keith Greene
$query = 'INSERT into aeMail set test=\''.$_POST[test].'\'';
Your quotes look screwy to me. You seem to be missing both trailing single 
quotes.
try this:

$query = 'INSERT into aeMail set test=\'''.$_POST[test].'\''';
At 01:07 PM 7/12/2004, Matthew Sims wrote:
PHP version 5.0.0RC3 (cgi) (built: Jul  9 2004 13:18:24)
I'm just getting my feet wet with OO and have run into a problem that I'm
not familiar with...yet.
I have a class that does a database connection and query all together. It
all works nicely untiluntil my query has a word with quotes around it.
I've tried addslashes and mysql_escape_string but when I do I get a Fatal
Error. It occurs in the execute($query) function down below.
I'm also using the recommended php.ini file...magic quotes off and all.
*
class DB_Mysql {
  protected $user;  // Database username
  protected $pass;  // Database password
  protected $dbhost;// Database host
  protected $dbname;// Database name
  protected $dbh;   // Database handle
  public function __construct($user, $pass, $dbhost, $dbname) {
$this-user = $user;
$this-pass = $pass;
$this-dbhost = $dbhost;
$this-dbname = $dbname;
  }
  protected function connect() {
$this-dbh = mysql_connect($this-dbhost, $this-user, $this-pass);
if (!is_resource($this-dbh)) {
  throw new Exception;
}
if (!mysql_select_db($this-dbname, $this-dbh)) {
  throw new Exception;
}
  }
  public function execute($query) {
if (!$this-dbh) {
  $this-connect();
}
// My $query has quotes in it
// I try to escape the quotes
$query = mysql_escape_string($query);
// It causes an error
$ret = mysql_query($query, $this-dbh);
if (!$ret) {
  // An Exception error is thrown
  throw new Exception;
} elseif (!is_resource($ret)) {
  return TRUE;
} else {
  $statment = new DB_MysqlStatement($this-dbh, $query);
  return $statement;
}
  }
}
*
My query statement is:
$query = 'INSERT into aeMail set test=\''.$_POST[test].'\'';
I call the class as follows:
$dbh = new DB_Mysql(user,passwd,localhost,test);
$query = 'INSERT into aeMail set test=\''.$_POST[test].'\'';
$dbh-execute($query);
If the $_POST variable does not contain any quotes, the class works
perfectly. But whenever quotes are passed through, I get the following
error:
Fatal error: Uncaught exception 'Exception' in
/www/htdocs/classes/db_class.php:53 Stack trace: #0
/www/htdocs/letter.php(51): DB_Mysql-execute('INSERT into aeM...') #1
{main} thrown in /www/htdocs/classes/db_class.php on line 53
--Matthew Sims
--http://killermookie.org

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


[PHP] Common MySQL database function class

2004-07-08 Thread Keith Lawrence
Hi there,

I'm a web-developer and I work with PHP as often as I can (it's infinitely
preferable to ASP) and as a result of this I end up coding in lots of
different environments. Our local dev server is a windows machine which acts
differently to the multitude of *nix boxes which our clients run. Some have
safe-mode enabled (apparently a good safety measure for a shared-hosting
solution), some run with magic_quotes on, some with magic_quotes off,
register globals on/off, etc etc ad nauseum. Usually this isn't much of a
problem as I tend to only work on one major project at a time and I can set
up our local windows box to emulate the live server, but it would be very
useful to me if I could ask for your collective knowledge on building an
include file (or class) of common database functions. This class would take
into account whether the server has magic_quotes enabled and cater for it,
different login strings depending on the environment variables (for dev and
live environments) as well as catering for any other strange
platform-dependent niggles that I've left out. It'd also have methods to
fetch:
* just one specific value from the database 
* an array of rows from the database
* run an arbitrary query (insert/update/delete) and return success/failure
and optionally populate the identity id/error message/etc.

I hasten to add that I'm not asking for someone to build this for me, but
rather asking for any pointers/tips for things I should watch out for or
links that might help. I've searched extensively for something like this but
haven't found one that does exactly what I want. Am I re-inventing the wheel
here? Does anyone else who works on multiple platforms have these problems?

Many thanks (in advance) for any help,

Regards,
Keith
 
 http://www.pi-squared.co.za/ 

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



Re: [PHP] Malicious SQL

2004-07-07 Thread Keith Greene
For example, if you are not quoting your criteria:
sql = mysql_query(select * from users where name=.$name);
if someone enters the following in the name field, you're toast:
Jim; delete from users;
on the contrary:
sql = mysql_query(select * from users where name='.$name.');
will simply look for a user with a name of Jim; delete from users; and 
return no results found.

This is just one example.
Your queries look fine.
At 08:58 AM 7/7/2004, Gabe wrote:
Can someone help me understand how people are able to use SQL maliciously 
if you don't protect against it in PHP?  For example, I've written a very 
simple search SQL statement that takes the value of a variable for the 
search criteria ( from a webpage form ).  I don't understand how someone 
could enter an SQL statement that could be malicious.  Here's the SQL 
statement that I run once I have the search criteria stored in $strCriteria:

SELECT autoQuesID, fldQuesTitle, fldBody FROM tblFAQ_Question WHERE 
(blnHidden = FALSE AND ((fldBody LIKE '%$strCriteria%') OR (fldQuesTitle 
LIKE '%$strCriteria%')));

I know in general that protecting against someone entering SQL is a must 
.  So I guess I'm just wondering if anyone has any real-world experience 
with how people can take advantage of SQL and forms.

Thanks!
Gabe
--
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] binary data over UDP with PHP?

2004-07-07 Thread Keith Greene
I use the following without problem:
$fp = fsockopen(udp://www.server.com, 24250, $errno, $errstr, .2);
if (!$fp) {
 $status = Server not available;
} else {
$trigger = 
chr(hexdec('FF')).chr(hexdec('FF')).chr(hexdec('01')).chr(hexdec('00'));
fwrite($fp,$trigger);   # Send trigger to the 
status server
$junk = fread($fp, 4);  # discard echoed command 
from status server
}

Keith
At 04:23 PM 7/7/2004, coder_1024 wrote:
I'm trying to send some binary data to a UDP server using PHP.  The examples
I've been able to find show sending binary data over TCP, or they show
sending text over UDP.
I'm constructing the messages using the below:
  $text_msg = Hello, World\r\n;
  $binary_msg = chr(0x01).chr(0x02).chr(0x00).chr(0xAD);
  $binary_msg_size = 4;
I've tried a couple methods of sending the data:
  $fp = fsockopen(udp:// . $host,$port,);
  fwrite($fp,$binary_msg,$binary_msg_size);
and
  $sock = socket_create(AF_INET,SOCK_DGRAM,SOL_UDP);
  socket_sendto($sock,$binary_msg,$binary_msg_size,0,$host,$port);
In either case, a UDP packet is sent, but with a zero data size.  If I
instead send the $text_msg, it works as expected.  For some reason sending
the binary data doesn't work.
Does anyone have insight into how to send binary data over UDP using PHP?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] images outside of document root

2004-07-06 Thread Keith Greene
I use a system like that described below, however I added some checks to 
thwart attack.
first, the image serving script checks to make sure the user has a session 
id. This prevents people just loading the script to get the images, and 
also deters hot linking.
second, I have a script that runs once an hour and generates a random word 
and saves it to a text file. That file is read by the page that calls the 
image serving script, and the word contained within is md5 hashed, then 
passed to the image serving script like this:
img src='imgserv.php?i=joe.jpgh=fc5e038d38a57032085441e7fe7010b0' border=0

the image serving script then loads the same text file, hashes the word 
within and compares the hashes. If they don't match, the link is over an 
hour old and the image isn't served.

I know there are circumstances where an image can be hotlinked and 
viewable, but the hotlink only works for an hour, and only for people who 
have actually visited my site during their current browser session, and 
this I can live with.

Keith
At 01:20 PM 7/6/2004, Dennis Gearon wrote:
I may do that, but the 'showimage.php' file then has to be in the document 
root, and can be attacked a LOT.

I have found ways to do inline images, without javascript, I believe.
Curt Zirzow [EMAIL PROTECTED] wrote:
* Thus wrote Dennis Gearon:
I want to keep an entire library OUTSIDE of the document root. The 
library includes some imgages. How can I have the browser include the imageges?
I've hard of BASE64'ing the images into the header and decoding them 
using javascript. Is this the best way? Where is code to do that?

no, its probably the worst way.
To have the browser reference images outside the document root
you'll have to create a php wrapper function that decides on what
to do:
img src=/showimage.php?file=foobar.jpg
showimage.php:
?php
$file = $_GET['file'];
// authentication if needed...
// check for valid file, etc..
header('Content-Type: image/jpeg'); // send right content type
readfile($path_outside_docroot . $file);
--
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] include question

2004-06-21 Thread Keith Greene
Aaron,
I copied your code to a test file called test.php and created the following 
pages as dummy includes:
verify_faculty_info.php, functions.php and accesscontrol.php
in functions.php, I created a dummy search function:
function search(){
return Found!BR;
}

in verify_faculty_info.php, I made a call to the search function thusly:
echo search();
the test page, when called with the action=verify outputs the following:
verifying nowFound!
Found!
If you are not getting the output you are expecting, it probably isn't 
because of a function not being available, but more like variables are not 
available to the function.
Are you getting any error messages at all?

Keith
At 08:31 AM 6/21/2004, Aaron Axelsen wrote:
Below is the chunk of code i am using.  In the verify_faculty_info.php
file i call the search function.  The search function is coded in the
function.php file which is included in the accesscontrol.php.
I thought that it would carry over to the verify_Faculty_info.php file.
Was I mistaken?
Thanks
?php
include('accesscontrol.php');
if (isset($_GET['action'])){
  if ($_GET['action'] == add  $_SESSION['role'] == 1) {
include('includes/add_product.php');
  } elseif ($_GET['action'] == verify) {
echo verifying now;
search();
include('includes/verify_faculty_info.php');
  } else {
echo action asked for is not specified;
  }
} else {
   echo action is not specified;
}
?
--
Aaron Axelsen
aim: aaak2
email: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Problem with mail()

2004-06-17 Thread Keith Aldridge
New to php, can't see the problem with mail().

 

Server running 4.0.0

Path to sendmail: /var/sbin/sendmail

 

Using a simple form for test purposes, collect three pieces of info:
name, address, csz then POST to the page containing the code below.

 

All of the echo statements produce the expected results, including the
'Successful send' in the if mail() section; but the email is never
received.

 

?php

$name = $HTTP_POST_VARS['name'];

$address = $HTTP_POST_VARS['address'];

$csz = $HTTP_POST_VARS['csz'];

$to = '[EMAIL PROTECTED]';

$subj = 'Sending Mail thru Forms';

$body = You have given the following info:

If this is not correct, be sure and

notify us right away.



Name:  $name

Address:  $address

City, State and Zip code:  $csz;

 

echo ($name br/);

echo ($address br/);

echo ($csz br/);

?

 

?php

if (mail($to, $subj, $body)) {

echo (Successful send);

}

else {

echo (Failed);

}

?

 

any / all suggestions would be greatly appreciated, I'm having no luck
with tech support at the ISP.

 

Thanks in advance,

 

Keith mailto:[EMAIL PROTECTED] 



Re: [PHP] Re: What's this

2004-06-17 Thread Keith Greene
This stuff is common in PHPbb. Usually you will find the constants like 
that located in the template files. The definitions for those constants are 
usually found in the php file associated with that template file. For example,
if you found form method=post action={S_MODE} in 
/templates/subsilver/memberlist_body.tpl, the definition for that constant 
would probably be found in /memberlist.php, like this:
'S_MODE' = append_sid(memberlist.$phpEx))

Hope this helps.
Keith
At 05:30 AM 6/17/2004, Pieter from SA wrote:
This type of action is used in a lot of files in PHPbb.
I need to change someting in the Jump to at the bottom of Search and
memberlist pages.
Pieter From Sa [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi

 This has me confused, is this Java or a php class, a constant or what?, i
 have never seen this kind of action.

 form method=post action={S_MODE}

 In what type of file will i find the S_MODE.

 Thanks
--
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] src=test.php

2004-06-16 Thread Keith Greene
I don't think there is a standard for the extensions of these files. In 
fact, this page: http://www.w3c.org/TR/CSS1#basic-concepts
uses a url of http://style.com/cool; as an example of an external style sheet.

Also, I use a .php file as a javascript include on my site. The script is 
included on other websites as a js include as well so others can see what's 
new on my site.
I haven't had any problems or complaints so far.

At 10:58 AM 6/16/2004, Chris W. Parker wrote:
Gerben mailto:[EMAIL PROTECTED]
on Wednesday, June 16, 2004 10:38 AM said:
 I wondering how browsers handle the following html-codes:

 link rel=stylesheet src=style.php /
 and
 script type=text/javascript src=code.php/script

 are there any browser that will choke in it because the files don't
 have the appropriate (.css and .js) extension?
although i don't have an answer specifically, you might try having your
webserver process .js and .css files just like it would .php files. that
way you can use the correct extensions in your html and *still* have the
web server do what you want it to do.

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


[PHP] intermittent problems using ftp_get ...Help!

2004-04-13 Thread Keith
Hi all

Can anyone tell me what would cause intermittent problems downloading files
using ftp_get.
I have a php file that regularly connects to a number of servers in turn
using php's (ftp functions) and downloads files using ftp_get(...). This
usually works but often it just fails to download a file and ends up giving
a timeout error. Also it seems it can be any file.

I just cannot understand why when I run the script a number of times in
sucsession this will sometimes but not others. Any ideas?

p.s. The files I am downloading are '.sql' text files.

Thanks
K

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



Re: [PHP] intermittent problems using ftp_get ...Help!

2004-04-13 Thread Keith
Hi Red
Thanks, I had wondered about connection limitations, but frankly I'd be
surprised if that were the problem.
But as we are on this subject, I use proftpd and the MaxClients value is not
set yet. As I understand it I can set MaxClients to 'none' which removes any
maximum restriction. But what is the default number of connections allowed?

My proftpd version 1.2.5
Server = Cobalt Raq4

Thanks again
K



Red Wingate [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Maybe the max number of connections to the FTP server is reached? My
 provider allows only up to 3 FTP connections at the same time which causes
 similar problems to my scripts :-)

   -- red

 [...]
  Can anyone tell me what would cause intermittent problems downloading
files
  using ftp_get.
  I have a php file that regularly connects to a number of servers in turn
  using php's (ftp functions) and downloads files using ftp_get(...). This
  usually works but often it just fails to download a file and ends up
giving
  a timeout error. Also it seems it can be any file.
 
  I just cannot understand why when I run the script a number of times in
  sucsession this will sometimes but not others. Any ideas?
 [...]

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



Re: [PHP] intermittent problems using ftp_get ...Help!

2004-04-13 Thread Keith
Well the servers do indeed have firewalls! But why would this be
intermittent and how can I get around this WITHOUT removing the firewall :)

Thanks
K


Raditha Dissanayake [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Keith wrote:

 Hi all
 
 Can anyone tell me what would cause intermittent problems downloading
files
 using ftp_get.
 I have a php file that regularly connects to a number of servers in turn
 using php's (ftp functions) and downloads files using ftp_get(...). This
 usually works but often it just fails to download a file and ends up
giving
 a timeout error. Also it seems it can be any file.
 
 
 an offending firewall is a possibility


 -- 
 Raditha Dissanayake.
 -
 http://www.radinks.com/print/upload.php
 SFTP, FTP and HTTP File Upload solutions

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



Re: [PHP] intermittent problems using ftp_get ...Help!

2004-04-13 Thread Keith
But that's just it , I am using ftp_pasv($idconn, true) and yes I have
placed it after the connection and login statement.

Any other ideas?
K

Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 * Thus wrote Keith ([EMAIL PROTECTED]):
  Well the servers do indeed have firewalls! But why would this be
  intermittent and how can I get around this WITHOUT removing the firewall
:)

 ftp servers behind firwalls tend to require PASV to be on. check
 out http://php.net/ftp_pasv


 Curt
 -- 
 I used to think I was indecisive, but now I'm not so sure.

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



[PHP] Problem uploading large files via PHP (20+ MB)

2004-03-19 Thread Schonrock III, Keith H
All,

I am attempting to upload a large file via PHP to a web server running
Windows XP Pro IIS 5.1 and I am having some problems.  I have been trying to
find the right combination of settings in the php.ini file and elsewhere to
get large files to upload properly, but I keep getting a DNS error in
Internet Explorer 6 that shows up after about 12MB or 12.5MB of a 21.7MB
file has been transferred.  

When I looked at the IIS website connection timeout it was set at 900
seconds.  I have tried many different variations in the php.ini settings
file with little success.  I have tried using the 8M format and also the
full out Byte count for size fields in the php.ini file.  I can upload files
that are smaller that 10 MB (I tested with one that was 9MB earlier) with no
problem.  Here are my most recent relevant settings in my php.ini file (that
I know of):

  max_execution_time = 3600
  max_input_time = 3600
  memory_limit = 104857600
  post_max_size = 104857600
  upload_max_filesize = 104857600

Does anyone have any ideas?  Am I missing something else?  If you need any
more information that I left out please let me know.  My code for the php
files is located below this message.  Any help is greatly appreciated!

Thanks,
Keith

-Sending php file:

html
body
center
bThis is a test document/b
p
form enctype=multipart/form-data action=upload2.php method=post
 Send this file: input name=userfile type=file /
 input type=submit value=Send File /
/form
/body
/html

-Receiving php file:

html
body
?php
$uploaddir = 'c:\\new\\out\\';
$uploadfile = $uploaddir . $_FILES['userfile']['name'];

print pre;
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
   print File is valid, and was successfully uploaded. ;
   print Here's some more debugging info:\n;
   print_r($_FILES);
} else {
   print Possible file upload attack!  Here's some debugging info:\n;
   print_r($_FILES);
}
print /pre;

? 
/body
/html

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



Re: [PHP] Problem uploading large files via PHP (20+ MB)

2004-03-19 Thread Schonrock III, Keith H
Well, I tried the process with Mozilla and the transfer was blazing fast
compared to IE and it completed successfully with no DNS errors.  IE is very
slow and consistently gets those DNS errors.  I did turn on logging and
found that this error is being produced whenever the DNS error shows up:

  The script started from the URL '/php/upload2.php' with parameters '' has
not responded within the configured timeout period.  The HTTP server is
terminating the script.

Since I need to get IE working with this process I guess my next question is
this:  In IIS 5.1 on Windows XP Pro, how do you increase the configured
timeout period?  As I stated before, when I go to the Control
Panels-Administrative Tools-Internet Information Services and look at the
Properties for my Default website the connection timeout is set to 900
seconds.

Thanks,
Keith

Vincent DUPONT wrote:

DNS error seems to indicate that you have a connection problem, not a
storage or file size restriction problem. 
Maybe the IP connection is interrupted. ..
Do you have the same problem when running on Localhost?
  

IE more often than not shows DNS failure message regardless of the 
actual error.

  max_execution_time = 3600
  max_input_time = 3600
  memory_limit = 104857600
  post_max_size = 104857600
  upload_max_filesize = 104857600

Does anyone have any ideas?  Am I missing something else?  If you need any
more information that I left out please let me know.  My code for the php
files is located below this message.  Any help is greatly appreciated!
  

Try with mozilla it will give you a better error message. Enable logging 
if you have not already done so and take a look at the log file that 
will give you a better idea about what exactly is going wrong.

-- 
Raditha Dissanayake.

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



[PHP] [OTHER TOPIC - Please Help] Looking for file sync software (Linux)

2003-12-11 Thread Keith
Hi all,

[Apologies for the off-topic question. Hope you will bear with me]

Given that this is a PHP General newsgroup I figured there's a good chance
someone here would know the answer to this question. Can anyone here
recommend a file-sync application/package for Linux servers that has the
following features:

1. Enables file sync across 2 drives on same server.
2. Enables file-sync between remote and host servers.
3. Enables file-sync for whole drives as well as for selected folders.
4. Includes some aspect of GUI for easy task management.
5. Includes function for restoring (again, whole drives or just selected
folders).

I have come across the likes of 'rsync' and 'unison' but they both seem to
be command line intensive and I can't find much in the way of descent
documentation for them. For instance I don't understand if or how they
achieves 'Data Restore', and for my purposes the ability to restore is a
prerequisite.

Any advice would be most appreciated.

Thank you
Keith

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



[PHP] I need a script for deleting mail from mail boxes...

2003-12-09 Thread Keith
Hi All,

I need to know how to write a script for deleting mail from a Linux server.
Essentially I need to be able to delete all mail with a date-stamp less than
some threshold date.
Then I want this script to run from a regular cron job. I am not sure if
this is doable in PHP or whether I must write a shell script, but either way
I need some pointers on how to go about it.

Any help would be much appreciated.

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



[PHP] How does one run PHP scripts in 'silent mode' ???

2003-12-04 Thread Keith
Hi all,
I need to know how to run a php script without it popping open a browser
window.
$cmd = 'start http://www.somedomain.com/somedir/somefile.php '
exec( $cmd );
I have tried using exec  system with '' at the end of the command but that
does not seem to work.
It always opens a browser window even though the script has no echo/print
statements in it.

Any advice would be appreciated

Thanks
Keith

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



[PHP] PHP Mysql programmers wanted

2003-11-26 Thread Keith Atkinson
Gentlemen( Ladies):

I'm looking for experienced PHP  Mysql programmers. They must possess
mathematical skills, for SQL stored procedure, or PHP scripts that do the
math for reporting, plus Java Scripting and html experience a real plus.
This is contract work, and working off site is OK.

Please respond to:

Keith Atkinson
[EMAIL PROTECTED]

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



[PHP] PHP SESSION DURATION.....

2003-11-25 Thread Keith
Hi,
How do I go about making a session last longer that the duration of the
browser?
Say I wanted to make a session last for 1 month, so that I could close the
browser as often I wanted, and the session would still be there. I found the
explanations of the session function on PHP.net quite confusing. G...
Oh for good documentation!!!

Should I use session_cache_expire? Well, php.net says: The cache expire is
reset to the default value of 180 stored in session.cache_limiter at request
startup time.
What about session_set_cookie_params? But php.net says the effect of this
function only lasts for the duration of the script?

Are session variables stored server-side or does that apply to cookies only?
And what about session cookies? Are session cookies stored with the client?

Please help

Many thanks
Keith

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



[PHP] Re: PHP SESSION DURATION.....

2003-11-25 Thread Keith
Correction: I meant to say: Are session variables stored server-side or
client-side like cookies?

Keith [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,
 How do I go about making a session last longer that the duration of the
 browser?
 Say I wanted to make a session last for 1 month, so that I could close the
 browser as often I wanted, and the session would still be there. I found
the
 explanations of the session function on PHP.net quite confusing. G...
 Oh for good documentation!!!

 Should I use session_cache_expire? Well, php.net says: The cache expire is
 reset to the default value of 180 stored in session.cache_limiter at
request
 startup time.
 What about session_set_cookie_params? But php.net says the effect of this
 function only lasts for the duration of the script?

 Are session variables stored server-side or does that apply to cookies
only?
 And what about session cookies? Are session cookies stored with the
client?

 Please help

 Many thanks
 Keith

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



Re: [PHP] What is white space

2003-11-15 Thread Keith Greene
It's not a bug. Anything (including spaces, newlines etc) that is not 
inside ? and ? is output directly to the browser.

At 03:49 PM 11/15/2003, you wrote:
Robert Cummings wrote:

FYI, if you're woprried about the header cannot be sent due to
output... error, then if your file only has code and no HTML, then you
can omit the ? tag at the end of your script. This solves countless
issues with there being a space, a tab, a newline, or any whitespace
after the closing tag.
And when that bug is fixed?

--
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full extent 
of the law.

--
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] Re: Alternet row colors

2003-11-15 Thread Keith Greene
It's so much easier to use the mod (%) operator:

using the mod operator, you can check if a variable is divisible by some 
other number without leaving a remainder.
For this example, we want to change every other row, so we would compare 
our $count against 2 to see if it leaves a remainder:
$bg = ($count%2==0) ? #00 : FF;

What this line does is FIRST, it checks to see if $count/2 leaves no 
remainder. If this is true, it sets the $bg var to #00
If it is false, it sets $bg to #FF

It only requires the addition of one line of code, and to replace your row 
background color with a php variable.
Also, you don't need to use printf(), since you aren't specifying any 
formatting.

See code below:

code:---
$result = mysql_query(SELECT * FROM albums where id 15);
$Count = @mysql_num_rows($result);

 echo table border=1 cellpadding=3 cellspacing=0 bordercolor='#00'\n;
   echo trtd bgcolor='#66'ID/tdtd 
bgcolor='#66'ARTIST/tdtd bgcolor='#66'TITLE/tdtd 
bgcolor='#66'LABEL/tdtd bgcolor='#66'PRICE/td/tr\n;

 for ($count = 0; $count  $Count; $count++) {
   // Extract post details from database
$myrow = mysql_fetch_array($result);
   $id = $myrow ['id'];
   $artist = $myrow ['artist'];
 $title = $myrow ['title'];
 $label = $myrow ['label'];
 $price = $myrow ['price'];
$bg = ($count%2==0) ? #00 : FF;
   echo tr 
bgcolor='.$bg.'td$id/tdtd$artist/tdtd$title/tdtd$label/tdtd£$price/tr\n;
}
 echo /table\n;



At 01:08 PM 11/15/2003, you wrote:
Well, first of all Ill just scrap you script since this one is so easy
its better to do it from scratch.
OK, somewhere in your script you have the code that accually
aoutputs the tables you are working with. Im refferring to lines
here, and Im meaning the bottom of this document which is
the scipt you posted, and I have numbered the lines.
Overview of your script.
Line 5 - we print out the table header
Line 11 - 23 is the loop which prints out all the lines, or rows.
Line 24 closes the table.
So what we have to do?

First we need to declare the values we want to use as backround
colours, lets use logical names :
(fig a)
$backcolor1=#fafafa;
$backcolor2=#c0c0c0;
$backcolor=$backcolor1;// we assign color 1
This code has to be written before the loop starts, so somewhere
before line 11.
In the loop (11-23) we need to switch between the colours where
we write the colour of the tr. So we write something like :
(fig b)
echo 'tr style=background-color:' . $backcolor . ';';
// continue with the rest of td... /td/tr here
// which is - your code.
This will print out the first background color, nice. Now we need it
to switch color, so we need to add a little logic. This will be inserted
right before the loop ends (infact, you can put it where ever you like
aslong as its in the loop).
(fig c)
if($backcolor=backcolor1)
$backcolor=$backcolor2;
else
$backcolor=$backcolor1;
As you see above the logic is quite simple, if the color is 1 - we set it
to 2,
else we set it to 1. If you think of it, if you process this logic over and
over again
you will infact get 1, 2, 1, 2, 1, 2, 1, 2 all the time, :) Nice!
There you have it, and I hope you got the hang of it.

To take your code and implement my colorswither all you need to do is,

1. On line 21 replace #00 width $backcolor
2. Insert the logic (figc), all lines, into line 19
3. Place fig a in line 4.
--
Kim Steinhaug
---
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
---
The code for return the top ten result is :
1 $result = mysql_query(SELECT * FROM albums where id 15);
2
3 $Count = @mysql_num_rows($result);
4
5  echo table border=1 cellpadding=3 cellspacing=0
6 bordercolor='#00'\n;
7echo trtd bgcolor='#66'ID/tdtd
8 bgcolor='#66'ARTIST/tdtd bgcolor='#66'TITLE/tdtd
9 bgcolor='#66'LABEL/tdtd bgcolor='#66'PRICE/td/tr\n;
10
11 for ($count = 0; $count  $Count; $count++) {
12   // Extract post details from database
13$myrow = mysql_fetch_array($result);
14   $id = $myrow ['id'];
15   $artist = $myrow ['artist'];
16 $title = $myrow ['title'];
17 $label = $myrow ['label'];
18 $price = $myrow ['price'];
19
20   printf(tr
21bgcolor='#00'td$id/tdtd$artist/tdtd$title/tdtd$label/t
d
22td£$price/tr\n);
23}
24 echo /table\n;
--
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] What is white space

2003-11-15 Thread Keith Greene
Yep. It allows you to only use php where needed, and use HTML for the rest.

At 04:02 PM 11/15/2003, you wrote:
On Sat, 2003-11-15 at 18:49, Leif K-Brooks wrote:
 Robert Cummings wrote:

 FYI, if you're woprried about the header cannot be sent due to
 output... error, then if your file only has code and no HTML, then you
 can omit the ? tag at the end of your script. This solves countless
 issues with there being a space, a tab, a newline, or any whitespace
 after the closing tag.
 
 
 And when that bug is fixed?
Isn't that a feature?

Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'
--
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] What is white space

2003-11-15 Thread Keith Greene
Ok, you're getting into semantics now. 
http://www.php.net/manual/en/language.basic-syntax.php doesn't say whether 
it is acceptable or not, but as Robert pointed out, if your script is 
purely php, omitting it is a good way of eliminating the headache of 
trailing white spaces that may interfere with headers.

Keith

At 04:41 PM 11/15/2003, Leif K-Brooks wrote:
Keith Greene wrote:

That's not a bug either. Leaving out the ? is simply telling the php 
parser that it has to parse the rest of the script.
Where's the manual page saying that's allowed?

--
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full extent 
of the law.

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


[PHP] php Losing apache environment vars

2003-11-10 Thread Keith Greene
Greetings list,
I have run into a problem that has me at my wits end. We run an affiliate 
program, and have forum software (phpBB) wrapped in our menu system.
There are 2 sides to the site, Affiliates and Admin, and I have 2 installs 
of the board using the same database. This all works fine.

The mind-boggling problem is that while the board works perfectly from the 
Affiliate side of the site, it exhibits some strange behavior from the Admin
side of the site. In particular, we are using an apache environment 
variable to point to our includes directory, and any time an http post is 
made from
the admin side of the board, php loses the environment vars and throws 
all kinds of errors about not being able to find the includes.
The only difference between the Affiliate and Admin sides is the include 
used for the actual menu, though the only difference in those files is
the actual links that make up the menu.

I have never seen this behavior, and was wondering if anyone has seen 
anything like it before, and possibly found a solution.
We are running php 4.3.2, Apache 1.3.26 on FreeBSD 4.5.

Any help would be very appreciated.

Keith

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


Re: [PHP] php Losing apache environment vars

2003-11-10 Thread Keith Greene
After restarting apache, the error is gone. Still not sure what was causing 
it. The site was running fine to begin with, and the environment vars
have been in use for over a year throughout the site.

Keith

At 12:56 PM 11/10/2003, Keith Greene wrote:
Greetings list,
I have run into a problem that has me at my wits end. We run an affiliate 
program, and have forum software (phpBB) wrapped in our menu system.
There are 2 sides to the site, Affiliates and Admin, and I have 2 installs 
of the board using the same database. This all works fine.

The mind-boggling problem is that while the board works perfectly from the 
Affiliate side of the site, it exhibits some strange behavior from the Admin
side of the site. In particular, we are using an apache environment 
variable to point to our includes directory, and any time an http post is 
made from
the admin side of the board, php loses the environment vars and throws 
all kinds of errors about not being able to find the includes.
The only difference between the Affiliate and Admin sides is the include 
used for the actual menu, though the only difference in those files is
the actual links that make up the menu.

I have never seen this behavior, and was wondering if anyone has seen 
anything like it before, and possibly found a solution.
We are running php 4.3.2, Apache 1.3.26 on FreeBSD 4.5.

Any help would be very appreciated.

Keith

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


[PHP] Form Passed Multidimension Array

2003-09-25 Thread Keith Spiller
Hello,

I am trying to find out how to pass a multidimensional array within a hidden input of 
a form.
Would it be something like this?

  input type='hidden' name='all_links' value='$all_links'

Any advice would be forever appreciated...


Keith


RE: [PHP] text area question

2003-08-22 Thread Keith Higgs
Only if you're concerned about those few whitespace characters increasing your file 
size. Granted, there mey be PHP output related issues to a multi-line whitespace 
within an echo or print operation but, so far as the actual HTML is concerned, white 
space is white space and it should all be ignored by the browser's  rendering engine.

The suggested correction DOES do a lot for programming style by eliminating the 
superfluous space, and the possibility that you may introduce errors by inserting 
other code in that area.

D. Keith Higgs mailto:[EMAIL PROTECTED] 216-368-0559
 Case Western Reserve University, Webmaster / Database Analyst - University Library
 Additional Information at http://www.cwru.edu/UL/ and http://keith.cwru.edu/
Never overestimate the sanity of your sysadmin.

 No trees were killed in the creation of this message. 
 However, many electrons were terribly inconvenienced.

 -Original Message-
 From: Marek Kilimajer [mailto:[EMAIL PROTECTED] 
 Sent: Friday, August 22, 2003 07:08 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] text area question
 
 
 Your textarea should be:
 textarea name=  /textarea
 
 and not
 textarea name=  
 
 
 
 
 /textarea
 
 
 Angelo Zanetti wrote:
 
  
  Hi this is slightly off topic but i hope i will be forgived.
  
  I have a textarea and whenever my page loads and I click in 
 it the cursor
  nevers starts at the very beginning and I have to push the 
 backspace buttton
  until i get to the start. is there a property or something 
 to fix this??
  
  thanx in advance
  angelo
  
  
  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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



[PHP] Apache to compile PHP and Ruby languages in the same document?

2003-06-11 Thread Keith Hamilton
Hello,

I'm trying to create one document with PHP and Ruby scripts in
the same document.  Is this possible?  I've tried to configure mod_ruby
to compile php documents as well but when I do that PHP doesn't work.
Is it possible to have 2 languages in the same document?

-- Keith


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



[PHP] short_open_tags = On

2003-03-04 Thread Keith Mastin
I was asked to change this in the php.ini file by a user to make it
easier to use php on the server. Before doing so, I thought I better ask
if there's any know security implications. I checked the wiki, and it
showed that there are 31 instances of this, but didn't actually show any.
:)

The server is on the web and has a number of domains. The user in question
writes a lot of websites using php for maybe 1/2 of the domains.

TIA

-- 
Keith Mastin
BeechTree Information Technology Services Inc.
Toronto, Canada
(416)696-6070





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



[PHP] LOGOUT - Reset Session

2003-01-30 Thread Keith Spiller
Hello Everyone,

I'm trying to create a Logout Function and Link.  My site uses a standard
htaccess file for its authentication method.  After the brower requests the
username and password they have access to the protected site.

Then users can jump to a special Messaging section where I wrote a php
script that retieves the $REMOTE_USER value and checks it against a message
database.

My problem is that I'd like to have a logout link that will dump the values
the user had entered for their username and password so that they can no
longer access the messages, neither with a back button nor just by going
back to the site url.  But since I am retrieving the $REMOTE_USER value
using PHP4, it seems some how it remebers the username and password.  Is
that because I need to destroy the session and remove or replace the session
cookies?  I do not know what the session name is, nor how to check it.

Here is what I have tried so far:

function logout() {

session_start();
session_destroy();
setcookie(SES_NAME,,,/);
header(Location: http://www.yahoo.com;);
exit;
}

My results were that everytime I click the logout link, I can just press
back on the browser and go back where I was and continue using the Messaging
application.

Thank you for any help you might provide...


Larentium
[EMAIL PROTECTED]


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




[PHP] Re: Forms

2002-12-10 Thread Keith D Sellars
What action is designated in the form you are using?  I don't see anything
below in the code you submitted.  Whenever php processes a form, then it
automatically generates the individual strings containing the designated
data in the form's fields.  Therefore, if on the page to which the data is
submitted contains something like:
?
 echo $name;
?

... then it should work.  HOWEVER, you have to be certain that you are
actually passing the data to the subsequent page.  You could either do all
of the processing and display in one file generating the code as necessary
OR you have to submit the form (using the action attribute), to the page
to which the data is to be directed.

Thanks,
Keith D Sellars
WebGraffix
www.webgraffix.com

Making database sites seem easy
- Original Message -
From: Beauford.2002 [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, December 11, 2002 4:36 PM
Subject: Forms


 Hi,

 I'm sending this to both lists as I'm not sure where the problem is, but I
 believe it is an issue with my HTML form. Here's the problem:

 I have a drop-down menu form on my webpage with employee names in it. When
I
 choose a name and click submit it gets passed to a php page which accesses
a
 mysql database and displays information about that employee.

 The problem is that the form is not sending the employee name to the php
 page. If I insert the name in the php page manually, it works fine, so the
 problem appears to be with the form.

 Can someone help me out here - a sample of my code is below. I'm not sure
 how to explain this, but whatever gets sent to the PHP page has to be one
 variable - i.e. if I choose John, then the variable that gets sent to the
 PHP should have the value John, if I choose Mary, the value of the
variable
 should be Mary. Hope this makes sense.

 TIA

 PCENTERFORM NAME=Employees
 SELECT NAME=name
 OPTION SELECTED VALUE=/OPTION
 OPTION VALUE=John/OPTIONJohn
 OPTION VALUE=Mary/OPTIONMary
 /SELECT
 INPUT TYPE=submit VALUE=Submit





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




RE: [PHP] Whimper, help :)

2002-12-04 Thread Keith Sauvant
 Like I said, I can run the same SQL in PHPMyAdmin...

Be careful when testing SQL statements containing (double)quotes in
PHPMyAdmin, as I remember, it automatically masks them! Try the same
statement on mysqls commandline.

Good luck
Keith


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




RE: [PHP] Problem uploading files other than text/plain ones

2002-12-02 Thread Keith Sauvant
You know about the php.ini option upload_max_filesize? Perhaps its
default value is not enough for your task?

Greeting from
Keith
Aachen, Germany


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




Re: [PHP] Confirm message box

2002-11-27 Thread Keith Sauvant
Hi Wilmar,

 And when the user hits the Delete link a pop up dialog box (javascript

 style) asks for confirmation.

Not a big deal. Your PHP script has to generate Links like:

a href=myscript.php?del=xy onClick=return confirm('really
delete?')delete/a

where xy is the id of your record. The link will be followed after a
positive conformation, myscript.php can delete the record.

Good luck
Keith


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




[PHP] Php Form Issue

2002-11-16 Thread Keith Spiller
Hello,

I've managed to get a series of javascripts to work exactly as I wanted.
They check all and uncheck all checkboxes with a single click of a control checkbox.

Unfortunately, the information has to be sent to php.  As soon as I add the [] 
brackets to
an input name, the javascript no longer functions.  I'll look up a javascript mailing 
list next,
but I figured there must be some other way to get php to recieve the data and convert 
it
to an array.

Does anyone have an idea how I can make the php script gather all the multiple
browser=lynxbrowser=mosaicbrowser=explorer
instead of only the last entry?

Thanks for any help,


Keith



Re: [PHP] explode didn't work well

2002-10-31 Thread Keith Vance
echo ($pieces[2]);
instead of
echo ($pieces [2]);



Keith Vance
Vance Consulting LLC
www.vanceconsulting.net
(206) 355-2399

Try U.M.A. at http://uma.sourceforge.net/


On Thu, 31 Oct 2002, ppf wrote:


 Hi all:
 I had tried to split the string into an array of
 string using explode but the result isn't displaying
 anything
 I tried the example from document its its not showing
 anything, pls point out where i went wrong
 **
 $pizaa=piece1 piece2 piece3 piece4 piece5 piece6;
 $pieces = explode(' ', $pizza);
 echo $pizaa;
 echo ($pieces [2]);
 
  Thanks in advance
   Prad

 __
 Do you Yahoo!?
 HotJobs - Search new jobs daily now
 http://hotjobs.yahoo.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] explode didn't work well

2002-10-31 Thread Keith Vance
And that too.

Keith Vance
Vance Consulting LLC
www.vanceconsulting.net
(206) 355-2399

Try U.M.A. at http://uma.sourceforge.net/


On Thu, 31 Oct 2002, Rasmus Lerdorf wrote:

 Because you can't spell pizza, I bet.

 On Thu, 31 Oct 2002, ppf wrote:

 
  Hi all:
  I had tried to split the string into an array of
  string using explode but the result isn't displaying
  anything
  I tried the example from document its its not showing
  anything, pls point out where i went wrong
  **
  $pizaa=piece1 piece2 piece3 piece4 piece5 piece6;
  $pieces = explode(' ', $pizza);
  echo $pizaa;
  echo ($pieces [2]);
  
   Thanks in advance
Prad
 
  __
  Do you Yahoo!?
  HotJobs - Search new jobs daily now
  http://hotjobs.yahoo.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




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




Re: [PHP] why can't i do this?

2002-10-16 Thread Keith Vance

Because that's not the way PHP works. You aren't comparing anything on the
second half of the elseif statement.

Keith Vance
Vance Consulting LLC
www.vanceconsulting.net
(206) 355-2399

Try U.M.A. at http://uma.sourceforge.net/


On Thu, 17 Oct 2002, Peter Houchin wrote:

 howdy

 can some one please tell me why i can't do this

 elseif ($_POST['cost'] =4  =20001){...}

 but i can do this

 elseif ($_POST['cost'] =4  $_POST['cost'] =20001){...}



 Cheers

 Peter
 the only dumb question is the one that wasn't asked


 --
 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: Fw: Re: [PHP] Simple HTML-Form Question

2002-10-13 Thread Keith Vance

I would quote get in method=get and end the /form for starters.

Keith Vance
Vance Consulting LLC
www.vanceconsulting.net
(206) 355-2399

Try my open source PHP authentication system, Rampart by visiting 
http://rampart.sourceforge.net/. Commercial support is available at, 
http://www.vanceconsulting.net/support/.

On Sun, 13 Oct 2002, Chip Wiegand wrote:

 Yep, I've been going over this with John off-list, I learned something
 new tonite. One thing about his script - it doesn't print the text
 entered in the box, it only prints the work Hallo. To fix that would
 require adding
 . $name;
 to the end of the echo statement.
 Regards,
 --
 Chip

  Edwin wrote this stuff back on Mon, 14 Oct 2002 11:55:28 +0900:

  Hello,
 
  Just for the sake of the argument...
 
  On Monday, October 14, 2002 10:44 AM
  Chip Wiegand wrote:
 
   Sascha Cunz wrote this stuff back on Mon, 14 Oct 2002 01:13:53
   +0200:
  
This beautifies it (even makes it a bit more secure), but one
doesn't need it really; should have worked without these changes,
too. (Of course, it's better to include these changes)
   
Sascha
  
   No it shouldn't have worked the way you had it originally. The isset
   statement HAS to have the same value as the submit buttom name or it
   won't work at all.
 
  Yes it will. Try it. ;)
 
  Of course, I didn't mean to say that it will work the way you want it.
  I just wanted to say that it would still work even though the isset
  statement doen't have the same value with the submit button. Remember,
  isset() is basically a function to check if something is set or not...
 
  So, changing this
 
 if (isset($_GET['submit']))
 
  to this
 
 if (isset($_GET['name']))
 
  will have a similar result (for the short code discussed here).
 
  - E
 
  PS
  Typo: (should be $_GET['name'])
  echo Hallo .$GET['name'];
 
   As for the beautify part, that's just the way I write
   my code, that doesn't matter at all to whether or not the script
   will work.
  
   --
   Chip
  
 The value of name for the submit button is wrong - it should be
 the same as the value you gave the isset statement, in this case
 it should beinput type=submit name=name value=sendit
 Better yet is to use isset($submit) and the value for the submit
 statement is also name=submit -
 input type=submit name=submit value=sendit
 of course value is optional. So you end up with this -

 ?
 if (isset($_GET['submit']))
 {
  echo Hallo .$GET['name'];
 }
 else
 {
 echo FORM action='test.php' method=get
 input type='text' name='name'
  input type='submit' name='submit' value='sendit';
 }
 ?
   
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
   
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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





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




[PHP] Re: displaying a select number of rows from a sql query

2002-10-10 Thread Keith Posehn

I tried this code, and it still just keeps 'a loopin'...

What is wierd is that I have some if the code I tried in my site on other
pages, and it functions without a problem...any thoughts?

Thanks for the help.

-Keith Posehn

Owen Prime [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 With the line:

 while (list($link, $title, $content) = mysql_fetch_array($result)) {

 The php docs don't actually say what the list() function returns, but
since
 your getting an infinite loop i would say that it probably evaluates to
 true no matter whats on the right hand side of the assignment. I would
 suggest that you use:

 while ($tmp = mysql_fetch_array($result)) {
 list($link, $title, $content) = $tmp;

 Cheers,

 Owen Prime
 http://www.noggin.com.au


 Keith Posehn wrote:

  Ok, here is the question:
 
  I have a sql query, nothing special. It has 3 variables. I have created
  the php code to display the variables in context with the html code. I
  need it to loop a select number of times, most likely twice, and
therefore
  display the first two rows of the query.
 
  In other words, querying the database for a set of rows, it needs to
  display the first two of the rows on the page.
 
  Here is the code I have tried so far, which has either looped
continuosly
  or displayed the top row twice (edited for security):
 
  ?php
 
 
   $sql  = SELECT * FROM [database] ORDER BY [collumn] LIMIT 2;
   $result = mysql_query($sql) or die(problem with $sql);
   // list($title) = mysql_fetch_array($result);
  ?
 
  td width=48% align=left valign=top
 
  h3What's New?/h3
 
  ?php
 
  /* It tried this: */ while(list($link, $title, $content) =
  mysql_fetch_array($result)){
 
  /* And this: */ while($row = mysql_fetch_array($result) and
  (($count++)2)){
 
  // The first kept looping infinitely, the second displayed the top row
  twice. Grr... _
 
  ?
 
  h4
  a href=?php echo mysql_result($result,0,link); ??php echo
  mysql_result($result,0,title); ?/a
  /h4
  p
  ?php echo mysql_result($result,0,content); ?
  /p
 
  ?php
  }
  ?
 
  /td
 
  Thanks for any help you can provide.
 
  -Keith Posehn





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




[PHP] displaying a select number of rows from a sql query

2002-10-09 Thread Keith Posehn

Ok, here is the question:

I have a sql query, nothing special. It has 3 variables. I have created the
php code to display the variables in context with the html code. I need it
to loop a select number of times, most likely twice, and therefore display
the first two rows of the query.

In other words, querying the database for a set of rows, it needs to display
the first two of the rows on the page.

Here is the code I have tried so far, which has either looped continuosly or
displayed the top row twice (edited for security):

?php


 $sql  = SELECT * FROM [database] ORDER BY [collumn] LIMIT 2;
 $result = mysql_query($sql) or die(problem with $sql);
 // list($title) = mysql_fetch_array($result);
?

td width=48% align=left valign=top

h3What's New?/h3

?php

/* It tried this: */ while(list($link, $title, $content) =
mysql_fetch_array($result)){

/* And this: */ while($row = mysql_fetch_array($result) and (($count++)2)){

// The first kept looping infinitely, the second displayed the top row
twice. Grr... _

?

h4
a href=?php echo mysql_result($result,0,link); ??php echo
mysql_result($result,0,title); ?/a
/h4
p
?php echo mysql_result($result,0,content); ?
/p

?php
}
?

/td

Thanks for any help you can provide.

-Keith Posehn



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




Re: [PHP] Running a PHP script automatically?

2002-09-21 Thread Keith Vance

On the Linux box compile PHP as CGI (i.e. don't configure it as an apache
mod). Then you can just run your script from the the command-line.

For example:
#!/usr/local/bin/php -q
?php
print Hello world.\n;
?

The -q suppresses the html crap that gets spit out. I don't know jack
about Redhat (Debian rocks), you might be able to get an RPM that will
install the php executable for you.

To do the crontab:
RUN THIS COMMAND
crontab -e

TYPE THIS
15,30,45,0 * * * * name_of_your_script

THEN
ESC
:wq

Keith Vance
Vance Consulting LLC
www.vanceconsulting.net
(206) 355-2399

Try my open source PHP authentication system, Rampart by visiting 
http://rampart.sourceforge.net/. Commercial support is available at, 
http://www.vanceconsulting.net/support/.

On Sat, 21 Sep 2002, Joseph Szobody wrote:

 Folks, I have a PHP script that needs to be executed automatically every 15 minutes. 
I have the option of doing this on a RedHat linux box, or on Windows 2000 Server.

 How would I do this (on either platform) and which would be easier?

 I believe somehow I could create a cron job on linux, but I'm a bit confused how 
that would work. Would I just call the php script using Lynx? If so, does the Lynx 
process die when the php script is finished? Will I have dozens of Lynx processes 
still running at the end of the day?

 In Windows, I believe I could use the task scheduler, or something like that. But 
again, how exactly would I call the script? I certainly don't want a new browser 
window to open every 15 minutes, especially if it doesn't close again.

 Any insight? Thanks!

 Joseph


 --
 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] SESSION ARRAY

2002-08-29 Thread Keith Vance

$_SESSION is a predefined variable, session_start()
session_register('BILLARRAY') should work though :)

Keith Vance
Vance Consulting LLC
www.vanceconsulting.net
(206) 355-2399

Try my open source PHP authentication system, Rampart by visiting 
http://rampart.sourceforge.net/. Commercial support is available at, 
http://www.vanceconsulting.net/support/.

On Fri, 30 Aug 2002, Todd Pasley wrote:

  What is the proper syntax for storing an array in a session?
 
  is it $_SESSION[BILLARRAY]=$ARRAY?

 Yep,  providing youre using session_start() and session_register(_SESSION)
 you can assign any type of data, just like a regular hash.

 Todd.

 - Original Message -
 From: Randy Johnson [EMAIL PROTECTED]
 To: phplist [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Friday, August 30, 2002 9:08 AM
 Subject: [PHP] SESSION ARRAY


  What is the proper syntax for storing an array in a session?
 
  is it $_SESSION[BILLARRAY]=$ARRAY?
 
 
  Randy
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


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




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




Re: [PHP] Are sessions affected by Unix user changes?

2002-08-28 Thread Keith Soares

To clarify, session files ARE being created still, but they all have a length of 0.
So it seems that the permissions to create a file are ok, but something else is wrong.

Any idea why the file could be created, but would be empty?
I'm perplexed.
K.

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




[PHP] [Followup] Exploding Zip Codes! (Using PHP's explode function)

2002-08-13 Thread Keith Posehn

Final question on this (I hope).

I have the code together now to put it all the zip codes into and array--but
now I need to add those zip codes to a sql statement for the WHERE clause.
Example:

SELECT * FROM [table]
WHERE zip=[all the darn zips listed here]

(or something like that)

How would I set it to loop all the zip codes into this statement? I'm not
worried about the SQL syntax, I can figure that out without a problem, but
the php code is the question. This is in MySQL btw, and I have looked
through the docs there and at php for this, but need some help from all you
guru's out there.

Thanks for the help!

(Previous message here)

 I have a huge block of zip codes I need to seperate into their constituent
 parts for a query of a database. The block looks like this (in part):

 |  36310  ABBEVILLE  |
 |  35440  ABERNANT  |
 |  35005  ADAMSVILLE  |
 |  35540  ADDISON  |
 |  35006  ADGER  |
 |  35441  AKRON  |

 I need to use eplode (probably) to seperate this all out into two arrays,
 one of codes, the other of names--presumably named $zips[] and $cities[]
 with the rest of the data dumped.

 I have gone and looked at the various functions docs at php.net, but they
 haven't really helped to answer my question as much as I would like. Any
 information is appreciated.

 Thanks




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




[PHP] Exploding Zip Codes! (Using PHP's explode function)

2002-08-12 Thread Keith Posehn

I have a huge block of zip codes I need to seperate into their constituent
parts for a query of a database. The block looks like this (in part):

|  36310  ABBEVILLE  |
|  35440  ABERNANT  |
|  35005  ADAMSVILLE  |
|  35540  ADDISON  |
|  35006  ADGER  |
|  35441  AKRON  |

I need to use eplode (probably) to seperate this all out into two arrays,
one of codes, the other of names--presumably named $zips[] and $cities[]
with the rest of the data dumped.

I have gone and looked at the various functions docs at php.net, but they
haven't really helped to answer my question as much as I would like. Any
information is appreciated.

Thanks



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




[PHP] Cannot parse html pages in php

2002-07-18 Thread Keith Roberts

I am running into a situation where I need some serious help.  My
environment is:

Workstation - W2k, Frontpage
Server - Cobalt RaQ4i, Linux, Apache

Problem:  I need to access MySQL to display inventory information on the web
page.  When I have modified the httpd.conf file to parse html files through
php, the embedded php code works.  However, FrontPage no longer works and a
Web statisics application will not work (Webalizer).  I know I am not
setting something correctly, but dang if I know what it is.

I really need some help on this.  Please realize that I am relatively new to
internet programming, linux, php, etc.  I have done okay so far, but this is
beyond me at this point.  Any help will be greatly appreciated.



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




[PHP] Cannot parse html pages in php

2002-07-18 Thread Keith Roberts

I am running into a situation where I need some serious help.  My
environment is:

Workstation - W2k, Frontpage
Server - Cobalt RaQ4i, Linux, Apache

Problem:  I need to access MySQL to display inventory information on the web
page.  When I have modified the httpd.conf file to parse html files through
php, the embedded php code works.  However, FrontPage no longer works and a
Web statisics application will not work (Webalizer).  I know I am not
setting something correctly, but dang if I know what it is.

I really need some help on this.  Please realize that I am relatively new to
internet programming, linux, php, etc.  I have done okay so far, but this is
beyond me at this point.  Any help will be greatly appreciated.





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




[PHP] php and html

2002-07-18 Thread Keith Roberts

I am running into a situation where I need some serious help.  My
environment is:

Workstation - W2k, Frontpage
Server - Cobalt RaQ4i, Linux, Apache

Problem:  I need to access MySQL to display inventory information on the web
page.  When I have modified the httpd.conf file to parse html files through
php, the embedded php code works.  However, FrontPage no longer works and a
Web statisics application will not work (Webalizer).  I know I am not
setting something correctly, but dang if I know what it is.

I really need some help on this.  Please realize that I am relatively new to
internet programming, linux, php, etc.  I have done okay so far, but this is
beyond me at this point.  Any help will be greatly appreciated.






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




[PHP] php and html

2002-07-18 Thread Keith Roberts

I am running into a situation where I need some serious help.  My
environment is:

Workstation - W2k, Frontpage
Server - Cobalt RaQ4i, Linux, Apache

Problem:  I need to access MySQL to display inventory information on the web
page.  When I have modified the httpd.conf file to parse html files through
php, the embedded php code works.  However, FrontPage no longer works and a
Web statisics application will not work (Webalizer).  I know I am not
setting something correctly, but dang if I know what it is.

I really need some help on this.  Please realize that I am relatively new to
internet programming, linux, php, etc.  I have done okay so far, but this is
beyond me at this point.  Any help will be greatly appreciated.








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




[PHP] unhandled exception processing the ISAPI

2002-05-13 Thread Keith AY

Hi all, I got a problem when using PHP

Server: win2000(sp2)
Version: 4.2.0
Application use: ODBC, sessions, oci8, oracle.

I tried PHP ISAPI version (4.2.0)
I am using generic client socket(i.e. fsockopen()) to communicate with a
server. It work fine at the begin, but I found that if the server
suddenly shutdown. The follow error
occur:

The HTTP server encountered an unhandled exception while processing the
ISAPI Application '
php4ts!zend_strndup + 0x2B
 + 0xA05E5983

and I have to reboot the system because IIS won't work!!!

Would u please give me some help or advice? thx

Keith AY



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




[PHP] php, pdf's and restricting access

2002-04-03 Thread Keith Posehn

Ok, here's my question:

I have a set of pdf files that I am selling. I want the users of my site,
when they buy the files to be able to only view them if they are acquired,
so I need to restrict access to them. Could I set the permissions on them so
they are not publicly viewable, and then make a php page that would actually
view the files as a specific user? Is there some way to include a pdf file
in the page?

Any ideas appreciated.

Keith Posehn



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




[PHP] Curl output to an array -- HELP!!

2002-03-19 Thread Keith Posehn

Ok, lets say I have some code here:

$result = array();

$ch = curl_init (https://www.myverificationplace.com/verify.asp;);

curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $args);
curl_setopt ($ch, CURLOPT_TIMEOUT, 120); // Set the timeout, in seconds.
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($ch);

curl_close ($ch);

Now that we see that, how can I make it so that the output from curl, which
is in the variable $result, will be an array, for each line of output?

Some of the line of output looks like this:

ssl_result_message=APPROVED
ssl_txn_id=----
ssl_approval_code=00

I need each of the lines to be turned into a variable. Any ideas as to how I
might go about this?

Thanks,

Keith Posehn





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




[PHP] Curl output to an array -- HELP!! -- Appended

2002-03-19 Thread Keith Posehn

This is an revision of my previous message:

Ok, lets say I have some code here:

$result = array();

$ch = curl_init (https://www.myverificationplace.com/verify.asp;);

curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $args);
curl_setopt ($ch, CURLOPT_TIMEOUT, 120); // Set the timeout, in seconds.
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($ch);

curl_close ($ch);

Now that we see that, how can I make it so that the output from curl, which
is in the variable $result, will be an array, for each line of output?

Some of the line of output looks like this:

ssl_result_message=APPROVED
ssl_txn_id=----
ssl_approval_code=00

I need each of the lines to be turned into a variable.

Example:

name the variable 'ssl_result_message', the value being 'APPROVED'

Any ideas as to how I might go about this?

Thanks,

Keith Posehn




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




[PHP] Re: mail() getenv() problems (after 4.1.2 update)...

2002-03-11 Thread Keith Waters

Just to report back to the group, the mail() delay problem was solved by
putting entries into /etc/hosts to speed up reverse DNS lookups.  (Worked
fine before 4.1.2, but I guess there's some new code in there somewhere!)

Paul's getenv() problem was a simple one, he forgot the double-quotes!

Keith

Keith Waters [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm having the same problem -

 I've been using the mail() command for quite some time now and it's been
 working 100% and executing immediately.

 Suddenly, this morning, it is taking about 60 seconds to send mail,
delaying
 the display of the php web page by that same amount of time.

 I have checked the mail server and sending mail from the command prompt
 (linux) and there is no delay there.

 Does anybody have any clue? I even momentarily downgraded to 4.1.0 to make
 sure it wasnt a bug in 4.1.2


 Paul [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Can nobody help?  This is so frustrating.  I cannot see what's wrong,
open
  to ANY suggestions!
 
  Thanks.
 
  Paul
  Paul [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Hello,
  
   I wonder if anyone can help me with a problem I have.  I have some
sites
   hosted on a Cobalt Raq4 server (not sure if this is relevant).  I
 recently
   upgraded PHP from a package at www.pkgmaster.com, and since making
this
   upgrade I have problems with PHP that I cannot find the solution to.
  
   I have conacted their 'team' who have thus far offered no explanation,
   saying it must be something else causing these issues with PHP, but I
   haven't made any more changes, just installed the new PHP version.
  
   The problems are with the mail() function taking an AGE to excecute,
and
   environmental HTTP header information not being sent/recieved by
 getenv().
  
   Some examples follow..
  
   For example, as an extremely basic example of the mail function going
  slow,
   this simple script:
   ?
   mail([EMAIL PROTECTED], Test subject, Test
message);
   print finished!;
   ?
  
   Which can be found at http://www.clicktolearn.co.uk/test/mail.php in
  action,
   ran (as it should do) extremely fast the week before I made the
upgrade
  from
   the packages.  Now, as you will see, it runs dog slow.
  
   Secondly, the following script shows the lack of headers:
   http://www.clicktolearn.co.uk/test/  (click the link, so there's a
 referer
   to the script page)...
  
   ?
   function get_http_headers($url, $proto=HTTP/1.0, $timeout=10) {
   $return = false;
   if (substr($url,0,7)==http://;) {
   $url = substr($url,7);
   }
  
   $parts = parse_url(http://.$url);
  
   $ips = gethostbynamel($parts[host]);
  
   if ($ips[0]) {
   $ip = $ips[0];
   $host = $parts[host];
   $path = ($parts[path]) ? $parts[path] : /;
   $port = ($parts[port]) ? $parts[port] : 80;
  
   $start = time();
   $timeout = $timeout + $start;
  
   if($sock = fsockopen($host, $port)) {
   set_socket_blocking($sock, 0);
   switch($proto) {
   case HTTP/1.1:
   set_socket_blocking($sock, 1);
   fputs($sock, sprintf(HEAD %s
  %s\n,
   $path, $proto));
   fputs($sock, sprintf(Host:
  %s\n\n,
   $host));
   break;
   default:
   fputs($sock, sprintf(HEAD %s
   %s\n\n, $path, $proto));
   }
  
   while(!feof($sock)  $t$timeout) {
   $line .= fgets($sock,1);
   $t = time();
   }
   fclose($sock);
   $end = time();
  
   if ($t=$timeout) {
   $http = parse_output($line);
   $http[result] = 502;
   $http[message] = Timed Out;
   $http[time_used] = $end - $start;
   $return = $http;
   } elseif($line) {
   $http = parse_output($line);
   $http[time_used] = $end - $start;
   $return = $http;
   }
   }
   }
   return $return;
   }
  
   function parse_output($line) {
   $lines = explode(\n, $line);
   if(substr($lines[0],0,4)==HTTP) {
   list($http[protocol], $http[result], $h

  1   2   >