Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, March 29, 2024
About Us
O nás
Magazine
Magazín
Open Source
Otvorený softvér
CVS
CVS
Services
Služby
Index  »  Projects  »  phpMyEdit  »  Forum  »  Authenticating/Returning only Values for that sessions ID

phpMyEdit Configuration     Authenticating/Returning only Values for that sessions ID
Post new topic   Reply to topic    
 
tyler     Joined: 30 Aug 2010   Posts: 2  
Post Posted: 2010-08-30 05:07
Back to top  Reply with quote     

Hello, good people. I come here after much searching and trying different things...and basically pulling my hair out.

I want to do what I thought was a simple thing.

On all my PHP pages (outside of phpMyEdit), users have to login. Thus, they have all have a session ID which is referred to as $_SESSION['user_id'] on all of my PHP pages. I always use this in the "where" variable so that they only see their stuff.

When it came time that they needed a form not only to view but to edit data, I turned to phpMyEdit.

However, I can't for the life of me figure out how to do this.

I implemented the "WHERE" filter so I got the first page to display just their data.

However, if they go to add record or change a record, it does not use the where filter and provides them the option of adding data to anybody's userID (I tried hiding this field but this fails...it also then doesn't seem to know what ID field to use).

The docs do say that using this "filter" is for "any generated SELECT statement". Does this mean that it does not apply for an update or insert?

Is is possible to do what I want to do or am I using the wrong program?

Thanks in advance. Any help is great appreciated.

--Tyler

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2010-08-30 13:02
Back to top  Reply with quote     

Make the user id persistent (appended to all link parameters and actions).

Code:
$opts['cgi']['persist'] = array( 'session_id' => $SESSION_ID );


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


 
tyler     Joined: 30 Aug 2010   Posts: 2  
Post Posted: 2010-08-30 13:54
Back to top  Reply with quote     

Doug,

Thank you for your quick response.

I didn't entirely understand it because I am more a "figure it out as I go" person (translation: technically unaware of what most find obvious!)

Anyway, do I put those lines in the php file that is created by phpMyEdit or in one of the other two (phpMyEdit.class.php OR phpMyEditSetup.php)?

And what would be the exact lines? Here are my exact session variables:

$_SESSION['user_id']
$_SESSION['user_name']

Thanks again for your help and patience Doug. I am a newbie to phpMyEdit and it does things different that I am used to.

Cheers,
T

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2010-08-30 14:56
Back to top  Reply with quote     

Code goes in the created script, not the class file. The following might work, given that $_SESSION is global in scope and as such does not need to be made persistent.

Code:
$opts['filters'] = 'PMEtable0.user_id = "$_SESSION[{"user_id"]"';


A somewhat related example, based on $_SESSION['sess_user_level'] gives the admin (9) more privileges than other users.

Code:
switch($_SESSION['sess_user_level'])
{
  Case 9:
    $opts['filters'] = 'PMEtable0.deleted = "0"';
    $opts['inc'] = 20;
    $opts['options'] = 'ACPVDFL';
    break;
  Case 7:
    $opts['filters'] = 'PMEtable0.deleted = "0" AND PMEtable0.forum_id < "200"';
    $opts['inc'] = 40;
    $opts['options'] = 'CVFL';
    break;
  Case 0:
  default:
    $opts['filters'] = 'PMEtable0.deleted = "0"';
    $opts['inc'] = 40;
    $opts['options'] = 'VL';
    break;
}


 
Goldyy     Joined: 08 Nov 2020   Posts: 79  
Post Posted: 2022-02-19 14:20
Back to top  Reply with quote     

Good post! Thanks! Every day, at least 600+ students from all around the globe turn to our service asking ;Can you do my essay please? or Will you write my paper for me?. So, why are there so many people willing to pay for essay instead of completing the assignment on their own? A good essay writer from our paper writing service is a qualified professional with the necessary hard and soft skills. A one-on-one meeting allows us to find flexible and outgoing authors with great time-management qualities and a genuine passion for writing.

 
Gloriya     Joined: 17 Nov 2021   Posts: 8  
Post Posted: 2022-02-19 19:26
Back to top  Reply with quote     

Good post! Thanks.

 
Alexgerrard783     Joined: 05 Mar 2022   Posts: 11  
Post Posted: 2022-05-13 20:47
Back to top  Reply with quote     

Our custom term paper writing services focus on diverse subject areas, such as https://expertpaperwriter.com/samedayessay-com-review/ English, Information Technology, Sciences, Economics, Law, Engineering, among others.

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Odkazový formulár · Application form · Prihláška
Report bug on PLATON.SK website · Upozorniť na chybu na PLATON.SK webstránke · Terms of use · Podmienky použitia · Privacy policy · Ochrana osobných údajov