Re: [PHP] Rapid application development

2006-10-04 Thread Manuel Lemos
Hello,

 I need your feedback in this

 What is the best RAD (Rapid application development) do you use for
 PHP to develop an *advance* application in few days or weeks ?

 I like programming but one this that I hate is the first stage of
 programming when you start creating the basic code (db connection,
 interface, insert,update,etc), this is why I'm looking for a good
 RAD tool that can speed up my programming.

You may want to take a look at Metastorage. It is an ORM
(Object-Relational Mapping) generator tool. It generates classes that
let you store and retrieve your database table rows as objects.

It also takes care of generating classes to install or upgrade your
database schema when your data model is updated.

There would be a lot to say about Metastorage because it is really
powerful and effectively enables rapid development. But I think it is
better for you to take a look at it directly in its site:

http://www.metastorage.net/


-- 

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] Re: Re: Re: Frustrated trying to get help from your site

2006-10-04 Thread Robin Vickery

On 03/10/06, David Robley [EMAIL PROTECTED] wrote:

Michelle Konzack wrote:

 Am 2006-09-27 17:39:25, schrieb David Robley:

 88 tons!! Point us to an image of that please.

 Currently not availlable but it is an ex Pershing II Transporter
 from the US-Army manufactured by the german Enterprise MAN.

You surely don't mean the tracked vehicle that was used to transport the
missiles? How the #%@ can you register and drive something like that.
Boggle!


Probably not. Try looking for a picture of a MAN M1014 Transporter
Erector Launcher.

ummm... here's one:

http://commons.wikimedia.org/wiki/Image:M-1014_MAN.jpg

-robin

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



[PHP] Re: file to blob

2006-10-04 Thread Manuel Lemos
Hello,

on 10/03/2006 04:38 PM Joshua Capy said the following:
 I am relatively new to php and could use a good pointing in the right
 direction.
 
 I have a soap client in NuSoap that I developed for a webservice that I
 wrote in another language and I need it to be able to send a file in a
 blob.
 
 I can't find an example of how you load a file in its entirety (not just
 the content) into a blob in PHP. I need to be able to do this because
 the webservice that is being called recreates the document locally for
 the user.
 
 Can this be done in PHP?

You may want to take a look at this HTTP client class. It even comes
with an example of how to submit a SOAP request. Although it will not
build the SOAP request for you, at least it can stream the file data to
the HTTP server so you do not have to load it in memory all at once.

-- 

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



[PHP] Re: file to blob

2006-10-04 Thread Manuel Lemos
Hello,

Sorry, I sent the message too soon. The HTTP client class is here:

http://www.phpclasses.org/httpclient


on 10/03/2006 04:38 PM Joshua Capy said the following:
 I am relatively new to php and could use a good pointing in the right
 direction.
 
 I have a soap client in NuSoap that I developed for a webservice that I
 wrote in another language and I need it to be able to send a file in a
 blob.
 
 I can't find an example of how you load a file in its entirety (not just
 the content) into a blob in PHP. I need to be able to do this because
 the webservice that is being called recreates the document locally for
 the user.
 
 Can this be done in PHP?

You may want to take a look at this HTTP client class. It even comes
with an example of how to submit a SOAP request. Although it will not
build the SOAP request for you, at least it can stream the file data to
the HTTP server so you do not have to load it in memory all at once.

-- 

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

2006-10-04 Thread Philipp Schwarz

Stupid?

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



[PHP] Re: Strange error in PHP/MySQL

2006-10-04 Thread Ivo F.A.C. Fokkema
On Sun, 01 Oct 2006 19:59:08 +0100, Deckard wrote:

 Hello,
 
 I have this code:
 
  // insert new user in mysql user table
   $sqlInsertUser = INSERT INTO user (Host, User , Password ,
 Select_priv, Insert_priv, Update_priv, Delete_priv) VALUES ('$hostname',
 '$mysql_username', '$mysql_password', 'N', 'N', 'N', 'N');
 
   if (mysql_query($sqlInsertUser, $conn))
$messagesqlInsertUser = 'Success...';
   else
$messagesqlInsertUser = 'Error: ' . mysql_error();
   $result = mysql_query($sqlInsertUser);
 
 that gives me the error:
 Error: Duplicate entry 'localhost-' for key 1
 
 I can't see nothing wrong with it and if i run it in MySQL's prompt
 everything's fine.
 
 Any ideas ?
 
 Besta Regards,
 Deckard.

Hi,

Wouldn't it be easier to just use the MySQL GRANT statement?

Ivo

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



Re: [PHP] RE:[PHP] Client Computer Registration

2006-10-04 Thread Wesley Acheson

I don't see how its that much of a secuity risk, they create a ssh
tunnel.  All it does is add an extra layer of authentication.  Its not
like the password requirements are bypassed.


On 10/3/06, Richard Lynch [EMAIL PROTECTED] wrote:

On Tue, October 3, 2006 2:33 am, Wesley Acheson wrote:
 They could also be doing something like giving the client an SSH key
 to download, I've heard of this situation in a bank before.

Is the key tied to my hardware?

At least that stops the virus/Trojan scenario.

But not the petty thief who breaks in and takes my computer, and oh
look, now I have his bank account too!  Sweet!!!

Puhleeze!

Do you really want to bank with a place that does this?

--
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] Re: Understanding persistent connections with oci8

2006-10-04 Thread Manuel Lemos
Hello,

on 10/03/2006 07:03 PM Mendonce, Kiran (STSD) said the following:
 This is a follow up to the bug (#39029) that I reported earlier which
 has been repeatedly closed as bogus.
 
 The oci8.persistent_timeout setting in the php.ini file is documented as
 :
 The maximum length of time (in seconds) that a given process is allowed
 to maintain an idle persistent connection. Setting this option to -1
 means that idle persistent connections will be maintained forever. 
 
 If I do not want the connection to be persist forever, then by using
 this setting, I should be able to ensure that a connection is not idle
 for longer than what I specified. However, when I set persistent_timeout
 to 10 seconds, I find that the connection is not terminated even after
 10 seconds have passed. In fact, it doesn't terminate at all. So the
 question is what is the purpose of this setting ? And what does an 'idle
 connection' mean ? A google query for 'idle timeout' yields enough
 results to point that when the timeout occurs, the idle connection is
 terminated.
 
 Obviously there is a bug somewhere. Either in the documentation or in
 the behavior. Please advise.

I think that there is no bug and that option is useless.

If you are using Apache, it will rotate the processes that serve each
request. So, unless your server is mostly idle or your scripts rarely
access the database, your connections will keep being reused before
reaching that timeout.

If you are willing to reduce the number of persistent Oracle
connections, you will most likely get better results if you move your
site images to a separate Web server. Image requests do not establish
Oracle connections, but they raise the need for Apache to fork more
processes, which leads to more opened persistent connections.

Here you may find more details about that strategy:

http://www.meta-language.net/metabase-faq.html#excessive-connections

-- 

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



[PHP] want to create new format for fckeditor's combo box...

2006-10-04 Thread Bipul Dobhal

Hi, 

How can i create my own formats for fckeditors combo box.. 

I found the line 
  FCKConfig.FontFormats='p;dic'pre;address;h1;h2;h3;h4;h5;h6'; 
in fckconfig.js file. 
I think by setting my own format in this line may handle this problem
because when I added any word or letter in this line like this 
   FCKConfig.FontFormats='p;dic'pre;address;h1;h2;h3;h4;h5;h6;Temp'; 

it creates a new format in combo box with named Undefined.. 

If i will get the source where these formats
('p;dic'pre;address;h1;h2;h3;h4;h5;h6' ) are defined then I will solve my
problem. 

Can any one shed some light on where and how to define the formats so that
it will be rendered on the fckeditor's format combo box..? 

Thanks, 
Bipul Dobhal

-- 
View this message in context: 
http://www.nabble.com/want-to-create-new-format-for-fckeditor%27s-combo-box...-tf2381768.html#a6637711
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] Re: xsl + xml

2006-10-04 Thread José Manuel Peso

Colin Guthrie escribió:

José Manuel Peso Echarri wrote:
  

Hi people,

I  am looking for a library that mix xsl and xml producing output in
xhtml at server side.
I have readed about sablotron and libxsl, but i am confused.

Which is the best alternative in perfomance terms for the versions 4.2,
4.3?
is there some way for preprocess xsl or let ir in memory or any way for
improve the resources usage?



Dunno about v4, but for v5 at least:

$xsl = DOMDocument::loadXML($xslt_as_a_string);
$xsltproc = new XSLTProcessor;
$xsltproc-importStyleSheet($xsl);
echo $xsltproc-transformToXML($my_xml_dom_doc);

  

If anybody is interested in the code:

There is in DOM form(compile --with-dom-xslt and libxslt):

   $xslDom = domxml_xslt_stylesheet_file($this-xsl);

   $params = array();
   $result = $this-xslDom-process($xml, $params);
   $this-assertEquals($this-html,$result-dumpmem());

There is in Sablotron form( compiling with --enable-xslt and sablotron ext):

$arguments = array('/_xml' = file_get_contents($this-xml),
'/_xsl' = file_get_contents($this-xsl));   
$xh = xslt_create();   
$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', 
NULL,arguments);   
xslt_free($xh);


Of course, all in PHP4


I had tested this two API for processing XSL, but now my question is 
about the improvement of resources usage.


I want to use eaccelerator extension for caching the xsl_stylessheet 
objects and give the xmls continuosly for getting xhtml. It not works 
correctly, because the xsl object contains a handler (that is not 
serializable).


Any way for caching in memory xsl objects ?


Regards,
Jose

Or something like that. going form memory, so there may be more
  
appropriate commands etc.


Col.

  




[PHP] Re: Test

2006-10-04 Thread David Robley
Sheena Mullally wrote:

 test

Sorry, you failed.



Cheers
-- 
David Robley

This tag is devoid of any humor.
Today is Boomtime, the 58th day of Bureaucracy in the YOLD 3172. 

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



[PHP] Re: [PHP-DB] textarea value assignment

2006-10-04 Thread Stut

Bradley,

There are words to describe people like you, but this list tends to be 
quite clean so I'll refrain.


Bradley, meet /dev/null, I hope you'll be very happy together!

-Stut

(I'm thinking this fscker has set up an automated response system - 
someone at PHP must be able to unsubscribe him from the list)


Bradley Stahl wrote:

If anyone is interested in some VERY good webhosting that has support for
PHP and MySQL, please take a look at the following link:

http://www.sturdyhosting.com/idevaffiliate/idevaffiliate.php?id=100

They offer domain names for $8.95 and also webhositng solutions for as low
as $2.95 per month.


I hope that some of you are interested and can join the greatest 
webhosting

company in the world!


On 10/4/06, *Stut* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

Brad Bonkoski wrote:
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
 Hello
 how I could assign a textarea with a variable value?
 Although I tried to achieve an allocation like a normal input,
but
 it does not work so I have no success with textarea.

 The code looks like following fragment.

 $problem_val = mysqlclean($_SESSION, problem_eb, 500,
$connection);

 textarea style=width: 320px; height: 150px; heigth=30
width=50
 cols=1 rows=1 name=problem_eb value=?php echo
 $problem_val?/textarea


 Best regards, Joerg Kuehne


 There is no value attribute of textarea...to put text in there, you
 place it between the textarea/textarea tags.
 i.e.

 textarea style=width: 320px; height: 150px; heigth=30
width=50
 cols=1 rows=1 name=problem_eb ?php echo $problem_val;
 ?/textarea

Also worth mentioning that you may run into problems if you don't use
htmlentities on $problem_val, like so...

textarea style=width: 320px; height: 150px; heigth=30 width=50
cols=1 rows=1 name=problem_eb ?php echo
htmlentities($problem_val); ?/textarea

-Stut

--
PHP Database 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: want to create new format for fckeditor's combo box...

2006-10-04 Thread Kae Verens

Bipul Dobhal wrote:
Hi, 

How can i create my own formats for fckeditors combo box.. 

I found the line 
  FCKConfig.FontFormats='p;dic'pre;address;h1;h2;h3;h4;h5;h6'; 
in fckconfig.js file. 
I think by setting my own format in this line may handle this problem
because when I added any word or letter in this line like this 
   FCKConfig.FontFormats='p;dic'pre;address;h1;h2;h3;h4;h5;h6;Temp'; 

it creates a new format in combo box with named Undefined.. 


If i will get the source where these formats
('p;dic'pre;address;h1;h2;h3;h4;h5;h6' ) are defined then I will solve my
problem. 


Can any one shed some light on where and how to define the formats so that
it will be rendered on the fckeditor's format combo box..? 

Thanks, 
Bipul Dobhal



that's a javascript question, and should be asked in FCKeditor's forums - see 
under Support at http://fckeditor.net/


Kae

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



[PHP] Class sqlite2pgsql - Export from sqlite to Import in postgresql

2006-10-04 Thread Jônata Tyska Carvalho

Hi people,

Im working in a class that export a database from sqlite to postgresql. I
will finish my work soon and my doubt is: This class is useful for the php
programers comunnity or is useless because everybody that need to use this,
already develop a class like that ? I needed to do this conversion of
databases and didn't find such class, then i develop one.



P.S: Please forget my english errors.

--
Jônata Tyska Carvalho
-
-- Técnico em Informática pelo Colégio Técnico Industrial (CTI)
-- Graduando em Engenharia de Computação
Fundação Universidade Federal de Rio Grande (FURG)


Re: [PHP] changing the global variables (_SERVER[HTTP_USER_AGENT])

2006-10-04 Thread Richard Lynch
Register Globals will take all the keys/values in
$_SERVER/$_POST/$_GET/$_COOKIES and turn each one into a variable in
your script.

It is equivalent to:
extract($_POST);
extract($_GET);
extract($_COOKIE);
.
.
.

The GPC settings in php.ini determine the order of the above
statements, in case *both* POST and GET have 'x' defined, for example.


$_SERVER['USER_AGENT'] or whatever it is, is nothing more than the
User-agent: header sent by your tool.

You can put whatever you want in that header.

What the server decides to *do* because of what you put in there is
another matter.

Some sites don't want to be indexed or otherwise visited by automated
scripts.

Follow the robot guidelines [Google for it] or expect to have severe
issues with your webhost/carrier shutting down your account, no
refund, no appeal, because other hosts are complaining about you...

It's also inconceivable that wget, curl, and similar tools cannot do
whatever customization you need.  Those tools exist expressly for that
purpose -- to be customized to automate the retrieval of data.  So,
almost-for-sure, you have not correctly identified your needs and
assessed the tools available, and you're wasting a lot of your time
inventing the wheel.

On Tue, October 3, 2006 1:59 pm, Balaji A wrote:
 Thanks Richard.
 I am returned progarmmer for PHP..I am little confused about register
 globals and Server variables.

 Your understanding is corect...I want to masquerade the client
 requests
 I need to customize the tool thats why I am not ging for public
 tools..

 anyway thanks for the info.. :-)


 On 10/3/06, Richard Lynch [EMAIL PROTECTED] wrote:

 On Tue, October 3, 2006 12:43 pm, Balaji A wrote:
  Hi,
  in php.ini I have changed the register_global to On.
 
  Is it possible to change the global variable
 _SERVER[HTTP_USER_AGENT]?
 
  Thanks in advance..

 E.

 You're not making sense...

 You want my browser to LIE to your server about what browser it is?
 Opera will let you do that.

 You want to not believe I'm not using the browser I say I'm using,
 by
 changing the string it sends you to identify itself?
 Just ignore what I send.

 You are trying to masquerede as some other browser, but don't want
 to
 let us know because you think it's some big Security thing, or
 you're
 scraping things you think somebody cares about or...?
 I hesitate to help you, but the bottom line is that there are
 *dozens*
 of tools to web scrape and masquerede as any browser you want, so
 even
 if you're as, e, naive, as this post indicates, you're going to
 find them within a week.


 None of this has ANYTHING to do with register_globals, so you
 clearly
 are not understanding the User-agent: header, or register_globals,
 or
 both.  Probably both, to be honest...

 re-read the register_globals page on php.net

 And for the User-agent, Opera, wget, Firefox with LiveHTTPHeaders,
 and
 dozens of other tools let you alter that.

 But ain't no way you can make *MY* browser not send you the
 User-agent
 it wants to send.  It's *MY* browser, on *MY* computer, thank you
 very
 much.

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





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



RE: [PHP] Re: Understanding persistent connections with oci8

2006-10-04 Thread Mendonce, Kiran (STSD)
I understand the performance boost one can get by reusing existing
connections. And I did see for myself that with the default settings,
oci_pconnect() does reuse all the connections.

But what should happen if there are idle connections and the timeout is
reached ? That is my question. What is the purpose of the
persistent_timeout setting ? Does it give the user a means of specifying
a timeout after which idle connections are removed ?

-Original Message-
From: Manuel Lemos [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 04, 2006 12:16 AM
To: php-general@lists.php.net
Subject: [PHP] Re: Understanding persistent connections with oci8

Hello,

on 10/03/2006 07:03 PM Mendonce, Kiran (STSD) said the following:
 This is a follow up to the bug (#39029) that I reported earlier which 
 has been repeatedly closed as bogus.
 
 The oci8.persistent_timeout setting in the php.ini file is documented 
 as
 :
 The maximum length of time (in seconds) that a given process is 
 allowed to maintain an idle persistent connection. Setting this option

 to -1 means that idle persistent connections will be maintained
forever. 
 
 If I do not want the connection to be persist forever, then by using 
 this setting, I should be able to ensure that a connection is not idle

 for longer than what I specified. However, when I set 
 persistent_timeout to 10 seconds, I find that the connection is not 
 terminated even after 10 seconds have passed. In fact, it doesn't 
 terminate at all. So the question is what is the purpose of this 
 setting ? And what does an 'idle connection' mean ? A google query for

 'idle timeout' yields enough results to point that when the timeout 
 occurs, the idle connection is terminated.
 
 Obviously there is a bug somewhere. Either in the documentation or in 
 the behavior. Please advise.

I think that there is no bug and that option is useless.

If you are using Apache, it will rotate the processes that serve each
request. So, unless your server is mostly idle or your scripts rarely
access the database, your connections will keep being reused before
reaching that timeout.

If you are willing to reduce the number of persistent Oracle
connections, you will most likely get better results if you move your
site images to a separate Web server. Image requests do not establish
Oracle connections, but they raise the need for Apache to fork more
processes, which leads to more opened persistent connections.

Here you may find more details about that strategy:

http://www.meta-language.net/metabase-faq.html#excessive-connections

-- 

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

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



[PHP] PHP jump to other page

2006-10-04 Thread Groundhog

how can I jump to another page after IF..ELSE statement, for example:

IF (statement == TRUE)
  { stay on this page, index.php }
ELSE { jump to index2.php}

--
Come and Visit My Blog
http://ubuntu-ku.blogspot.com

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



[PHP] File Uploads not working over SSL

2006-10-04 Thread Rahul S. Johari
Ave,

I have a File Manager application in place for over 2 years now.
Everything¹s been working groovy!
Until yesterday. Yesterday we purchased and installed an SSL Certificate.
And now the uploads are not working anymore! Gets the ³Page cannot be
displayed² error. Tried the same application without SSL and it¹s working
fine!

What¹s the workaround? How do I get this to work on SSL?
Any suggestions?

Rahul S. Johari
Supervisor, Internet  Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com



Re: [PHP] PHP jump to other page

2006-10-04 Thread Jo�o C�ndido de Souza Neto
In other hand, if you sent any character yet, you can use.

IF (statement == TRUE)
stay on this page, index.php
ELSE
   echo script language=\javascript\window 
location=\index2.php\;/script;


AraDaen [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
 If you have not sent any character till that moment, you can use:

 IF (statement == TRUE)
   { stay on this page, index.php }
 ELSE {
 header(Location: index2.php);




 cya 

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



Re: [PHP] File Uploads not working over SSL

2006-10-04 Thread Jo�o C�ndido de Souza Neto
Please, show us your code.

Rahul S. Johari [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
Ave,

I have a File Manager application in place for over 2 years now.
Everything¹s been working groovy!
Until yesterday. Yesterday we purchased and installed an SSL Certificate.
And now the uploads are not working anymore! Gets the ³Page cannot be
displayed² error. Tried the same application without SSL and it¹s working
fine!

What¹s the workaround? How do I get this to work on SSL?
Any suggestions?

Rahul S. Johari
Supervisor, Internet  Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



Re: [PHP] File Uploads not working over SSL

2006-10-04 Thread Rahul S. Johari

Well, the File Manager application itself is pretty extensive... But if
you're looking for the upload code, here it is (sensitive information
erased):

if($upload_file) {
$db = mysql_connect(localhost,usr,pwd);
mysql_select_db(db,$db);
$date = date(m-d-Y, D, H:i);
$img1_name = str_replace(\', null,
$img1_name);
if(($img1_name==) || ($img1_size=10)) {
?
script
language=javascriptalert('error');/script
?
}
else {

$justchecking = imsafm/$location/$img1_name;
if (file_exists($justchecking)) {
echo i$img1_name/i already exists. Please delete
the file first, or rename the file before uploading.;
}
   
else {
$sql = INSERT INTO file
(login,filename,descr,size,uppedby,date) VALUES
('$location','$img1_name','$desc','$img1_size','$PHP_login','$date');
$result = mysql_query($sql) or die(There is a
problem.);
copy($img1, imsafm/$location/$img1_name) or
die(Could not do);
}
}


And this is what I have as the form tag for the upload form. The form
itself is pretty simple  basic, so nothing much to show in it:
form method=post action=http://www.myurl.com/imsafm2_main.php;
name=upload_form enctype=multipart/form-data

Thanks.

On 10/4/06 3:49 PM, João Cândido de Souza Neto
[EMAIL PROTECTED] wrote:

 Please, show us your code.
 
 Rahul S. Johari [EMAIL PROTECTED] escreveu na mensagem
 news:[EMAIL PROTECTED]
 Ave,
 
 I have a File Manager application in place for over 2 years now.
 Everything¹s been working groovy!
 Until yesterday. Yesterday we purchased and installed an SSL Certificate.
 And now the uploads are not working anymore! Gets the ³Page cannot be
 displayed² error. Tried the same application without SSL and it¹s working
 fine!
 
 What¹s the workaround? How do I get this to work on SSL?
 Any suggestions?
 
 Rahul S. Johari
 Supervisor, Internet  Administration
 Informed Marketing Services Inc.
 500 Federal Street, Suite 201
 Troy NY 12180
 
 Tel: (518) 687-6700 x154
 Fax: (518) 687-6799
 Email: [EMAIL PROTECTED]
 http://www.informed-sources.com

Rahul S. Johari
Supervisor, Internet  Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com



Re: [PHP] File Uploads not working over SSL

2006-10-04 Thread Rahul S. Johari

Sorry, copied wrong code to you. Actually code has https in it:
form method=post action=https://www.myurl.com/imsafm2_main.php;
name=upload_form enctype=multipart/form-data



On 10/4/06 4:55 PM, Andrew Brampton [EMAIL PROTECTED] wrote:

 form method=post action=http://www.myurl.com/imsafm2_main.php;
 name=upload_form enctype=multipart/form-data
 
 
 might be your error, should that not be https://   ?
 
 Andrew
 
 - Original Message -
 From: Rahul S. Johari [EMAIL PROTECTED]
 To: Jo ã o C â ndido de Souza Neto [EMAIL PROTECTED]; PHP
 php-general@lists.php.net
 Sent: Wednesday, October 04, 2006 9:02 PM
 Subject: Re: [PHP] File Uploads not working over SSL
 
 
 
 Well, the File Manager application itself is pretty extensive... But if
 you're looking for the upload code, here it is (sensitive information
 erased):
 
 if($upload_file) {
 $db = mysql_connect(localhost,usr,pwd);
 mysql_select_db(db,$db);
 $date = date(m-d-Y, D, H:i);
 $img1_name = str_replace(\', null,
 $img1_name);
 if(($img1_name==) || ($img1_size=10)) {
 ?
 script
 language=javascriptalert('error');/script
 ?
 }
 else {
 
 $justchecking = imsafm/$location/$img1_name;
 if (file_exists($justchecking)) {
 echo i$img1_name/i already exists. Please delete
 the file first, or rename the file before uploading.;
 }
 
 else {
 $sql = INSERT INTO file
 (login,filename,descr,size,uppedby,date) VALUES
 ('$location','$img1_name','$desc','$img1_size','$PHP_login','$date');
 $result = mysql_query($sql) or die(There is a
 problem.);
 copy($img1, imsafm/$location/$img1_name) or
 die(Could not do);
 }
 }
 
 
 And this is what I have as the form tag for the upload form. The form
 itself is pretty simple  basic, so nothing much to show in it:
 form method=post action=http://www.myurl.com/imsafm2_main.php;
 name=upload_form enctype=multipart/form-data
 
 Thanks.
 
 On 10/4/06 3:49 PM, João Cândido de Souza Neto
 [EMAIL PROTECTED] wrote:
 
 Please, show us your code.
 
 Rahul S. Johari [EMAIL PROTECTED] escreveu na mensagem
 news:[EMAIL PROTECTED]
 Ave,
 
 I have a File Manager application in place for over 2 years now.
 Everything¹s been working groovy!
 Until yesterday. Yesterday we purchased and installed an SSL Certificate.
 And now the uploads are not working anymore! Gets the ³Page cannot be
 displayed² error. Tried the same application without SSL and it¹s working
 fine!
 
 What¹s the workaround? How do I get this to work on SSL?
 Any suggestions?
 
 Rahul S. Johari
 Supervisor, Internet  Administration
 Informed Marketing Services Inc.
 500 Federal Street, Suite 201
 Troy NY 12180
 
 Tel: (518) 687-6700 x154
 Fax: (518) 687-6799
 Email: [EMAIL PROTECTED]
 http://www.informed-sources.com
 
 Rahul S. Johari
 Supervisor, Internet  Administration
 Informed Marketing Services Inc.
 500 Federal Street, Suite 201
 Troy NY 12180
 
 Tel: (518) 687-6700 x154
 Fax: (518) 687-6799
 Email: [EMAIL PROTECTED]
 http://www.informed-sources.com
 

Rahul S. Johari
Supervisor, Internet  Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



[PHP] quick question about preg_replace

2006-10-04 Thread Martin Bach Nielsen
Hi all.

 

I have written a guestbook (I know, there's a ton out there), which until
recently did not get any spam, so now I'm trying to remove the spam-ad by
using preg_replace:

 

$melding = preg_replace('/(a href=\http:\/\/[^^]+)/i', This message is
temporarily cut-off due to spam-suspicion., $melding);

 

However, this only makes the problem half-solved, since I also want any text
before the link to be replaced with a message as stated above. The above
line removes anything after 'a href=//'.

Is there any way to make the above line to include anything before the a
href=// ?

 

I have tried different options, and yes, I have read the php manual on
preg_replace, but I might not have properly identified how to get the text
in front modified.

 

Thankful for any hints, tips, links, anything that helps :-)

 

Regards,

Martin Bach Nielsen 



Re: [PHP] WebMail client

2006-10-04 Thread Christopher Weldon
Peter Lauri wrote:
 Hi,
 
  
 
 Do you have any suggestion on WebMail clients written in PHP that is good
 and easy to install?
 

http://hastymail.sourceforge.net/

--
Christopher Weldon

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



Re: [PHP] Re: file to blob

2006-10-04 Thread Curt Zirzow

On 10/4/06, Manuel Lemos [EMAIL PROTECTED] wrote:

Hello,

Sorry, I sent the message too soon. The HTTP client class is here:

http://www.phpclasses.org/httpclient



I'm wondering how soap has to do with this.

Curt

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



[PHP] Really strange

2006-10-04 Thread Deckard
Hi,

I have this line of code:
include_once('../config.inc.php');

I'm 100% sure that the file config.inc.php is a directory up.

config.inc.php is in /var/www/html
and the file that calls it is in
/var/www/html/classes

nevertheless, i'm getting the error:
Warning: main(../config.inc): failed to open stream: No such file or
directory in /var/www/html/classes/dBInsert.php on line 10

Warning: main(): Failed opening '../config.inc' for inclusion
(include_path='.:/usr/share/pear') in /var/www/html/classes/dBInsert.php
on line 10

I'm boggled!

Any help would be appreciated.

Best Regards,
Deckard

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



[PHP] Re: Really strange

2006-10-04 Thread Ben Ramsey

On 10/4/06 8:32 PM, Deckard wrote:

Hi,

I have this line of code:
include_once('../config.inc.php');

I'm 100% sure that the file config.inc.php is a directory up.

config.inc.php is in /var/www/html
and the file that calls it is in
/var/www/html/classes

nevertheless, i'm getting the error:
Warning: main(../config.inc): failed to open stream: No such file or
directory in /var/www/html/classes/dBInsert.php on line 10

Warning: main(): Failed opening '../config.inc' for inclusion
(include_path='.:/usr/share/pear') in /var/www/html/classes/dBInsert.php
on line 10


The first thing that jumps out at me is that your error says it failed 
to open ../config.inc, but you say the file is named config.inc.php. 
Check your code to ensure that you have:


include_once('../config.inc.php');

and not:

include_once('../config.inc');

If config.inc.php is the correct file you want to include and you're 
trying to include config.inc, then it obviously can't find it because it 
doesn't exist. :-)


--
Ben Ramsey
http://benramsey.com/

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



Re: [PHP] Re: Really strange / TYPO

2006-10-04 Thread Deckard
Hi,

It's a typo.
The file is really config.inc.php everywhere

Regards,
Deckard

Ben Ramsey wrote:
 On 10/4/06 8:32 PM, Deckard wrote:
 Hi,

 I have this line of code:
 include_once('../config.inc.php');

 I'm 100% sure that the file config.inc.php is a directory up.

 config.inc.php is in /var/www/html
 and the file that calls it is in
 /var/www/html/classes

 nevertheless, i'm getting the error:
 Warning: main(../config.inc): failed to open stream: No such file or
 directory in /var/www/html/classes/dBInsert.php on line 10

 Warning: main(): Failed opening '../config.inc' for inclusion
 (include_path='.:/usr/share/pear') in /var/www/html/classes/dBInsert.php
 on line 10
 
 The first thing that jumps out at me is that your error says it failed
 to open ../config.inc, but you say the file is named config.inc.php.
 Check your code to ensure that you have:
 
 include_once('../config.inc.php');
 
 and not:
 
 include_once('../config.inc');
 
 If config.inc.php is the correct file you want to include and you're
 trying to include config.inc, then it obviously can't find it because it
 doesn't exist. :-)
 

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



Re: [PHP] PHP jump to other page

2006-10-04 Thread Penthexquadium
On Thu, 5 Oct 2006 01:17:41 +0700, Groundhog [EMAIL PROTECTED] wrote:

 how can I jump to another page after IF..ELSE statement, for example:
 
 IF (statement == TRUE)
{ stay on this page, index.php }
 ELSE { jump to index2.php}
 
 -- 
 Come and Visit My Blog
 http://ubuntu-ku.blogspot.com
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

if (!statement) {
header('Location: index2.php');
exit;
}
// other codes...

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



Re: [PHP] WebMail client

2006-10-04 Thread Glenn Richmond
http://www.roundcube.net/

I can't say enough good things about the roundcube project. Ajax-based,
like a desktop email client in a browser. Still got some minor bugs, but
works pretty well. Note that it's still a Beta at this point.

Cheers,

Glenn.

Christopher Weldon wrote:
 Peter Lauri wrote:
   
 Hi,

  

 Do you have any suggestion on WebMail clients written in PHP that is good
 and easy to install?

 

 http://hastymail.sourceforge.net/

 --
 Christopher Weldon

   

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



Re: [PHP] quick question about preg_replace

2006-10-04 Thread Penthexquadium
On Wed, 4 Oct 2006 23:19:58 +0200, Martin Bach Nielsen [EMAIL PROTECTED] 
wrote:

 Hi all.
 
  
 
 I have written a guestbook (I know, there's a ton out there), which until
 recently did not get any spam, so now I'm trying to remove the spam-ad by
 using preg_replace:
 
  
 
 $melding = preg_replace('/(a href=\http:\/\/[^^]+)/i', This message is
 temporarily cut-off due to spam-suspicion., $melding);
 
  
 
 However, this only makes the problem half-solved, since I also want any text
 before the link to be replaced with a message as stated above. The above
 line removes anything after 'a href=//'.
 
 Is there any way to make the above line to include anything before the a
 href=// ?
 
  
 
 I have tried different options, and yes, I have read the php manual on
 preg_replace, but I might not have properly identified how to get the text
 in front modified.
 
  
 
 Thankful for any hints, tips, links, anything that helps :-)
 
  
 
 Regards,
 
 Martin Bach Nielsen 
 

If you only want to replace the line including url(s) by a message, a
simple regular expression is enough.

?php
$melding = This is a spam.\n
 . This is a a href=\http://www.example.com/\;example/a line.\n
 . Another line.\n
 . a href=\http://www.e.com/ads/show?n=123\;123/a (456)\n
 . End Line.\n;

$melding = preg_replace(/.*?a href=\http:\/\/.+/i, This line is 
temporarily cut-off due to spam-suspicion., $melding);

echo $melding;
?

The script above will output:

This is a spam.
This line is temporarily cut-off due to spam-suspicion.
Another line.
This line is temporarily cut-off due to spam-suspicion.
End Line.

-- 
Sorry for my poor English.

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



Re: [PHP] Re: Really strange / TYPO

2006-10-04 Thread Ben Ramsey

On 10/4/06 9:14 PM, Deckard wrote:

It's a typo.
The file is really config.inc.php everywhere


Check the file permissions. Does the Webserver have permission to read 
from the /var/www/html (it probably does, but it wouldn't hurt to 
check)? Does the Web server have permission to read 
/var/www/html/config.inc.php? Do you happen to have PHP running in 
safe_mode? If so, is the owner of /var/www/html/classes/dBInsert.php the 
same owner of /var/www/html/config.inc.php?


These are just the things I can think of off the top of my head that 
would block your script from being able to include a file one directory 
above it.




Ben Ramsey wrote:

On 10/4/06 8:32 PM, Deckard wrote:

Hi,

I have this line of code:
include_once('../config.inc.php');

I'm 100% sure that the file config.inc.php is a directory up.

config.inc.php is in /var/www/html
and the file that calls it is in
/var/www/html/classes

nevertheless, i'm getting the error:
Warning: main(../config.inc): failed to open stream: No such file or
directory in /var/www/html/classes/dBInsert.php on line 10

Warning: main(): Failed opening '../config.inc' for inclusion
(include_path='.:/usr/share/pear') in /var/www/html/classes/dBInsert.php
on line 10

The first thing that jumps out at me is that your error says it failed
to open ../config.inc, but you say the file is named config.inc.php.
Check your code to ensure that you have:

include_once('../config.inc.php');

and not:

include_once('../config.inc');

If config.inc.php is the correct file you want to include and you're
trying to include config.inc, then it obviously can't find it because it
doesn't exist. :-)




--
Ben Ramsey
http://benramsey.com/

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



[PHP] Help on objects

2006-10-04 Thread Deckard
Hi,

I'm trying to lay my hands on PHP OOP, but it's not easy :(
I've read several examples in the web, but cannot transpose to may case.

I'm trying to set a class to make SQL inserts in mysql.

I have the class:
-
?php

  class dBInsert
 {
  // global variables
  var $first;

 // constructor
 function dBInsert($table, $sql)
 {
  $this-table = $table;
  $this-sql   = $sql;

  return(TRUE); 
 }


  // function that constructs the sql and inserts it into the database
  function InsertDB($sql)
   {

print($sql);
// connect to MySQL
$conn-debug=1;
$conn = ADONewConnection('mysql');
$conn-PConnect('localhost', 'deckard', 'ble', 'wordlife');

if ($conn-Execute($sql) === false)
print 'error inserting: '.$conn-ErrorMsg().'BR';

return (TRUE);
   }
}


and the code that calls it:

?php

 include_once(classes/dBInsert.php);
 $sql = INSERT INTO wl_admins VALUES ('',2);
 $dBInsert = new dBInsert('wl_admins', '$sql');
 $dBInsert-InsertDB('$sql');

?


but it's not working ?

Can anyone give me a hand here ?

I've read the manuals, examples, etc.

Any help would be appreciated.

Best Regards,
Deckard

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



Re: [PHP] Re: Really strange / TYPO

2006-10-04 Thread Deckard
Yes, permissions are fine :(

Ben Ramsey wrote:
 On 10/4/06 9:14 PM, Deckard wrote:
 It's a typo.
 The file is really config.inc.php everywhere
 
 Check the file permissions. Does the Webserver have permission to read
 from the /var/www/html (it probably does, but it wouldn't hurt to
 check)? Does the Web server have permission to read
 /var/www/html/config.inc.php? Do you happen to have PHP running in
 safe_mode? If so, is the owner of /var/www/html/classes/dBInsert.php the
 same owner of /var/www/html/config.inc.php?
 
 These are just the things I can think of off the top of my head that
 would block your script from being able to include a file one directory
 above it.
 

 Ben Ramsey wrote:
 On 10/4/06 8:32 PM, Deckard wrote:
 Hi,

 I have this line of code:
 include_once('../config.inc.php');

 I'm 100% sure that the file config.inc.php is a directory up.

 config.inc.php is in /var/www/html
 and the file that calls it is in
 /var/www/html/classes

 nevertheless, i'm getting the error:
 Warning: main(../config.inc): failed to open stream: No such file or
 directory in /var/www/html/classes/dBInsert.php on line 10

 Warning: main(): Failed opening '../config.inc' for inclusion
 (include_path='.:/usr/share/pear') in
 /var/www/html/classes/dBInsert.php
 on line 10
 The first thing that jumps out at me is that your error says it failed
 to open ../config.inc, but you say the file is named config.inc.php.
 Check your code to ensure that you have:

 include_once('../config.inc.php');

 and not:

 include_once('../config.inc');

 If config.inc.php is the correct file you want to include and you're
 trying to include config.inc, then it obviously can't find it because it
 doesn't exist. :-)

 
 

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



Re: [PHP] Help on objects

2006-10-04 Thread Penthexquadium
On Thu, 05 Oct 2006 02:47:59 +0100, Deckard [EMAIL PROTECTED] wrote:

 Hi,
 
 I'm trying to lay my hands on PHP OOP, but it's not easy :(
 I've read several examples in the web, but cannot transpose to may case.
 
 I'm trying to set a class to make SQL inserts in mysql.
 
 I have the class:
 -
 ?php
 
   class dBInsert
  {
   // global variables
   var $first;
   
  // constructor
  function dBInsert($table, $sql)
  {
   $this-table = $table;
   $this-sql   = $sql;
   
   return(TRUE);   
  }
 
 
   // function that constructs the sql and inserts it into the database
   function InsertDB($sql)
{
 
 print($sql);
 // connect to MySQL
 $conn-debug=1;
 $conn = ADONewConnection('mysql');
 $conn-PConnect('localhost', 'deckard', 'ble', 'wordlife');
   
   if ($conn-Execute($sql) === false)
   print 'error inserting: '.$conn-ErrorMsg().'BR';
   
   return (TRUE);
}
 }
 
 
 and the code that calls it:
 
 ?php
 
  include_once(classes/dBInsert.php);
  $sql = INSERT INTO wl_admins VALUES ('',2);
  $dBInsert = new dBInsert('wl_admins', '$sql');
  $dBInsert-InsertDB('$sql');
 
 ?
 
 
 but it's not working ?
 
 Can anyone give me a hand here ?
 
 I've read the manuals, examples, etc.
 
 Any help would be appreciated.
 
 Best Regards,
 Deckard
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

You'd better learn the basic knowledge of PHP. There are several obvious
mistakes in your code.

 $dBInsert = new dBInsert('wl_admins', '$sql');
 $dBInsert-InsertDB('$sql');
Note that variables will *not* be expanded when they occur in single
quoted strings.

 $this-table = $table;
 $this-sql   = $sql;
The two variables seemed useless.

 $conn-debug=1;
 $conn = ADONewConnection('mysql');
Called $conn before creating it.

And, I could not to know what is the purpose of this class.

PS, a description such as it's not working is useless for solving the
problem.

-- 
Sorry for my poor English.

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



Re: [PHP] WebMail client

2006-10-04 Thread Google Kreme

On 04 Oct 2006, at 19:28 , Glenn Richmond wrote:

http://www.roundcube.net/

I can't say enough good things about the roundcube project. Ajax- 
based,
like a desktop email client in a browser. Still got some minor  
bugs, but

works pretty well. Note that it's still a Beta at this point.


Despite it being beta, and rather an early beta at that, I've found  
roundcube to work amazingly well. less features than Squirrelmail,  
but sooo much faster.


I'm super impressed.

--
My little brother got his arm stuck in the microwave. So my mom had  
to take him to the hospital. My grandma dropped acid this morning,  
and she freaked out. She hijacked a busload of penguins. So it's sort  
of a family crisis. Bye!


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



[PHP] Re: OOP Hello World

2006-10-04 Thread Martin Alterisio

Me... again, still boring you to death with meaningless OOP rantings.

First I would like to point out that there was a design mistake in what I
proposed in the last mail (following afterwards): the Saluter shouldn't be
an abstract class, it isn't correct to base your class hierarchy on the
ability to greet (or in the ability to do something generally speaking). If
it's done that way we'll have classes coexisting in the same branch of the
class tree, but possibly having completely different nature. Saluter should
be an interface:

 interface class Saluter {
   public function greet(Salutable $receiver);
 }

 class FormalSaluter implements Saluter {
   public function greet(Salutable $receiver) {
 echo Hello  . $receiver-getSalutationName() . \n;
   }
 }

Then, I'll try to translate what has been said in the spanish list.

It has been proposed that World should be a singleton, since there is only
one world... but this arguable, at metaphysic level perhaps...

Also an observer pattern could be used so anyone can hear the greetings. But
I think this should be done on the design of the greeting enviroment
abstraction (to provide other places than standard output where the greeting
can be said).

The saluters factory should use a factory method pattern or an abstract
factory pattern? I think an abstract factory is not appropiate in this case,
the creation process is not that complex to require this kind of design
pattern.

Also I proposed that decorators could be used to add styles to the greeting
for outputs that allow styling (e.g.:html). In this case maybe an abstract
factory would be appropiate, so that decorated saluters are created for the
appropiate type of output, combined with a builder pattern to create the
decorated saluters (this last part I thought it just now, I'll post it later
on the spanish list)

Well, I think that sums it all up.

2006/9/29, Martin Alterisio [EMAIL PROTECTED]:


What's up folks?

I just wanted to tell you about a thread that's going on in the spanish
php mailing list. A fellow software developer which had just started with
OOP was asking for Hello World examples using OOP. The examples of code he
had been doing was not that different from the usual Hello World example we
all know and love(?), so I thought he was missing the point of what was the
purpose of using OOP. This was my reply (I'll try to keep the translation as
accurate as possible):

I believe you have misunderstood what is the purpose of OOP, your objects
are not proper abstractions.

First and most important, you should define what is the problem to solve:
greet the world.
We build an abstraction of the problem and its main components: somebody
who greets and something to greet.
Here we're working with generalizations, since our main objective is to
build reusable objects. For that purpose is useful that our saluter could
be used to greet more than just the world.

Therefore we'll first define what kind of interaction we expect the
salutation receivers to have, in the following interface:

  interface Salutable {
public function getSalutationName();
  }

In this interface we have all we need to properly greet any entity: the
name we should use when doing the salutation.

Then we create the object which represents the world:

  class World implements Salutable {
public function getSalutationName() {
  return World;
}
  }

Now we're missing a saluter, but we're not sure which way of greeting
would be appropiate, so we prefer to create an abstract saluter and leave
the child implementation to decide the appropiate greeting:

  abstract class Saluter {
abstract public function greet(Salutable $receiver);
  }

In our case we need a formal saluter as we should not disrespect the world
(saying hey! wazzup world? could be offensive), then:

  class FormalSaluter extends Saluter {
public function greet(Salutable $receiver) {
  echo Hello  . $receiver-getSalutationName() . \n;
}
  }

Finally we make our saluter greet the world:

  $saluter = new FormalSaluter();
  $world = new World();
  $saluter-greet($world);



Other things you should keep in mind:

* PHP's type hinting is preety limited, in this case we would like to
indicate that the name should be provided as a string but we can't. Maybe it
would be useful to use an object as a wrapper for native strings. EDIT: I
remembered while translating this that type hinting can only be used in
function parameters, therefore this point is useless.

* En this model it seems more appropiate that the saluter is an abstract
class, since salutation works one way, but, in the event salutations became
a two way trip, an interface would be more appropiate for the saluters.

* Here we're sending the salutation to the standard output, which is
acceptable in this case, but a more complex abstration would require us to
indicate where we should procede with the salutation, and we will have to
provide an abstraction for the possible salutation 

Re: [PHP] Help on objects

2006-10-04 Thread Satyam
I've seen you already had a good answer on the errors in the code so I won't 
go on that.  As for OOP, the one design error you have is that you are 
asking for an action, not an object.   You want to make SQL inserts, that is 
your purpose, and that is an action, which is solved by a statement, not by 
an object.   There is no doer.  Objects are what even your English teacher 
would call objects while describing a sentence.  You are asking for a verb, 
you don't have a subject, you don't have an object.   Of course you can wrap 
an action in a class, but that is bad design.  Classes will usually have 
names representing nouns, methods will be verbs, properties adjectives, more 
or less, that's OOP for English teachers.


Satyam

- Original Message - 
From: Deckard [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, October 05, 2006 3:47 AM
Subject: [PHP] Help on objects



Hi,

I'm trying to lay my hands on PHP OOP, but it's not easy :(
I've read several examples in the web, but cannot transpose to may case.

I'm trying to set a class to make SQL inserts in mysql.

I have the class:
-
?php

 class dBInsert
{
 // global variables
 var $first;

// constructor
function dBInsert($table, $sql)
{
 $this-table = $table;
 $this-sql   = $sql;

 return(TRUE);
}


 // function that constructs the sql and inserts it into the database
 function InsertDB($sql)
  {

   print($sql);
   // connect to MySQL
   $conn-debug=1;
   $conn = ADONewConnection('mysql');
   $conn-PConnect('localhost', 'deckard', 'ble', 'wordlife');

if ($conn-Execute($sql) === false)
print 'error inserting: '.$conn-ErrorMsg().'BR';

return (TRUE);
  }
}


and the code that calls it:

?php

include_once(classes/dBInsert.php);
$sql = INSERT INTO wl_admins VALUES ('',2);
$dBInsert = new dBInsert('wl_admins', '$sql');
$dBInsert-InsertDB('$sql');

?


but it's not working ?

Can anyone give me a hand here ?

I've read the manuals, examples, etc.

Any help would be appreciated.

Best Regards,
Deckard

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