php-general Digest 27 Jan 2006 17:18:06 -0000 Issue 3930

2006-01-27 Thread php-general-digest-help

php-general Digest 27 Jan 2006 17:18:06 - Issue 3930

Topics (messages 229357 through 229370):

Re: copy problem with HTTP wrapper
229357 by: Laurent Vanstaen
229362 by: Manuel Lemos
229363 by: Laurent Vanstaen
229364 by: Manuel Lemos
229365 by: David Grant
229366 by: Laurent Vanstaen
229367 by: David Grant
229368 by: Laurent Vanstaen

Re: [SOLVED] Re: usr VAR value as a VAR Name
229358 by: Barry

Re: Does file_exists() 'honour' open_basedir?
229359 by: DRYALLS
229360 by: David Grant
229361 by: David Grant

PHP Job opening in UK, London
229369 by: Chris Boget

doubt regarding while loop
229370 by: suresh kumar

Administrivia:

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

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

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


--
---BeginMessage---



 Hi all,
   I'm trying to copy a file from my PHP server to another server (a
 home
 gateway, called a LiveBox). I've used this code :

 $livebox = 192.168.1.1;
 ...
 ...
 ...
 $crontab_livebox = http://.$livebox./cgi-bin/newCrontab;;
 if (!copy($crontab_temp_name, $crontab_livebox)) {
echo br /Impossible to copy the temp crontab file to the
 Livebox.br
 /;
 }

 I get the following error :
 HTTP wrapper does not support writeable connections

 OK can I solve this. Can't I use URLs with the copy function if they
 don't
 point to my PHP server (local URLs) ? How can I copy a file from my
 PHP
 server to another server (there's no FTP server on the destination
 machine)
 ?

Put it this way:
If what you typed above *DID* work, what's to stop *ME* from copying
whatever I want onto your server?...


I see your point. Here in my case the server I want to copy a file on has 
192.168.1.1 for IP address and thus cannot be found from outside a LAN, so 
the security problem is not that much important. But I agree with you and 
see what you mean.




You probably need to use cURL to login to your livebox, and then POST
the data into the newCrontab form handler.



OK I'm gonna look for information about that.

Thank you,

Laurent
---End Message---
---BeginMessage---
Hello,

on 01/27/2006 05:59 AM Laurent Vanstaen said the following:
 I see your point. Here in my case the server I want to copy a file on
 has 192.168.1.1 for IP address and thus cannot be found from outside a
 LAN, so the security problem is not that much important. But I agree
 with you and see what you mean.

You may want to try sending files via form upload. Then on the
destination end the you could have a PHP script that would take care of
authentication and receiving and storing the uploaded files.

In that case you may want to try this HTTP client class. It can act as a
normal browser submitting files via POST and also authentication, cookie
handling and redirection in case you want make a robust file copying system:

http://www.phpclasses.org/httpclient


-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
---End Message---
---BeginMessage---



Hello,

on 01/27/2006 05:59 AM Laurent Vanstaen said the following:
 I see your point. Here in my case the server I want to copy a file on
 has 192.168.1.1 for IP address and thus cannot be found from outside a
 LAN, so the security problem is not that much important. But I agree
 with you and see what you mean.

You may want to try sending files via form upload. Then on the
destination end the you could have a PHP script that would take care of
authentication and receiving and storing the uploaded files.


The destination server doesn't have PHP 

Laurent
---End Message---
---BeginMessage---
Hello,

on 01/27/2006 11:07 AM Laurent Vanstaen said the following:
  I see your point. Here in my case the server I want to copy a file on
  has 192.168.1.1 for IP address and thus cannot be found from outside a
  LAN, so the security problem is not that much important. But I agree
  with you and see what you mean.

 You may want to try sending files via form upload. Then on the
 destination end the you could have a PHP script that would take care of
 authentication and receiving and storing the uploaded files.
 
 The destination server doesn't have PHP 

It that case you need to use a different kind of file server support.
For instance, if it has Samba (Windows like file shares), you can try
this other class:

http://www.phpclasses.org/smbwebclient

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
---End Message---
---BeginMessage---
Laurent,

Laurent Vanstaen wrote:
 
 Hello,


php-general Digest 28 Jan 2006 07:51:37 -0000 Issue 3931

2006-01-27 Thread php-general-digest-help

php-general Digest 28 Jan 2006 07:51:37 - Issue 3931

Topics (messages 229371 through 229392):

PHP Frameworks?
229371 by: Jay Paulson
229389 by: Richard K Miller

Re: doubt regarding while loop
229372 by: David Grant
229380 by: David Hall

PHP Job Opening in UAE
229373 by: M Saleh EG
229379 by: Miles Thompson

get key of array (key function sucks?)
229374 by: Sjef
229388 by: David Robley

questions regarding PHP and Forms
229375 by: Paul Goepfert
229376 by: Jay Paulson
229377 by: Austin Denyer
229378 by: Weber Sites LTD

PHP Newsletter
229381 by: Jedidiah

php classes and data retrieval
229382 by: robert

A black thumbnail.
229383 by: tedd
229384 by: Philip Hallstrom
229390 by: Richard Correia
229392 by: Weber Sites LTD

Adding XMLDBX to PHP CVS
229385 by: Mark

Please help with apache 2
229386 by: PHP
229387 by: The Doctor

Re: Apache is not parsing .php files
229391 by: Richard Correia

Administrivia:

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

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

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


--
---BeginMessage---
Has anyone used any of the following frameworks?  What is the general
opinion of using frameworks etc?

WASP - http://wasp.sourceforge.net/content/
Symfony - http://www.symfony-project.com/
Prado - http://www.xisc.com/
WACT - http://www.phpwact.org/
CakePHP - http://www.cakephp.org/
---End Message---
---BeginMessage---
I haven't used them, but our local user group recently had a meeting  
on PHP frameworks[1].  The feeling of the people that have used them  
was that Symfony was a good project, and that CakePHP was a  
particularly large installation.  No one mentioned having used Prado,  
WACT or WASP.


We also had the creator of PHP on Trax present on the framework he  
created that very closely resembles Ruby on Rails.  His company used  
Trax to build KatrinaHousing.org, a site that helped hurricane  
victims find housing.  I have a copy of his (John Peterson's) slides  
on my website[2].


Richard

[1] http://uphpu.org/article.php?story=2006011715500753
[2] http://richardkmiller.com/blog/archives/2006/01/eventful-month-in- 
technology (third section)


On Jan 27, 2006, at 10:25 AM, Jay Paulson wrote:


Has anyone used any of the following frameworks?  What is the general
opinion of using frameworks etc?

WASP - http://wasp.sourceforge.net/content/
Symfony - http://www.symfony-project.com/
Prado - http://www.xisc.com/
WACT - http://www.phpwact.org/
CakePHP - http://www.cakephp.org/

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

---End Message---
---BeginMessage---
Suresh,

suresh kumar wrote:
 hi,
for eg 
   
 while(list(t1,t2,...)=mysql_fetch_row($result)):
 endwhile;

You could start with list($t1, $t2, ...) instead.  Personally, I'd done
it without assuming mysql_fetch_row is returning an array.

Try:

$t1 = ;
$t2 = ;
while ($row = mysql_fetch_row($result)) {
list($t1, $t2) = $row;
...
}

echo $t1;

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

WANTED: Junior PHP Developer in Bristol, UK
---End Message---
---BeginMessage---

suresh kumar wrote:

while(list(t1,t2,...)=mysql_fetch_row($result)):


do you mean to use:
while(list($t1, $t2, . . .) = mysql_fetch_row($result)):

David Hall
---End Message---
---BeginMessage---
Login Innovations, a new media  internet solutions studio in UAE is looking
for a resident-in-house PHP developer with at least 2 years experience.

Skills required:
OO knowledge and PHP5
PEAR aware
Framework and code libraries integration
CMS integration
SQL and PL-SQL (MySQL 4.x, MySQL 5)
XML and AJaX is plus

Send your resume to [EMAIL PROTECTED]
---End Message---
---BeginMessage---


UAE = United Arab Emirates?

Do you want people on-site, or to work remotely?

Miles

At 02:05 PM 1/27/2006, M Saleh EG wrote:


Login Innovations, a new media  internet solutions studio in UAE is looking
for a resident-in-house PHP developer with at least 2 years experience.

Skills required:
OO knowledge and PHP5
PEAR aware
Framework and code libraries integration
CMS integration
SQL and PL-SQL (MySQL 4.x, MySQL 5)
XML and AJaX is plus

Send your resume to [EMAIL PROTECTED]



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 267.14.23/242 - Release Date: 1/26/2006
---End Message---
---BeginMessage---
Hallo,
I am adding a value to a session variable (an array). Then I want to place 
the key of the array in another session variable to keep it for later use 
(so I 

Re: [PHP] copy problem with HTTP wrapper

2006-01-27 Thread Laurent Vanstaen



 Hi all,
   I'm trying to copy a file from my PHP server to another server (a
 home
 gateway, called a LiveBox). I've used this code :

 $livebox = 192.168.1.1;
 ...
 ...
 ...
 $crontab_livebox = http://.$livebox./cgi-bin/newCrontab;;
 if (!copy($crontab_temp_name, $crontab_livebox)) {
echo br /Impossible to copy the temp crontab file to the
 Livebox.br
 /;
 }

 I get the following error :
 HTTP wrapper does not support writeable connections

 OK can I solve this. Can't I use URLs with the copy function if they
 don't
 point to my PHP server (local URLs) ? How can I copy a file from my
 PHP
 server to another server (there's no FTP server on the destination
 machine)
 ?

Put it this way:
If what you typed above *DID* work, what's to stop *ME* from copying
whatever I want onto your server?...


I see your point. Here in my case the server I want to copy a file on has 
192.168.1.1 for IP address and thus cannot be found from outside a LAN, so 
the security problem is not that much important. But I agree with you and 
see what you mean.




You probably need to use cURL to login to your livebox, and then POST
the data into the newCrontab form handler.



OK I'm gonna look for information about that.

Thank you,

Laurent

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



Re: [PHP][SOLVED] Re: usr VAR value as a VAR Name

2006-01-27 Thread Barry

Chris Boget wrote:
Let me start by saying there is nothing wrong with the above and it's 
doing exactly what the OP needed.  However, when I use variable 
variables, I prefer to use the following notation:

${$foo}
It makes the coder's intention clear and makes it so that it can't be 
mistaken for a possible typo when someone comes in after the fact to 
maintain the code.


And When I use this and when i use that. Oh i like this ^_^
Btw. my working buddys said on first view your example looked more wrong.



Try it and see. ;)


Try what? ^_^



And on top of that, i wont let anyone code in my PHP docs who doesn't 
know what $$var is or does!!



Agreed.  But there have been a few times when I accidently added in an
extra $ to the variable and, consequently, didn't get the results I 
expected.


Never happened to me ;)
I mostly look at the screen programming :)

PHP - Best coded with: Open eyes O_O

--
Smileys rule (cX.x)C --o(^_^o)

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



[PHP] Re: Does file_exists() 'honour' open_basedir?

2006-01-27 Thread DRYALLS
Let me try and answer my own question. I've *heard* that since PHP v4.3.2 
file_exists() returne an open_basedir warning, but earlier PHP versions did 
not. Is this true?

DRYALLS [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I have 2 different PHP installs, each are slightly different versions, and 
each have different open_basedir restictions.

 I have a PHP script that fails on ONE of the installs but NOT the other.

 The line that fails is $foo = file_exists(/proc/loadavg);

 What I don't understand is why one script fails, yet the other does not 
 because NEITHER have /proc in the open_basedir path.

 What could be different about the PHP configs that makes one report a PHP 
 warning, yet the other does not? 

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



Re: [PHP] Re: Does file_exists() 'honour' open_basedir?

2006-01-27 Thread David Grant
Hi,

Perhaps you refer to this (fixed in 4.3.3):

http://bugs.php.net/bug.php?id=24313

David

DRYALLS wrote:
 Let me try and answer my own question. I've *heard* that since PHP v4.3.2 
 file_exists() returne an open_basedir warning, but earlier PHP versions did 
 not. Is this true?
 
 DRYALLS [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 I have 2 different PHP installs, each are slightly different versions, and 
 each have different open_basedir restictions.

 I have a PHP script that fails on ONE of the installs but NOT the other.

 The line that fails is $foo = file_exists(/proc/loadavg);

 What I don't understand is why one script fails, yet the other does not 
 because NEITHER have /proc in the open_basedir path.

 What could be different about the PHP configs that makes one report a PHP 
 warning, yet the other does not? 
 


-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] Re: Does file_exists() 'honour' open_basedir?

2006-01-27 Thread David Grant
Perhaps you saw it here:

http://php.net/file_exists

Search the page for ceo at l-i-e dot com or open_basedir.

David

DRYALLS wrote:
 Let me try and answer my own question. I've *heard* that since PHP v4.3.2 
 file_exists() returne an open_basedir warning, but earlier PHP versions did 
 not. Is this true?
 
 DRYALLS [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 I have 2 different PHP installs, each are slightly different versions, and 
 each have different open_basedir restictions.

 I have a PHP script that fails on ONE of the installs but NOT the other.

 The line that fails is $foo = file_exists(/proc/loadavg);

 What I don't understand is why one script fails, yet the other does not 
 because NEITHER have /proc in the open_basedir path.

 What could be different about the PHP configs that makes one report a PHP 
 warning, yet the other does not? 
 


-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] copy problem with HTTP wrapper

2006-01-27 Thread Manuel Lemos
Hello,

on 01/27/2006 05:59 AM Laurent Vanstaen said the following:
 I see your point. Here in my case the server I want to copy a file on
 has 192.168.1.1 for IP address and thus cannot be found from outside a
 LAN, so the security problem is not that much important. But I agree
 with you and see what you mean.

You may want to try sending files via form upload. Then on the
destination end the you could have a PHP script that would take care of
authentication and receiving and storing the uploaded files.

In that case you may want to try this HTTP client class. It can act as a
normal browser submitting files via POST and also authentication, cookie
handling and redirection in case you want make a robust file copying system:

http://www.phpclasses.org/httpclient


-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] copy problem with HTTP wrapper

2006-01-27 Thread Laurent Vanstaen



Hello,

on 01/27/2006 05:59 AM Laurent Vanstaen said the following:
 I see your point. Here in my case the server I want to copy a file on
 has 192.168.1.1 for IP address and thus cannot be found from outside a
 LAN, so the security problem is not that much important. But I agree
 with you and see what you mean.

You may want to try sending files via form upload. Then on the
destination end the you could have a PHP script that would take care of
authentication and receiving and storing the uploaded files.


The destination server doesn't have PHP 

Laurent

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



Re: [PHP] copy problem with HTTP wrapper

2006-01-27 Thread Manuel Lemos
Hello,

on 01/27/2006 11:07 AM Laurent Vanstaen said the following:
  I see your point. Here in my case the server I want to copy a file on
  has 192.168.1.1 for IP address and thus cannot be found from outside a
  LAN, so the security problem is not that much important. But I agree
  with you and see what you mean.

 You may want to try sending files via form upload. Then on the
 destination end the you could have a PHP script that would take care of
 authentication and receiving and storing the uploaded files.
 
 The destination server doesn't have PHP 

It that case you need to use a different kind of file server support.
For instance, if it has Samba (Windows like file shares), you can try
this other class:

http://www.phpclasses.org/smbwebclient

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] copy problem with HTTP wrapper

2006-01-27 Thread David Grant
Laurent,

Laurent Vanstaen wrote:
 
 Hello,

 on 01/27/2006 05:59 AM Laurent Vanstaen said the following:
  I see your point. Here in my case the server I want to copy a file on
  has 192.168.1.1 for IP address and thus cannot be found from outside a
  LAN, so the security problem is not that much important. But I agree
  with you and see what you mean.

 You may want to try sending files via form upload. Then on the
 destination end the you could have a PHP script that would take care of
 authentication and receiving and storing the uploaded files.
 
 The destination server doesn't have PHP 

When you say Livebox, are you in fact referring to the router given
out by your ISP?  If so, what makes you think it's writable in the first
place?

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



Re: [PHP] copy problem with HTTP wrapper

2006-01-27 Thread Laurent Vanstaen




Laurent Vanstaen wrote:

 Hello,

 on 01/27/2006 05:59 AM Laurent Vanstaen said the following:
  I see your point. Here in my case the server I want to copy a file on
  has 192.168.1.1 for IP address and thus cannot be found from outside 
a

  LAN, so the security problem is not that much important. But I agree
  with you and see what you mean.

 You may want to try sending files via form upload. Then on the
 destination end the you could have a PHP script that would take care of
 authentication and receiving and storing the uploaded files.

 The destination server doesn't have PHP 

When you say Livebox, are you in fact referring to the router given out 
by your ISP ?


Yes, that's it.


If so, what makes you think it's writable in the first place?


'Cause I work for this ISP 

Laurent

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



Re: [PHP] copy problem with HTTP wrapper

2006-01-27 Thread Laurent Vanstaen



 If so, what makes you think it's writable in the first place?

 'Cause I work for this ISP 

So you don't have specs then I guess, since you're asking in a public forum 
!


Bingo :)
Shitty product bought on the shelf from a third party, no specs, no doc ...


Have you considered using a HTTP PUT request (using cURL)?


I'm trying it. Thank you.

Laurent

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



Re: [PHP] copy problem with HTTP wrapper

2006-01-27 Thread David Grant
Laurent,

Laurent Vanstaen wrote:
 If so, what makes you think it's writable in the first place?
 
 'Cause I work for this ISP 

So you don't have specs then I guess, since you're asking in a public
forum!  Have you considered using a HTTP PUT request (using cURL)?

php.net/curl

$curl = curl_init();
$file = replacementfile.txt;

curl_setopt($curl, CURLOPT_URL, 'http://192.168.1.1/cgi-bin/newCrontab');
curl_setopt($curl, CURLOPT_PUT, true);
curl_setopt($curl, CURLOPT_INFILESIZE, filesize($file));
curl_setopt($curl, CURLOPT_INFILE, fopen($file, 'r'));

curl_exec($curl);

Note: you might need to set the CURLOPT_USERPWD option too.

This is my best guess at a solution, but obviously I've not tested it.

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

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



[PHP] PHP Job opening in UK, London

2006-01-27 Thread Chris Boget
My company is looking for a PHP developer to work out of their London 
office.  If you live in/around the city and are interested, please respond 
to me (personally, not the list :p) with your resume/CV.


thnx,
Chris 


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



[PHP] PHP Frameworks?

2006-01-27 Thread Jay Paulson
Has anyone used any of the following frameworks?  What is the general
opinion of using frameworks etc?

WASP - http://wasp.sourceforge.net/content/
Symfony - http://www.symfony-project.com/
Prado - http://www.xisc.com/
WACT - http://www.phpwact.org/
CakePHP - http://www.cakephp.org/

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



Re: [PHP] doubt regarding while loop

2006-01-27 Thread David Grant
Suresh,

suresh kumar wrote:
 hi,
for eg 
   
 while(list(t1,t2,...)=mysql_fetch_row($result)):
 endwhile;

You could start with list($t1, $t2, ...) instead.  Personally, I'd done
it without assuming mysql_fetch_row is returning an array.

Try:

$t1 = ;
$t2 = ;
while ($row = mysql_fetch_row($result)) {
list($t1, $t2) = $row;
...
}

echo $t1;

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

WANTED: Junior PHP Developer in Bristol, UK

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



[PHP] doubt regarding while loop

2006-01-27 Thread suresh kumar
hi,
   for eg 
  
while(list(t1,t2,...)=mysql_fetch_row($result)):
endwhile;
 while i use $t1 ouside while loop ,its corresponding
value is not  displaying,how can i display the value
of $t1.

  A.suresh



__ 
Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com

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



[PHP] PHP Job Opening in UAE

2006-01-27 Thread M Saleh EG
Login Innovations, a new media  internet solutions studio in UAE is looking
for a resident-in-house PHP developer with at least 2 years experience.

Skills required:
OO knowledge and PHP5
PEAR aware
Framework and code libraries integration
CMS integration
SQL and PL-SQL (MySQL 4.x, MySQL 5)
XML and AJaX is plus

Send your resume to [EMAIL PROTECTED]


[PHP] get key of array (key function sucks?)

2006-01-27 Thread Sjef
Hallo,
I am adding a value to a session variable (an array). Then I want to place 
the key of the array in another session variable to keep it for later use 
(so I can return to the array to write data to it). The key function should 
work there, but it seems to be a bit strange.

Imagine:

$array = array();
$array[] = Yellow;
$array[] = Geen;
$array[] = Red;

foreach ($array as $key=$value)
{
print (Key:  . $key .  has color  . $value .  | );
print (current key =  . key($array) . br/);
}

If you run the loop the key value returned from key is one higher than the 
key in $key, and the last key is null?

How do I get the present key without a problem??

Thanks!! 

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



[PHP] questions regarding PHP and Forms

2006-01-27 Thread Paul Goepfert
Hi all,

I am  writing my first website in php.  I have a few questions.

1) I need to do vaildation on form values that I have entered into a
form.  Is there a way I can write the vaildation code on the same page
as the form in php?

2)  I have a drop down menu on one of my form fields.  What I want to
do is if a certain item is seelected I want to have a new textbox
appear below the drop down menu.  Is there a way to do this in php?

Thanks

Paul

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



Re: [PHP] questions regarding PHP and Forms

2006-01-27 Thread Jay Paulson
 1) I need to do vaildation on form values that I have entered into a
 form.  Is there a way I can write the vaildation code on the same page
 as the form in php?

Yes there sure is. :)

if (isset($submit)) {
// data validation etc.
}
else {
// display html form
}

 2)  I have a drop down menu on one of my form fields.  What I want to
 do is if a certain item is seelected I want to have a new textbox
 appear below the drop down menu.  Is there a way to do this in php?

You'll have to do this via JavaScript. =/

Hope that helps!

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



Re: [PHP] questions regarding PHP and Forms

2006-01-27 Thread Austin Denyer

On Fri, 27 Jan 2006 12:28:07 -0700
Paul Goepfert [EMAIL PROTECTED] wrote:

 I am  writing my first website in php.  I have a few questions.
 
 1) I need to do vaildation on form values that I have entered into a
 form.  Is there a way I can write the vaildation code on the same page
 as the form in php?

Yes.  What you do is check to see if you have any input, if not then
display the form, if you do then validate the input and skip the
display. 

 2)  I have a drop down menu on one of my form fields.  What I want to
 do is if a certain item is seelected I want to have a new textbox
 appear below the drop down menu.  Is there a way to do this in php?

It depends.  If you want the text box to appear immediately then no,
you'll need JavaScript.  If you're ok with the user hitting submit and
being re-desplayed the same page, this time with the text box showing,
then that is trivial in php.  You can use the same process as the
validation in (1) above.

Regards,
Ozz.


pgpe5O4s3sb82.pgp
Description: PGP signature


RE: [PHP] questions regarding PHP and Forms

2006-01-27 Thread Weber Sites LTD
Check out this list of code examples to help with #1
http://www.weberdev.com/AdvancedSearch.php?searchtype=titlesearch=validatio
n

Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
PHP code examples : http://www.weberdev.com 
Free Uptime Monitor : http://uptime.weberdev.com
PHP content for your site : http://content.weber-sites.com
 

-Original Message-
From: Paul Goepfert [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 27, 2006 9:28 PM
To: php-general@lists.php.net
Subject: [PHP] questions regarding PHP and Forms

Hi all,

I am  writing my first website in php.  I have a few questions.

1) I need to do vaildation on form values that I have entered into a form.
Is there a way I can write the vaildation code on the same page as the form
in php?

2)  I have a drop down menu on one of my form fields.  What I want to do is
if a certain item is seelected I want to have a new textbox appear below the
drop down menu.  Is there a way to do this in php?

Thanks

Paul

--
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] PHP Job Opening in UAE

2006-01-27 Thread Miles Thompson


UAE = United Arab Emirates?

Do you want people on-site, or to work remotely?

Miles

At 02:05 PM 1/27/2006, M Saleh EG wrote:


Login Innovations, a new media  internet solutions studio in UAE is looking
for a resident-in-house PHP developer with at least 2 years experience.

Skills required:
OO knowledge and PHP5
PEAR aware
Framework and code libraries integration
CMS integration
SQL and PL-SQL (MySQL 4.x, MySQL 5)
XML and AJaX is plus

Send your resume to [EMAIL PROTECTED]



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 267.14.23/242 - Release Date: 1/26/2006

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



[PHP] Re: doubt regarding while loop

2006-01-27 Thread David Hall

suresh kumar wrote:

while(list(t1,t2,...)=mysql_fetch_row($result)):


do you mean to use:
while(list($t1, $t2, . . .) = mysql_fetch_row($result)):

David Hall

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



[PHP] PHP Newsletter

2006-01-27 Thread Jedidiah
I send out a daily email to an email list.  I have only been doing this for
about a week, and realized today that each one of them so far has had at
least one mysterious exclamation point somewhere in the email.  This is
sometimes in the middle of the word or sentence, but always out of place.  I
have tried replacing my quotation marks with single quotes, quot;, and
adding a backslash before them as I was told the issue had something to do
with these, but none of this has helped.  

 

So first question.How do I lose this exclamation point?

 

And second questions.Is there anyway around changing my quotation marks to
something else or is that just part of it?

 

Thanks,

 

Jedidiah 



[PHP] php classes and data retrieval

2006-01-27 Thread robert

Hello!
I have a database and php classes and I'm not sure the best way I  
should be retrieving the data.


as below, if 'other' (line 9) is stored in the database as an id of a  
record in another table,

should my getData() method:

a. return the id as part of the MyObj object and whatever function
that called it is responsible for matching the id to the name?
or
b. should it look up the value from within the class?

(I read something about JOIN or stuff beyond SELECT --sorry i'm kinda  
just getting into this-- could bring a database to it's knees)


Also I thought that with OOP you are supposed to keep the classes  
independent of each other, but I was thinking if I need a MyObj I  
would want all the data in a ready usable form and not a mix of data  
and database ids.


I'm not sure what is the best practice or even if there is a correct  
one, but suggestions would be appreciated!


-robert


here is my set up:

DATABASE:
myobj_table with id, name, other as columns
other_table with id, name as columns

PHP CLASSES:
   1: ?php
   2:
   3: /* base object data structure */
   4: class MyObj {
   5:
   6:   function MyObj($id, $name, $other) {
   7: $this-id = $id;
   8: $this-name = $name;
   9: $this-other = $other; // ?? ID OR VALUE ??
  10:   }
  11:
  12:   // getters/setters
  13:
  14: }
  15:
  16:
  17: /* create/update/delete database methods */
  18: class MyObjData {
  19:
  20:   var $_id;
  21:   var $_items;
  22:
  23:   function MyObjData($id) {
  24: $this-_id = $id;
  25:   }
  26:
  27:   function getData() {
  28: $query = select * from myobject_table where id=' . $this- 
_id . ';
  29: $records = getDatabaseRecords($query); // some db action:  
returns an array of records

  30: foreach ($records as $record) {
  31:   $data = new MyObj(
  32:   $record['id']
  33: , $record['name']
  34: , $record['other']
  35: );
  36:   $this-_items[] = $data;
  37:   unset($data);
  38: }
  39: return $this-_items;
  40:   }
  41:
  42:   // other methods
  43:
  44: }
  45:
  46:
  47:
  48: ?

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



[PHP] A black thumbnail.

2006-01-27 Thread tedd

Hi:

I'm trying to create a thumbnail from a jpeg stored in a long blob in mySQL.

What's wrong here? I get an image that's the correct size, but it's black.

Any ideas?

Thanks.

tedd

code

$dbQuery = SELECT image_type, image, image_width, image_height ;
$dbQuery .= FROM pictures ;
$dbQuery .= WHERE image_Id = $pic_id;
$result = mysql_query($dbQuery) or die(Couldn't get file list);

if(mysql_num_rows($result) == 1)
{
$fileType = @mysql_result($result, 0, image_type);
$fileContent = @mysql_result($result, 0, image);
$width_orig = @mysql_result($result, 0, image_width);
$height_orig = @mysql_result($result, 0, image_height);

// Set a maximum height and width
$width = 200;
$height = 200;

if ($width  ($width_orig  $height_orig))
   {
   $width = ($height / $height_orig) * $width_orig;
   }
else
   {
   $height = ($width / $width_orig) * $height_orig;
   }

// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($fileContent);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, 
$width_orig, $height_orig);


// Output
imagejpeg($image_p, null, 100);
}

/code
--

http://sperling.com/

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



Re: [PHP] A black thumbnail.

2006-01-27 Thread Philip Hallstrom

(skip down)


I'm trying to create a thumbnail from a jpeg stored in a long blob in mySQL.
What's wrong here? I get an image that's the correct size, but it's black.

Any ideas?

code

$dbQuery = SELECT image_type, image, image_width, image_height ;
$dbQuery .= FROM pictures ;
$dbQuery .= WHERE image_Id = $pic_id;
$result = mysql_query($dbQuery) or die(Couldn't get file list);

if(mysql_num_rows($result) == 1)
{
$fileType = @mysql_result($result, 0, image_type);
$fileContent = @mysql_result($result, 0, image);
$width_orig = @mysql_result($result, 0, image_width);
$height_orig = @mysql_result($result, 0, image_height);

// Set a maximum height and width
$width = 200;
$height = 200;

if ($width  ($width_orig  $height_orig))
  {
  $width = ($height / $height_orig) * $width_orig;
  }
else
  {
  $height = ($width / $width_orig) * $height_orig;
  }

// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($fileContent);


imagecreatefromjpeg takes a *filename* not the actual contents of the file 
itself.  So $image is going to be invalid so your next command isn't going 
to do what you think which means you're going to get black as that's 
probably the first/default color of $image_p.


-philip


imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, 
$width_orig, $height_orig);


// Output
imagejpeg($image_p, null, 100);
}

/code
--

http://sperling.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] Adding XMLDBX to PHP CVS

2006-01-27 Thread Mark

I am thinking about adding XMLDBX, a pretty good XML serializer to CVS. It
is documented and available at www.mohawksoft.org.

Any comments?

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



[PHP] Please help with apache 2

2006-01-27 Thread PHP



Help, I can't find anything on this.

I upgraded from apache 1.3 to apache 
2.2

My problem is, I currently have .htm files being 
parsed as php, that works fine.

However, if I have the php_engine turned off for a 
directory, any .htm files will now prompt firefox to download it.

How do I stop this? I need to keep .htm files 
parsed for php, but I also need to be able to turn php off for certain 
directories and still allow regular .htm files to be seen.

Thanks.

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 1/27/2006

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

Re: [PHP] Please help with apache 2

2006-01-27 Thread The Doctor
On Fri, Jan 27, 2006 at 06:03:50PM -0800, PHP wrote:
 Help, I can't find anything on this.
 
 I upgraded from apache 1.3 to apache 2.2
 
 My problem is, I currently have .htm files being parsed as php, that works 
 fine.
 
 However, if I have the php_engine turned off for a directory, any .htm files 
 will now prompt firefox to download it.
 
 How do I stop this? I need to keep .htm files parsed for php, but I also need 
 to be able to turn php off for certain directories and still allow regular 
 .htm files to be seen.
 
 Thanks.


HAve you examined you php.ini and httpd.conf for any changes?
 
 -- 
 This message has been scanned for viruses and
 dangerous content by MailScanner, and is
 believed to be clean.
 

Content-Description: AVG certification
 No virus found in this outgoing message.
 Checked by AVG Free Edition.
 Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 1/27/2006
 

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

-- 
Member - Liberal International  
This is [EMAIL PROTECTED]   Ici [EMAIL PROTECTED]
God Queen and country! Beware Anti-Christ rising!
Born 29 Jan 1969 Redhill Surrey UK

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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



[PHP] Re: get key of array (key function sucks?)

2006-01-27 Thread David Robley
Sjef wrote:

 Hallo,
 I am adding a value to a session variable (an array). Then I want to place
 the key of the array in another session variable to keep it for later use
 (so I can return to the array to write data to it). The key function
 should work there, but it seems to be a bit strange.
 
 Imagine:
 
 $array = array();
 $array[] = Yellow;
 $array[] = Geen;
 $array[] = Red;
 
 foreach ($array as $key=$value)
 {
 print (Key:  . $key .  has color  . $value .  | );
 print (current key =  . key($array) . br/);
 }
 
 If you run the loop the key value returned from key is one higher than the
 key in $key, and the last key is null?
 
 How do I get the present key without a problem??

You've already got it in $key. I think you will find that foreach advances
the internal array pointer by one each time it loops, so what you have is
key($array) looking at the next array element from the one in $key and
$value.

Nothing wrong with key(), just a misunderstanding on your part about how
foreach works :-)

In simplified terms, the first time through the foreach loop, this happens:

pointer at element 0
$key gets value 0
$value gets value Yellow
pointer moved to element 1

Then you use key(), which gives you - guess what?



Cheers
-- 
David Robley

I'll tempt Adam tonight, she said evilly.

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



Re: [PHP] PHP Frameworks?

2006-01-27 Thread Richard K Miller
I haven't used them, but our local user group recently had a meeting  
on PHP frameworks[1].  The feeling of the people that have used them  
was that Symfony was a good project, and that CakePHP was a  
particularly large installation.  No one mentioned having used Prado,  
WACT or WASP.


We also had the creator of PHP on Trax present on the framework he  
created that very closely resembles Ruby on Rails.  His company used  
Trax to build KatrinaHousing.org, a site that helped hurricane  
victims find housing.  I have a copy of his (John Peterson's) slides  
on my website[2].


Richard

[1] http://uphpu.org/article.php?story=2006011715500753
[2] http://richardkmiller.com/blog/archives/2006/01/eventful-month-in- 
technology (third section)


On Jan 27, 2006, at 10:25 AM, Jay Paulson wrote:


Has anyone used any of the following frameworks?  What is the general
opinion of using frameworks etc?

WASP - http://wasp.sourceforge.net/content/
Symfony - http://www.symfony-project.com/
Prado - http://www.xisc.com/
WACT - http://www.phpwact.org/
CakePHP - http://www.cakephp.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



Re: [PHP] A black thumbnail.

2006-01-27 Thread Richard Correia
Hi Tedd,

Dynamic Thumbnail generation:
http://www.weberdev.com/ViewArticle-388.html




On 1/28/06, tedd [EMAIL PROTECTED] wrote:

 Hi:

 I'm trying to create a thumbnail from a jpeg stored in a long blob in
 mySQL.

 What's wrong here? I get an image that's the correct size, but it's black.

 Any ideas?

 Thanks.

 tedd

 code

 $dbQuery = SELECT image_type, image, image_width, image_height ;
 $dbQuery .= FROM pictures ;
 $dbQuery .= WHERE image_Id = $pic_id;
 $result = mysql_query($dbQuery) or die(Couldn't get file list);

 if(mysql_num_rows($result) == 1)
 {
 $fileType = @mysql_result($result, 0, image_type);
 $fileContent = @mysql_result($result, 0, image);
 $width_orig = @mysql_result($result, 0, image_width);
 $height_orig = @mysql_result($result, 0, image_height);

 // Set a maximum height and width
 $width = 200;
 $height = 200;

 if ($width  ($width_orig  $height_orig))
{
$width = ($height / $height_orig) * $width_orig;
}
 else
{
$height = ($width / $width_orig) * $height_orig;
}

 // Resample
 $image_p = imagecreatetruecolor($width, $height);
 $image = imagecreatefromjpeg($fileContent);
 imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height,
 $width_orig, $height_orig);

 // Output
 imagejpeg($image_p, null, 100);
 }

 /code
 --




Re: [PHP] Apache is not parsing .php files

2006-01-27 Thread Richard Correia
have you added .php .php3 .php4 extenstions to be treated as  php files?


Thanks,
Richard


On 1/27/06, sanjay [EMAIL PROTECTED] wrote:

 Hi,

 I have a strange problem while trying to run php based applications.

 Lets start with phpMyAdmin, a very popular open source tool to manage
 MySQL written in php.
 I have already installed phpMyAdmin and was running fine.
 One day suddenly when I pointed my browser at :
 http://localhost/phpMyAdmin
 Instead of running the phpMyAdmin browser opened a message window with
 options-
 Open With or Save to disk .
 I am sure its not browser problem because I tried on Firefox-1.5,
 Mozilla, Epiphany and Konqueror.

 One more point I would like to add here that if I write one small php
 program and
 save it in as php file (test.php) then
 http://localhost/test.php
 executes properly

 I am using Fedora 2 and apache2, php-4.3x and mysql-3.x were part of the
 Fedora installation.
 The only change I made in the /etc/php.ini file was to increase the
 memory limit from 8MB to 12MB.
 (Then restarted the http server)
 Now even php.ini file is in the original state but problem is still there.
 The http.conf file is unchanged.


 Can any one give me some sort of idea.

 Thanks,

 Sanjay

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




RE: [PHP] A black thumbnail.

2006-01-27 Thread Weber Sites LTD
Check out this article : http://www.weberdev.com/ViewArticle-3.html

Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
PHP  MySQL Forums : http://www.weberforums.com
Learn PHP  MySQL Playing Trivia : http://www.webertrivia.com
Free Uptime Monitor : http://uptime.weberdev.com
 

-Original Message-
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 28, 2006 2:43 AM
To: php-general@lists.php.net
Subject: [PHP] A black thumbnail.

Hi:

I'm trying to create a thumbnail from a jpeg stored in a long blob in mySQL.

What's wrong here? I get an image that's the correct size, but it's black.

Any ideas?

Thanks.

tedd

code

$dbQuery = SELECT image_type, image, image_width, image_height ; $dbQuery
.= FROM pictures ; $dbQuery .= WHERE image_Id = $pic_id; $result =
mysql_query($dbQuery) or die(Couldn't get file list);

if(mysql_num_rows($result) == 1)
{
$fileType = @mysql_result($result, 0, image_type); $fileContent =
@mysql_result($result, 0, image); $width_orig = @mysql_result($result, 0,
image_width); $height_orig = @mysql_result($result, 0, image_height);

// Set a maximum height and width
$width = 200;
$height = 200;

if ($width  ($width_orig  $height_orig))
{
$width = ($height / $height_orig) * $width_orig;
}
else
{
$height = ($width / $width_orig) * $height_orig;
}

// Resample
$image_p = imagecreatetruecolor($width, $height); $image =
imagecreatefromjpeg($fileContent);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height,
$width_orig, $height_orig);

// Output
imagejpeg($image_p, null, 100);
}

/code
--


http://sperling.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