Forums / General Questions / User Accounts

User Accounts

Locked

Started by darkjackwolf on 9 Jun 2010, 4:13 AM · Views: 1,532

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
9 Jun 2010, 4:13 AM
#1
darkjackwolf avatar

darkjackwolf

New Zenner

Join Date:
Jun 2010
Posts:
3
Plugin Contributions:
0

User Accounts

Hey all, new to Zen Cart.
I'm not sure if any information is relevant to the question, but I can provide it if asked.

I set up zen-cart within my customers site. I've decided I want to set up an account system for the site, but I do not want users to log into the website and then log into zen-cart separately, so can I use the zen-cart user account database to have users log in and see private portions of the actual site.

I hope I didn't word the question to weirdly, thanx for helping.
-Jared

9 Jun 2010, 4:38 AM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: User Accounts

While it is possible to "bridge" zencart with other applications, it is not (generally) a simple procedure - especially where there's another content management system (usually a database) involved.

Before any meaningful pointers can be given it is probably necessary for someone to take a detailed look at how you are currently managing logins, and how the user's "session" is being governed.

This could require the input of a skilled zenner, whose knowledge of php and mysql is advanced. Probably a project that will require you to dip into your pocket.

20 years a Zencart User

9 Jun 2010, 4:52 AM
#3
darkjackwolf avatar

darkjackwolf

New Zenner

Join Date:
Jun 2010
Posts:
3
Plugin Contributions:
0

Re: User Accounts

Well, there is only one database involved. The website is a simple HTML website that I would have specific pages private and that only members who log in can see them. I would like to set up a log in field in a simple HTML page. I set up Zencart within this website so the Account database is now in MySQL. I would just like to use that database for logins on the website.

9 Jun 2010, 4:57 AM
#4
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: User Accounts

So you are probably using a htpasswd (directory password) to control access?

I still think you will need some specialised help. You will probably need to re-structure those flat HTML pages into a php-managed environment.

20 years a Zencart User

9 Jun 2010, 5:11 AM
#5
awatson945 avatar

awatson945

New Zenner

Join Date:
Jun 2010
Location:
So Cal
Posts:
13
Plugin Contributions:
0

Re: User Accounts

schoolboy:

So you are probably using a htpasswd (directory password) to control access?

I still think you will need some specialised help. You will probably need to re-structure those flat HTML pages into a php-managed environment.

Ok, let's assume that you are right. Set all of that aside for just a moment. Is it possible to have a static HTML page with fields for user name and password that will update the MySQL database used by ZenCart? Yes? No? Maybe? I'm new to ZenCart and SQL so I can't answer the question but it's most certainly possible with other DBMS's and Carts. In fact it's not difficult at all. It's kinda built in to the system. Is there something esoteric about MySQL and ZenCart?

9 Jun 2010, 6:04 AM
#6
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: User Accounts

awatson945:

Ok, let's assume that you are right. Set all of that aside for just a moment. Is it possible to have a static HTML page with fields for user name and password that will update the MySQL database used by ZenCart? Yes? No? Maybe?
Answer: No

awatson945:

I'm new to ZenCart and SQL so I can't answer the question
Good point... so why won't you trust the opinion of someone who's posted over 5,500 items of help and advice?

awatson945:

but it's most certainly possible with other DBMS's and Carts. In fact it's not difficult at all. It's kinda built in to the system.
Please give examples. I work with:

  • Magento
  • OsCommerce
  • Prestashop
  • Pinnacle
  • XCart
  • Cubecart
  • Joomla and Virtumart
  • Drupal and Ubercart
  • Zencart
    ... and I don't know of the behaviour you describe in any of these systems -all MAJOR eCommerce systems.

awatson945:

Is there something esoteric about MySQL and ZenCart?
No... The list I give above uses the same fundamental technology.

This IS a complex issue. If you choose not to believe me, then c'est la vie. :D

20 years a Zencart User

9 Jun 2010, 6:23 AM
#7
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: User Accounts

I mentioned the use of BRIDGING earlier.

For example, zencart bridges with phpBB3

here is a smattering of some of the code lines that make it possible:

/includes/auto_loaders/config.core.php

Line #60 : 'loadFile'=>'class.phpbb.php');

Line #113 : * $phpBB = new phpBB();

Line #123 : 'className'=>'phpBB',

Line #124 : 'objectName'=>'phpBB');
 
/includes/auto_loaders/paypal_ipn.core.php

Line #84 : * $phpBB = new phpBB();
 
/includes/classes/class.phpbb.php

Line #2 : * phpBB3 Class.

Line #4 : * This class is used to interact with phpBB3 forum

Line #9 : * @version $Id: class.phpbb.php 14689 2009-10-26 17:06:43Z drbyte $

Line #16 : class phpBB extends base {

Line #18 : var $db_phpbb;

Line #19 : var $phpBB=array();

Line #20 : var $dir_phpbb='';

Line #23 : function phpBB() {

Line #24 : $this->debug = (defined('PHPBB_DEBUG_MODE') && strtoupper(PHPBB_DEBUG_MODE)=='ON') ? (defined('PHPBB_DEBUG_IP') && (PHPBB_DEBUG_IP == '' || PHPBB_DEBUG_IP == $_SERVER['REMOTE_ADDR'] || strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])) ? true : false ) : false;

Line #25 : $this->phpBB = Array();

Line #26 : $this->phpBB['installed'] = false;

Line #27 : if (PHPBB_LINKS_ENABLED =='true') { // if disabled in Zen Cart admin, don't do any checks for phpBB

Line #28 : $this->get_phpBB_info();

Line #30 : $this->db_phpbb = new queryFactory();

Line #31 : $connect_status = $this->db_phpbb->connect($this->phpBB['dbhost'], $this->phpBB['dbuser'], $this->phpBB['dbpasswd'], $this->phpBB['dbname'], USE_PCONNECT, false);

Line #36 : echo "phpBB connection disabled in Admin<br>";

Line #41 : function get_phpBB_info() {

Line #42 : $this->phpBB['db_installed'] = false;

Line #43 : $this->phpBB['files_installed'] = false;

Line #44 : $this->phpBB['phpbb_path']='';

Line #45 : $this->phpBB['phpbb_url']='';

Line #49 : $this->dir_phpbb = str_replace(array('\\', '//'), '/', DIR_WS_PHPBB ); // convert slashes

Line #51 : if (substr($this->dir_phpbb,-1)!='/') $this->dir_phpbb .= '/'; // ensure has a trailing slash

Line #52 : if ($this->debug==true) echo 'dir='.$this->dir_phpbb.'<br>';

Line #55 : if (@file_exists($this->dir_phpbb . 'config.php')) {

Line #56 : $this->phpBB['files_installed'] = true;

Line #59 : $this->phpBB['phpbb_path'] = $this->dir_phpbb;

Line #60 : if ($this->debug==true) echo 'phpbb_path='. $this->dir_phpbb . '<br><br>';

Line #62 : // find phpbb table prefix without including file:

Line #64 : $lines = @file($this->phpBB['phpbb_path']. 'config.php');

Line #72 : if (substr($line,0,7)=='$dbhost') $this->phpBB['dbhost'] = ($def_string[1] == '' ? 'localhost' : $def_string[1]);

Line #73 : if (substr($line,0,7)=='$dbname') $this->phpBB['dbname'] = $def_string[1];

Line #74 : if (substr($line,0,7)=='$dbuser') $this->phpBB['dbuser'] = $def_string[1];

Line #75 : if (substr($line,0,9)=='$dbpasswd') $this->phpBB['dbpasswd'] = $def_string[1];

Line #76 : if (substr($line,0,13)=='$table_prefix') $this->phpBB['table_prefix'] = $def_string[1];

Line #78 : // find phpbb table-names without INCLUDEing file:

Line #79 : if (@file_exists($this->phpBB['phpbb_path'] . 'includes/constants.php')) {

Line #81 : $lines = @file($this->phpBB['phpbb_path']. 'includes/constants.php');

Line #90 : if ($def_string[1]=='USERS_TABLE') $this->phpBB['users_table'] = $this->phpBB['table_prefix'] . $def_string[3];

Line #91 : if ($def_string[1]=='USER_GROUP_TABLE') $this->phpBB['user_group_table'] = $this->phpBB['table_prefix'] . $def_string[3];

Line #92 : if ($def_string[1]=='GROUPS_TABLE') $this->phpBB['groups_table'] = $this->phpBB['table_prefix'] . $def_string[3];

Line #93 : if ($def_string[1]=='CONFIG_TABLE') $this->phpBB['config_table'] = $this->phpBB['table_prefix'] . $def_string[3];

Line #97 : $this->phpBB['files_installed'] = false;

Line #100 : echo 'prefix='.$this->phpBB['table_prefix'].'<br>';

Line #101 : echo 'dbname='.$this->phpBB['dbname'].'<br>';

Line #102 : echo 'dbuser='.$this->phpBB['dbuser'].'<br>';

Line #103 : echo 'dbhost='.$this->phpBB['dbhost'].'<br>';

Line #104 : echo 'dbpasswd='.$this->phpBB['dbpasswd'].'<br>';

Line #105 : echo 'users_table='.$this->phpBB['users_table'].'<br>';

Line #106 : echo 'user_group_table='.$this->phpBB['user_group_table'].'<br>';

Line #107 : echo 'groups_table='.$this->phpBB['groups_table'].'<br>';

Line #108 : echo 'config_table='.$this->phpBB['config_table'].'<br>';

Line #116 : if ($this->phpBB['dbname']!='' && $this->phpBB['dbuser'] !='' && $this->phpBB['dbhost'] !='' && $this->phpBB['config_table']!='' && $this->phpBB['users_table'] !='' && $this->phpBB['user_group_table'] !='' && $this->phpBB['groups_table']!='') {

Line #117 : if ($this->phpBB['dbname'] == DB_DATABASE) {

Line #118 : $this->phpBB['db_installed'] = $this->table_exists_zen($this->phpBB['users_table']);

Line #119 : $this->phpBB['db_installed_config'] = $this->table_exists_zen($this->phpBB['config_table']);

Line #120 : if ($this->debug==true) echo "db_installed -- in ZC Database = ".$this->phpBB['db_installed']."<br>";

Line #122 : $this->phpBB['db_installed'] = $this->table_exists_phpbb($this->phpBB['users_table']);

Line #123 : $this->phpBB['db_installed_config'] = $this->table_exists_phpbb($this->phpBB['config_table']);

Line #124 : if ($this->debug==true) echo "db_installed -- in separate database = ".$this->phpBB['db_installed']."<br>";

Line #136 : if ($this->debug==true) echo "link_enabled_admin_status=".PHPBB_LINKS_ENABLED.'<br>';

Line #138 : if ( ($this->phpBB['db_installed']) && ($this->phpBB['files_installed']) && (PHPBB_LINKS_ENABLED=='true')) {

Line #143 : $this->phpBB['phpbb_url'] = str_replace(array($_SERVER['DOCUMENT_ROOT'],substr($script_filename,0,strpos($script_filename,$_SERVER['PHP_SELF']))),'',$this->phpBB['phpbb_path']);

Line #144 : $this->phpBB['installed'] = true;

Line #145 : if ($this->debug==true) echo 'URL='.$this->phpBB['phpbb_url'].'<br>';

Line #148 : if ($this->debug==true && $this->phpBB['installed']==false) echo "FAILURE: phpBB NOT activated<br><br>";

Line #149 : // will use $phpBB->phpBB['installed'] to check for suitability of calling phpBB in the future.

Line #164 : function table_exists_phpbb($table_name) {

Line #165 : // Check to see if the requested PHPBB table exists, regardless of which database it's set to use

Line #167 : $tables = $this->db_phpbb->Execute($sql);

Line #175 : function phpbb_create_account($nick, $password, $email_address) {

Line #176 : if ($this->phpBB['installed'] != true || !zen_not_null($password) || !zen_not_null($email_address) || !zen_not_null($nick)) return false;

Line #177 : if (!$this->phpbb_check_for_duplicate_email($email_address) == 'already_exists') {

Line #178 : $sql = "select max(user_id) as total from " . $this->phpBB['users_table'];

Line #179 : $phpbb_users = $this->db_phpbb->Execute($sql);

Line #180 : $user_id = ($phpbb_users->fields['total'] + 1);

Line #181 : $sql = "insert into " . $this->phpBB['users_table'] . "

Line #185 : $this->db_phpbb->Execute($sql);

Line #186 : $sql = " update " . $this->phpBB['config_table'] . " SET config_value = '{$user_id}' WHERE config_name = 'newest_user_id'";

Line #187 : $this->db_phpbb->Execute($sql);

Line #188 : $sql = " update " . $this->phpBB['config_table'] . " SET config_value = '{$nick}' WHERE config_name = 'newest_username'";

Line #189 : $this->db_phpbb->Execute($sql);

Line #190 : $sql = " update " . $this->phpBB['config_table'] . " SET config_value = config_value + 1 WHERE config_name = 'num_users'";

Line #191 : $this->db_phpbb->Execute($sql);

Line #192 : $sql = "INSERT INTO " . $this->phpBB['user_group_table'] . " (user_id, group_id, user_pending)

Line #194 : $this->db_phpbb->Execute($sql);

Line #197 : function v2phpbb_create_account($nick, $password, $email_address) {

Line #198 : if ($this->phpBB['installed'] != true || !zen_not_null($password) || !zen_not_null($email_address) || !zen_not_null($nick)) return false;

Line #199 : if ($this->phpbb_check_for_duplicate_email($email_address) == 'already_exists') {

Line #200 : // $this->phpbb_change_email($old_email, $email_address);

Line #202 : $sql = "select max(user_id) as total from " . $this->phpBB['users_table'];

Line #203 : $phpbb_users = $this->db_phpbb->Execute($sql);

Line #204 : $user_id = ($phpbb_users->fields['total'] + 1);

Line #205 : $sql = "insert into " . $this->phpBB['users_table'] . "

Line #209 : $this->db_phpbb->Execute($sql);

Line #211 : $sql = "INSERT INTO " . $this->phpBB['groups_table'] . " (group_name, group_description, group_single_user, group_moderator)

Line #213 : $this->db_phpbb->Execute($sql);

Line #214 : $group_id = $this->db_phpbb->Insert_ID();

Line #215 : $sql = "INSERT INTO " . $this->phpBB['user_group_table'] . " (user_id, group_id, user_pending)

Line #217 : $this->db_phpbb->Execute($sql);

Line #218 : //might optionally send an extra email welcoming them to the phpBB forum, reminding them of their nickname?

Line #222 : function phpbb_check_for_duplicate_nick($nick='') {

Line #223 : if ($this->phpBB['installed'] != true || empty($nick)) return false;

Line #225 : $sql = "select * from " . $this->phpBB['users_table'] . " where username = '" . $nick . "'";

Line #227 : $phpbb_users = $this->db_phpbb->Execute($sql);

Line #228 : //echo "count=".$phpbb_users->RecordCount();

Line #229 : if ($phpbb_users->RecordCount() > 0 ) {

Line #235 : function phpbb_check_for_duplicate_email($email_address) {

Line #236 : if ($this->phpBB['installed'] != true) return false;

Line #238 : $sql = "select * from " . $this->phpBB['users_table'] . " where user_email = '" . $email_address . "'";

Line #239 : $phpbb_users = $this->db_phpbb->Execute($sql);

Line #240 : if ($phpbb_users->RecordCount() > 0 ) {

Line #246 : function phpbb_change_password($nick, $newpassword) {

Line #247 : if ($this->phpBB['installed'] != true || !zen_not_null($nick) || $nick == '') return false;

Line #248 : $sql = "update " . $this->phpBB['users_table'] . " set user_password='" . MD5($newpassword) . "'

Line #250 : $phpbb_users = $this->db_phpbb->Execute($sql);

Line #253 : function phpbb_change_email($old_email, $email_address) {

Line #255 : if ($this->phpBB['installed'] != true || !zen_not_null($email_address) || $email_address == '') return false;

Line #256 : $sql = "update " . $this->phpBB['users_table'] . " set user_email='" . $email_address . "', user_email_hash = '" . crc32(strtolower($email_address)) . strlen($email_address) . "'

Line #258 : $phpbb_users = $this->db_phpbb->Execute($sql);

Line #261 : function phpbb_change_nick($old_nick, $new_nick) {

Line #263 : if ($this->phpBB['installed'] != true || !zen_not_null($nick) || $nick == '') return false;

Line #264 : $sql = "update " . $this->phpBB['users_table'] . " set username='" . $new_nick . "', username_clean = '" . $new_nick . "'

Line #266 : $phpbb_users = $this->db_phpbb->Execute($sql);
 
/includes/classes/sniffer.php

Line #26 : $this->phpBB = Array();
 
/includes/configure.php

Line #36 : define('DIR_WS_PHPBB', '/');
 
/includes/filenames.php

Line #186 : define('FILENAME_BB_INDEX', 'index.php'); // phpBB main index filename
 
/includes/modules/create_account.php

Line #141 : if ($phpBB->phpBB['installed'] == true) {

Line #154 : // check phpBB for duplicate nickname

Line #155 : if ($phpBB->phpbb_check_for_duplicate_nick($nick) == 'already_exists' ) {

Line #157 : $messageStack->add('create_account', ENTRY_NICK_DUPLICATE_ERROR . ' (phpBB)');

Line #313 : // phpBB create account

Line #314 : if ($phpBB->phpBB['installed'] == true) {

Line #315 : $phpBB->phpbb_create_account($nick, $password, $email_address);
 
/includes/modules/pages/account_edit/header_php.php

Line #82 : // check phpBB for duplicate email address

Line #83 : if ($phpBB->phpbb_check_for_duplicate_email(zen_db_input($email_address)) == 'already_exists' ) {

Line #85 : $messageStack->add('account_edit', 'phpBB-'.ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);

Line #97 : //update phpBB with new email address

Line #99 : $phpBB->phpbb_change_email(zen_db_input($old_addr_check->fields['customers_email_address']),zen_db_input($email_address));
 
/includes/modules/pages/account_password/header_php.php

Line #66 : if ($phpBB->phpBB['installed'] == true) {

Line #68 : $phpBB->phpbb_change_password($nickname, $password_new);
 
/includes/modules/pure_black/create_account.php

Line #155 : if ($phpBB->phpBB['installed'] == true) {

Line #168 : // check phpBB for duplicate nickname

Line #169 : if ($phpBB->phpbb_check_for_duplicate_nick($nick) == 'already_exists' ) {

Line #171 : $messageStack->add('create_account', ENTRY_NICK_DUPLICATE_ERROR . ' (phpBB)');

Line #327 : // phpBB create account

Line #328 : if ($phpBB->phpBB['installed'] == true) {

Line #329 : $phpBB->phpbb_create_account($nick, $password, $email_address);
 
/includes/modules/sideboxes/information.php

Line #26 : // Forum (phpBB) link:

Line #27 : if ( (isset($phpBB->phpBB['db_installed_config']) && $phpBB->phpBB['db_installed_config']) && (isset($phpBB->phpBB['files_installed']) && $phpBB->phpBB['files_installed']) && (PHPBB_LINKS_ENABLED=='true')) {

Line #28 : $information[] = '<a href="' . zen_href_link($phpBB->phpBB['phpbb_url'] . FILENAME_BB_INDEX, '', 'NONSSL', false, '', true) . '" target="_blank">' . BOX_BBINDEX . '</a>';

Line #29 : // or: $phpBB->phpBB['phpbb_url'] . FILENAME_BB_INDEX

Line #30 : // or: str_replace(str_replace(DIR_WS_CATALOG, '', DIR_FS_CATALOG), '', DIR_WS_PHPBB)
 
/includes/templates/pure_black.pg-bak/templates/tpl_modules_create_account.php

Line #194 : if ($phpBB->phpBB['installed'] == true) {
 
/includes/templates/pure_black/templates/tpl_modules_create_account.php

Line #194 : if ($phpBB->phpBB['installed'] == true) {
 
/includes/templates/template_default/templates/tpl_modules_create_account.php

Line #153 : if ($phpBB->phpBB['installed'] == true) {
 
/includes/templates/template_default/templates/tpl_site_map_default.php

Line #60 : <?php if ( (isset($phpBB->phpBB['db_installed_config']) && $phpBB->phpBB['db_installed_config']) && (isset($phpBB->phpBB['files_installed']) && $phpBB->phpBB['files_installed']) && (PHPBB_LINKS_ENABLED=='true')) { ?>

Line #61 : <li><?php echo '<a href="' . zen_href_link($phpBB->phpBB['phpbb_url'] . FILENAME_BB_INDEX, '', 'NONSSL', false, '', true) . '" target="_blank">' . BOX_BBINDEX . '</a>'; ?></li>
 

20 years a Zencart User

9 Jun 2010, 8:21 AM
#8
awatson945 avatar

awatson945

New Zenner

Join Date:
Jun 2010
Location:
So Cal
Posts:
13
Plugin Contributions:
0

Re: User Accounts

schoolboy:

Good point... so why won't you trust the opinion of someone who's posted over 5,500 items of help and advice?Dude, I'm simply asking a question. No need for the drama. I work with DBMS's like FileMaker pro and Access. The shopping carts are proprietary. I've not worked with an off the shelf shopping cart in nearly a decade. So, all I wanted to know is what is so complicated about these carts? No real need for the ego really. I don't know you. I don't know what your experience is. So I asked a question. Your king of your roost. I'm sorry I offended you.

Now, let me ask you this, MySQL, SQL is in the name. I assume it adheres to standard database protocols right? Why can't I appeand the database without all of the bridging?

9 Jun 2010, 8:32 AM
#9
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: User Accounts

The question related to external flat HTML pages being given some kind of password protection, where the password is specifically that which the customer creates when they create an account in zencart.

There is no mechanism in zencart's php to append the user login to an external HTML page... unless some pretty hefty coding is done.

You appeared to be adamant that it should either be "standard behaviour" (and you come across as incredulous as to why it's not standard), or it should be easy enough for an amoeba to code.

So, "dude", I was pointing out that it is neither standard nor easy.:smartalec:

20 years a Zencart User

9 Jun 2010, 8:47 AM
#10
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: User Accounts

As the login is stored in a database (doesn't matter what kind of database). A lookup query could be written (using MD5 protocols) - even as a bit of CGI if you want to.

So, yes... it can be done, but it will still take a bit of skill to do it.

A few years ago, Scott Wilson (swguy) built me a "Loyalty Club" function, where we could indeed bar access to zencart defined pages to non-logged in visitors.

So PM swguy and ask him if he'll do this for you.

20 years a Zencart User

9 Jun 2010, 10:00 AM
#11
awatson945 avatar

awatson945

New Zenner

Join Date:
Jun 2010
Location:
So Cal
Posts:
13
Plugin Contributions:
0

Re: User Accounts

schoolboy:

The question related to external flat HTML pages being given some kind of password protection, where the password is specifically that which the customer creates when they create an account in zencart.That wasn't the question AIU. The question was could the customer add a record and populate the user name and password fields from a static HTML page into the SQL database?

9 Jun 2010, 10:01 AM
#12
awatson945 avatar

awatson945

New Zenner

Join Date:
Jun 2010
Location:
So Cal
Posts:
13
Plugin Contributions:
0

Re: User Accounts

schoolboy:

As the login is stored in a database (doesn't matter what kind of database). A lookup query could be written (using MD5 protocols) - even as a bit of CGI if you want to.

So, yes... it can be done, but it will still take a bit of skill to do it.

A few years ago, Scott Wilson (swguy) built me a "Loyalty Club" function, where we could indeed bar access to zencart defined pages to non-logged in visitors.

So PM swguy and ask him if he'll do this for you.Thank you.