Platon Technologies
neprihlásený Prihlásiť Registrácia
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Utorok, 16. júl 2024
O nás
Otvorený softvér
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Filter Attribute and Hidden Value

phpMyEdit Configuration     Filter Attribute and Hidden Value
Odoslať novú tému   Odpovedať na tému    
wpatch     Založený: 21.09.2010   Príspevky: 2  
Príspevok Zaslal: 2010-09-21 21:09
Návrat hore  Odpovedať s citátom     

All first off thanks for phpmyedit. A) Great code, but B) great online documentation.

Problem 1

Filter based on logged in user ID

Table that I am editing includes user_id. I want user x to only see user x's entries, not user y's

Here is what I found out there...but seems to not work.(user_id is both in the table in question and a separate table users)


$opts['filters'] = 'user_id = "'.$user_id.'" OR user_id = "public"';

$opts['cgi']['persist'] = array('user_id' => $user_id );

Problem 2 I want to then add user_id when a user adds a new entry.

Now normally I would just add a hidden value of user id, then during the normal insert portion of the script add $user_id....but so far inside the phpmyedit code I am a bit lost.

Thanks in advance for any help!


doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2010-09-22 14:53
Návrat hore  Odpovedať s citátom     

Another example can be found at

Use the forum's search feature to look for the words: persist user

wpatch     Založený: 21.09.2010   Príspevky: 2  
Príspevok Zaslal: 2010-09-22 17:40
Návrat hore  Odpovedať s citátom     

Think I have the filtering problem all sorted....thanks to Doug's help!

Where I am stuck now is user_id isn't being recognized from login/cookie side to the form/phpmyedit side.

Think what I need to do is either a:

set user_id persistent from the login script....not sure it will pass through the php open/close

or b:

Parse the from table users to make persistent in the display code.

I have included a pastebin to help illustrate. It will be persistent for a month:-)

Thanks in advance:-P


doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2010-09-23 02:16
Návrat hore  Odpovedať s citátom     

Cookies and login issues are beyond the scope of phpMyEdit. Many good (and bad) examples exist elsewhere, including

Cookies are easily forged, thus my hope the secured data is not terribly important should it leak out to unauthorized individuals.

Lacking time to study the posted code in great detail, I did note that
$check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());

is rather insecure and should include a check to make sure $username is not empty. Further, since relying on non-local variables, using sprintf() to create the query string subsequently fed to mysql_query() is generally more secure.

danverseak2     Založený: 07.09.2022   Príspevky: 72  
Príspevok Zaslal: 2023-01-06 02:28
Návrat hore  Odpovedať s citátom     

Are your truck’s brakes feeling less than ideal? You’re likely expecting more stopping power from them, and rightly so.

Calgary Mobile Truck Repair

Hatell1974     Založený: 23.04.2022   Príspevky: 240  
Príspevok Zaslal: 2023-02-09 12:32
Návrat hore  Odpovedať s citátom     

A filter attribute is a data field that is used for filtering records. Just like the name suggests, it helps the user to filter data based on various criteria. In other words, when combined with filters, these attributes help users to further refine their searches. Get here and learn more new things for concrete layers. While there's no way to deny that these attributes come in handy when searching for specific items on websites, we often forget about them and simply use search operators in our queries.

denisbeta     Založený: 25.08.2023   Príspevky: 2205  
Príspevok Zaslal: 2024-05-12 06:44
Návrat hore  Odpovedať s citátom


Dermo pro

Hydroserum [CL]

Urotrin Slovakia


Wirex [LV]

Dialine [BO]


Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov