RE: [PHP] error handling

2005-04-13 Thread Stephen March
Personally, I create a custom error handler for all my apps (currently 4.3.*
compliant).  While I normally use Smarty and have separate error templates,
here is a quick example.

function errorHandler($errno, $errstr, $errfile, $errline )
{
print Error #: $errno br/Error Message: $error_Message;
}  

set_error_handler(errorHandler);

call_some_pgsql_function();


-Original Message-
From: Cima [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 12, 2005 11:46 PM
To: php
Subject: [PHP] error handling

hi,

im working with php 4 and postgresql 8 and i would like to know how to
handle certain errors generated. in postgresql,  i've written a stored
function that selects a record from a table and in case no record is found i
'raise an exception'. fine, now in my php script  i call that the stored
function which works properly when there is a record but when the record
doesnt exist, i would like to be able to place my own error message and not
e.g  'fatal error, .'. how do i capture(in php)  the exception i raised
in postgres so that i know the record doesnt exist?


thanx.

-- 
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] User Management

2005-04-13 Thread Stephen March
This is one of the many reasons I've been using Fusebox for the past few
years.  http://www.fusebox.org

It's an open sourced framework that provides you with an interesting way to
do includes, to break your application out into MVC (Model View Controller)
and allows you to provide a better granular security. You then control the
users permissions to a series of circuits and fuses (much like folders and
functions) - rather than to specific code pages.

For my purposes I find it more beneficial to diagram out my UML Use Cases (A
user will do 'x', whereas an administrator will do 'y').  Eventually you
will need a mechanism to store that information - whether it be a MySQL
table or a directory server accessible via LDAP.

I generally try to develop a table for roles (or groups), for users,
permissions.  Assign the permissions to the roles, and assign a user to
role.

I haven't found an easy solution per-se, but this is effective for me.

Cheers,
~Stephen March, CIS, BSc



-Original Message-
From: Dasmeet Singh [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 13, 2005 4:15 AM
To: php-general@lists.php.net; [EMAIL PROTECTED]
Subject: Re: [PHP] User Management

Thanks..

And how to manage user and their permissions.. should I store each page 
name in a table and then store permissions of each and every user to 
individual pages in another table?

Is there any other way to do this?


[EMAIL PROTECTED] wrote:

 
 use an include file at the top of each page.
 in this include file you will check to see whether that user has access 
 to see that page, if they dont then just redirect to the main menu page 
 or an error page.
 
 hope this helps
 
 Angelo Zanetti
 Z Logic
 
 www.zlogic.co.za
 
 
 This message was sent using IMP, the Internet Messaging Program.

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