|
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
[Back to original message]
|