X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Login Link (https://forum.x-cart.com/showthread.php?t=2355)

ecommerce 08-06-2006 02:08 PM

where i customer/secure_login.php
on 4 0 18?

i looked everywhere man.

the closest i found is secure loging form tpl.

B00MER 08-07-2006 02:45 AM

Version 4.0.x+ secure_login.php is directly under xcart/ and NOT customer/

As for categories and location not showing up you'll need to include the, include/categories.php file and define a "location" variable via $smarty->assign within your php. :wink:

ecommerce 08-07-2006 08:15 AM

Does secure_login.php need to have an SSL installed?

How do i make it so that secure_login.php doesnt need the https in front of it?

ecommerce 08-07-2006 10:19 AM

boomer, you know how xcart just lists all the ROOT categories on the left side by default, well i dont want that.

i want that area to only show the subcategories based on the Root cat.


example - I have 2 main/root cats

CAT1 CAT2

Only When visitor clicks on CAT1 then left menu will
list in the subcats of CAT1.

Only When visitor clicks on CAT2 then left menu will
list in the subcats of CAT2.

Ofcourse, it has to work in such a way that if i add cat 3, 4, 5 ,6 and so on,
it will automatically do this.

i found this http://forum.x-cart.com/viewtopic.php?t=25470&highlight=
but i dont know if thats what i need.

B00MER 08-07-2006 10:30 AM

Look around the General Settings area in X-Cart's Admin ;)

Quote:

If ticked, the categories list always shows root categories

ecommerce 08-07-2006 11:14 AM

lolol wow that was the easiest. i was killig myself.
lolololol wow i feel stupid, and balinor is probably, saying
"this guy doesnt read the manual"

4 things happenened when i unticked it.

1. i lost the little gifs before the sub cat name.
now is just a link. the rest of the css is ok.
im on 4 0 18 and could it be cuz theres 2 menu
menu.tpl
menu_customer.tpl
I'll looke for the answer.

2. if the subcat, doesnt have subsubcats, the box is empty and looks ugly.
is not a big deal, as of yet.

this is one in need advice on mate.
3. if customer not on any categeroy, it shows the root menu.
instead of the root menu, can i disable it so that it doesnt show it?

instead, i would like to show the hept.tpl menu or something else that i can make up.

ecommerce 08-07-2006 12:07 PM

boomer, you being the master of css,

i tried putting a current css on the menu but it didnt work.

my dreamweaver css attribute didnt recognize the command current

if visitor is on cat1
or a subcat, to high lit the background permantently for as long
as the visitor is on that category.

stickygoblin 08-08-2006 05:09 AM

any ideas how to do this in my version of xcart as I have tried the one that worked in 3.5.5 and it does nothing.

or is there a real simple way now that i'm totally missing?

cheers

sticky

yages 08-10-2006 08:14 PM

Copied Laureon's mod and the following error occurs

Warning: main(./auth.php): failed to open stream: No such file or directory in /home/xxxx/public_html/xxxxx/customer/myaccount.php on line 2

here is the php file

<?
require "./auth.php";
require $xcart_dir."/include/categories.php";
$smarty->assign("main", "myaccount");
$smarty->assign("location",$location);
$smarty->display("customer/home.tpl");
?>

Anyone know how to fix the error

ecommerce 08-11-2006 07:21 PM

yages, i guess u fixed it cuz ur page is working.

TanyaG 04-23-2008 04:05 AM

Re: Login Link
 
Thanks a lot. Great idea!

boomobile 07-03-2008 11:27 AM

Re: Login Link
 
Quote:

Originally Posted by B00MER
edit [skin1]/common_templates.tpl and add something similar:

Code:

{elseif $main eq "mainlogin"}
{include file="customer/main/login.tpl"}

Note, place your login form from, auth.tpl in customer/main/login.tpl

Now just create the login.php file, with something like:

Code:

<?

require "../smarty.php";
require "../config.php";
@include "./https.php";
require "./auth.php";

$smarty->assign("main","mainlogin");
$smarty->display("customer/home.tpl");

?>


Should do the trick ;)



I want to combine three templates into one page. I can't figure out how they are called. I don't need to edit the templates themselves, just have them all on the same page.
Here's specifics:

I have 3 separate pages as follows
login = secure_login_form.tpl
registration = register.tpl
recover lost password = change_password.tpl

these all come up on separate pages, I want them all on one.

My home_main.tpl includes this:

{elseif $main eq "register"}
{include file="customer/main/register.tpl"}

{elseif $main eq "secure_login_form"}
{include file="customer/main/secure_login_form.tpl"}

{elseif $main eq "change_password"}
{include file="customer/main/change_password.tpl"}

I'm not sure what file I need to modify.

neaisha 07-10-2008 11:16 AM

Re: Login Link
 
i couldnt get this to work. so what i did was duplicate this page - xcart/error_message.php?need_login. i'm not sure what unnecessary code can/should be removed from the duplicated file beyond what i've already removed so that it continues to work but...

create a file called myaccount.php and insert the following code

Code:

<?php

require "./auth.php";
require $xcart_dir."/include/categories.php";

#
# Assign login information
#
x_session_register("login_antibot_on");
x_session_register("antibot_err");
x_session_register("username");
$smarty->assign("main","myaccount");
$smarty->assign("username", $username);
$smarty->assign("login_antibot_on", $login_antibot_on);
if ($antibot_err) {
    $smarty->assign("antibot_err", $antibot_err);
    $antibot_err = false;
}


# Assign the current location line
$smarty->assign("location", $location);

func_display("customer/home.tpl",$smarty);
?>



then upload it to /xcart directory.



then in skin1/common_templates.tpl add the following...

Code:

{elseif $main eq "myaccount" or $main eq "antibot_error" or $main eq "disabled"}
{assign var="is_remember" value="Y"}
{include file="main/error_login_incorrect.tpl"}


then add the link to your page http://www.mysite/xcart/myaccount.php where you want it to appear.

neaisha 07-10-2008 01:04 PM

Re: Login Link
 
if it helps anyone, here's how i displayed the login link if logged out and vice versa...

Code:


{if $login ne ""}

<form action="/store/include/login.php" method="post" name="loginform"><img src="{$ImagesDir}/spacer.gif" width="10" height="1" alt="" /><a href="javascript: document.loginform.submit();">log out</a>
<input name="mode" value="logout" type="hidden">
<input name="redirect" value="customer" type="hidden">
</form>


{else}

<a href="mysite/xcart/myaccount.php">login</a>

{/if}


JWait 07-19-2008 08:43 AM

Re: Login Link
 
Quote:

Originally Posted by boomobile
I have 3 separate pages as follows
login = secure_login_form.tpl
registration = register.tpl
recover lost password = change_password.tpl

these all come up on separate pages, I want them all on one.

My home_main.tpl includes this:

{elseif $main eq "register"}
{include file="customer/main/register.tpl"}

{elseif $main eq "secure_login_form"}
{include file="customer/main/secure_login_form.tpl"}

{elseif $main eq "change_password"}
{include file="customer/main/change_password.tpl"}

I'm not sure what file I need to modify.


I don't really understand why you would want them all on the same page, particularly since they do different things.

"Register" does just that, registers new customers.
"Secure Login" will login current customers using https.
"Change Password" will allow current customers to change their password, and is part of "modify profile".

"recover lost password = change_password.tpl" as you state is incorrect. "Recover Password" allows a current customer to retrieve their login information via email and has nothing to do with changing their password (unless of course you require them to change it at their next logon).

Anyway, to get more than one template on a page, just call it...

{elseif $main eq "whatever_you_want_to_name_your_page"}
{include file="customer/main/register.tpl"}
{include file="customer/main/secure_login_form.tpl"}
{include file="customer/main/change_password.tpl"}

You need to include the "requires" on "whatever_you_want_to_name_your_page.tpl"

drubarth 12-17-2008 04:55 PM

Re: Login Link
 
I'm running X-cart 4.1.11 and to get a login page, I just link to secure_login.php. Ideally you should use https, but either way. I'm not sure how long this program has been part of X-cart.

ChristineP 01-30-2009 05:24 AM

Re: Login Link
 
I've copied updated Laureon's mod with your code above. Now, I need to remove the previous {if $login ne ""} info and include what you have posted. Can you direct me where this should go in the myaccount.tpl?

I will also be adding a 'password protect' register login for this new login page. Any suggestions are welcome.

Christine


Quote:

Originally Posted by neaisha
if it helps anyone, here's how i displayed the login link if logged out and vice versa...

Code:


{if $login ne ""}

<form action="/store/include/login.php" method="post" name="loginform"><img src="{$ImagesDir}/spacer.gif" width="10" height="1" alt="" /><a href="javascript: document.loginform.submit();">log out</a>
<input name="mode" value="logout" type="hidden">
<input name="redirect" value="customer" type="hidden">
</form>


{else}

<a href="mysite/xcart/myaccount.php">login</a>

{/if}



ChristineP 01-30-2009 12:14 PM

Re: Login Link
 
Boomer,

I've tried both your code and Laureon's, but I'm not having any luck. When I used your suggestion to copy the code from my site login_form.tpl <form> </form>, I could see the code and no way to submit. When I used your code and corrected any portion that points to your /lab/, then the login page shows, but still no submit button. Any suggestions?

Christine


Quote:

Originally Posted by B00MER
Here is mine from cart-lab [3.5.5]

Code:

If you already have an account, you can authenticate yourself by filling in the form below. The fields marked with <font class="TableCenterCustomerFormOrange">*</font> are mandatory.


 
<table border=0>
<form action="/lab/include/login.php" method=post name=errorform>
<tr>
<td height="10" width="78" class=FormButton>Login</td>
<td width="10" height="10"><font class=Star>*</font></td>
<td width="282" height="10">
<input type="text" name="username" size="30">
</td>
</tr>
<tr>
<td height="10" width="78" class=FormButton>Password</td>
<td width="10" height="10"><font class=Star>*</font></td>
<td width="282" height="10">
<input type="password" name="password" size="30">
<input type="hidden" name="usertype" value="C">
<input type="hidden" name="redirect" value="customer">
<input type=hidden name=mode value=login>
</td>
</tr>
<tr>
<td height="10" width="78" class=FormButton></td>
<td width="10" height="10"></td>
<td width="282" height="10" class=ErrorMessage>
</td>
</tr>
<tr>
<td height="10" width="78" class=FormButton></td>
<td width="10" height="10" class=FormButton></td>
<td width="282" height="10">
[img]/lab/skin1/images/buttons/submit.gif[/img]
</td>
</tr>
</form>
</table>


 
If you do not have an account, you can easily
<font class=TableCenterCustomerform>register here</font>




secure_login.php in 4.0.x is in the root /


robertswww 02-03-2009 12:56 PM

Re: Login Link
 
Hi Christine,

In the sample code you posted it is showing a link to: skin1/images/buttons/submit.gif

I believe you will find no such file in your 4.1.x version of X-Cart.

There is now a skin1/buttons/ folder and inside you will find submit.tpl (TPL not GIF).

In place of the submit button, you may be able to use:

{include file="buttons/login_menu.tpl"}



Also, compare the source code on one of your existing web site login pages.

The customer login page uses this template: customer/main/secure_login_form.tpl

And here is part of the Submit Button code from that template:

{if $js_enabled}
{include file="buttons/submit.tpl" href="javascript:document.secureform.submit()" js_to_href="Y"}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_submit}
{/if}
</td>
</tr>
</form>

The above code shows how they are including the file: buttons/submit.tpl if Javascript is enabled, else include submit_wo_js.tpl


Both submit.tpl and login_menu.tpl then include file="buttons/button.tpl" to create the Submit button image.

One of those methods should work for you. Just work on a copy of the file and a test site (if you have one available).

Robert

ChristineP 02-03-2009 04:27 PM

Re: Login Link
 
Thanks for your reply. I've made some progress with the login page, but I am having trouble with the submit-login button. I tried your code and your suggestion using {include file="buttons/login_menu.tpl"} with my original code from auth.tpl. Tonight the link is working in IE7, but earlier today it didn't work in Safari or Firefox. Do you have any suggestions for me to password protect register.php?

Christine



Quote:

Originally Posted by robertswww
Hi Christine,

In the sample code you posted it is showing a link to: skin1/images/buttons/submit.gif

I believe you will find no such file in your 4.1.x version of X-Cart.

There is now a skin1/buttons/ folder and inside you will find submit.tpl (TPL not GIF).

In place of the submit button, you may be able to use:

{include file="buttons/login_menu.tpl"}



Also, compare the source code on one of your existing web site login pages.

The customer login page uses this template: customer/main/secure_login_form.tpl

And here is part of the Submit Button code from that template:

{if $js_enabled}
{include file="buttons/submit.tpl" href="javascript:document.secureform.submit()" js_to_href="Y"}
{else}
{include file="submit_wo_js.tpl" value=$lng.lbl_submit}
{/if}
</td>
</tr>
</form>

The above code shows how they are including the file: buttons/submit.tpl if Javascript is enabled, else include submit_wo_js.tpl


Both submit.tpl and login_menu.tpl then include file="buttons/button.tpl" to create the Submit button image.

One of those methods should work for you. Just work on a copy of the file and a test site (if you have one available).

Robert


robertswww 02-15-2009 01:15 PM

Re: Login Link
 
Quote:

Originally Posted by ChristineP
Do you have any suggestions for me to password protect register.php?

Christine

Hi Christine,

That is already built into X-Cart. Just go to: Admin --> General Settings, then select the "Security Options" sub-menu link. Under there you will find:

HTTPS options:

Use HTTPS for users' login and registration: (CHECK this box)

If instead, you actually want to password protect the register.php file, you can do that via C-Panel, and choose: Password Protect Directories. However, anyone who attempts to register will get a pop-up asking for the Username and Password.

Robert

ChristineP 02-16-2009 05:11 AM

Re: Login Link
 
Hi Robert,

Yes, I want to do the later part of your suggestion, to password protect register.php file. Per your suggestion, I checked our cpanel Password Protect Directories, though this only allows to protect an entire folder. Do I need to move my register.php to it's own folder to acheive this?

Christine

Quote:

Originally Posted by robertswww
Hi Christine,

That is already built into X-Cart. Just go to: Admin --> General Settings, then select the "Security Options" sub-menu link. Under there you will find:

HTTPS options:

Use HTTPS for users' login and registration: (CHECK this box)

If instead, you actually want to password protect the register.php file, you can do that via C-Panel, and choose: Password Protect Directories. However, anyone who attempts to register will get a pop-up asking for the Username and Password.

Robert


robertswww 02-16-2009 06:22 AM

Re: Login Link
 
Quote:

Originally Posted by ChristineP
Yes, I want to do the later part of your suggestion, to password protect register.php file. Per your suggestion, I checked our cpanel Password Protect Directories, though this only allows to protect an entire folder. Do I need to move my register.php to it's own folder to acheive this?

Hi Christine,

Try this... go back to your cPanel --> "Password Protect Directories".

1. Click on a Folder Icon (not folder name) to open it, such as: public_html
2. Keep doing this until you get to the lowest possible folder that contains the file you want to protect, such as: register.php

Add the folder protection to that lowest sub-folder. Go back to your web site via FTP and download the new .htaccess file that was added to that lowest sub-folder you just protected.

In the .htaccess file will be text such as:

AuthType Basic
AuthName "Restricted Access"
AuthUserFile "/home/[username]/.htpasswds/public_html/passwd"
require valid-user

Next, you will need to modify the .htaccess file so the protection applies to a single specific file using the <files> tags, as follows:

<Files [filename]></Files >

To protect the file "register.php", you would modify the .htaccess statement as follows:

<Files register.php>
AuthType Basic
AuthName "Restricted Access"
AuthUserFile "/home/[username]/.htpasswds/public_html/passwd"
require valid-user
</Files>

Preferably, test this on a test site, or a less important file, before taking it live.

Robert

aaronpost 02-19-2009 02:51 PM

Re: Login Link
 
anybody get this working in 4.2x without an SSL?

I've made a file in main catalog root "mainlogin.php" that I used the code from secure_login.php and commented out the following.

Code:

<?php
require "./auth.php";

/*
if (!empty($_GET[$XCART_SESSION_NAME])) {
    if (empty($_COOKIE[$XCART_SESSION_NAME]))
        $_COOKIE[$XCART_SESSION_NAME] = $XCARTSESSID;
    func_header_location("secure_login.php");
}
*/
require $xcart_dir."/include/categories.php";

$location[] = array(func_get_langvar_by_name("lbl_authentication"), "");

x_session_register("login_antibot_on");
x_session_register("username");
//if ($active_modules["Manufacturers"])
//    include $xcart_dir."/modules/Manufacturers/customer_manufacturers.php";

#
# Assign Smarty variables and show template
#

if ($login_antibot_on) {
    $smarty->assign("login_antibot_on", $login_antibot_on);
}
$smarty->assign("username", $username);
$smarty->assign("main", "secure_login_form");

# Assign the current location line
$smarty->assign("location", $location);

func_display("customer/home.tpl",$smarty);
?>


It displays the form fine but on login tries to go secure (https) and we don't have an ssl and don't plan on using one for this site... how do I bypass the secure login stuff?

ChristineP 02-24-2009 07:20 AM

Re: Login Link
 
Hi Robert,

I really want to try your suggestion! I've been back to my cpanel and I can get to the lowest-folder of /store/ and I add the name of the protected directory, though it protects the entire store instead of just the register.php. Do you know if I need to add/change something in the register.php to make this work?

Christine

Quote:

Originally Posted by robertswww
Hi Christine,

Try this... go back to your cPanel --> "Password Protect Directories".

1. Click on a Folder Icon (not folder name) to open it, such as: public_html
2. Keep doing this until you get to the lowest possible folder that contains the file you want to protect, such as: register.php

Add the folder protection to that lowest sub-folder. Go back to your web site via FTP and download the new .htaccess file that was added to that lowest sub-folder you just protected.

In the .htaccess file will be text such as:

AuthType Basic
AuthName "Restricted Access"
AuthUserFile "/home/[username]/.htpasswds/public_html/passwd"
require valid-user

Next, you will need to modify the .htaccess file so the protection applies to a single specific file using the <files> tags, as follows:

<Files [filename]></Files >

To protect the file "register.php", you would modify the .htaccess statement as follows:

<Files register.php>
AuthType Basic
AuthName "Restricted Access"
AuthUserFile "/home/[username]/.htpasswds/public_html/passwd"
require valid-user
</Files>

Preferably, test this on a test site, or a less important file, before taking it live.

Robert


robertswww 02-27-2009 10:32 AM

Re: Login Link
 
Quote:

Originally Posted by ChristineP
Hi Robert,
I really want to try your suggestion! I've been back to my cpanel and I can get to the lowest-folder of /store/ and I add the name of the protected directory, though it protects the entire store instead of just the register.php. Do you know if I need to add/change something in the register.php to make this work?
Christine

Hi Christine,

I have not tried it on a root-level file, but just make sure that after you applied the Password Protection via cPanel to your /store/ directory, that you then login to your store's server via FTP and download the new .htaccess file that was just created.

NOTE: You should first make sure you backup your old .htaccess file in case you want to revert, before applying any password protection in cPanel, because that will overwrite your old .htaccess file.

Once you have downloaded the new .htaccess file, make sure you add the <Files> lines at the beginning and end of the .htaccess code block to specify which file to assign the Password protection to (i.e. register.php in our example):
<Files register.php>
</Files>


See the full example in my previous post.

If that does not work, then someone else will need to jump in with another idea.

Robert

ChristineP 03-02-2009 11:59 AM

Re: Login Link
 
Awesome, this works! Thank you Robert.

Christine

ChristineP 06-03-2009 01:17 PM

Re: Login Link
 
I created a new static page and I'm using Boomers mod for the login. My problem is the location always directs to the current page -- which happens to be the static page. Once the login passes I want the customer to be directed to either their cart if there's any items selected in their cart else they'll go to the home.php. Any suggestions?

robertswww 06-12-2009 10:29 AM

Re: Login Link
 
Christine,

Try adjusting the VALUE of the Redirect statement of your login template...

<input type="hidden" name="redirect" value="{$redirect}" />

Try setting the value="http://www.YourHomePage.com" for starters.

You will need to add some IF - ELSE logic if you want to check their cart for contents, else go to the homepage.

Robert

Nour 07-30-2010 12:00 PM

Re: Login Link
 
I am lost
here is what I have done
edit [skin1]/common_templates.tpl and add:
Quote:

{elseif $main eq "mainlogin"}
{include file="customer/main/login.tpl"}

I add it that on the end of common_templates.tpl

step 2
I created a new tpl customer/main/login.tpl
and past the auth.tpl in it

Now just create the login.php file, with:

Quote:

<?

require "../smarty.php";
require "../config.php";
@include "./https.php";
require "./auth.php";

$smarty->assign("main","mainlogin");
$smarty->display("customer/home.tpl");

?>


the result
http://www.prestigedentalproducts.com/customer/login.php

it redirect me to
http://www.prestigedentalproducts.com/customer/index.php
Not Found



I have tried all different ways nothing worked !!!!!!!!!!!!!!!!

I have x-cart-4.3.2gold


All times are GMT -8. The time now is 11:13 PM.

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