Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Admin Account with Access Level


Parikesit

Recommended Posts

I have my tables set for auto increment and the numbers go up and the number of groups go up

hmm, interessting..

first, i was following your thoughts and instructions, but didn't work for my tables. i couldn't set the field 'admin_id' for auto_increment, which wouldn't make any sense, i think - i don't want this value go up by adding a new row in 'admin_files', it has to go up by adding a new admin in the table 'admin'..

thank you for your help, but i don't think this is the right solution... i guess

Link to comment
Share on other sites

  • Replies 297
  • Created
  • Last Reply

Top Posters In This Topic

I have my tables set for auto increment and the numbers go up and the number of groups go up

hmm, interessting..

first, i was following your thoughts and instructions, but didn't work for my tables. i couldn't set the field 'admin_id' for auto_increment, which wouldn't make any sense, i think - i don't want this value go up by adding a new row in 'admin_files', it has to go up by adding a new admin in the table 'admin'..

thank you for your help, but i don't think this is the right solution... i guess

auto increment is for the tables

 

example

 

DROP TABLE IF EXISTS admin;
CREATE TABLE admin (
 admin_id int(11) NOT NULL auto_increment,
 admin_groups_id int(11) default NULL,
 admin_firstname varchar(32) NOT NULL default '',
 admin_lastname varchar(32) default NULL,
 admin_email_address varchar(96) NOT NULL default '',
 admin_password varchar(40) NOT NULL default '',
 admin_created datetime default NULL,
 admin_modified datetime NOT NULL default '0000-00-00 00:00:00',
 admin_logdate datetime default NULL,
 admin_lognum int(11) NOT NULL default '0',
 PRIMARY KEY  (admin_id),
 UNIQUE KEY admin_email_address (admin_email_address)
) TYPE=MyISAM AUTO_INCREMENT=5;

DROP TABLE IF EXISTS admin_access_files;
CREATE TABLE admin_access_files (
 file_access_id int(4) NOT NULL auto_increment,
 admin_files_id int(11) NOT NULL default '0',
 admin_id int(11) NOT NULL default '1',
 admin_access_values int(11) NOT NULL default '1',
 PRIMARY KEY  (file_access_id)
) TYPE=MyISAM;

DROP TABLE IF EXISTS admin_files;
CREATE TABLE admin_files (
 admin_files_id int(11) NOT NULL auto_increment,
 admin_files_name varchar(64) NOT NULL default '',
 admin_files_is_boxes tinyint(5) NOT NULL default '0',
 admin_files_to_boxes int(11) NOT NULL default '0',
 admin_groups_id set('1','2','3','4','5') NOT NULL default '1',
 admin_id set('1','2','3','4') NOT NULL default '1',
 PRIMARY KEY  (admin_files_id)
) TYPE=MyISAM AUTO_INCREMENT=115;

DROP TABLE IF EXISTS admin_groups;
CREATE TABLE admin_groups (
 admin_groups_id int(11) NOT NULL auto_increment,
 admin_groups_name varchar(64) default NULL,
 PRIMARY KEY  (admin_groups_id),
 UNIQUE KEY admin_groups_name (admin_groups_name)
) TYPE=MyISAM AUTO_INCREMENT=6;

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

DROP TABLE IF EXISTS admin_files;

CREATE TABLE admin_files (

?admin_files_id int(11) NOT NULL auto_increment,

?admin_files_name varchar(64) NOT NULL default '',

?admin_files_is_boxes tinyint(5) NOT NULL default '0',

?admin_files_to_boxes int(11) NOT NULL default '0',

?admin_groups_id set('1','2','3','4','5') NOT NULL default '1',

?admin_id set('1','2','3','4') NOT NULL default '1',

?PRIMARY KEY ?(admin_files_id)

) TYPE=MyISAM AUTO_INCREMENT=115;

of course is auto_increment for the tables, where else..

 

look at your line you wrote : admin_id set('1','2','3','4') NOT NULL default '1',

how do you get the id for administrator #5 in this field? you only can choose between 1 and 4, you'll never get a 5 in this SET by adding a new administrator - it stays that way

Link to comment
Share on other sites

in admin/admin_members.php

 

add this line of code after line # 153

 

            tep_db_query("alter table " . TABLE_ADMIN_FILES . " change admin_id admin_id set( " . $add_group_id . ") NOT NULL DEFAULT '1' ");

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

 ? ? ? ? ? ?tep_db_query("alter table " . TABLE_ADMIN_FILES . " change admin_id admin_id set( " . $add_group_id . ") NOT NULL DEFAULT '1' ");

Thank you trying to help me, but it isn't that easy. I came up with the same idea, but it's obvious this won't work, you can't add the group_id ($add_group_id) to admin_id -these are different IDs..

i would have to add a hidden field in the form (add new admin) with the values which are already in the table .... and so on. just like he did for the group-ids.

i can't believe the guy who coded this forgot about that and i am the first one noticed it...

Link to comment
Share on other sites

First, let me say that I have not looked at all of the tables or code, but I believe this may help:

 

What you may be talking about is the number of GROUPS of people...

 

ADMIN GROUP IS's are:

 

1 Top Administrator

2 Marketing

3 Guest

4 VIP

and the next ADMIN GROUP ID would be 5 if you added another GROUP of people.

 

I belive that as you add Admin users (with any capability) the ADMIN ID will increment. The GROUP ID will stay the same. Thus you might have in the TABLE called "ADMIN"

 

 

ADMIN ID / GROUP ID / NAME etc

 

1 / 2 / Fred in Marketing

2 / 1 / Mark is a Top Admin

3 / 4 / Tom is a VIP

4 / 1 / Sam is a Top Admin

5 / 2 / Jane is in Marketing

 

If you want to add another GROUP of people, perhaps people who do reports, you would have to create a new GROUP of people called REPORTS (which would become group #5) then add a new user (new user would become #6 from my example above) and would look like this:

 

 

6 / 5 / New person in the REPORTS group

Based upon your question, you seem to be asking if anyone has had more than 4 people in Top Admin?

 

This would mean that your table ADMIN fould look something like this:

 

ADMIN ID GROUP ID NAME etc

 

1 / 1 / Fred is a Top Admin

2 / 1 / Mark is a Top Admin

3 / 1 / Tom is a Top Admin

4 / 1 / Sam is a Top Admin

5 / 1 / Jane is a Top AdminSo when you ask:

 

I think I found the problem, but i'm not sure about it.

In the table 'admin_files', where the permission of each file is set for the admins, the field-type is 'SET' including the values '1','2','3','4' . So this means I only can chose administrators with an ID 1-4. After adding a new administartor, this field-value will not be increased by the ID of the new administrator - so i won't be able set permission for this administator...

 

I think that value of 1-4 refers to the number of the ADMIN GROUP rather than the number of the ADMIN USER ID. So unless you create a new GROUP of users, this value of 1-4 should suffice.

This a particular menu item is probably limited to a group of people and not a user by his ID.

Edited by Lavarock
Link to comment
Share on other sites

 ? ? ? ? ? ?tep_db_query("alter table " . TABLE_ADMIN_FILES . " change admin_id admin_id set( " . $add_group_id . ") NOT NULL DEFAULT '1' ");

Thank you trying to help me, but it isn't that easy. I came up with the same idea, but it's obvious this won't work, you can't add the group_id ($add_group_id) to admin_id -these are different IDs..

i would have to add a hidden field in the form (add new admin) with the values which are already in the table .... and so on. just like he did for the group-ids.

i can't believe the guy who coded this forgot about that and i am the first one noticed it...

This was not meant to be the definitive answer, this was meant only as a part answer to a part of one of your posts about not being able to auto increment that field, this resolves that part in that when adding a new group the field does now increment by the value of 1, I now have that field at 8

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

..well, lavarock, you were almost right, you got the structure of the tables and the point of the problem.. almost, cause the numbers of the IDs has nothing to do with the groups.

CREATE TABLE admin_files (
admin_files_id int(11) NOT NULL auto_increment,
admin_files_name varchar(64) NOT NULL default '',
admin_files_is_boxes tinyint(5) NOT NULL default '0',
admin_files_to_boxes int(11) NOT NULL default '0',
admin_groups_id set('1','2','3','4','5') NOT NULL default '1',
admin_id set('1','2','3','4') NOT NULL default '1',
PRIMARY KEY ?(admin_files_id)

in this table are all the files including permission for all groups and additional permission for each administartor.(in this case i can set permission for the groups with ID 1 - 5, this set will have a 6 after adding a new group).

 

the problem is the field called 'admin_id'. this field contains the real IDs of the administartors. they're not refering to the group_IDs in any way.

the code won't add id 5 in 'admin_id' after adding a new admin.

 

what the code does for adding a new group_id to the field 'admin_groups_id' is a lengthly process. what 241 worte was just a small part of it

tep_db_query("alter table " . TABLE_ADMIN_FILES . " change admin_id admin_id set( " . $add_group_id . ") NOT NULL DEFAULT '1' ");

 

@ 241

okay, i first thought you were talking about the table doing the auto_increment, so i said it won't work. of course the code does it for the group_id, but not for admin_id. and as i said above, your code is just a small part of the whole complicated process

 

actually i would know what to do, but it seems to be very complicated. i was just hoping or i was sure someone else defently noticed this before and has an easy solution.

 

Thank you both anyway for your help!

Edited by tjEx
Link to comment
Share on other sites

  • 3 weeks later...

Just installed this great! Contribution but there is a "little" thing there just seams not to work.

 

I login to my admin panel selects "My Account" I press the "Edit" button, and enters my password, and nothing happens, I can not change the password or anything, the only thing happening is the side updates, and I can now select the "Back" button. Tried the contribution in the "CRE loaded" oscommerce (where allot of contributions is pre installed including this contribution), there I can se the fields that holds the name, e-mail, password ect. Should be editable, but that is not working on the installation I seasonally made on my old oscommerce store.

 

Is there a way to correct that, my server runs with register globals off, and there fore I have installed the "register globals" contribution. I don't know if the problem should be fund there? I am pretty sure I have installed everything correct (used the included files and compare and merge software).

Edited by wils
Link to comment
Share on other sites

I got the Administration Access Level Accounts 2.0 working in most of the case. However, after I logged in and tried to go to customers->Orders, I got this error message: Fatal error: Call to undefined function: trans_id() in /var/www/html/eshop/admin/orders.php on line 384. Anyone knows how to fix this? Thanks! :(

Link to comment
Share on other sites

I'm adding the Step-By-Step Manual Order Entry contribution and I've added the various files to the admin_files table and the create account works fine. However the select customer button on the create order screen causes a redirection to the login screen. It's due to a call on the function tep_admin_check_login. Has anyone any suggestions as to how to solve this issue please?

Link to comment
Share on other sites

  • 2 weeks later...

I've succesfully installed the Admin Access level 2.3. able to run it on default admin username and password.

 

Problem i have:

 

1. when i change the admin password, it is suppose to email me the details i have changed. I did not receive any. Any ideas?

 

2. I'm able to add new users to the admin, but i can't seem to find the place to add the password for each users. Can i know where is it?

 

 

Please help...i've been searching through out the forum but yet can't find...any guidance is appreciated. :(

 

Thanks

Link to comment
Share on other sites

I've succesfully installed the Admin Access level 2.3. able to run it on default admin username and password.

 

Problem i have:

 

1. when i change the admin password, it is suppose to email me the details i have changed. I did not receive any. Any ideas?

 

2. I'm able to add new users to the admin, but i can't seem to find the place to add the password for each users. Can i know where is it?

Please help...i've been searching through out the forum but yet can't find...any guidance is appreciated.  :(

 

Thanks

 

Well..i reinstalled the whole thing and it's working fine now...i wonder why :huh:

Link to comment
Share on other sites

Alright. I just finished installing this package, got the e-mail for forgotten passwords working, and have successfully logged in. Unfortunately, the member groups screen isn't populating because "tep_array_merge()" function is coming up as "undefined." I'm using wordpad and notepad for my development, so I can't efficiently search through to figure out where the function is supposed to be. If someone could help me out by directing me to the file containing tep_array_merge(), I'd appreciate it.

 

Thanks!

Link to comment
Share on other sites

Alright.  I just finished installing this package, got the e-mail for forgotten passwords working, and have successfully logged in.  Unfortunately, the member groups screen isn't populating because "tep_array_merge()" function is coming up as "undefined."  I'm using wordpad and notepad for my development, so I can't efficiently search through to figure out where the function is supposed to be.  If someone could help me out by directing me to the file containing tep_array_merge(), I'd appreciate it.

 

Thanks!

 

Just remove tep_ from the function call. array_merge is now part of PHP unless you've got a very old version.

Link to comment
Share on other sites

Please can somebody help me. I'm having real trouble installing the user admin auth. I've just tried installing "administrators_v1.3.0_for_osCommerce 2.2MS1".

 

I now get the message:

Warning: main(includes/functions/sessions_mysql.php): failed to open stream: No such file or directory in /home/pmtzqmjy/public_html/php/admin/includes/functions/administrators.php on line 72

 

Warning: main(): Failed opening 'includes/functions/sessions_mysql.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/pmtzqmjy/public_html/php/admin/includes/functions/administrators.php on line 72

 

Fatal error: Cannot redeclare tep_draw_selection_field() (previously declared in /home/pmtzqmjy/public_html/php/admin/includes/functions/html_output.php:15) in /home/pmtzqmjy/public_html/php/admin/includes/functions/html_output.php on line 48

 

If someone could even just point me back in the right direction of the original files/folders for the admin section so I can start using it again, it would be a start.

 

Thanks in advance.

 

Damian

Link to comment
Share on other sites

I'm not sure about the first two, but the third message (the fatal error) is happening because you have the function declared twice. If you delete the original version of that particular function in admin/includes/functions/html_output.php, and keep the version you added, you should be all set on that front at least.

Link to comment
Share on other sites

I'm not sure about the first two, but the third message (the fatal error) is happening because you have the function declared twice.  If you delete the original version of that particular function in admin/includes/functions/html_output.php, and keep the version you added, you should be all set on that front at least.

 

Thanks for your reply. To be honest I'm almost ready to throw away my computer. I don't suppose you know where the complete original files are stored for admin so I can just get back to normal before I even started this admin user access thing?

 

I want to replace all my admin folder with the original so I can start again because I've done so much now that I don't even know what I've done.

 

Thanks again for your reply.

Link to comment
Share on other sites

i installed version 2.3 but have problem now.

access to every page under /admin/ will lead to http 404 (file not fund) error.

 

and access to catalog got this error msg

 

Warning: main(includes/functions/localization.php) [function.main]: failed to create stream: No such file or directory in d:\appserv\www\jqube\includes\application_top.php on line 140

 

Fatal error: main() [function.main]: Failed opening required 'includes/functions/localization.php' (include_path='.;c:\php4\pear') in d:\appserv\www\jqube\includes\application_top.php on line 140

 

what is wrong?

thanks in advance for any help.

Link to comment
Share on other sites

Does anyone have a copy of Admin Access With Levels 1.5 or 1.6?

I tried them all and these two were closest to optimal without making the change to using an email for login.

It would be nice to know what happen to this contrib from the contribs directory. BTW, this was listed as contrib 1 before. Now there is no contrib 1 at all.

 

Thanks.

Link to comment
Share on other sites

  • 2 weeks later...
i installed version 2.3 but have problem now.

access to every page under /admin/ will lead to http 404 (file not fund) error.

 

and access to catalog got this error msg

 

Warning: main(includes/functions/localization.php) [function.main]: failed to create stream: No such file or directory in d:\appserv\www\jqube\includes\application_top.php on line 140

 

Fatal error: main() [function.main]: Failed opening required 'includes/functions/localization.php' (include_path='.;c:\php4\pear') in d:\appserv\www\jqube\includes\application_top.php on line 140

 

what is wrong?

thanks in advance for any help.

 

I had the exact same problems that you seem to be experiencing. You need to update your configuration with the correct file paths, which I believe are stored admin/includes/configure.php.

 

There are various roots that you'll need to re-route to your relevant paths. I asked for help and found it was a case of trial and error.

 

Hope this helps a little.

Link to comment
Share on other sites

I've installed this contribution which took a while. The "application_top_php" file made me think I needed to install everthing into the "admin/includes/application_top.php". I figured out that there is code that belongs in filenames.php & database_tables.php.

 

My problem is that when I login to work with the Member Groups - I can't add nor delete. In fact, there is nothing under the grey bar that states: Name, email address, groupls level, lognum, & action. There is nothing on the right side allowing me to add. Is this how it is supposed to be?

 

I just don't know where to go from here. Also, this contribution states it will only work with CVS2 and MS1. Well, I've downloaded the lates OSC. Does this mean it won't work with MS2?

 

anybody?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...