Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Help with securing private storefront.

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-29-2008, 11:16 AM
 
drnlz drnlz is offline
 

Newbie
  
Join Date: Apr 2008
Posts: 8
 

Default Help with securing private storefront.

I'm working on customizing x-cart for our B2B site and part of that is disabling customer registration and securing the storefront so that no one can see it without an account created by us. Right now I'm trying to create a login page with something similar to authbox.tpl but I'm not really familiar enough with auth.php and the x-cart functions yet. If anyone could point me in the right general direction it would be much appreciated.
__________________
X-Cart Version 4.1.9
Reply With Quote
  #2  
Old 09-29-2008, 12:02 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: Help with securing private storefront.

Open auth.php

At the bottom, before ?> add:

Code:
// Force Login if ($login == '') func_header_location($http_location);

This will prevent the user from accessing the cart without being logged in.

Open your .htaccess file and set the DirectoryIndex to index.php:

Code:
DirectoryIndex index.php home.php index.html

Create an index.php and input a login form page, something like:

Code:
<?php require "./top.inc.php"; require "./init.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Your Home Page Title</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="/login/skin1/skin1.css" /> </head> <body> <table width="100%" height="100%"> <tr> <td align="center" valign="middle"> <h1>Your Home Page Title</h1> <p>Your Message</p> <form action="<?php echo $https_location; ?>/include/login.php" method="post" name="authform"> <input type="hidden" name="mode" value="login" /> <input type="hidden" name="usertype" value="C" /> <input type="hidden" name="redirect" value="customer" /> <div style="padding: 10px; background-color: #E5E5E5; width: 400px;"> <table cellpadding="2" cellspacing="2"> <tr> <td>Username:</td> <td><input type="text" name="username" size="16" value="" /></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="password" size="16" maxlength="64" value="" /></td> </tr> <tr> <td colspan="2" align="right"> <input type="submit" name="login" value="Login" /> </td> </tr> </table> </div> </form> </td> </tr> </table> </body> </html>

I would also customize this page and your include/login.php to send them back to this index.php with an error message when a login is incorrect, etc., but this should get you going in the right direction.
Reply With Quote
  #3  
Old 09-29-2008, 01:13 PM
 
drnlz drnlz is offline
 

Newbie
  
Join Date: Apr 2008
Posts: 8
 

Default Re: Help with securing private storefront.

Thanks a bundle Jon, that set me in the right direction and saved me a good deal of work.
__________________
X-Cart Version 4.1.9
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:20 PM.

   

 
X-Cart forums © 2001-2020