Re: [PHP] Coding for email response forms

2009-01-31 Thread Edmund Hertle
2009/1/30 Tom obeli...@comcast.net


 Shawn McKenzie nos...@mckenzies.net wrote in message
 news:47.36.08436.e8b80...@pb1.pair.com...
  Tom wrote:
  Clancy clanc...@cybec.com.au wrote in message
  news:c77vn4pri9tsbaqg9avv3i7dnfb8nvk...@4ax.com...
  On Mon, 26 Jan 2009 17:57:29 -0600, obeli...@comcast.net (Tom)
 wrote:
 
  ..
  Also make sure there aren't line returns or any nonsense like that in
  the to  subjects.  Look up email header injection.  Your script
 might
  become quite popular at advertising p3n1s pills otherwise. :)
  Thanks I'll check it out. I tried including the above code but I still
  can't
  seem to get it to work. Must be missing something.
 
  Thanks,
  David Powers books PHP for Dreamweaver xxx (Friends of Ed) give very
  clear  instructions
  on installing PHP and implementing the essential items such as this.
 
  Thanks I'll check it out.
 
   I am no Coder and don't have a lot of time to devote to these things,
 to
  busy running a business, but I do enjoy learning how things work which
 is
  why I have taken this on. Website is just for informational display as
  they
  don't produce much in the way of mortgage originations. I was hoping to
  get
  something along the lines of the actually coding needed to pull this
 off.
  I
  have spent every available moment over the last three  months on this
  website (which is my first) with nothing more than an online beginners
  course in CS3  CSS. I have appreciated everyones feedbackl. If anyone
  has
  coding I can cut and paste with just a few adjustments on my end that
  would
  be great.
 
  Thanks,
  Tom
 
 
  You have the code.  You just need to create a contact.php file and put
  the email specific PHP in it and then modify your form to have
  method=post action=contact.php.
 
  --
  Thanks!
  -Shawn
  http://www.spidean.com

 The following link shows my PHP configurations.
 http://www.richlandmtg.com/test.php Are there any that should be set
 differently? I noticed the system is Linux.


You should never let a php_info() file be accesibly to the public! Security
concerns!
And your problem has nothing to do with your php configuration or if your
server is linux or windows or...


Re: [PHP] Web Shop Management

2009-01-31 Thread Sancar Saran
On Friday 30 January 2009 23:14:25 Edmund Hertle wrote:
 2009/1/30 Sancar Saran sancar.sa...@evodot.com

  Hello everyone,
 
  Maybe it was bit off topic.
 
  Recently we move our web server. Of course there where tons of WTF ???
 
  So is there any kindof web based management system to handle. Web based
  projects.
 
  I'm looking for someting like this
 
  Customer
   -- Project 1
   -- Project 2
 -- Project Propeties
 
 
  Thanks for advice
 
  Regards
 
  Sancar

 Web based projects? Code projects? SVN/Git?
 -eddy

Not really.

It was someting like customer tracking.  

Finding 200 apache directory with no info was very frustrating experiment.

Some of them are abandoned,  some customers are leaved. some of them just 
projects but customers does not accept.

I want store some info about the customer or project. Maybe categorize them. 

Lets call it customer documentation. 

I want to record something like that

This was blahblah.com owned by some guy, needs this. dislikes this. Please be 
careful when moving or altering site. 
He was sychopath to check every 30 min to his 5 hit per day site. 

This system uses uber CMS system which needs php-tidy php-postgresql etc etc. 
Have to acess some blah blah service.


Regards

Sancar

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



Re: [PHP] Web Shop Management

2009-01-31 Thread Michael Kubler

If it's just documentation you could use a wiki.
I've found that mediawiki http://www.mediawiki.org/wiki/MediaWiki is 
the best (the one that wikipedia uses), although twiki isn't too bad, 
but the problems with wiki's are that they expect you to know how to use 
them, and all their crazy words and syntax. Something like Google Docs 
http://www.google.com/google-d-s/tour1.html is actually really sexy 
(can I say that about a web app that looks like a slimmed down version 
of office?), because it is so easy to use.


You could also check out things like dotproject 
http://www.dotproject.net/, or google 'project management + PHP'.
As a non PHP, hosted alternatively you could look into basecamp 
http://www.basecamphq.com/, which is designed for making project 
collaboration, with goals, timelines, and all sorts, although that 
doesn't quite sound like what you want as it isn't something you host, 
and you'd basically need to create a new one for each project.


Michael Kubler
*G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



Sancar Saran wrote:

Not really.
It was someting like customer tracking.  


Finding 200 apache directory with no info was very frustrating experiment.

Some of them are abandoned,  some customers are leaved. some of them just 
projects but customers does not accept.


I want store some info about the customer or project. Maybe categorize them. 

Lets call it customer documentation. 


I want to record something like that

This was blahblah.com owned by some guy, needs this. dislikes this. Please be 
careful when moving or altering site. 
He was sychopath to check every 30 min to his 5 hit per day site. 

This system uses uber CMS system which needs php-tidy php-postgresql etc etc. 
Have to acess some blah blah service.



Regards

Sancar
  


Re: [PHP] Web Shop Management

2009-01-31 Thread Sancar Saran
On Saturday 31 January 2009 12:43:52 Michael Kubler wrote:
 If it's just documentation you could use a wiki.
 I've found that mediawiki http://www.mediawiki.org/wiki/MediaWiki is
 the best (the one that wikipedia uses), although twiki isn't too bad,
 but the problems with wiki's are that they expect you to know how to use
 them, and all their crazy words and syntax. Something like Google Docs
 http://www.google.com/google-d-s/tour1.html is actually really sexy
 (can I say that about a web app that looks like a slimmed down version
 of office?), because it is so easy to use.

 You could also check out things like dotproject
 http://www.dotproject.net/, or google 'project management + PHP'.
 As a non PHP, hosted alternatively you could look into basecamp
 http://www.basecamphq.com/, which is designed for making project
 collaboration, with goals, timelines, and all sorts, although that
 doesn't quite sound like what you want as it isn't something you host,
 and you'd basically need to create a new one for each project.

 Michael Kubler
 *G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz

 Sancar Saran wrote:
  Not really.
  It was someting like customer tracking.
 
  Finding 200 apache directory with no info was very frustrating
  experiment.
 
  Some of them are abandoned,  some customers are leaved. some of them just
  projects but customers does not accept.
 
  I want store some info about the customer or project. Maybe categorize
  them.
 
  Lets call it customer documentation.
 
  I want to record something like that
 
  This was blahblah.com owned by some guy, needs this. dislikes this.
  Please be careful when moving or altering site.
  He was sychopath to check every 30 min to his 5 hit per day site.
 
  This system uses uber CMS system which needs php-tidy php-postgresql etc
  etc. Have to acess some blah blah service.
 
 
  Regards
 
  Sancar

Thanks,

It look like, do it with wiki or do it with own code

Regards

Sancar


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



Re: [PHP] Matching

2009-01-31 Thread Ashley Sheridan
On Fri, 2009-01-30 at 21:33 -0500, Eric Butera wrote:
 On Fri, Jan 30, 2009 at 9:28 PM, Ron Piggott ron@actsministries.org 
 wrote:
  How do I determine the value oftx   from this string?
 
 
  page/words_from_the_well_checkout/?tx=8UM53005HH344951Tst=Completedamt=0.01
 
  My desired answer is: 8UM53005HH344951T
 
  I am trying to capture the serial number which follows tx= and ends
  immediately before the 
 
  Ron
 
 
 http://us.php.net/parse_str
 
 -- 
 http://www.voom.me | EFnet: #voom
 
Go regular expressions...

/tx=([^\]+)/

then do a preg_match with the string using the $matches array argument.
$matches[1] should be your value.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: Session won't pick up one variable

2009-01-31 Thread Terion Miller
On Fri, Jan 30, 2009 at 5:44 PM, Shawn McKenzie nos...@mckenzies.netwrote:

 Terion Miller wrote:
  Well I changed it because it's not a post since its not coming from a
 form
  is this closer?
 
  if (!empty($UserName)) {
 

 Why are you doing this?  Only to see if  0 rows are returned?  You can
 use the results you know.
  $sql = SELECT `AdminID`,`UserName` FROM `admin` WHERE
  `UserName`='$UserName' and`Password`='$Password';
  $result = mysql_query ($sql);
  $row = mysql_fetch_object ($result);

 Do you maybe mean $row['AdminID']?  Well you're using objects now so
 $row-AdminID?
  $AdminId = $_SESSION['AdminID'];
 

 What in the hell are you doing here?  If it's set then set it again to
 equal itself?
 if(isset($_SESSION['AdminID']))
  $_SESSION['AdminID'] = $_SESSION['AdminID'];
  else
  $_SESSION['AdminID'] = $AdminID;
 
  If (mysql_num_rows($result)  0) {
  $_SESSION['AdminLogin'] = true;
  $_SESSION['user']=$UserName;
  $_SESSION['AdminID']=$AdminID;
 
  header ('Location: Main.php');
  exit;
  } else {

 You either need to get a good PHP book or pay much closer attention to
 what you're doing.  Many more problems, but those seem to cause your
 issue.  This is not complete but seems to be the structure you need:

 session_start();
 include(inc/dbconn_open.php);

 if (!empty($_POST['UserName'])  !empty($_POST['Password'])) {
$UserName = $_POST['UserName'];
$Password = $_POST['Password'];

$sql = SELECT `AdminID`,`UserName` FROM `admin` WHERE
 `UserName`='$UserName' and`Password`='$Password';
$result = mysql_query ($sql);
$row = mysql_fetch_object ($result);

 If (mysql_num_rows($result)  0) {
$_SESSION['AdminLogin'] = true;
$_SESSION['user'] = $UserName;
 $_SESSION['AdminID'] = $row-AdminID;

header ('Location: Main.php');
exit;
} else {


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

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

 yep I had actually tried your way my first try because it seemed to be what
exactly it should do, but I get a blank pageno errors just a blank page,
so I was suggested by someone else it was that the AdminID is not set, so
that is why I was attempting to set it
And for the record I have two O'reilly books on php...programming php, and
web database applications with php, and the sessions section pretty much
includes:
session_start()
and the oh so helpful $_SESSION($BLAH) = 'BLAH'
I couldn't find anything about how to pull a result from the db and then use
it to set a session, well anything past what seem to be common sense, to
just put it after the query...and it does not pick up the adminID, and I've
also tried another suggestion and also get a blank page, should I be setting
the AdminID session on the page after the login?
Here was the other way I tried :
$UserName = (isset($_POST['UserName'])) ? mysql_real_escape_string($_POST[
'UserName']) : '';
$Password = (isset($_POST['Password'])) ? mysql_real_escape_string($_POST[
'Password']) : '';

if (!empty($UserName)) {
$sql = SELECT `AdminID`,`UserName`,`Password` FROM `admin` WHERE
`UserName`='$UserName';
$result = mysql_query($sql);
$row = mysql_fetch_array($result);

   //If hashed passwords match proceed login
if (sha1($Password) == $row['Password']) { //granted the password was
sha1() before insertion into db
$_SESSION['AdminID'] = (isset($_SESSION['AdminID'])) ? $_SESSION[
'AdminID'] : $row['id'];
$_SESSION['AdminLogin'] = true;
$_SESSION['user'] = $UserName;
header ('Location: Main.php');
}
}


Re: [PHP] Re: Session won't pick up one variable (SOLVED)

2009-01-31 Thread Terion Miller
thanks got it fixed:
if (!empty($_POST['UserName'])  !empty($_POST['Password'])) {
   $UserName = $_POST['UserName'];
   $Password = $_POST['Password'];
}  *---was missing a curly bracket..oi syntax*


$msg = '';

if (!empty($UserName)) {

$sql = SELECT `AdminID`,`UserName` FROM `admin` WHERE
`UserName`='$UserName' and`Password`='$Password';
$result = mysql_query ($sql);
$row = mysql_fetch_object ($result);




 If (mysql_num_rows($result)  0) {
   $_SESSION['AdminLogin'] = true;
   $_SESSION['user'] = $UserName;
   $_SESSION['AdminID'] = $row-AdminID;


header ('Location: Main.php');
exit;


[PHP] More questions about SESSION use

2009-01-31 Thread Terion Miller
So now I have SESSIONs set: user, AdminID, AdminLogin

but I'm trying to use them without showing them in links...currently the
pages only load if I make the links like this:

a href=Welcome.php?AdminID=?php echo $_SESSION['AdminID']; ?
target=mainFrameHome/a

I thought the whole purpose of having/using Sessions is to not have to pass
variables in url's, but if I remove the session in the link above when I
click to it, It logs me out, even though it IS holding the SESSION (which I
checked by revealing my variables) so I guess I am confused about this bit
of code, I think its saying if the SESSION is there great if not logout...
but even when I expose the variables and see that the session is passing
from page to page it keeps sending me to the logout page:

This is how it was originally written:
if (empty($_SESSION['AdminLogin']) || $_SESSION['AdminLogin'] !=  true){
header (Location: LogOut.php);
$_SESSION['user']=$UserName;
$_SESSION['AdminID']=$AdminID; --*I added this one originally the
script only used 'user' and 'AdminLogin'* but passed them in urls
}


Is the above part not needed since the Session is already active? Should I
be not using the header part (honestly I havent read up on that chapter yet)


Re: [PHP] Matching

2009-01-31 Thread Eric Butera
On Sat, Jan 31, 2009 at 7:32 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
 On Fri, 2009-01-30 at 21:33 -0500, Eric Butera wrote:
 On Fri, Jan 30, 2009 at 9:28 PM, Ron Piggott ron@actsministries.org 
 wrote:
  How do I determine the value oftx   from this string?
 
 
  page/words_from_the_well_checkout/?tx=8UM53005HH344951Tst=Completedamt=0.01
 
  My desired answer is: 8UM53005HH344951T
 
  I am trying to capture the serial number which follows tx= and ends
  immediately before the 
 
  Ron
 

 http://us.php.net/parse_str

 --
 http://www.voom.me | EFnet: #voom

 Go regular expressions...

 /tx=([^\]+)/

 then do a preg_match with the string using the $matches array argument.
 $matches[1] should be your value.


 Ash
 www.ashleysheridan.co.uk



There really isn't a need to even try to build something like that
when something already exists exactly for the purpose.  It's well
documented too.  Plus after this part works, there's probably a good
chance we'd be looking for that second variable. =)

-- 
http://www.voom.me | EFnet: #voom

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



Re: [PHP] Matching

2009-01-31 Thread Ashley Sheridan
On Sat, 2009-01-31 at 08:38 -0500, Eric Butera wrote:
 On Sat, Jan 31, 2009 at 7:32 AM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
  On Fri, 2009-01-30 at 21:33 -0500, Eric Butera wrote:
  On Fri, Jan 30, 2009 at 9:28 PM, Ron Piggott ron@actsministries.org 
  wrote:
   How do I determine the value oftx   from this string?
  
  
   page/words_from_the_well_checkout/?tx=8UM53005HH344951Tst=Completedamt=0.01
  
   My desired answer is: 8UM53005HH344951T
  
   I am trying to capture the serial number which follows tx= and ends
   immediately before the 
  
   Ron
  
 
  http://us.php.net/parse_str
 
  --
  http://www.voom.me | EFnet: #voom
 
  Go regular expressions...
 
  /tx=([^\]+)/
 
  then do a preg_match with the string using the $matches array argument.
  $matches[1] should be your value.
 
 
  Ash
  www.ashleysheridan.co.uk
 
 
 
 There really isn't a need to even try to build something like that
 when something already exists exactly for the purpose.  It's well
 documented too.  Plus after this part works, there's probably a good
 chance we'd be looking for that second variable. =)
 
 -- 
 http://www.voom.me | EFnet: #voom
 
But isn't what you suggest to use only available in PHP5? When possible,
I try to build for PHP4, as my own hosting, and others I've seen only
support 4, and the old answer of find a better hosting is not always a
good solution.

Besides, if you need the second part of the URL, just adapt the regular
expression a bit. I don't why people seem so afraid of them to be
honest.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: help with end of line charater

2009-01-31 Thread tedd

At 11:58 AM -0600 1/30/09, Adam Williams wrote:

yeah just a second ago a big lightbulb went off in my head



Try a bigger light-bulb and store the email addresses in a database. 
Then you can use them as you want regardless if the user hit return 
or not.


Cheers,

tedd


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

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



Re: [PHP] Re: Switch statement Question

2009-01-31 Thread tedd

At 4:16 PM +0100 1/30/09, Jochem Maas wrote:

tedd schreef:

 At 4:43 PM -0500 1/29/09, Frank Stanovcak wrote:

  

 yes...that is legal.  as long as the statment resolves to a boolean it
 will
 work.  It's not technically correct, but it does work.


 There you go again. What's technically correct?


hiya tedd,

you mean to ask not technically correct ... I plead
that it's his statement that is not technically correct.

1. php does a soft comparison ('==' rather than '===') so the
results of each case expression is auto-cast to a boolean
(in the case of switch'ing on TRUE), ergo there is no 'as long',
statements will always resolve to a boolean ... only they may not
do it in a way that is readily understood by everyone.

2. the php engine specifically allows for 'complex expression'
cases testing against a boolean switch value ... not best practice
according to some but very much technically correct according to
the php implementation.



Good explanation -- I think the drum he's beating is that some of use 
the switch without actually using the main expression within the 
control, such as:


switch($who_cares)
   {
   case $a = $b:
   // do something
  break;
   case $a  0:
// do something else
  break;
   case $a  0:
   // do something elser
  break;
  }

The control works.

However to him, technically correct means:

switch($a)
   {
   case 0:
   // do something
  break;
   case 1:
// do something else
  break;
   case 2:
   // do something elser
  break;
  }

That's what I think he's advocating.

Cheers,

tedd


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

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



Re: [PHP] PHP Enclosing Tags? Do You Close Your PHP Declarations?

2009-01-31 Thread tedd

At 8:45 PM +0200 1/30/09, Nitsan Bin-Nun wrote:

I was just wondering whether people enclosing their PHP tags declarations,
I don't close these ?php tags just because the interpreter doesn't really
needs them,
and for the second reason - if a space/tab/new line/etc will beneath them it
will cause
problems with output buffering and session handling.

Do you close your PHP ?php tags?

(at least I closed them here :P look down)
--
?


My mother always told me to close the door. She wasn't a programmer, 
but it kept the chickens out.


As a matter of habit, I always close all tags. However, I have yet to 
be bitten by the problem everyone speaks about (knock on wood).


Cheers,

tedd

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

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



Re: [PHP] Matching

2009-01-31 Thread Eric Butera
On Sat, Jan 31, 2009 at 9:33 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
 On Sat, 2009-01-31 at 08:38 -0500, Eric Butera wrote:
 On Sat, Jan 31, 2009 at 7:32 AM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
  On Fri, 2009-01-30 at 21:33 -0500, Eric Butera wrote:
  On Fri, Jan 30, 2009 at 9:28 PM, Ron Piggott ron@actsministries.org 
  wrote:
   How do I determine the value oftx   from this string?
  
  
   page/words_from_the_well_checkout/?tx=8UM53005HH344951Tst=Completedamt=0.01
  
   My desired answer is: 8UM53005HH344951T
  
   I am trying to capture the serial number which follows tx= and ends
   immediately before the 
  
   Ron
  
 
  http://us.php.net/parse_str
 
  --
  http://www.voom.me | EFnet: #voom
 
  Go regular expressions...
 
  /tx=([^\]+)/
 
  then do a preg_match with the string using the $matches array argument.
  $matches[1] should be your value.
 
 
  Ash
  www.ashleysheridan.co.uk
 
 

 There really isn't a need to even try to build something like that
 when something already exists exactly for the purpose.  It's well
 documented too.  Plus after this part works, there's probably a good
 chance we'd be looking for that second variable. =)

 --
 http://www.voom.me | EFnet: #voom

 But isn't what you suggest to use only available in PHP5? When possible,
 I try to build for PHP4, as my own hosting, and others I've seen only
 support 4, and the old answer of find a better hosting is not always a
 good solution.

 Besides, if you need the second part of the URL, just adapt the regular
 expression a bit. I don't why people seem so afraid of them to be
 honest.


 Ash
 www.ashleysheridan.co.uk




parse_str

(PHP 4, PHP 5)

parse_str — Parses the string into variables


-- 
http://www.voom.me | EFnet: #voom

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



Re: [PHP] PHP Enclosing Tags? Do You Close Your PHP Declarations?

2009-01-31 Thread Eric Butera
On Sat, Jan 31, 2009 at 10:10 AM, tedd tedd.sperl...@gmail.com wrote:
 My mother always told me to close the door. She wasn't a programmer, but it
 kept the chickens out.

 As a matter of habit, I always close all tags. However, I have yet to be
 bitten by the problem everyone speaks about (knock on wood).

 Cheers,

 tedd

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

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



Right, but the problem isn't us, its them.  I don't have this problem
myself (since I figured out why I was getting those lame headers sent
errors years ago), but when we work in teams... well.. all bets are
off. :(

-- 
http://www.voom.me | EFnet: #voom

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



[PHP] Re: Matching

2009-01-31 Thread Shawn McKenzie
Ron Piggott wrote:
 How do I determine the value oftx   from this string?
 
 
 page/words_from_the_well_checkout/?tx=8UM53005HH344951Tst=Completedamt=0.01
 
 My desired answer is: 8UM53005HH344951T
 
 I am trying to capture the serial number which follows tx= and ends
 immediately before the 
 
 Ron
 
If this is actually the URL of the script that is running, then $_GET['tx']

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

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



Re: [PHP] Re: frameworks

2009-01-31 Thread Shawn McKenzie
Eric Butera wrote:
 On Fri, Jan 30, 2009 at 7:14 PM, Kevin Waterson ke...@phpro.org wrote:
 On Fri, 2009-01-30 at 18:03 -0600, Shawn McKenzie wrote:
  From what I could tell, this was
 the best RAD, however if you prefer to lay everything out your own way
 and do things your own way then probably CI or Zend.
 I use Zend every day in my current employ.
 It is like pulling teeth and its feature set is not as rich as
 they would have you believe.
 Zend DB is pathetic
 Zend Form (although not from Zend itself) is abstraction for
 abstractions sake and is mind numbingly complex.
 The lack of a model loader is laughable.
 The list goes but you get the point, this is supposed to be from
 the makers of PHP and is supposed to be a mature framework and
 ready for enterprise level applications.
 What a joke.

 but, just my $0.02
 Kevin


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


 
 And what exactly do you expect for the model layer?  That's the part
 you are supposed to write on your own.
 
Supposed to?  Who says?  The DB yes, but if you design the DB correctly
and want your models tightly coupled with the DB, then it is an useless
step to create the model yourself.

Zend has a Zend_Tool script in the incubator that does project and some
code gen.  Reading the plans they plan to include model generation as
well.  It will probably be a while in coming though.

To me, right now Zend is just a more professional and consistent PEAR,
but with fewer features.

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

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



Re: [PHP] Matching

2009-01-31 Thread Nathan Rixham

Eric Butera wrote:

On Sat, Jan 31, 2009 at 9:33 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:

On Sat, 2009-01-31 at 08:38 -0500, Eric Butera wrote:

On Sat, Jan 31, 2009 at 7:32 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:

On Fri, 2009-01-30 at 21:33 -0500, Eric Butera wrote:

On Fri, Jan 30, 2009 at 9:28 PM, Ron Piggott ron@actsministries.org wrote:

How do I determine the value oftx   from this string?


page/words_from_the_well_checkout/?tx=8UM53005HH344951Tst=Completedamt=0.01

My desired answer is: 8UM53005HH344951T

I am trying to capture the serial number which follows tx= and ends
immediately before the 

Ron


http://us.php.net/parse_str

--
http://www.voom.me | EFnet: #voom


Go regular expressions...

/tx=([^\]+)/

then do a preg_match with the string using the $matches array argument.
$matches[1] should be your value.


Ash
www.ashleysheridan.co.uk



There really isn't a need to even try to build something like that
when something already exists exactly for the purpose.  It's well
documented too.  Plus after this part works, there's probably a good
chance we'd be looking for that second variable. =)

--
http://www.voom.me | EFnet: #voom


But isn't what you suggest to use only available in PHP5? When possible,
I try to build for PHP4, as my own hosting, and others I've seen only
support 4, and the old answer of find a better hosting is not always a
good solution.

Besides, if you need the second part of the URL, just adapt the regular
expression a bit. I don't why people seem so afraid of them to be
honest.


Ash
www.ashleysheridan.co.uk





parse_str

(PHP 4, PHP 5)

parse_str — Parses the string into variables




lol - it's obviously an url guys..

http://php.net/parse_url
and
http://php.net/parse_str

$s = 'your/url/?with=parrams';
$parts = parse_url($s);
$arrayOfQueryParams = parse_str($parts['query']);
$theBitYouWant = $arrayOfQueryParams['tx'];
// output the bit you want
echo $theBitYouWant . PHP_EOL;
// output all the params
print_r($arrayOfQueryParams);

regards

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



Re: [PHP] PHP Enclosing Tags? Do You Close Your PHP Declarations?

2009-01-31 Thread Nathan Rixham

Eric Butera wrote:

On Sat, Jan 31, 2009 at 10:10 AM, tedd tedd.sperl...@gmail.com wrote:

My mother always told me to close the door. She wasn't a programmer, but it
kept the chickens out.

As a matter of habit, I always close all tags. However, I have yet to be
bitten by the problem everyone speaks about (knock on wood).

Cheers,

tedd

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

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




Right, but the problem isn't us, its them.  I don't have this problem
myself (since I figured out why I was getting those lame headers sent
errors years ago), but when we work in teams... well.. all bets are
off. :(



personally I close and ensure no trailing space; however I have been 
trying to remove the ? recently for files with nothing but php - purely 
to save others grief who may use the code, as I did come across this 
error again recently.


specifically the error in my scenario was called by a DOS format php 
file with trailing lines on a linux box - so I'm guessing that /n is 
trimmed but that leaves the /r which is output on linux systems; hence 
the error.


although, in a world of tags and markup there's something that really 
grates about opening with ?php and not closing it.!


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



Re: [PHP] Re: frameworks

2009-01-31 Thread Eric Butera
On Sat, Jan 31, 2009 at 12:06 PM, Shawn McKenzie nos...@mckenzies.net wrote:
 Eric Butera wrote:
 On Fri, Jan 30, 2009 at 7:14 PM, Kevin Waterson ke...@phpro.org wrote:
 On Fri, 2009-01-30 at 18:03 -0600, Shawn McKenzie wrote:
  From what I could tell, this was
 the best RAD, however if you prefer to lay everything out your own way
 and do things your own way then probably CI or Zend.
 I use Zend every day in my current employ.
 It is like pulling teeth and its feature set is not as rich as
 they would have you believe.
 Zend DB is pathetic
 Zend Form (although not from Zend itself) is abstraction for
 abstractions sake and is mind numbingly complex.
 The lack of a model loader is laughable.
 The list goes but you get the point, this is supposed to be from
 the makers of PHP and is supposed to be a mature framework and
 ready for enterprise level applications.
 What a joke.

 but, just my $0.02
 Kevin


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



 And what exactly do you expect for the model layer?  That's the part
 you are supposed to write on your own.

 Supposed to?  Who says?  The DB yes, but if you design the DB correctly
 and want your models tightly coupled with the DB, then it is an useless
 step to create the model yourself.

 Zend has a Zend_Tool script in the incubator that does project and some
 code gen.  Reading the plans they plan to include model generation as
 well.  It will probably be a while in coming though.

 To me, right now Zend is just a more professional and consistent PEAR,
 but with fewer features.

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

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



Model != database.  I made this mistake for years, but no more!  :)
Models can persist data, but a model is supposed to be the business
logic of your app.  It's a set of rules.  So how could any tool
generate your app for you is/was my point.

Take an ecommerce example.  You might have a product in the database,
but calculating it's price based on categories, sale prices, etc isn't
something that a database is going to do.  That is your app's logic 
is part of your model.  The model can ask the DB for all that static
info about pricing, but it makes the determination as to what the
price is.

What about when you want to add a product to the cart?  Where would
you ask the code if that product is already in the cart?  Just all
those types of things...

-- 
http://www.voom.me | EFnet: #voom

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



Re: [PHP] Re: frameworks

2009-01-31 Thread Nathan Rixham

Eric Butera wrote:

On Sat, Jan 31, 2009 at 12:06 PM, Shawn McKenzie nos...@mckenzies.net wrote:

Eric Butera wrote:

On Fri, Jan 30, 2009 at 7:14 PM, Kevin Waterson ke...@phpro.org wrote:

On Fri, 2009-01-30 at 18:03 -0600, Shawn McKenzie wrote:

 From what I could tell, this was
the best RAD, however if you prefer to lay everything out your own way
and do things your own way then probably CI or Zend.

I use Zend every day in my current employ.
It is like pulling teeth and its feature set is not as rich as
they would have you believe.
Zend DB is pathetic
Zend Form (although not from Zend itself) is abstraction for
abstractions sake and is mind numbingly complex.
The lack of a model loader is laughable.
The list goes but you get the point, this is supposed to be from
the makers of PHP and is supposed to be a mature framework and
ready for enterprise level applications.
What a joke.

but, just my $0.02
Kevin


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



And what exactly do you expect for the model layer?  That's the part
you are supposed to write on your own.


Supposed to?  Who says?  The DB yes, but if you design the DB correctly
and want your models tightly coupled with the DB, then it is an useless
step to create the model yourself.

Zend has a Zend_Tool script in the incubator that does project and some
code gen.  Reading the plans they plan to include model generation as
well.  It will probably be a while in coming though.

To me, right now Zend is just a more professional and consistent PEAR,
but with fewer features.

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

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




Model != database.  I made this mistake for years, but no more!  :)
Models can persist data, but a model is supposed to be the business
logic of your app.  It's a set of rules.  So how could any tool
generate your app for you is/was my point.

Take an ecommerce example.  You might have a product in the database,
but calculating it's price based on categories, sale prices, etc isn't
something that a database is going to do.  That is your app's logic 
is part of your model.  The model can ask the DB for all that static
info about pricing, but it makes the determination as to what the
price is.

What about when you want to add a product to the cart?  Where would
you ask the code if that product is already in the cart?  Just all
those types of things...



actually (imho?)..
Model != Database
Model != Business Logic

A model class describes the structure of data, and has methods to ensure 
the instance properties are of the correct format and valid so that they 
can be persisted. Let's say a simple User class


class User {

  private $id;
  private $name;

  public function getId() {
return $this-id;
  }

  public function setId( $id ) {
// logic to ensure $id is the correct format to persist
// let say just a valid int
$this-id = $id;
  }

  public function getName() {
return $this-name;
  }

  public function setName( $name ) {
// logic to ensure $name is the correct format to persist
// let's say a string under 64 chars
$this-name = $name
  }

}

how it's persisted is out with the scope of this mail, and varying 
techniques exist, however this is normally inside the domain model layer 
(but not necessarily the model classes themselves)


The above keeps you're domain model clean and free from implementation 
specific idiosyncrasies. This is especially useful when working on 
n-tier/3-tier architectures, building a framework, or a single codebase 
to be used across multiple sites.


All the implementation specific code comes in at the business layer, 
which is where all you're business logic also occurs.


thus:
Business layer asks domain model layer for a new user, domain model 
layer returns a new empty instance of the user class.
Business layer does it's thing and ends up populating the user instance 
with data that valid for the specific application (let's say a name 
string 8-16 alphanumeric chars)
Business Layer then passes it back to the domain model layer to persist; 
the domain model layer either persists the data OR returns back an 
exception should the instance properties not be valid to persist, or if 
an error occurred.


regards :p

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



Re: [PHP] Re: frameworks

2009-01-31 Thread Eric Butera
On Sat, Jan 31, 2009 at 1:12 PM, Nathan Rixham nrix...@gmail.com wrote:
 Eric Butera wrote:

 On Sat, Jan 31, 2009 at 12:06 PM, Shawn McKenzie nos...@mckenzies.net
 wrote:

 Eric Butera wrote:

 On Fri, Jan 30, 2009 at 7:14 PM, Kevin Waterson ke...@phpro.org wrote:

 On Fri, 2009-01-30 at 18:03 -0600, Shawn McKenzie wrote:

  From what I could tell, this was
 the best RAD, however if you prefer to lay everything out your own way
 and do things your own way then probably CI or Zend.

 I use Zend every day in my current employ.
 It is like pulling teeth and its feature set is not as rich as
 they would have you believe.
 Zend DB is pathetic
 Zend Form (although not from Zend itself) is abstraction for
 abstractions sake and is mind numbingly complex.
 The lack of a model loader is laughable.
 The list goes but you get the point, this is supposed to be from
 the makers of PHP and is supposed to be a mature framework and
 ready for enterprise level applications.
 What a joke.

 but, just my $0.02
 Kevin


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


 And what exactly do you expect for the model layer?  That's the part
 you are supposed to write on your own.

 Supposed to?  Who says?  The DB yes, but if you design the DB correctly
 and want your models tightly coupled with the DB, then it is an useless
 step to create the model yourself.

 Zend has a Zend_Tool script in the incubator that does project and some
 code gen.  Reading the plans they plan to include model generation as
 well.  It will probably be a while in coming though.

 To me, right now Zend is just a more professional and consistent PEAR,
 but with fewer features.

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

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



 Model != database.  I made this mistake for years, but no more!  :)
 Models can persist data, but a model is supposed to be the business
 logic of your app.  It's a set of rules.  So how could any tool
 generate your app for you is/was my point.

 Take an ecommerce example.  You might have a product in the database,
 but calculating it's price based on categories, sale prices, etc isn't
 something that a database is going to do.  That is your app's logic 
 is part of your model.  The model can ask the DB for all that static
 info about pricing, but it makes the determination as to what the
 price is.

 What about when you want to add a product to the cart?  Where would
 you ask the code if that product is already in the cart?  Just all
 those types of things...


 actually (imho?)..
 Model != Database
 Model != Business Logic

 A model class describes the structure of data, and has methods to ensure the
 instance properties are of the correct format and valid so that they can be
 persisted. Let's say a simple User class

 class User {

  private $id;
  private $name;

  public function getId() {
return $this-id;
  }

  public function setId( $id ) {
// logic to ensure $id is the correct format to persist
// let say just a valid int
$this-id = $id;
  }

  public function getName() {
return $this-name;
  }

  public function setName( $name ) {
// logic to ensure $name is the correct format to persist
// let's say a string under 64 chars
$this-name = $name
  }

 }

 how it's persisted is out with the scope of this mail, and varying
 techniques exist, however this is normally inside the domain model layer
 (but not necessarily the model classes themselves)

 The above keeps you're domain model clean and free from implementation
 specific idiosyncrasies. This is especially useful when working on
 n-tier/3-tier architectures, building a framework, or a single codebase to
 be used across multiple sites.

 All the implementation specific code comes in at the business layer, which
 is where all you're business logic also occurs.

 thus:
 Business layer asks domain model layer for a new user, domain model layer
 returns a new empty instance of the user class.
 Business layer does it's thing and ends up populating the user instance with
 data that valid for the specific application (let's say a name string 8-16
 alphanumeric chars)
 Business Layer then passes it back to the domain model layer to persist; the
 domain model layer either persists the data OR returns back an exception
 should the instance properties not be valid to persist, or if an error
 occurred.

 regards :p


This is php we're talking about, not java! :D

-- 
http://www.voom.me | EFnet: #voom

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



RE: [PHP] Payment question in Canada

2009-01-31 Thread Ernie Kemp
Thanks for your replies.

Very useful...
/Ernie


-Original Message-
From: farn...@googlemail.com [mailto:farn...@googlemail.com] On Behalf Of 
Edmund Hertle
Sent: January-30-09 4:47 PM
To: Bastien Koert
Cc: Ernie Kemp; php-general@lists.php.net
Subject: Re: [PHP] Payment question in Canada

2009/1/30 Bastien Koert phps...@gmail.com

 On Fri, Jan 30, 2009 at 2:11 PM, Ernie Kemp ernie.k...@sympatico.ca
 wrote:

My question is one of pay; hope this is the correct forum.
 
 
 
  A couple of people have asked me to write some PHP code for their website
  backend.
 
 
 
  I need the money from this but I don't know what to charge them.  I think
  in total the work will be about 8-10 hours.
 
 
 
  Please indicate what hourly fee I should charge them as don't wish to
  overcharge them nor under value my services.
 
 
 
  If I have the wrong list, let me know which list to go to.
 
 
 
  Thanks in advance,
 
 
 
 
 
  Thanks,
 
  Ernie
 
 
 
 
 
  ...man will occasionally stumble over the truth, but usually manages to
  pick himself up, walk over or around it, and carry on.
 
 
Winston S. Churchill* *
 
 
 
 
 
 
 
 
 
 I charge anywhere from $50-$75/hr depending on the project and exactly what
 the client wants


 --

 Bastien


Read this discussion. I think this will help you:
http://marc.info/?t=12329898971r=1w=2

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.0.233 / Virus Database: 270.10.16/1925 - Release Date: 01/30/09 
07:37:00


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



Re: [PHP] Payment question in Canada

2009-01-31 Thread Daniel Brown
On Sat, Jan 31, 2009 at 13:44, Ernie Kemp ernie.k...@sympatico.ca wrote:
 Thanks for your replies.

 Very useful...
 /Ernie

Please don't top-post.

This question doesn't have a direct answer.  Three major things
come into play: first, the type and scope of work involved; second,
your level of skill and what it's worth; and finally, the perceived
value of the cost-vs-service by the client.  If they think they're
getting a fair (or even great) deal, then the price is fine.

The big thing that throws up a red flag is that you're asking
about what to bill a client for the work - if you're unsure of what to
charge for something like this, it says that you're not used to
performing at a professional level yet.  This isn't anything at all
against you personally, it's a mistake that nearly everyone makes when
they're first getting their feet wet in freelance services.  I'd
recommend reading through some forums and mailing list archives -
especially discussions between service buyers - to see what's fair and
going rate for your skill level and years of experience.

Best of luck with everything, Ernie.


P.S. - This is the General list, so you did ask in the right place.  ;-P

-- 
/Daniel P. Brown
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

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



Re: [PHP] Re: frameworks

2009-01-31 Thread Nathan Rixham

Eric Butera wrote:

On Sat, Jan 31, 2009 at 1:12 PM, Nathan Rixham nrix...@gmail.com wrote:

Eric Butera wrote:

On Sat, Jan 31, 2009 at 12:06 PM, Shawn McKenzie nos...@mckenzies.net
wrote:

Eric Butera wrote:

On Fri, Jan 30, 2009 at 7:14 PM, Kevin Waterson ke...@phpro.org wrote:

On Fri, 2009-01-30 at 18:03 -0600, Shawn McKenzie wrote:

 From what I could tell, this was
the best RAD, however if you prefer to lay everything out your own way
and do things your own way then probably CI or Zend.

I use Zend every day in my current employ.
It is like pulling teeth and its feature set is not as rich as
they would have you believe.
Zend DB is pathetic
Zend Form (although not from Zend itself) is abstraction for
abstractions sake and is mind numbingly complex.
The lack of a model loader is laughable.
The list goes but you get the point, this is supposed to be from
the makers of PHP and is supposed to be a mature framework and
ready for enterprise level applications.
What a joke.

but, just my $0.02
Kevin


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



And what exactly do you expect for the model layer?  That's the part
you are supposed to write on your own.


Supposed to?  Who says?  The DB yes, but if you design the DB correctly
and want your models tightly coupled with the DB, then it is an useless
step to create the model yourself.

Zend has a Zend_Tool script in the incubator that does project and some
code gen.  Reading the plans they plan to include model generation as
well.  It will probably be a while in coming though.

To me, right now Zend is just a more professional and consistent PEAR,
but with fewer features.

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

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



Model != database.  I made this mistake for years, but no more!  :)
Models can persist data, but a model is supposed to be the business
logic of your app.  It's a set of rules.  So how could any tool
generate your app for you is/was my point.

Take an ecommerce example.  You might have a product in the database,
but calculating it's price based on categories, sale prices, etc isn't
something that a database is going to do.  That is your app's logic 
is part of your model.  The model can ask the DB for all that static
info about pricing, but it makes the determination as to what the
price is.

What about when you want to add a product to the cart?  Where would
you ask the code if that product is already in the cart?  Just all
those types of things...


actually (imho?)..
Model != Database
Model != Business Logic

A model class describes the structure of data, and has methods to ensure the
instance properties are of the correct format and valid so that they can be
persisted. Let's say a simple User class

class User {

 private $id;
 private $name;

 public function getId() {
   return $this-id;
 }

 public function setId( $id ) {
   // logic to ensure $id is the correct format to persist
   // let say just a valid int
   $this-id = $id;
 }

 public function getName() {
   return $this-name;
 }

 public function setName( $name ) {
   // logic to ensure $name is the correct format to persist
   // let's say a string under 64 chars
   $this-name = $name
 }

}

how it's persisted is out with the scope of this mail, and varying
techniques exist, however this is normally inside the domain model layer
(but not necessarily the model classes themselves)

The above keeps you're domain model clean and free from implementation
specific idiosyncrasies. This is especially useful when working on
n-tier/3-tier architectures, building a framework, or a single codebase to
be used across multiple sites.

All the implementation specific code comes in at the business layer, which
is where all you're business logic also occurs.

thus:
Business layer asks domain model layer for a new user, domain model layer
returns a new empty instance of the user class.
Business layer does it's thing and ends up populating the user instance with
data that valid for the specific application (let's say a name string 8-16
alphanumeric chars)
Business Layer then passes it back to the domain model layer to persist; the
domain model layer either persists the data OR returns back an exception
should the instance properties not be valid to persist, or if an error
occurred.

regards :p



This is php we're talking about, not java! :D



dude you're gonna have to stop using that language as an excuse to 
negate everything I say weg


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



Re: [PHP] Re: help with end of line charater

2009-01-31 Thread Jim Lucas
tedd wrote:
 At 11:58 AM -0600 1/30/09, Adam Williams wrote:
 yeah just a second ago a big lightbulb went off in my head
 
 
 Try a bigger light-bulb and store the email addresses in a database.
 Then you can use them as you want regardless if the user hit return or not.
 
 Cheers,
 
 tedd
 
 

I don't think majordomo can talk to a DB can it?

Or maybe he doesn't want to configure it to do so even if it can.

-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Re: frameworks

2009-01-31 Thread Eric Butera
On Sat, Jan 31, 2009 at 2:16 PM, Nathan Rixham nrix...@gmail.com wrote:
 Eric Butera wrote:

 On Sat, Jan 31, 2009 at 1:12 PM, Nathan Rixham nrix...@gmail.com wrote:

 Eric Butera wrote:

 On Sat, Jan 31, 2009 at 12:06 PM, Shawn McKenzie nos...@mckenzies.net
 wrote:

 Eric Butera wrote:

 On Fri, Jan 30, 2009 at 7:14 PM, Kevin Waterson ke...@phpro.org
 wrote:

 On Fri, 2009-01-30 at 18:03 -0600, Shawn McKenzie wrote:

  From what I could tell, this was
 the best RAD, however if you prefer to lay everything out your own
 way
 and do things your own way then probably CI or Zend.

 I use Zend every day in my current employ.
 It is like pulling teeth and its feature set is not as rich as
 they would have you believe.
 Zend DB is pathetic
 Zend Form (although not from Zend itself) is abstraction for
 abstractions sake and is mind numbingly complex.
 The lack of a model loader is laughable.
 The list goes but you get the point, this is supposed to be from
 the makers of PHP and is supposed to be a mature framework and
 ready for enterprise level applications.
 What a joke.

 but, just my $0.02
 Kevin


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


 And what exactly do you expect for the model layer?  That's the part
 you are supposed to write on your own.

 Supposed to?  Who says?  The DB yes, but if you design the DB correctly
 and want your models tightly coupled with the DB, then it is an useless
 step to create the model yourself.

 Zend has a Zend_Tool script in the incubator that does project and some
 code gen.  Reading the plans they plan to include model generation as
 well.  It will probably be a while in coming though.

 To me, right now Zend is just a more professional and consistent PEAR,
 but with fewer features.

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

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


 Model != database.  I made this mistake for years, but no more!  :)
 Models can persist data, but a model is supposed to be the business
 logic of your app.  It's a set of rules.  So how could any tool
 generate your app for you is/was my point.

 Take an ecommerce example.  You might have a product in the database,
 but calculating it's price based on categories, sale prices, etc isn't
 something that a database is going to do.  That is your app's logic 
 is part of your model.  The model can ask the DB for all that static
 info about pricing, but it makes the determination as to what the
 price is.

 What about when you want to add a product to the cart?  Where would
 you ask the code if that product is already in the cart?  Just all
 those types of things...

 actually (imho?)..
 Model != Database
 Model != Business Logic

 A model class describes the structure of data, and has methods to ensure
 the
 instance properties are of the correct format and valid so that they can
 be
 persisted. Let's say a simple User class

 class User {

  private $id;
  private $name;

  public function getId() {
   return $this-id;
  }

  public function setId( $id ) {
   // logic to ensure $id is the correct format to persist
   // let say just a valid int
   $this-id = $id;
  }

  public function getName() {
   return $this-name;
  }

  public function setName( $name ) {
   // logic to ensure $name is the correct format to persist
   // let's say a string under 64 chars
   $this-name = $name
  }

 }

 how it's persisted is out with the scope of this mail, and varying
 techniques exist, however this is normally inside the domain model layer
 (but not necessarily the model classes themselves)

 The above keeps you're domain model clean and free from implementation
 specific idiosyncrasies. This is especially useful when working on
 n-tier/3-tier architectures, building a framework, or a single codebase
 to
 be used across multiple sites.

 All the implementation specific code comes in at the business layer,
 which
 is where all you're business logic also occurs.

 thus:
 Business layer asks domain model layer for a new user, domain model
 layer
 returns a new empty instance of the user class.
 Business layer does it's thing and ends up populating the user instance
 with
 data that valid for the specific application (let's say a name string
 8-16
 alphanumeric chars)
 Business Layer then passes it back to the domain model layer to persist;
 the
 domain model layer either persists the data OR returns back an exception
 should the instance properties not be valid to persist, or if an error
 occurred.

 regards :p


 This is php we're talking about, not java! :D


 dude you're gonna have to stop using that language as an excuse to negate
 everything I say weg


/white flag ?

-- 
http://www.voom.me | EFnet: #voom

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



Re: [PHP] Re: frameworks

2009-01-31 Thread Shawn McKenzie
Eric Butera wrote:
 On Sat, Jan 31, 2009 at 12:06 PM, Shawn McKenzie nos...@mckenzies.net wrote:
   
 Eric Butera wrote:
 
 On Fri, Jan 30, 2009 at 7:14 PM, Kevin Waterson ke...@phpro.org wrote:
   
 On Fri, 2009-01-30 at 18:03 -0600, Shawn McKenzie wrote:
 
  From what I could tell, this was
 the best RAD, however if you prefer to lay everything out your own way
 and do things your own way then probably CI or Zend.
   
 I use Zend every day in my current employ.
 It is like pulling teeth and its feature set is not as rich as
 they would have you believe.
 Zend DB is pathetic
 Zend Form (although not from Zend itself) is abstraction for
 abstractions sake and is mind numbingly complex.
 The lack of a model loader is laughable.
 The list goes but you get the point, this is supposed to be from
 the makers of PHP and is supposed to be a mature framework and
 ready for enterprise level applications.
 What a joke.

 but, just my $0.02
 Kevin


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


 
 And what exactly do you expect for the model layer?  That's the part
 you are supposed to write on your own.

   
 Supposed to?  Who says?  The DB yes, but if you design the DB correctly
 and want your models tightly coupled with the DB, then it is an useless
 step to create the model yourself.

 Zend has a Zend_Tool script in the incubator that does project and some
 code gen.  Reading the plans they plan to include model generation as
 well.  It will probably be a while in coming though.

 To me, right now Zend is just a more professional and consistent PEAR,
 but with fewer features.

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

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


 

 Model != database.  I made this mistake for years, but no more!  :)
 Models can persist data, but a model is supposed to be the business
 logic of your app.  It's a set of rules.  So how could any tool
 generate your app for you is/was my point.

 Take an ecommerce example.  You might have a product in the database,
 but calculating it's price based on categories, sale prices, etc isn't
 something that a database is going to do.  That is your app's logic 
 is part of your model.  The model can ask the DB for all that static
 info about pricing, but it makes the determination as to what the
 price is.

 What about when you want to add a product to the cart?  Where would
 you ask the code if that product is already in the cart?  Just all
 those types of things...

   

I understand and agree.  I'm by no means a hardcore OOP guy, or even a
professional developer.  What I should have said was that a base
model  is generated for each table describing your table, fields,
relations, validations etc. and providing some base methods (find,
findAll, etc.).  You still need to add your business logic, extra
methods and any validation logic that the code gen doesn't do for you. 
These base models are easily extended and there are many callbacks that
you can create in the model (before and after, find, save, validate,
etc...).

So what I meant was that it creates a working skeleton application that
works with your DB.  You then need to build your actual functionality,
includes business logic.  To me this is RAD, and rad :-)

Thanks!
-Shawn

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



Re: [PHP] Mail subject encoding problem

2009-01-31 Thread Manuel Lemos
Hello,

on 01/30/2009 11:43 AM Thodoris said the following:
 Yes I know that this is not reasonable but using UTF-8 fails. And this
 seems to work in some cases. I am thinking that this has to do with
 PHP's internal encoding or something with the OS. I am not sure why that
 works this way that's why I am asking for some enlightenment  :-)
 
 Is there something that I need to set for PHP to change its behavior.

You cannot send 8 bit characters in e-mail. For headers you need to use
q-encoding to make your non-ASCIIC characters be represented with only
ASCII characters.

If you are not sure on how to encode message headers with q-encoding,
you may want to try this MIME message class. Take a look at the
test_email_message.php example to learn how to send messages with
non-ASCII characters on the headers or body.

http://www.phpclasses.org/mimemessage


-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

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: More questions about SESSION use

2009-01-31 Thread David Robley
Terion Miller wrote:

 So now I have SESSIONs set: user, AdminID, AdminLogin
 
 but I'm trying to use them without showing them in links...currently the
 pages only load if I make the links like this:
 
 a href=Welcome.php?AdminID=?php echo $_SESSION['AdminID']; ?
 target=mainFrameHome/a
 
 I thought the whole purpose of having/using Sessions is to not have to
 pass variables in url's, but if I remove the session in the link above
 when I click to it, It logs me out, even though it IS holding the SESSION
 (which I checked by revealing my variables) so I guess I am confused about
 this bit of code, I think its saying if the SESSION is there great if not
 logout... but even when I expose the variables and see that the session is
 passing from page to page it keeps sending me to the logout page:
 
 This is how it was originally written:
 if (empty($_SESSION['AdminLogin']) || $_SESSION['AdminLogin'] !=  true){
 header (Location: LogOut.php);
 $_SESSION['user']=$UserName;
 $_SESSION['AdminID']=$AdminID; --*I added this one originally the
 script only used 'user' and 'AdminLogin'* but passed them in urls
 }
 
 
 Is the above part not needed since the Session is already active? Should I
 be not using the header part (honestly I havent read up on that chapter
 yet)

Are you using session_start()? 


Cheers
-- 
David Robley

The Hubbell works fine; all that stuff IS blurry!
Today is Boomtime, the 32nd day of Chaos in the YOLD 3175. 


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