Access Control with PHP and MySQL

Hi,

I'm new to PHP and MySQL, and need to implement an access control
system similar to many web retailers:

The database will track jobs, so a person needs to be able to enter a
new job onto the database. That job will be allocated at the entry
stage to an engineer.

What I need is for only the person entering the job and the engineer to
be able to see that particular job. i.e. each of them sees only the
jobs relevant to them.

Can anyone give me any suggestions about how this might be implemented
with PHP and MySQL? I'm very happy to go and learn the details if
someone can give me an outline of how this can be achieved.

Thanks,

Neil
neil.mcdonald [ Mi, 17 Januar 2007 12:37 ] [ ID #1598883 ]

Re: Access Control with PHP and MySQL

neil.mcdonald [at] blueyonder.co.uk wrote:
> Hi,
>
> I'm new to PHP and MySQL, and need to implement an access control
> system similar to many web retailers:
>
> The database will track jobs, so a person needs to be able to enter a
> new job onto the database. That job will be allocated at the entry
> stage to an engineer.
>
> What I need is for only the person entering the job and the engineer to
> be able to see that particular job. i.e. each of them sees only the
> jobs relevant to them.
>
> Can anyone give me any suggestions about how this might be implemented
> with PHP and MySQL? I'm very happy to go and learn the details if
> someone can give me an outline of how this can be achieved.

You add a column for the user who enter the job and one for the engineer, when
checking to show the data, you compare if the user logged in is one of them

$query="SELECT * FROM yourtable WHERE (job_inscriber='$userloggedin' OR
engineer='$userloggedin') AND job_id='$jobid_searched'";

That query would prevent anyone else than the engineer and the user who filed
the job from seeing it, of course this require you to have a login system.


--

//Aho
Shion [ Mi, 17 Januar 2007 12:54 ] [ ID #1598884 ]

Re: Access Control with PHP and MySQL

neil.mcdonald [at] blueyonder.co.uk wrote:
> Hi,
>
> I'm new to PHP and MySQL, and need to implement an access control
> system similar to many web retailers:
>
> The database will track jobs, so a person needs to be able to enter a
> new job onto the database. That job will be allocated at the entry
> stage to an engineer.
>
> What I need is for only the person entering the job and the engineer to
> be able to see that particular job. i.e. each of them sees only the
> jobs relevant to them.
>
> Can anyone give me any suggestions about how this might be implemented
> with PHP and MySQL? I'm very happy to go and learn the details if
> someone can give me an outline of how this can be achieved.

If you're new, you probably don't want to roll your own. PHP has
built-in sessions, but that won't be enough. You should probably check
out this: http://pear.php.net/packages.php?catpid=1&catname=Authentica tion
Paul Bramscher [ Mi, 17 Januar 2007 18:43 ] [ ID #1598898 ]

Re: Access Control with PHP and MySQL

neil.mcdonald [at] blueyonder.co.uk wrote:
> Hi,
>
> I'm new to PHP and MySQL, and need to implement an access control
> system similar to many web retailers:
>
> The database will track jobs, so a person needs to be able to enter a
> new job onto the database. That job will be allocated at the entry
> stage to an engineer.
>
> What I need is for only the person entering the job and the engineer to
> be able to see that particular job. i.e. each of them sees only the
> jobs relevant to them.
>
> Can anyone give me any suggestions about how this might be implemented
> with PHP and MySQL? I'm very happy to go and learn the details if
> someone can give me an outline of how this can be achieved.

You add a column for the user who enter the job and one for the engineer, when
checking to show the data, you compare if the user logged in is one of them

$query="SELECT * FROM yourtable WHERE (job_inscriber='$userloggedin' OR
engineer='$userloggedin') AND job_id='$jobid_searched'";

That query would prevent anyone else than the engineer and the user who filed
the job from seeing it, of course this require you to have a login system.


--

//Aho
Shion [ Mi, 17 Januar 2007 12:54 ] [ ID #1598927 ]
PHP » alt.php » Access Control with PHP and MySQL

Vorheriges Thema: Merging two sql databases
Nächstes Thema: Re: Pingy: Spacey Gurl