X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Help with securing private storefront. (https://forum.x-cart.com/showthread.php?t=42664)

drnlz 09-29-2008 11:16 AM

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.

Jon 09-29-2008 12:02 PM

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.

drnlz 09-29-2008 01:13 PM

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.


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

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.