This topic is locked

showing only own records with code

10/30/2008 4:48:12 PM
PHPRunner General questions
C
cartman author

hello,

i want to change the security option for the List page, from "view all records, edit own records" to "view and edit only own records" when user clicks to a button.

but i dont want to build project again, i made lots of customization, i want to do it with coding.

How can i change the security option for the page with coding?

what i want to do is to put a "Show Only My Own Records" button, near of the "Show All Records" button...

J
Jane 10/31/2008

Hi,
you can add custom button on the page (generated templates/..._list.htm file).

Here is a sample:

<input type=button class=button value=Button1 onclick="TableName_list.php?showrecords=own">


Then add new List page: Before SQL query event in the generated include/..._events.php file.

Here is a sample:

function BeforeQueryList(&$strSQL,&$strWhereClause,&$strOrderBy)

{

global $strTableName;

if (@$_REQUEST["showrecords"]=="own")

$strWhereClause = whereAdd($strWhereClause,"OwnerIDField=".$SESSION["".$strTableName."_OwnerID"]);

} // function BeforeQueryList

C
cartman author 10/31/2008

Hi,

you can add custom button on the page (generated templates/..._list.htm file).

Here is a sample:
Then add new List page: Before SQL query event in the generated include/..._events.php file.

Here is a sample:


thank you very much jane <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=34627&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />