You are here: Re: Access Control with PHP and MySQL « PHP SQL « IT news, forums, messages
Re: Access Control with PHP and MySQL

Posted by J.O. Aho on 01/17/07 11:54

neil.mcdonald@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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация