Re: [PHP] mail function

2007-08-02 Thread Siavash Miri
Check to see if you can send mail out of your server aside from the php 
script. Also, check the logs: error_log, maillog, messages  to see what's 
wrong with the script or the mail function. I'm not sure if these logs exist 
on IIS or where they are.


Siavash

- Original Message - 
From: "Animesh Joshi" <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, August 01, 2007 3:20 AM
Subject: [PHP] mail function


I've installed IIS (Internet information services on my windows XP machine. 
I've also installed php 5.0 from www.php.net. I'm trying to use the mail() 
function in a simple php script which uses a html form. However, i'm not 
able to send the mail using the mail($to, $subject, $message, $headers); 
function. I wonder what's wrong. Please help, i'm new to php.


Animesh Joshi 


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



[PHP] PHP and nCurses

2007-08-02 Thread Man-wai Chang

Anyone ever coded a full business app using PHP and nCurses?

-- 
  @~@   Might, Courage, Vision, SINCERITY.
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04)  Linux 2.6.22.1
  ^ ^   15:43:01 up 21 days 17:47 2 users load average: 0.01 0.04 0.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

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



Re: [PHP] Question about passing date in sql...

2007-08-02 Thread Payne

Stut wrote:

Michael Preslar wrote:

I know it has to do with date='`date +%Y%m%d`', because if I remove it
works.


Are you trying to use perl's back tic operator in php here?


PHP also supports the that.

However, I think the OP's problem is that it's inside other quotes and 
is therefore not being executed. But, as someone else pointed out, you 
should be using the PHP date function to get the date from within PHP.


-Stut

Not perl, bash! Well, what I was trying to do was covert my bash script 
to php, my sql statement makes the call to date so that it puts today 
date, that all it doing. I will look around and see if I can do that 
with php.


Thanks.

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



Re: [PHP] Session Issues with Certain ISPs

2007-08-02 Thread Mark Tuma

Hi Richard,

Sorry to have not responded for so long, and thanks for your views.  It 
turns out the problem is browser based, at least in part.  A windows PC 
with IE6 in our office could not get the site working right, whereas a 
linux laptop with firefox was fine with it.  The immediate need is over 
now, but I think I'll look into database sessions for future systems.


Cheers,
Mark

Richard Lynch wrote:

On Wed, July 18, 2007 9:35 am, Mark Tuma wrote:
  

I have a fairly simple set of php scripts which use session variables
to
pass information from one page to the next in an online booking system
for an event.  In most cases these work fine, but users with a couple
of
ISPs are consistently unable to use the system, as the session
variables
seem to get lost along the way.  The troublesome ISPs are AOL and
BTOpenworld.

Does anyone have any experiences that could shed light on this for me?



Not sure how they'd manage it, but if AOL is failing to deliver the
proper cookie headers, they'd lose track of there session and pretty
much be logged out for all intents and purposes...

I have the same issue, but always assumed it was browser-based, or,
rather, browser-settings based, as I could never reproduce it even
with the same browser version.

So "Try another browser" has been my only remedy so far. :-(

  


--
---
The views expressed in this email do not necessarily represent those of
Norwich Youth For Christ.
Norwich Youth For Christ, 36 St. Giles Street, Norwich, NR2 1LL
Tel: +44 1603 620678
www.norwichyfc.co.uk
Norwich Youth For Christ is a registered charity number 1071019

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



Re: [PHP] Question about passing date in sql...

2007-08-02 Thread Payne

Payne wrote:

Stut wrote:

Michael Preslar wrote:

I know it has to do with date='`date +%Y%m%d`', because if I remove it
works.


Are you trying to use perl's back tic operator in php here?


PHP also supports the that.

However, I think the OP's problem is that it's inside other quotes 
and is therefore not being executed. But, as someone else pointed 
out, you should be using the PHP date function to get the date from 
within PHP.


-Stut

Not perl, bash! Well, what I was trying to do was covert my bash 
script to php, my sql statement makes the call to date so that it puts 
today date, that all it doing. I will look around and see if I can do 
that with php.


Thanks.

Guys, thanks for the help got it, if I switch to current_date with is 
build into mysql that does what I was doing anyway.


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



Re: [PHP] mail function

2007-08-02 Thread Stut

Animesh Joshi wrote:

I've installed IIS (Internet information services on my windows XP machine. 
I've also installed php 5.0 from www.php.net. I'm trying to use the mail() 
function in a simple php script which uses a html form. However, i'm not able 
to send the mail using the mail($to, $subject, $message, $headers); function. I 
wonder what's wrong. Please help, i'm new to php.


Please review the Runtime Configuration section of 
http://uk.php.net/mail and make sure you've told php.ini about your mail 
server.


-Stut

--
http://stut.net/

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



Re: [PHP] Includes eating up my time [SOLVED]

2007-08-02 Thread Dave M G

David,

Thank you for responding.


__autoload
... which basically only loads classes when they are required. 


Yes, this is exactly what I needed. Not only was I already on PHP5, but 
fortunately I had also already been building my classes so that it was 
one class per file, as __autoload requires.


So this was possibly the easiest and most effective change I've ever 
implemented. And the results were impressive. The Zend profiler reported 
that I went from 500 to 800 milliseconds per page request down to 40 to 
60 milliseconds. Occasional database connections raised the time now and 
again, but I think I have a handle on that.


Thank you for pointing that out to me. Just the right solution.

--
Dave M G
Ubuntu Feisty 7.04
Kernel 2.6.20-16-386

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



Re: [PHP] Loss of precision in intval()

2007-08-02 Thread Roberto Mansfield
Those numbers must fall on the other side of the number. E.g.,

  75.81 ==> 75.8100011 (etc)

so you get the expected results.

Mark Summers wrote:
> I like to think that I'm reasonably aware of the limitations of floating
> point (famous last words).
> 
> To my mind, the ridiculousness (probably not a word) of the example is
> highlighted by the fact that 75.81 and 75.83 work perfectly.
> 
> Roberto Mansfield wrote:
>> Internally, 75.82 can't be stored exactly, so 75.82 * 100 is probably
>> 7581.92 rather than the expected integer value of 7582. So intval is
>> behaving properly. Sounds like you want intval(round($a));
>>
>>
>>
>> [EMAIL PROTECTED] wrote:
>>  
>>> Very weird and counter intuitive.  Looking at the php manual, I see
>>> this:
>>>
>>> Converting to integer from floating point:
>>>
>>> "When converting from float to integer, the number will be rounded
>>> towards zero."
>>>
>>> But you'd think the multiplication would happen before the rounding.
>>>
>>> if you do:
>>> $a = ceil(75.82 * 100);
>>>
>>> you should get the proper answer.
>>>
>>> This is what I used for testing:
>>>
>>> >> $x = 75.82;
>>> $y = 100;
>>>
>>> echo "x is " . gettype($x) . "\n";
>>> echo "y is " . gettype($y) . "\n";
>>>
>>> $a = ceil($x * $y);
>>>
>>> echo "a is " . gettype($a) . "\n";
>>>
>>> echo "intval(a) is " . gettype(intval($a)) . "\n";
>>>
>>> echo $a . " *** " . intval($a);
>>> ?>
>>>
>>> Not sure that really helps, but seems to be some kind of order of
>>> precedence issue.
>>>
>>> -TG
>>>
>>> = = = Original message = = =
>>>
>>> This sort of thing really isn't helpful...
>>>
>>> >>
>>> $a = 75.82 * 100;
>>>
>>> echo intval($a);
>>>
>>> ?>
>>>
>>>
>>> ___
>>> Sent by ePrompter, the premier email notification software.
>>> Free download at http://www.ePrompter.com.
>>> 
>>
>>   

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



[PHP] Setting group sticky bit on directory with chmod()

2007-08-02 Thread Ben Ramsey
I'm trying to set a sticky bit on a directory with chmod(). The same
octal value works from the command prompt, but it doesn't appear to work
correctly with the PHP function. Anyone have an idea as to why?

PROMPT (works):
$> chmod 2775 /path/to/dir

PHP (doesn't work):
chmod('/path/to/dir', 02775);

We've tested the PHP code on files, and it works, but it doesn't work on
directories.

Our current umask is 0002. We're using PHP 5.2.2 on Linux 
2.6.9-42.0.10.ELsmp #1 SMP Fri Feb 16 17:17:21 EST 2007 i686 i686 i386
GNU/Linux.

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

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



[PHP] Cut text from a string

2007-08-02 Thread Don Don
hi all, am trying to cut some texts from a serries of string values e.g.

"this is how  we do (50 cents feat. the game)"
"give it to me (nelly feat timerland)"
"let me hold you (bow wow feat omarion)"

i want to cut off the text between the comas and i've seen some examples

 this is a test";
 preg_match('/.*<\/b>/i', $string, $result);
 echo strip_tags($result[0]);
 ?>
 
 this is a test";
 list($junk, $good) = split('', $string);
 list($good, $junk) = split('', $good);
 echo $good;
 ?>

but they wont work with comas

   
-
Yahoo! oneSearch: Finally,  mobile search that gives answers, not web links. 

RE: [PHP] Cut text from a string

2007-08-02 Thread Jay Blanchard
[snip]
hi all, am trying to cut some texts from a serries of string values e.g.

"this is how  we do (50 cents feat. the game)"
"give it to me (nelly feat timerland)"
"let me hold you (bow wow feat omarion)"

i want to cut off the text between the comas and i've seen some examples
[/snip]

Comas? Do you mean parentheses?

Do you want to cut the text, get rid of it?

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



Re: [PHP] Cut text from a string

2007-08-02 Thread Dan Shirah
Maybe I'm blind, but I don't see any commas in the text you are referring
to.

On 8/2/07, Don Don <[EMAIL PROTECTED]> wrote:
>
> hi all, am trying to cut some texts from a serries of string values e.g.
>
> "this is how  we do (50 cents feat. the game)"
> "give it to me (nelly feat timerland)"
> "let me hold you (bow wow feat omarion)"
>
> i want to cut off the text between the comas and i've seen some examples
>
>  $string = "Hello world, this is a test";
> preg_match('/.*<\/b>/i', $string, $result);
> echo strip_tags($result[0]);
> ?>
>
>  $string = "Hello world, this is a test";
> list($junk, $good) = split('', $string);
> list($good, $junk) = split('', $good);
> echo $good;
> ?>
>
> but they wont work with comas
>
>
> -
> Yahoo! oneSearch: Finally,  mobile search that gives answers, not web
> links.


[PHP] How can I get a list of object vars?

2007-08-02 Thread js
Hi list.

I'm trying to write a ORM  in PHP.
I want the ORM to have metadata mapping, which have a list of  properties name
and the value, without using any external file.
(I like simple one, not want messy XML)

I'm thinking PHP's reflective functions might help me to do that
and treid  get_object_vars but it  doesn't  return properties name
and even value itself when it  haven't been assigned any value.

Is there  any good way to get a list of properties name  and the value?
Or some good PHP framework's implementation  to study for this?

Thanks in advance.

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



Re: [PHP] Setting group sticky bit on directory with chmod()

2007-08-02 Thread Daniel Brown
On 8/2/07, Ben Ramsey <[EMAIL PROTECTED]> wrote:
> I'm trying to set a sticky bit on a directory with chmod(). The same
> octal value works from the command prompt, but it doesn't appear to work
> correctly with the PHP function. Anyone have an idea as to why?
>
> PROMPT (works):
> $> chmod 2775 /path/to/dir
>
> PHP (doesn't work):
> chmod('/path/to/dir', 02775);
>
> We've tested the PHP code on files, and it works, but it doesn't work on
> directories.
>
> Our current umask is 0002. We're using PHP 5.2.2 on Linux 
> 2.6.9-42.0.10.ELsmp #1 SMP Fri Feb 16 17:17:21 EST 2007 i686 i686 i386
> GNU/Linux.
>
> --
> Ben Ramsey
> http://benramsey.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Ben,

Drop the preceding 0 from the chmod() function parameters.  The
four-digit octal value is preferred, and the 0 is the first bit to
show that there's no user- or group-specific execution (su-exec'ing,
basically) or "stickiness" to the file/directory.  However,
three-digit values will work.  In either case, five digits will not
work.

Right:
chmod 0755 file.php
chmod 1777 file.php
chmod('file.php',0755);
chmod('file.php',1777);

Will almost always work, but isn't entirely correct:
chmod 755 file.php
chmod 644 file.php
chmod('file.php',755);
chmod('file.php',644);

Will never (or at least, SHOULD never) work:
chmod 00755 file.php
chmod 01777 file.php
chmod('file.php',00755);
chmod('file.php',01777);

If you are interested in things like this, search the archives for
a post I made a few months back about permissions.  It's a long one,
but in my opinion, a pretty damned good article stub.

/me pats self on back without regard.

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Cut text from a string

2007-08-02 Thread Daniel Brown
On 8/2/07, Dan Shirah <[EMAIL PROTECTED]> wrote:
> Maybe I'm blind, but I don't see any commas in the text you are referring
> to.
>
> On 8/2/07, Don Don <[EMAIL PROTECTED]> wrote:
> >
> > hi all, am trying to cut some texts from a serries of string values e.g.
> >
> > "this is how  we do (50 cents feat. the game)"
> > "give it to me (nelly feat timerland)"
> > "let me hold you (bow wow feat omarion)"
> >
> > i want to cut off the text between the comas and i've seen some examples
> >
> >  > $string = "Hello world, this is a test";
> > preg_match('/.*<\/b>/i', $string, $result);
> > echo strip_tags($result[0]);
> > ?>
> >
> >  > $string = "Hello world, this is a test";
> > list($junk, $good) = split('', $string);
> > list($good, $junk) = split('', $good);
> > echo $good;
> > ?>
> >
> > but they wont work with comas
> >
> >
> > -
> > Yahoo! oneSearch: Finally,  mobile search that gives answers, not web
> > links.
>

To remove the text between the comas would be a great feat,
especially if you're still groggy from waking up from the first one.
However, if you meant "commas", then I, like the others, don't see
one.

On a different note, with all kidding aside now, if you want to
strip everything in parentheses, inclusively, then you can use this
code:

 $v) {
$out = preg_replace('/\(.*\)/',null,$v);
echo $out."\n";
}
?>

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Setting group sticky bit on directory with chmod()

2007-08-02 Thread Ben Ramsey
On 8/2/07 10:57 AM, Daniel Brown wrote:
> On 8/2/07, Ben Ramsey <[EMAIL PROTECTED]> wrote:
>> PHP (doesn't work):
>> chmod('/path/to/dir', 02775);
>>
>> We've tested the PHP code on files, and it works, but it doesn't work on
>> directories.
> 
> Drop the preceding 0 from the chmod() function parameters.  The
> four-digit octal value is preferred, and the 0 is the first bit to
> show that there's no user- or group-specific execution (su-exec'ing,
> basically) or "stickiness" to the file/directory.  However,
> three-digit values will work.  In either case, five digits will not
> work.
> 
> Right:
> chmod 0755 file.php
> chmod 1777 file.php
> chmod('file.php',0755);
> chmod('file.php',1777);

What about on directories? That's our problem.

The following works on files (even though you say it shouldn't). I'll
clarify: 02775 sets permissions based on how we expect 2775 to work
using chmod from the command prompt. The problem is that 2775 with PHP's
chmod() doesn't set the permissions in the same way that it does from
the command prompt.

This works on files:
chmod('/path/to/file.php', 02775);

But it doesn't work on directories.

Here's what we're doing:



Here's what we get:
$ ls -l
d-ws-w-rwt   2 user user  4096 Aug  2 15:33 test1

Here's what we expect:
$ chmod 2775 test1
drwxrwsr-x   2 user user  4096 Aug  2 15:34 test1

So, what are we doing wrong with chmod() that is causing us to get the
wrong results? Keep in mind that we are running the PHP script as the
same user who owns the directory.

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

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



Re: [PHP] Setting group sticky bit on directory with chmod()

2007-08-02 Thread Ben Ramsey
On 8/2/07 10:57 AM, Daniel Brown wrote:
> On 8/2/07, Ben Ramsey <[EMAIL PROTECTED]> wrote:
>> PHP (doesn't work):
>> chmod('/path/to/dir', 02775);
>>
>> We've tested the PHP code on files, and it works, but it doesn't work on
>> directories.
> 
> Drop the preceding 0 from the chmod() function parameters.  The
> four-digit octal value is preferred, and the 0 is the first bit to
> show that there's no user- or group-specific execution (su-exec'ing,
> basically) or "stickiness" to the file/directory.  However,
> three-digit values will work.  In either case, five digits will not
> work.
> 
> Right:
> chmod 0755 file.php
> chmod 1777 file.php
> chmod('file.php',0755);
> chmod('file.php',1777);

What about on directories? That's our problem.

The following works on files (even though you say it shouldn't). I'll
clarify: 02775 sets permissions based on how we expect 2775 to work
using chmod from the command prompt. The problem is that 2775 with PHP's
chmod() doesn't set the permissions in the same way that it does from
the command prompt.

This works on files:
chmod('/path/to/file.php', 02775);

But it doesn't work on directories.

Here's what we're doing:



Here's what we get:
$ ls -l
d-ws-w-rwt   2 user user  4096 Aug  2 15:33 test1

Here's what we expect:
$ chmod 2775 test1
drwxrwsr-x   2 user user  4096 Aug  2 15:34 test1

So, what are we doing wrong with chmod() that is causing us to get the
wrong results? Keep in mind that we are running the PHP script as the
same user who owns the directory.

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

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



Re: [PHP] Setting group sticky bit on directory with chmod()

2007-08-02 Thread Ben Ramsey
On 8/2/07 11:45 AM, Tijnema wrote:
> On 8/2/07, Ben Ramsey <[EMAIL PROTECTED]> wrote:
>> So, what are we doing wrong with chmod() that is causing us to get the
>> wrong results? Keep in mind that we are running the PHP script as the
>> same user who owns the directory.
> 
> Who is the owner of the directory containing this test1 directory?
> That one should also be the same as PHP script is running on AFAIK.
> 

Read my last paragraph. ;-)

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

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



[PHP] Does PDO prevent class functions from calling other class functions?

2007-08-02 Thread Ken Tozier

Hi

I've been writing PHP classes for around two years now but all of a  
sudden, the things I used to do don't work any more. I have a class  
that implements utility functions for database calls using PDO and am  
finding that I can't call one utility function from within another.  
If each function is called by itself from a script, they work  
perfectly. This is really basic stuff so I'm very puzzled why it  
isn't working. The only difference between these new classes and my  
old classes is the use of PDO. Could PDO be causing all these headaches?


Anyone see where I'm screwing up?

Thanks in advance

Ken

Here's the '__construct' function of the included 'MySQLDatabase' class

function __construct($inDomain, $inUser, $inPassword, $inDBName)
{
try
{
		$this->db		= new PDO('mysql:host='.$inDomain.';dbname='.$inDBName,  
$inUser, $inPassword);


// set error reporting
$this->db->setAttribute(PDO::ATTR_ERRMODE, 
PDO::ERRMODE_EXCEPTION);
}
catch (PDOException $e)
{
print "Error!: " . $e->getMessage() . "";
die();
}
}

Here's the utility class so far

	// MySQLDatabase is a DB access class that handles a bunch of stuff  
like pulling values out of a query
	// value coersion etc. I've tested this for the last day or so and  
it seems to be stable.

include_once('MySQLDatabase.php');

class PMXUtilities
{
private $db;

function __construct()
{
$domain = 'localhost';
$user   = 'root';
$password   = '';
$db_name= 'pagemanager';

$this->db= new MySQLDatabase($domain, 
$user, $password, $db_name);
}

// if this is called on its own, it works
function site_for_pub($inPubID)
{
			$query= 'select site.id, site.site_name from site, publication  
where publication.id='.$inPubID.' and publication.site=site.id';

$coersions  = array('id'=> 
'integer');
$args   = array('query'=> $query, 
'coersions'=> $coersions);

$queryResult= 
$this->db->query_database($args);

if (count($queryResult) > 0)
return $queryResult[0]['id'];
else
return 'Error: PMXUtilities.site_for_pub_id failed while fetching  
site info for publication:'.$inPubID;			

}

/ if this is called on its own, it works
function directory_type_id_for_name($inName)
{
$query  = 'select id from directory_type 
where name="'.$inName.'"';
$coersions  = array('id'=> 
'integer');
$args   = array('query'=> $query, 
'coersions'=> $coersions);

$queryResult= 
$this->db->query_database($args);

if (count($queryResult) > 0)
return $queryResult[0]['id'];
else
return 'Error: PMXUtilities.site_for_pub_id failed while fetching  
directory type id for directory:'.$inName;

}

// this function never gets past the first "echo"
function directory_path_for_pub_id($inPubID, $inDirType)
{
echo 'entered: directory_path_for_pub_id';

// seems to die on next line as the 'echo site' line 
never prints
$site   = 
$this->site_for_pub_id($inPubID);
echo 'site: '.$site.'';
/*
$dirTypeID  = 
$this->directory_type_id_for_name($inDirType);
echo 'dir_type: '.$dirTypeID.'';

			$query			= "select server.server_name, directory.path from  
directory, server, site where directory.type=".$dirTypeID." and  
directory.server=server.id and server.site=site.id and site.id=".$site;

echo $query.'';
$queryResult= $this->db->query_database($query);

return 
$queryResult[0]->server_name.$queryResult[0]->path;
*/
}

}
?>

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

Re: [PHP] Setting group sticky bit on directory with chmod()

2007-08-02 Thread Ben Ramsey
On 8/2/07 10:57 AM, Daniel Brown wrote:
> On 8/2/07, Ben Ramsey <[EMAIL PROTECTED]> wrote:
>> PHP (doesn't work):
>> chmod('/path/to/dir', 02775);
>>
>> We've tested the PHP code on files, and it works, but it doesn't work on
>> directories.
> 
> Drop the preceding 0 from the chmod() function parameters.  The
> four-digit octal value is preferred, and the 0 is the first bit to
> show that there's no user- or group-specific execution (su-exec'ing,
> basically) or "stickiness" to the file/directory.  However,
> three-digit values will work.  In either case, five digits will not
> work.
> 
> Right:
> chmod 0755 file.php
> chmod 1777 file.php
> chmod('file.php',0755);
> chmod('file.php',1777);

What about on directories? That's our problem.

The following works on files (even though you say it shouldn't). I'll
clarify: 02775 sets permissions based on how we expect 2775 to work
using chmod from the command prompt. The problem is that 2775 with PHP's
chmod() doesn't set the permissions in the same way that it does from
the command prompt.

This works on files:
chmod('/path/to/file.php', 02775);

But it doesn't work on directories.

Here's what we're doing:



Here's what we get:
$ ls -l
d-ws-w-rwt   2 user user  4096 Aug  2 15:33 test1

Here's what we expect:
$ chmod 2775 test1
drwxrwsr-x   2 user user  4096 Aug  2 15:34 test1

So, what are we doing wrong with chmod() that is causing us to get the
wrong results? Keep in mind that we are running the PHP script as the
same user who owns the directory.

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

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



Re: [PHP] Setting group sticky bit on directory with chmod()

2007-08-02 Thread Tijnema
On 8/2/07, Ben Ramsey <[EMAIL PROTECTED]> wrote:
> On 8/2/07 10:57 AM, Daniel Brown wrote:
> > On 8/2/07, Ben Ramsey <[EMAIL PROTECTED]> wrote:
> >> PHP (doesn't work):
> >> chmod('/path/to/dir', 02775);
> >>
> >> We've tested the PHP code on files, and it works, but it doesn't work on
> >> directories.
> >
> > Drop the preceding 0 from the chmod() function parameters.  The
> > four-digit octal value is preferred, and the 0 is the first bit to
> > show that there's no user- or group-specific execution (su-exec'ing,
> > basically) or "stickiness" to the file/directory.  However,
> > three-digit values will work.  In either case, five digits will not
> > work.
> >
> > Right:
> > chmod 0755 file.php
> > chmod 1777 file.php
> > chmod('file.php',0755);
> > chmod('file.php',1777);
>
> What about on directories? That's our problem.
>
> The following works on files (even though you say it shouldn't). I'll
> clarify: 02775 sets permissions based on how we expect 2775 to work
> using chmod from the command prompt. The problem is that 2775 with PHP's
> chmod() doesn't set the permissions in the same way that it does from
> the command prompt.
>
> This works on files:
> chmod('/path/to/file.php', 02775);
>
> But it doesn't work on directories.
>
> Here's what we're doing:
>
>  chmod('./test1', 2775);
> ?>
>
> Here's what we get:
> $ ls -l
> d-ws-w-rwt   2 user user  4096 Aug  2 15:33 test1
>
> Here's what we expect:
> $ chmod 2775 test1
> drwxrwsr-x   2 user user  4096 Aug  2 15:34 test1
>
> So, what are we doing wrong with chmod() that is causing us to get the
> wrong results? Keep in mind that we are running the PHP script as the
> same user who owns the directory.
>
> --
> Ben Ramsey
> http://benramsey.com/
>

Who is the owner of the directory containing this test1 directory?
That one should also be the same as PHP script is running on AFAIK.

Tijnema

-- 
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

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



Re: [PHP] Does PDO prevent class functions from calling other class functions?

2007-08-02 Thread Nathan Nobbe
> On 8/2/07, Ken Tozier <[EMAIL PROTECTED]> wrote:
> I have a class
> that implements utility functions for database calls using PDO and am
> finding that I can't call one utility function from within another.

can you supply an error or warning that php is giving ?
it would help to determine the problem.

-nathan

On 8/2/07, Ken Tozier <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> I've been writing PHP classes for around two years now but all of a
> sudden, the things I used to do don't work any more. I have a class
> that implements utility functions for database calls using PDO and am
> finding that I can't call one utility function from within another.
> If each function is called by itself from a script, they work
> perfectly. This is really basic stuff so I'm very puzzled why it
> isn't working. The only difference between these new classes and my
> old classes is the use of PDO. Could PDO be causing all these headaches?
>
> Anyone see where I'm screwing up?
>
> Thanks in advance
>
> Ken
>
> Here's the '__construct' function of the included 'MySQLDatabase' class
>
> function __construct($inDomain, $inUser, $inPassword, $inDBName)
> {
> try
> {
> $this->db   = new
> PDO('mysql:host='.$inDomain.';dbname='.$inDBName,
> $inUser, $inPassword);
>
> // set error reporting
> $this->db->setAttribute(PDO::ATTR_ERRMODE,
> PDO::ERRMODE_EXCEPTION);
> }
> catch (PDOException $e)
> {
> print "Error!: " . $e->getMessage() . "";
> die();
> }
> }
>
> Here's the utility class so far
>
>  // MySQLDatabase is a DB access class that handles a bunch of
> stuff
> like pulling values out of a query
> // value coersion etc. I've tested this for the last day or so and
> it seems to be stable.
> include_once('MySQLDatabase.php');
>
> class PMXUtilities
> {
> private $db;
>
> function __construct()
> {
> $domain = 'localhost';
> $user   = 'root';
> $password   = '';
> $db_name= 'pagemanager';
>
> $this->db   = new
> MySQLDatabase($domain, $user, $password, $db_name);
> }
>
> // if this is called on its own, it works
> function site_for_pub($inPubID)
> {
> $query  = 'select site.id,
> site.site_name from site, publication
> where publication.id='.$inPubID.' and publication.site=site.id';
> $coersions  = array('id'=>
> 'integer');
> $args   = array('query'=>
> $query, 'coersions'=> $coersions);
>
> $queryResult=
> $this->db->query_database($args);
>
> if (count($queryResult) > 0)
> return $queryResult[0]['id'];
> else
> return 'Error:
> PMXUtilities.site_for_pub_id failed while fetching
> site info for publication:'.$inPubID;
> }
>
> / if this is called on its own, it works
> function directory_type_id_for_name($inName)
> {
> $query  = 'select id from
> directory_type where name="'.$inName.'"';
> $coersions  = array('id'=>
> 'integer');
> $args   = array('query'=>
> $query, 'coersions'=> $coersions);
>
> $queryResult=
> $this->db->query_database($args);
>
> if (count($queryResult) > 0)
> return $queryResult[0]['id'];
> else
> return 'Error:
> PMXUtilities.site_for_pub_id failed while fetching
> directory type id for directory:'.$inName;
> }
>
> // this function never gets past the first "echo"
> function directory_path_for_pub_id($inPubID, $inDirType)
> {
> echo 'entered: directory_path_for_pub_id';
>
> // seems to die on next line as the 'echo site'
> line never prints
> $site   =
> $this->site_for_pub_id($inPubID);
> echo 'site: '.$site.'';
> /*
> $dirTypeID  =
> $this->directory_type_id_for_name($inDirType);
> echo 'dir_type: '.$dirTypeID.'';
>
> $query  = "select
> server.server_name, directory.path from
> directory, server, site where di

Re: [PHP] How can I get a list of object vars?

2007-08-02 Thread Robin Vickery
On 02/08/07, js <[EMAIL PROTECTED]> wrote:
> Hi list.
>
> I'm trying to write a ORM  in PHP.
> I want the ORM to have metadata mapping, which have a list of  properties name
> and the value, without using any external file.
> (I like simple one, not want messy XML)
>
> I'm thinking PHP's reflective functions might help me to do that
> and treid  get_object_vars but it  doesn't  return properties name
> and even value itself when it  haven't been assigned any value.
>
> Is there  any good way to get a list of properties name  and the value?

$properties = (array) $myObject;

no?

-robin

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



Re: [PHP] Does PDO prevent class functions from calling other class functions?

2007-08-02 Thread Ken Tozier


On Aug 2, 2007, at 12:03 PM, Nathan Nobbe wrote:


can you supply an error or warning that php is giving ?
it would help to determine the problem.


How would I go about that? I just took a quick look at the try/catch  
documentation and it looks like it's my responsibility to throw  
exceptions which isn't particularly useful if it's PHP itself that is  
doing something unexpected


http://www.php.net/manual/en/language.exceptions.php




-nathan

On 8/2/07, Ken Tozier <[EMAIL PROTECTED]> wrote: Hi

I've been writing PHP classes for around two years now but all of a
sudden, the things I used to do don't work any more. I have a class
that implements utility functions for database calls using PDO and am
finding that I can't call one utility function from within another.
If each function is called by itself from a script, they work
perfectly. This is really basic stuff so I'm very puzzled why it
isn't working. The only difference between these new classes and my
old classes is the use of PDO. Could PDO be causing all these  
headaches?


Anyone see where I'm screwing up?

Thanks in advance

Ken

Here's the '__construct' function of the included 'MySQLDatabase'  
class


function __construct($inDomain, $inUser, $inPassword, $inDBName)
{
try
{
$this->db   = new PDO('mysql:host='. 
$inDomain.';dbname='.$inDBName,

$inUser, $inPassword);

// set error reporting
$this->db->setAttribute(PDO::ATTR_ERRMODE,  
PDO::ERRMODE_EXCEPTION);

}
catch (PDOException $e)
{
print "Error!: " . $e->getMessage() . "";
die();
}
}

Here's the utility class so far

// MySQLDatabase is a DB access class that handles a bunch  
of stuff

like pulling values out of a query
// value coersion etc. I've tested this for the last day or  
so and

it seems to be stable.
include_once('MySQLDatabase.php');

class PMXUtilities
{
private $db;

function __construct()
{
$domain = 'localhost';
$user   = 'root';
$password   = '';
$db_name= 'pagemanager';

$this->db   = new MySQLDatabase 
($domain, $user, $password, $db_name);

}

// if this is called on its own, it works
function site_for_pub($inPubID)
{
$query  = 'select  
site.id, site.site_name from site, publication

where publication.id='.$inPubID.' and publication.site=site.id';
$coersions  = array 
('id'=> 'integer');
$args   = array 
('query'=> $query, 'coersions'=> $coersions);


$queryResult= $this->db- 
>query_database($args);


if (count($queryResult) > 0)
return $queryResult[0]['id'];
else
return 'Error:  
PMXUtilities.site_for_pub_id failed while fetching

site info for publication:'.$inPubID;
}

/ if this is called on its own, it works
function directory_type_id_for_name($inName)
{
$query  = 'select  
id from directory_type where name="'.$inName.'"';
$coersions  = array 
('id'=> 'integer');
$args   = array 
('query'=> $query, 'coersions'=> $coersions);


$queryResult= $this->db- 
>query_database($args);


if (count($queryResult) > 0)
return $queryResult[0]['id'];
else
return 'Error:  
PMXUtilities.site_for_pub_id failed while fetching

directory type id for directory:'.$inName;
}

// this function never gets past the first "echo"
function directory_path_for_pub_id($inPubID,  
$inDirType)

{
echo 'entered: directory_path_for_pub_id';

// seems to die on next line as the 'echo  
site' line never prints
$site   = $this- 
>site_for_pub_id($inPubID);

echo 'site: '.$site.'';
/*
$dirTypeID  = $this- 
>directory_type_id_for_name($inDirType);

echo 'dir_type: '.$dirTypeID.'';

$query  = "select  
server.server_name, directory.path from

directory, server, site where directory.type=".$dirTypeI

Re: [PHP] How can I get a list of object vars?

2007-08-02 Thread Nathan Nobbe
> On 8/2/07, js <[EMAIL PROTECTED]> wrote:
> you may need to work with the reflective functions for a while to get them
down.
> if  you want to see some usage of them, check out 
> PHPUnit
.

> Robin Vickery wrote:
> $properties = (array) $myObject;
> no?

no, thats why there are reflective methods.  to expose the private member
variables.

php -a
php > class someObj {
php { private $someVar = null;
php { }
php > $newobj = new someObj();
php > $properties = (array) $newobj;
php > var_dump($properties);
array(1) {
  ["someObjsomeVar"]=>
  NULL
}

-nathan

On 8/2/07, js <[EMAIL PROTECTED]> wrote:
>
> Hi list.
>
> I'm trying to write a ORM  in PHP.
> I want the ORM to have metadata mapping, which have a list of  properties
> name
> and the value, without using any external file.
> (I like simple one, not want messy XML)
>
> I'm thinking PHP's reflective functions might help me to do that
> and treid  get_object_vars but it  doesn't  return properties name
> and even value itself when it  haven't been assigned any value.
>
> Is there  any good way to get a list of properties name  and the value?
> Or some good PHP framework's implementation  to study for this?
>
> Thanks in advance.
>
> --
> PHP General Mailing List ( http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Does PDO prevent class functions from calling other class functions?

2007-08-02 Thread Nathan Nobbe
> On 8/2/07, Ken Tozier <[EMAIL PROTECTED]> wrote:
> How would I go about that? I just took a quick look at the try/catch
> documentation and it looks like it's my responsibility to throw
>exceptions which isn't particularly useful if it's PHP itself that is
> doing something unexpected

well, youre not throwing an exception here in your code, your doing
something called
swallowing the exception.  which is typically not a good practice.

   catch (PDOException $e)
   {
   print "Error!: " . $e->getMessage() . "";
   die();
   }

and you could show us the output from
$e->getMessage()

thats where the script is blowing up.  calling die() after that will
obviously stop processing
so you have no hope of recovering gracefully.

-nathan
On 8/2/07, Ken Tozier <[EMAIL PROTECTED]> wrote:
>
>
> On Aug 2, 2007, at 12:03 PM, Nathan Nobbe wrote:
>
> > can you supply an error or warning that php is giving ?
> > it would help to determine the problem.
>
> How would I go about that? I just took a quick look at the try/catch
> documentation and it looks like it's my responsibility to throw
> exceptions which isn't particularly useful if it's PHP itself that is
> doing something unexpected
>
> http://www.php.net/manual/en/language.exceptions.php
>
>
> >
> > -nathan
> >
> > On 8/2/07, Ken Tozier <[EMAIL PROTECTED]> wrote: Hi
> >
> > I've been writing PHP classes for around two years now but all of a
> > sudden, the things I used to do don't work any more. I have a class
> > that implements utility functions for database calls using PDO and am
> > finding that I can't call one utility function from within another.
> > If each function is called by itself from a script, they work
> > perfectly. This is really basic stuff so I'm very puzzled why it
> > isn't working. The only difference between these new classes and my
> > old classes is the use of PDO. Could PDO be causing all these
> > headaches?
> >
> > Anyone see where I'm screwing up?
> >
> > Thanks in advance
> >
> > Ken
> >
> > Here's the '__construct' function of the included 'MySQLDatabase'
> > class
> >
> > function __construct($inDomain, $inUser, $inPassword, $inDBName)
> > {
> > try
> > {
> > $this->db   = new PDO('mysql:host='.
> > $inDomain.';dbname='.$inDBName,
> > $inUser, $inPassword);
> >
> > // set error reporting
> > $this->db->setAttribute(PDO::ATTR_ERRMODE,
> > PDO::ERRMODE_EXCEPTION);
> > }
> > catch (PDOException $e)
> > {
> > print "Error!: " . $e->getMessage() . "";
> > die();
> > }
> > }
> >
> > Here's the utility class so far
> >
> >  > // MySQLDatabase is a DB access class that handles a bunch
> > of stuff
> > like pulling values out of a query
> > // value coersion etc. I've tested this for the last day or
> > so and
> > it seems to be stable.
> > include_once('MySQLDatabase.php');
> >
> > class PMXUtilities
> > {
> > private $db;
> >
> > function __construct()
> > {
> > $domain = 'localhost';
> > $user   = 'root';
> > $password   = '';
> > $db_name= 'pagemanager';
> >
> > $this->db   = new MySQLDatabase
> > ($domain, $user, $password, $db_name);
> > }
> >
> > // if this is called on its own, it works
> > function site_for_pub($inPubID)
> > {
> > $query  = 'select
> > site.id, site.site_name from site, publication
> > where publication.id='.$inPubID.' and publication.site=site.id';
> > $coersions  = array
> > ('id'=> 'integer');
> > $args   = array
> > ('query'=> $query, 'coersions'=> $coersions);
> >
> > $queryResult= $this->db-
> > >query_database($args);
> >
> > if (count($queryResult) > 0)
> > return $queryResult[0]['id'];
> > else
> > return 'Error:
> > PMXUtilities.site_for_pub_id failed while fetching
> > site info for publication:'.$inPubID;
> > }
> >
> > / if this is called on its own, it works
> > function directory_type_id_for_name($inName)
> > {
> > $query  = 'select
> > id from directory_type where name="'.$inName.'"';
> > $coersions  = array
> > ('id'=> 'integer');
> > $args   = array
> > ('query'=> $query, 'coersions'=> $coersions);

[PHP] Which PHP-Editor to use?

2007-08-02 Thread Merlin

Hi there,

I have worked now for several years happily with homesite 4.5, but now 
it looks like I have to switch to another system as homesite will not 
run without admin rights on a XP machine.


What editors do you use? Do you have any recomendations on a special 
one? I have looked into eclipse, but I would hear from your experience 
which one would you recommend me to switch to?


Thank you for any comment.

Best regards,

Merlin

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



RE: [PHP] Setting group sticky bit on directory with chmod()

2007-08-02 Thread Ford, Mike
On 02 August 2007 15:58, Daniel Brown wrote:

> On 8/2/07, Ben Ramsey <[EMAIL PROTECTED]> wrote:
> > I'm trying to set a sticky bit on a directory with chmod(). The same
> > octal value works from the command prompt, but it doesn't appear to
> > work correctly with the PHP function. Anyone have an idea as to why?

[SNIP]

 
> Drop the preceding 0 from the chmod() function parameters.  The
> four-digit octal value is preferred, and the 0 is the first bit to
> show that there's no user- or group-specific execution (su-exec'ing,
> basically) or "stickiness" to the file/directory.  However,
> three-digit values will work.  In either case, five digits will not
> work. 

That's a ridiculous and downright wrong piece of advice.  It may be correct for 
doing it directly in the shell, but in PHP you need the leading 0 to force the 
numbers to octal: 0755 is exactly the same as 00755 and 000755 (etc.), but 
different from plain 755.

> 
> Right:
> chmod 0755 file.php
> chmod 1777 file.php
> chmod('file.php',0755);
> chmod('file.php',1777);

That last statement is the same as:

  chmod('file.php', 03361)

which I don't think will have the desired effect!!

 
> Will almost always work, but isn't entirely correct:

Not even nearly correct:

> chmod 755 file.php
> chmod 644 file.php
> chmod('file.php',755);

... same as: chmod('file.php', 01363);


> chmod('file.php',644);

... same as: chmod('file.php', 01204);

 
> Will never (or at least, SHOULD never) work:

On the contrary, the PHP versions of these are entirely correct -- you *need* 
the leading zeros to make the numeric literals be octal:

> chmod 00755 file.php
> chmod 01777 file.php
> chmod('file.php',00755);
> chmod('file.php',01777);

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730  Fax:  +44 113 812 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP] Which PHP-Editor to use?

2007-08-02 Thread Chris Boget
> I have worked now for several years happily with 
> homesite 4.5, but now it looks like I have to switch 
> to another system as homesite will not run without 
> admin rights on a XP machine.
> What editors do you use? 

I used Homesite for the longest time until I was introduced to Visual
Slick Edit.  It really is an amazing IDE and I've been using it for the
last 3 - 4 years.

http://www.slickedit.com/content/view/73/60/

thnx,
Chris

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



Re: [PHP] Setting group sticky bit on directory with chmod()

2007-08-02 Thread Daniel Brown
Well, you're pleasant today, Mike.

On 8/2/07, Ford, Mike <[EMAIL PROTECTED]> wrote:
> On 02 August 2007 15:58, Daniel Brown wrote:
>
> > On 8/2/07, Ben Ramsey <[EMAIL PROTECTED]> wrote:
> > > I'm trying to set a sticky bit on a directory with chmod(). The same
> > > octal value works from the command prompt, but it doesn't appear to
> > > work correctly with the PHP function. Anyone have an idea as to why?
>
> [SNIP]
>
>
> > Drop the preceding 0 from the chmod() function parameters.  The
> > four-digit octal value is preferred, and the 0 is the first bit to
> > show that there's no user- or group-specific execution (su-exec'ing,
> > basically) or "stickiness" to the file/directory.  However,
> > three-digit values will work.  In either case, five digits will not
> > work.
>
> That's a ridiculous and downright wrong piece of advice.  It may be correct 
> for doing it directly in the shell, but in PHP you need the leading 0 to 
> force the numbers to octal: 0755 is exactly the same as 00755 and 000755 
> (etc.), but different from plain 755.
>
> >
> > Right:
> > chmod 0755 file.php
> > chmod 1777 file.php
> > chmod('file.php',0755);
> > chmod('file.php',1777);
>
> That last statement is the same as:
>
>   chmod('file.php', 03361)
>
> which I don't think will have the desired effect!!
>
>
> > Will almost always work, but isn't entirely correct:
>
> Not even nearly correct:
>
> > chmod 755 file.php
> > chmod 644 file.php
> > chmod('file.php',755);
>
> ... same as: chmod('file.php', 01363);
>
>
> > chmod('file.php',644);
>
> ... same as: chmod('file.php', 01204);
>
>
> > Will never (or at least, SHOULD never) work:
>
> On the contrary, the PHP versions of these are entirely correct -- you *need* 
> the leading zeros to make the numeric literals be octal:
>
> > chmod 00755 file.php
> > chmod 01777 file.php
> > chmod('file.php',00755);
> > chmod('file.php',01777);
>
> Cheers!
>
> Mike
>
> -
> Mike Ford,  Electronic Information Services Adviser,
> JG125, The Headingley Library,
> James Graham Building, Leeds Metropolitan University,
> Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 812 4730  Fax:  +44 113 812 3211
>
>
> To view the terms under which this email is distributed, please go to 
> http://disclaimer.leedsmet.ac.uk/email.htm
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Which PHP-Editor to use?

2007-08-02 Thread Nathan Nobbe
eclipse with php eclipse, but i may be switching to eclipse pdt once it
becomes stable if there is no support for xdebug in php eclipse when it
does.

-nathan

On 8/2/07, Merlin <[EMAIL PROTECTED]> wrote:
>
> Hi there,
>
> I have worked now for several years happily with homesite 4.5, but now
> it looks like I have to switch to another system as homesite will not
> run without admin rights on a XP machine.
>
> What editors do you use? Do you have any recomendations on a special
> one? I have looked into eclipse, but I would hear from your experience
> which one would you recommend me to switch to?
>
> Thank you for any comment.
>
> Best regards,
>
> Merlin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Which PHP-Editor to use?

2007-08-02 Thread tg-php
The age old question... is it that time of the year again already?

Some reviews and lists:
http://www.php-editors.com/


I've used Zend Studio for years, and really like it, but lately I've gotten 
tired of the java virtual machine seeming to hog tons of system resources.

I've also used Crimson Editor for quick and dirty code editing.  Very light 
weight, syntax highlighting, macros, etc.  No code completion or fancy stuff, 
but good for a 'text editor' (not really an IDE).

So in exploring alternatives to Zend Studio, I'm evaluating phpDesigner 2007.   
It's not a nice as Zend, but has a much happier footprint since it's Windows 
native.

I couldn't tell you if it requires admin or not.

An alternative if you want to keep using Homesite (an old favorite of mine too 
from ages ago) is see what it needs admin rights to access and maybe get your 
admin to change the permissions on those files/folders so your non-admin login 
has rights.

-TG



= = = Original message = = =

Hi there,

I have worked now for several years happily with homesite 4.5, but now 
it looks like I have to switch to another system as homesite will not 
run without admin rights on a XP machine.

What editors do you use? Do you have any recomendations on a special 
one? I have looked into eclipse, but I would hear from your experience 
which one would you recommend me to switch to?

Thank you for any comment.

Best regards,

Merlin

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


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



RE: [PHP] Which PHP-Editor to use?

2007-08-02 Thread Sanjeev N
Hi,

I have used both Editplus and Macromedia dreamweaver.

If you want to see the visual the elements then dreamweaver is best.
If you only want the coding environment the I also suggest you to use
editplus

Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com

-Original Message-
From: Merlin [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 02, 2007 9:43 PM
To: php-general@lists.php.net
Subject: [PHP] Which PHP-Editor to use?

Hi there,

I have worked now for several years happily with homesite 4.5, but now 
it looks like I have to switch to another system as homesite will not 
run without admin rights on a XP machine.

What editors do you use? Do you have any recomendations on a special 
one? I have looked into eclipse, but I would hear from your experience 
which one would you recommend me to switch to?

Thank you for any comment.

Best regards,

Merlin

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

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



Re: [PHP] Does PDO prevent class functions from calling other class functions?

2007-08-02 Thread Ken Tozier


On Aug 2, 2007, at 12:19 PM, Nathan Nobbe wrote:


> On 8/2/07, Ken Tozier <[EMAIL PROTECTED]> wrote:
> How would I go about that? I just took a quick look at the try/catch
> documentation and it looks like it's my responsibility to throw
>exceptions which isn't particularly useful if it's PHP itself that is
> doing something unexpected

well, youre not throwing an exception here in your code, your doing  
something called

swallowing the exception.  which is typically not a good practice.

   catch (PDOException $e)
   {
   print "Error!: " . $e->getMessage() . "";
   die();
   }

and you could show us the output from
$e->getMessage()

thats where the script is blowing up.  calling die() after that  
will obviously stop processing

so you have no hope of recovering gracefully.


There is no error. The browser calls the script and paints a blank  
screen. If I do a "view source" same deal, nothing.


Here's the MySQLDatabase "query_database' function that passes the  
actual call to PDO


function query_database($inQuery)
{
$query  = $inQuery;
$coersions  = null;
$object_key = null;
$group_by_key   = null;

if (is_array($inQuery))
{
$query  = $inQuery['query'];
$coersions  = $inQuery['coersions'];
$object_key = $inQuery['object_key'];
$group_by_key   = $inQuery['group_by_key'];
}

try
{
// determine query type
if (strpos($query, 'insert') === false)
{
$rows   = array();
$rowCounter = 0;

foreach ($this->db->query($query, PDO::FETCH_NAMED) as 
$row)
{
$rowFields  = array();
$recordKey  = $rowCounter;

foreach ($row as $key => $value)
{
// remember this key if it matches the 
user specified object key
if (($object_key != null) && ($key == 
$object_key))
$recordKey  = 
$value;

// perform user specified coersions
if ($coersions != null)
$value  = 
$this->coerce_value($value, $coersions[$key]);

$rowFields[$key]
= $value;
}

// perform grouping if requested
if ($group_by_key == null)
$rows[$recordKey]   = 
$rowFields;
else
{
$groupKey   = 
$rowFields[$group_by_key];

if ($rows[$groupKey] == null)
$rows[$groupKey]= 
array();

$rows[$groupKey][]  = 
$rowFields;
}

$rowCounter++;
}

return $rows;
}
else
{
// return last insert ID
return ($this->db->lastInsertId() + 0);
}
}
catch (PDOException $error)
{
print "Error!: " . $error->getMessage() . "";
//die();
}
}

And here's a modified version of the "directory_path_for_pub_id" with  
a try/catch


function directory_path_for_pub_id($inPubID, $inDirType)
{

echo 'entered: directory_path_for_pub_id';

try
{
$site   = $this->site_for_pub_id($inPubID);
echo 'site: '.$site.'';
}
// Tried both of these. Result: blank window/blank "view source'
catch ($e)
catch (Exception $e)
{
print $e.'';
}
}





-nathan
On 8/2/07, Ken Tozier <[EMAIL PROTECTED]> wrote:
On Aug 2, 2007, at 12:03 PM, Nathan Nobbe wrote:

> can you supply an error or warning that php is giving ?
> it would help to determine the problem.

Re: [PHP] Does PDO prevent class functions from calling other class functions?

2007-08-02 Thread Ken Tozier


On Aug 2, 2007, at 12:15 PM, Andrew Ballard wrote:


Ken,

Your method name is site_for_pub, and you are trying to call  
site_for_pub_id.


I am indeed. What a bonehead.

Thanks Andrew that fixed it.

Ken

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



Re: [PHP] Which PHP-Editor to use?

2007-08-02 Thread Tom Ray [Lists]

Merlin wrote:

Hi there,

I have worked now for several years happily with homesite 4.5, but now 
it looks like I have to switch to another system as homesite will not 
run without admin rights on a XP machine.


What editors do you use? Do you have any recomendations on a special 
one? I have looked into eclipse, but I would hear from your experience 
which one would you recommend me to switch to?


Thank you for any comment.

Best regards,

Merlin

I either code in Dreamweaver or straight on the server via SecureCRT and 
use Pico. I really never could get into the other editor programs.


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



Re: [PHP] Does PDO prevent class functions from calling other class functions?

2007-08-02 Thread Andrew Ballard
Ken,

Your method name is site_for_pub, and you are trying to call site_for_pub_id.

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



RE: [PHP] Which PHP-Editor to use?

2007-08-02 Thread Robert Cummings
On Thu, 2007-08-02 at 13:36 -0400, [EMAIL PROTECTED] wrote:
> -Original Message-
> From: Merlin [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, August 02, 2007 12:13 PM
> To: php-general@lists.php.net
> Subject: [PHP] Which PHP-Editor to use?
> 
> Hi there,
> 
> I have worked now for several years happily with homesite 4.5, but now 
> it looks like I have to switch to another system as homesite will not 
> run without admin rights on a XP machine.
> 
> What editors do you use? Do you have any recomendations on a special 
> one? I have looked into eclipse, but I would hear from your experience 
> which one would you recommend me to switch to?
> 
> Personally I use Vi on windows or linux or on windows I use Notepad++.
> 
> Thank you for any comment.

I've said it before and I'll say it again: JOE

http://sourceforge.net/project/showfiles.php?group_id=23475&package_id=16059&release_id=433511

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] Which PHP-Editor to use?

2007-08-02 Thread Richard Heyes
I have worked now for several years happily with homesite 4.5, but now 
it looks like I have to switch to another system as homesite will not 
run without admin rights on a XP machine.


What editors do you use? Do you have any recomendations on a special 
one? I have looked into eclipse, but I would hear from your experience 
which one would you recommend me to switch to?


I used to use Homesite, but it was a buggy POS. Try Scite at 
http://www.scintilla.org.


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



RE: [PHP] Which PHP-Editor to use?

2007-08-02 Thread djnecrogami
-Original Message-
From: Merlin [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 02, 2007 12:13 PM
To: php-general@lists.php.net
Subject: [PHP] Which PHP-Editor to use?

Hi there,

I have worked now for several years happily with homesite 4.5, but now 
it looks like I have to switch to another system as homesite will not 
run without admin rights on a XP machine.

What editors do you use? Do you have any recomendations on a special 
one? I have looked into eclipse, but I would hear from your experience 
which one would you recommend me to switch to?

Personally I use Vi on windows or linux or on windows I use Notepad++.

Thank you for any comment.

Best regards,

Merlin

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

---
Anton C. Swartz IV
Phoenix Edge Network L.L.C. http://www.phpopenid.com - Owner
PHPLogic Development Services http://www.phplogic.net - Co-Owner
Necrogami http://www.necrogami.com - Personal Blog
Based in Indianapolis, IN

"The Opposite of war is not Peace it is Creation."

Don't let sin rule your body. After all, your body is bound to die, so dont
obey its desires or let any part of it become slave to evil. Give yourselves
to God, as people who have been raised from death to life. Make every part
of your body a slavethat pleases God. Don't let sin keep ruling your
lives.You are ruled by God's Kindness and not by the law.
Romans 6:12-14



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.11.2/931 - Release Date: 8/1/2007 4:53 PM

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



Re: [PHP] Cut text from a string

2007-08-02 Thread tedd

At 11:07 AM -0400 8/2/07, Daniel Brown wrote:

To remove the text between the comas would be a great feat,
especially if you're still groggy from waking up from the first one.


LOL!

Thanks for the code. Next time I have a coma, I'll use it.

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



[PHP] PDO::ATTR_TIMEOUT script specific?

2007-08-02 Thread Ken Tozier

Hi

I have a script that needs to get ad information from two different  
sources, a primary and fallback. The primary source is a high traffic  
(and poorly designed/unpartitioned MSSQL database) with millions of  
records that gets locked up when 'certain folks' (ie executives)  
perform large queries. What I'd like to be able to do is set a  
timeout for a query to this database of 5 to 10 seconds and branch to  
the fallback database if the timeout expires.


I can't just use the fallback as my primary as it doesn't always have  
the most up to date info. It's really only for placeholder queries  
until the primary frees up.


So the question is, does setting PDO::ATTR_TIMEOUT affect all scripts  
or just the one that set the variable?


Thanks in advance

Ken

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



Re: [PHP] Does PDO prevent class functions from calling other class functions?

2007-08-02 Thread Andrew Ballard
It's usually the "obvious" things that get you -- especially after
you've been staring at the same piece of code for any length of time.
:)

Andrew

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



[PHP] Numbers, Numbers everywhere! Need some Dollar help.

2007-08-02 Thread Dan Shirah
Greetins all,

In my form I have an area where the user enters in the payment amount:



This is all fine and dandy and works as generically as it can. BUT, the
problem is that I need to make sure the user didn't fat finger any of the
numbers.  For instance, in my generic text field the user types 600 in the
payment amount and clicks submit.

This works and the user is charged $600.  But, come to find out the user
meant to enter 6.00 not 600. Can I add a check using PHP to force the user
to put in the dollar AND cents? This way if a number such as 600 is entered
and the user hits save, the check will notice there isn't a .00 on the end
and prompt the user for more information.

Could I incorporate something like:

if ($payment_amount != number_format($payment_amount, 2)) {
  error here
}

Or, do you think I would be better off using two text areas?  One for the
dollar value and one for the cents?

Or, do you think I would be better off trying to find some kind of
javascript function that would check the value upon submit?

Any help is appreciated.

Dan


Re: [PHP] Numbers, Numbers everywhere! Need some Dollar help.

2007-08-02 Thread Brad Bonkoski

Dan Shirah wrote:

Greetins all,

In my form I have an area where the user enters in the payment amount:



This is all fine and dandy and works as generically as it can. BUT, the
problem is that I need to make sure the user didn't fat finger any of the
numbers.  For instance, in my generic text field the user types 600 in the
payment amount and clicks submit.

This works and the user is charged $600.  But, come to find out the user
meant to enter 6.00 not 600. Can I add a check using PHP to force the user
to put in the dollar AND cents? This way if a number such as 600 is entered
and the user hits save, the check will notice there isn't a .00 on the end
and prompt the user for more information.

Could I incorporate something like:

if ($payment_amount != number_format($payment_amount, 2)) {
  error here
}

Or, do you think I would be better off using two text areas?  One for the
dollar value and one for the cents?

Or, do you think I would be better off trying to find some kind of
javascript function that would check the value upon submit?

Any help is appreciated.

Dan

  
If you want it squarely on the client side, then use javascript.  There 
are easy functions to split a text string (like php's explode).
Then you can split on the '.' and then do some logical stuff like the 
cents is between 00 and 99, and anything else you think necessary.
If there are no cents, then you can issue a confirmation box.  So, my 
vote is to handle it within javascript, as it should not be too difficult.

-B

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



Re: [PHP] Numbers, Numbers everywhere! Need some Dollar help.

2007-08-02 Thread Daniel Brown
On 8/2/07, Dan Shirah <[EMAIL PROTECTED]> wrote:
> Greetins all,
>
> In my form I have an area where the user enters in the payment amount:
>
> 
>
> This is all fine and dandy and works as generically as it can. BUT, the
> problem is that I need to make sure the user didn't fat finger any of the
> numbers.  For instance, in my generic text field the user types 600 in the
> payment amount and clicks submit.
>
> This works and the user is charged $600.  But, come to find out the user
> meant to enter 6.00 not 600. Can I add a check using PHP to force the user
> to put in the dollar AND cents? This way if a number such as 600 is entered
> and the user hits save, the check will notice there isn't a .00 on the end
> and prompt the user for more information.
>
> Could I incorporate something like:
>
> if ($payment_amount != number_format($payment_amount, 2)) {
>   error here
> }
>
> Or, do you think I would be better off using two text areas?  One for the
> dollar value and one for the cents?
>
> Or, do you think I would be better off trying to find some kind of
> javascript function that would check the value upon submit?
>
> Any help is appreciated.
>
> Dan
>

"woot woot"

That's all really a matter of preference, Dan.  You could even
just check to ensure that there's a period in there, and if not, emit
an error message that the user is required to enter the full amount in
dollars and cents.

".$err[$i]."\n";
}
?>






-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Numbers, Numbers everywhere! Need some Dollar help.

2007-08-02 Thread Eric Butera
On 8/2/07, Dan Shirah <[EMAIL PROTECTED]> wrote:
> Greetins all,
>
> In my form I have an area where the user enters in the payment amount:
>
> 
>
> This is all fine and dandy and works as generically as it can. BUT, the
> problem is that I need to make sure the user didn't fat finger any of the
> numbers.  For instance, in my generic text field the user types 600 in the
> payment amount and clicks submit.
>
> This works and the user is charged $600.  But, come to find out the user
> meant to enter 6.00 not 600. Can I add a check using PHP to force the user
> to put in the dollar AND cents? This way if a number such as 600 is entered
> and the user hits save, the check will notice there isn't a .00 on the end
> and prompt the user for more information.
>
> Could I incorporate something like:
>
> if ($payment_amount != number_format($payment_amount, 2)) {
>   error here
> }
>
> Or, do you think I would be better off using two text areas?  One for the
> dollar value and one for the cents?
>
> Or, do you think I would be better off trying to find some kind of
> javascript function that would check the value upon submit?
>
> Any help is appreciated.
>
> Dan
>

But what if they type in 600.00?  I understand your logic, but you
can't really save users from themselves.  You can put a notice on
there that says check your price field, but I'm sure the same person
who ignored what they typed in the first time will ignore any hurdles
you stick in front of them until the form submits.

I'm not sure exactly what your form is for, but perhaps you could do a
select dropdown with a few standard rates and then an input for other
amount.  That might help if this is a common issue.

Good luck.

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



Re: [PHP] Numbers, Numbers everywhere! Need some Dollar help.

2007-08-02 Thread David Giragosian
On 8/2/07, Brad Bonkoski <[EMAIL PROTECTED]> wrote:
>
> Dan Shirah wrote:
> > Greetins all,
> >
> > In my form I have an area where the user enters in the payment amount:
> >
> >  name="payment_amount">
> >
> > This is all fine and dandy and works as generically as it can. BUT, the
> > problem is that I need to make sure the user didn't fat finger any of
> the
> > numbers.  For instance, in my generic text field the user types 600 in
> the
> > payment amount and clicks submit.
> >
> > This works and the user is charged $600.  But, come to find out the user
> > meant to enter 6.00 not 600. Can I add a check using PHP to force the
> user
> > to put in the dollar AND cents? This way if a number such as 600 is
> entered
> > and the user hits save, the check will notice there isn't a .00 on the
> end
> > and prompt the user for more information.
> >
> > Could I incorporate something like:
> >
> > if ($payment_amount != number_format($payment_amount, 2)) {
> >   error here
> > }
> >
> > Or, do you think I would be better off using two text areas?  One for
> the
> > dollar value and one for the cents?
> >
> > Or, do you think I would be better off trying to find some kind of
> > javascript function that would check the value upon submit?
> >
> > Any help is appreciated.
> >
> > Dan
> >
> >
> If you want it squarely on the client side, then use javascript.  There
> are easy functions to split a text string (like php's explode).
> Then you can split on the '.' and then do some logical stuff like the
> cents is between 00 and 99, and anything else you think necessary.
> If there are no cents, then you can issue a confirmation box.  So, my
> vote is to handle it within javascript, as it should not be too difficult.
> -B


No ecommerce site I've ever used allowed me to manually enter in what I
owed. I clicked, checked, or somehow selected a product to buy and
everything was calculated behind the scenes and displayed. If you must allow
this behavior, I'd opt for perhaps somewhat unappealing select boxes for all
numerical input, one per field. As Ron White jokes, "You can't fix stupid",
and if you don't expect your users to be stupid, they will surprise you
every time.

Just MHO,

David


Re: [PHP] Cut text from a string

2007-08-02 Thread Don Don
I meant i want to get rid of the braces. e.g. get the text up to the start of 
the first brace and ignore anything from the first brace onwards

Dan Shirah <[EMAIL PROTECTED]> wrote: Maybe I'm blind, but I don't see any 
commas in the text you are referring
to.

On 8/2/07, Don Don 
 wrote:
>
> hi all, am trying to cut some texts from a serries of string values e.g.
>
> "this is how  we do (50 cents feat. the game)"
> "give it to me (nelly feat timerland)"
> "let me hold you (bow wow feat omarion)"
>
> i want to cut off the text between the comas and i've seen some examples
>
> > $string = "Hello world, this is a test";
> preg_match('/.*<\/b>/i', $string, $result);
> echo strip_tags($result[0]);
> ?>
>
> > $string = "Hello world, this is a test";
> list($junk, $good) = split('', $string);
> list($good, $junk) = split('', $good);
> echo $good;
> ?>
>
> but they wont work with comas
>
>
> -
> Yahoo! oneSearch: Finally,  mobile search that gives answers, not web
> links.



   
-
Be a better Heartthrob. Get better relationship answers from someone who knows.
Yahoo! Answers - Check it out. 

[PHP] Separation of Roles; with Salaries

2007-08-02 Thread Instruct ICC

Finally I have the green light to get some separation of roles/duties.

First there was just me.  "Web Programmer", yet all web related hats.
Then there was the "Server Administrator", and me, the "Web Developer" (sort 
of like peers).  Although the admin doesn't like to change the server 
settings with recompiles, etc.
Now there is also a "Project Manager" (over both of us) that is still 
studying project management in school and hasn't programmed in years.  And 
is a joke when it come to getting requirements.  But at least I'm grooming 
him to take on gathering requirements while I code.


How do you recommend duties be separated if we can add more staff?  The US 
Salary post (which I did not want to hijack) listed many tasks, but how 
specialized can the duties be reduced?


Originally my thoughts were for 2 positions to report to me:
Presentation/GUI/Designer (let's say Web Designer)
Web Programmer
But these 2 will probably be direct reports to the "Project Manager".

Even if I continue as Architect and Developer (according to Sun Java 
certification definitions), the Web Programming part would still be PHP, 
Perl, *NIX, MySQL, MSSQL, Javascript, HTML, CSS, Ajax, JSON, Security, 
Testing, Version Control, and possibly Java.  Did I miss anything?


Can I really have a PHP Programmer who doesn't do Javascript, Ajax, and 
JSON?  (With the intent to low-ball the salaries so we can have 2 more 
bodies).  I suppose the Web Designer can do the HTML and CSS, and the Web 
Programmer can just use certain CSS selectors defined by the Web Designer?


I still feel like I'll be doing all the above except html and css.

How should we separate the roles?
And what should their salaries be?

Please advise.

_
Find a local pizza place, movie theater, and moreĀ….then map the best route! 
http://maps.live.com/default.aspx?v=2&ss=yp.bars~yp.pizza~yp.movie%20theater&cp=42.358996~-71.056691&style=r&lvl=13&tilt=-90&dir=0&alt=-1000&scene=950607&encType=1&FORM=MGAC01


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



Re: [PHP] Cut text from a string

2007-08-02 Thread Daniel Brown
On 8/2/07, Don Don <[EMAIL PROTECTED]> wrote:
> I meant i want to get rid of the braces. e.g. get the text up to the start of 
> the first brace and ignore anything from the first brace onwards
>
> Dan Shirah <[EMAIL PROTECTED]> wrote: Maybe I'm blind, but I don't see any 
> commas in the text you are referring
> to.
>
> On 8/2/07, Don Don
>  wrote:
> >
> > hi all, am trying to cut some texts from a serries of string values e.g.
> >
> > "this is how  we do (50 cents feat. the game)"
> > "give it to me (nelly feat timerland)"
> > "let me hold you (bow wow feat omarion)"
> >
> > i want to cut off the text between the comas and i've seen some examples
> >
> > > $string = "Hello world, this is a test";
> > preg_match('/.*<\/b>/i', $string, $result);
> > echo strip_tags($result[0]);
> > ?>
> >
> > > $string = "Hello world, this is a test";
> > list($junk, $good) = split('', $string);
> > list($good, $junk) = split('', $good);
> > echo $good;
> > ?>
> >
> > but they wont work with comas
> >
> >
> > -
> > Yahoo! oneSearch: Finally,  mobile search that gives answers, not web
> > links.
>
>
>
>
> -
> Be a better Heartthrob. Get better relationship answers from someone who 
> knows.
> Yahoo! Answers - Check it out.



The example I sent you should work.

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



[PHP] Re: Which PHP-Editor to use?

2007-08-02 Thread Al

phpEdit  http://www.waterproof.fr/products/PHPEdit/

Merlin wrote:

Hi there,

I have worked now for several years happily with homesite 4.5, but now 
it looks like I have to switch to another system as homesite will not 
run without admin rights on a XP machine.


What editors do you use? Do you have any recomendations on a special 
one? I have looked into eclipse, but I would hear from your experience 
which one would you recommend me to switch to?


Thank you for any comment.

Best regards,

Merlin


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



RE: [PHP] Re: Which PHP-Editor to use?

2007-08-02 Thread Chris Aitken
I know I've been away from this list for years and have missed the several
reincarnations of this thread over time, but has anyone ever used a kickass
little program called Notepad2?

I discovered this about 2 years ago and it's the most brilliant little
application I've ever found. Sure, it doesn't have the niceties like
multi-file search & replace (which can be handy when you get a job to fix
someone elses website and they don't use a PHP shell for the HTML code
instead have all the HTML code in every file).

Notepad2 is just this little app which has things like language specific
colour coding, line numbering, tab indentation support, and its just SO
small, memory-unintensive, and a pleasure to use. I have tried so many
different types over the years always get sick of the bloat and the shit
that's put into programs like dreamweaver, smartedit etc that I cant stand
using it.

I love being able to fire off a quick little notepad2 editor from my FTP
program, make the changes, save it, close it and upload it. Brilliant
system.


-Original Message-
From: Al [mailto:[EMAIL PROTECTED] 
Sent: Friday, 3 August 2007 6:56 AM
To: php-general@lists.php.net
Subject: [PHP] Re: Which PHP-Editor to use?

phpEdit  http://www.waterproof.fr/products/PHPEdit/

Merlin wrote:
> Hi there,
> 
> I have worked now for several years happily with homesite 4.5, but now 
> it looks like I have to switch to another system as homesite will not 
> run without admin rights on a XP machine.
> 
> What editors do you use? Do you have any recomendations on a special 
> one? I have looked into eclipse, but I would hear from your experience 
> which one would you recommend me to switch to?
> 
> Thank you for any comment.
> 
> Best regards,
> 
> Merlin

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



__ NOD32 2433 (20070802) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



[PHP] php install problem

2007-08-02 Thread David McDivitt
I hate to ask a simple question, but I have two issues installing PHP. I have 
XP SP 2 with IIS. When I ran the install php-5.2.3-win32-installer.msi, it said 
it could not access "httpd.config" and I would have to configure the web server 
manually. I could not find anything on the internet containing the error 
message. I get the same error when installing IIS API and IIS CGI. The other 
problem I have is when I attempt to display a page containing PHP, the browser 
displays an error. The error I was getting said "PHP has encountered an Access 
Violation". Now it's changed and says "No input file specified." Weird. If 
someone could shed light I'd appreciate it. Thanks

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



Re: [PHP] Numbers, Numbers everywhere! Need some Dollar help.

2007-08-02 Thread Tijnema
On 8/2/07, Brad Bonkoski <[EMAIL PROTECTED]> wrote:
> Dan Shirah wrote:
> > Greetins all,
> >
> > In my form I have an area where the user enters in the payment amount:
> >
> > 
> >
> > This is all fine and dandy and works as generically as it can. BUT, the
> > problem is that I need to make sure the user didn't fat finger any of the
> > numbers.  For instance, in my generic text field the user types 600 in the
> > payment amount and clicks submit.
> >
> > This works and the user is charged $600.  But, come to find out the user
> > meant to enter 6.00 not 600. Can I add a check using PHP to force the user
> > to put in the dollar AND cents? This way if a number such as 600 is entered
> > and the user hits save, the check will notice there isn't a .00 on the end
> > and prompt the user for more information.
> >
> > Could I incorporate something like:
> >
> > if ($payment_amount != number_format($payment_amount, 2)) {
> >   error here
> > }
> >
> > Or, do you think I would be better off using two text areas?  One for the
> > dollar value and one for the cents?
> >
> > Or, do you think I would be better off trying to find some kind of
> > javascript function that would check the value upon submit?
> >
> > Any help is appreciated.
> >
> > Dan
> >
> >
> If you want it squarely on the client side, then use javascript.  There
> are easy functions to split a text string (like php's explode).
> Then you can split on the '.' and then do some logical stuff like the
> cents is between 00 and 99, and anything else you think necessary.
> If there are no cents, then you can issue a confirmation box.  So, my
> vote is to handle it within javascript, as it should not be too difficult.
> -B

What about the european format? Like this:
$1.234.567,89

Tijnema

-- 
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

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



Re: [PHP] [pcre] backreferences to all matches of a repeated subexpression

2007-08-02 Thread Steffen Ebermann
On Wed, Aug 01, 2007 at 08:05:09PM -0700, Jack Bates wrote:
> I'm not sure how to get an array of all subexpression matches, in the
> order matches appear in the subject, instead of the order expressions
> appear in the pattern.

This problem gave me a headache. My only idea is to use preg_split()
instead.

  

Seems to work as intended. Hope I could help.

Regards
  Steffen

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



Re: [PHP] Cut text from a string

2007-08-02 Thread "Crash" Dummy
> I meant i want to get rid of the braces. e.g. get the text up to the start
> of the first brace and ignore anything from the first brace onwards

I don't see any braces, either. For the record:

brace = {}
bracket = []
parentheses = ()
comma = ,
semicolon = ;

To extract the partial string leading to the first parentheses:

$var="this is how  we do (50 cents feat. the game)";

$stringpart = substr($var,0,strpos($var,"("));
-- 
Crash

Please reply to the group. E-mail is blocked.

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



Re: [PHP] Which PHP-Editor to use?

2007-08-02 Thread Tijnema
On 8/2/07, Merlin <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I have worked now for several years happily with homesite 4.5, but now
> it looks like I have to switch to another system as homesite will not
> run without admin rights on a XP machine.
>
> What editors do you use? Do you have any recomendations on a special
> one? I have looked into eclipse, but I would hear from your experience
> which one would you recommend me to switch to?
>
> Thank you for any comment.
>
> Best regards,
>
> Merlin
>

All about personal preference, I use Adobe (Macromedia) Dreamweaver
CS3, and I really like the server interface through FTP. It allows me
to easily switch between my different sites around the world :)
Apart from that, color coding is good, and supports auto tabbing :)

Tijnema

-- 
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

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



Re: [PHP] How can I get a list of object vars?

2007-08-02 Thread js
 Thank you, it worked, but it contains some dust.
Is it possible to remove  the  dust?

more_var = 'val';

foreach ((array)$obj as $k => $v)
  echo "$k = $v\n";
?>

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



Re: [PHP] Numbers, Numbers everywhere! Need some Dollar help.

2007-08-02 Thread M. Sokolewicz

Tijnema wrote:

On 8/2/07, Brad Bonkoski <[EMAIL PROTECTED]> wrote:

Dan Shirah wrote:

Greetins all,

In my form I have an area where the user enters in the payment amount:



This is all fine and dandy and works as generically as it can. BUT, the
problem is that I need to make sure the user didn't fat finger any of the
numbers.  For instance, in my generic text field the user types 600 in the
payment amount and clicks submit.

This works and the user is charged $600.  But, come to find out the user
meant to enter 6.00 not 600. Can I add a check using PHP to force the user
to put in the dollar AND cents? This way if a number such as 600 is entered
and the user hits save, the check will notice there isn't a .00 on the end
and prompt the user for more information.

Could I incorporate something like:

if ($payment_amount != number_format($payment_amount, 2)) {
  error here
}

Or, do you think I would be better off using two text areas?  One for the
dollar value and one for the cents?

Or, do you think I would be better off trying to find some kind of
javascript function that would check the value upon submit?

Any help is appreciated.

Dan



If you want it squarely on the client side, then use javascript.  There
are easy functions to split a text string (like php's explode).
Then you can split on the '.' and then do some logical stuff like the
cents is between 00 and 99, and anything else you think necessary.
If there are no cents, then you can issue a confirmation box.  So, my
vote is to handle it within javascript, as it should not be too difficult.
-B


What about the european format? Like this:
$1.234.567,89

Tijnema



Most people from the US don't understand that most of the world uses 
different ways of denoting currency, dates, etc, so this is a very valid 
point!


Now, as mentioned before: You have to decide for yourself if your 
application is the correct place to check for the stupidity of your 
users. If and only IF you decide you want to second-guess your users (I 
wouldn't usually, but it's up to you really), then you have the choice 
of where and when to do it. Assuming you want to do it around the 
submitting of the form, you have 3 choices:
1. client-side via a client-side language like 
J(ava)Script(/ECMAScript), VBScript, etc.

2. server-side via AJAX
3. server-side in PHP

All of these have their advantages and disadvantages.
Advantages:
1. (client-side) Easy to make, if the code decides the user might have 
made a mistake, the user can just change it and try again.
2. (AJAX) very complex checks can be performed easily against a lot of 
data stored already. Though this is usually not required.

3. (server-side) same as with AJAX.

Disadvantages:
1. You need to remember that your form should work with J(ava)Script (or 
any such language) turned OFF.
2. You need to do quite a lot of (usually useless) work, coding a 
complex and probably over-the-top check for something very simple.
3. If the user might have made a mistake, you need to make sure that the 
user does not have to fill _all_ fields again, and that state is preserved.


Personally, IF I would've chosen to check what the user did on such a 
thing, I'd do it via JavaScript, and later would perform sanity-checks 
on it via PHP (ie. is the number > 0.00 and less than some insane 
max_number (eg. < 500)).


- Tul

P.S. Always remember non-US users, there's few things more annoying than 
 being forced to use a format you are not familiair with using (ie. if 
I am forced insert a date formatted like month/day/year, I usually don't 
bother and leave the site).


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



[PHP] About PHP/MYSQL Pagination

2007-08-02 Thread Kelvin Park
I just couldn't find it anywhere, google or yahoo. I know how to make 
first, previous, last, and next links for php/mysql pagination. How do 
you list page numbers in the middle, between previous and next? (ex. << 
first previous | 1 2 3 4 5 | next last >> )


I know how to display them from 1 to whatever by using for loop, but the 
problem comes in when I click "next" from page "5", it does not get 
re-listed starting from page "6".


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



[PHP] Re: About PHP/MYSQL Pagination

2007-08-02 Thread Kelvin Park

Kelvin Park wrote:
I just couldn't find it anywhere, google or yahoo. I know how to make 
first, previous, last, and next links for php/mysql pagination. How do 
you list page numbers in the middle, between previous and next? (ex. 
<< first previous | 1 2 3 4 5 | next last >> )


I know how to display them from 1 to whatever by using for loop, but 
the problem comes in when I click "next" from page "5", it does not 
get re-listed starting from page "6".



nevermind, I figured it out. didn't know it was quite easy

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



Re: [PHP] How can I get a list of object vars?

2007-08-02 Thread Nathan Nobbe
i think you misunderstood me; i was recommending you NOT use the array cast
of an object to accomplish your task.
rather, i would advise you spend time learning the reflection API because
its designed for retrieval of information about
classes and functions, etc..
apparently the array cast method does show you the public members of the
class.  it does not accurately show the private
members though.  if you look at the output of what you sent, you will see
the name of the object, Obj, i prepended to the
name of the private data members.
there are other drawbacks to simply casting the object as an array and
trying to iterate over the array contents.  some of
these are,
 - you loose the ability to determine the access specifier of the current
member
 - you cannot analyze class methods

i dont know what exactly youre trying to do, but xml may not be a bad
choice, you should weigh the work it will take to
understand and utilize the reflection api against it after you experiment w/
the reflection api more.

-nathan

On 8/2/07, js <[EMAIL PROTECTED]> wrote:
>
> Thank you, it worked, but it contains some dust.
> Is it possible to remove  the  dust?
>
>  class Obj {
> private $priv;
> public $pub;
> protected $prot = 'foo';
> }
> $obj = new Obj();
> $obj->more_var = 'val';
>
> foreach ((array)$obj as $k => $v)
>   echo "$k = $v\n";
> ?>
>


[PHP] UTF-8 support

2007-08-02 Thread Naz Gassiep
The functions trim() and explode() appear to be munging multibyte UTF-8 
strings. I can't find multibyte safe versions of them in the manual, do 
they exist, or do I have to make my own?

- Naz.

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



Re: [PHP] Which PHP-Editor to use?

2007-08-02 Thread Naz Gassiep

Merlin wrote:

Hi there,

I have worked now for several years happily with homesite 4.5, but now 
it looks like I have to switch to another system as homesite will not 
run without admin rights on a XP machine.


What editors do you use? Do you have any recomendations on a special 
one? I have looked into eclipse, but I would hear from your experience 
which one would you recommend me to switch to?


Only replying because nobody has mentioned it yet:
UltraEdit and it's sister app, UEStudio. Both are outstanding, I'm using 
UEStudio now. I've tried a few other ones mentioned here, and UEStudio 
has it all, including the crucial (for me) direct editing of files over 
FTP/SFTP.


Auto-reopening of all files when the app restarts and positioning the 
windows where you want them saves lots of time when you're working on 
large scale apps too. When you're a pixel positioning pedant like me, 
oepning 20 files at the start of a coding session can be a pain.


Regards,
- Naz.

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



[PHP] function -> action

2007-08-02 Thread Ralph Kutschera
Hallo!

  I'm working on a project, where we distinguish between "functions" and
"actions" in design, although in PHP both are implemented as functions.
Is there a chance that PHP can use the word "action" as "function"?

E.g.:
public function doSomething() {  }
public action doSomethingElse() { ... }

... is actually the same but would help to see the design also in the code.

TIA, Ralph

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