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)
-   -   news letter subscription, getting 404 (https://forum.x-cart.com/showthread.php?t=9852)

jds580s 10-15-2004 05:42 AM

news letter subscription, getting 404
 
I am editing news.tpl and getting a 404 error when a user trys to subscribe.

Code:

<FORM action="{$xcart_web_dir}/mail/subscribe.php" name="subscribeform">
<INPUT type="hidden" name="redirect" value="{$redirect}">
<table width="400" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="44" class="maintext">Email*</td>
    <td width="356"><INPUT type="text" name="newsemail" size="45"></td>
  </tr>
  <tr>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td></td>
    <td>{include file="buttons/subscribe_menu.tpl"}
        <INPUT type="image" src="../images/Button_Submit.gif" border="0" onclick="javascript:document.subscribeform.submit()">
</td>
  </tr>
  <tr>
    <td></td>
    <td>to unsubscribe please click here</td>
  </tr>
</table>
</form>


I left the original submit button in there until everything is working, but it gives the same error. The 404 is looking for the error page
/xcart/mail/error_message.php instead of just in the /xcart folder but I'm not sure exactly where the error is. Any help would be appreciated.

jds580s 10-15-2004 06:36 AM

ok, perhaps this is more code related than template, I'm not sure.

It seems in the file mail/subscribe.php
everything is being processed fine until about 1/2 way into that file.
The logic looks something like

get email from form
if email is valid continue
if email doesn't all ready exist in the database continue
add email to database
send notification email to customer
send notification email to admin

If I plug in an invalid email it works fine and lets me know
if I plug in an existing email it works fine and lets me know
If I enter a new email address it gives the error

Here is the php (this is unmodified code)
Code:

$lists = func_query("SELECT * FROM $sql_tbl[newslists] WHERE avail='Y' AND show_as_news='Y'");
if (is_array($lists)) {
        foreach ($lists as $list) {
                db_query("INSERT INTO $sql_tbl[newslist_subscription] (listid, email, since_date) VALUES ('$list[listid]', '$email', '".time()."')");
        }
} else {
        func_header_location("/error_message.php?access_denied&id=58");
}


This is what seems to be tripping it up. I'm not sure what the issue is.

Using phpMyAdmin I can see that the table exists and has the one test email I put in there from the admin page.

Thanks!

jds580s 10-15-2004 06:41 AM

Wow I am no php guy at all, I just know a very little, but was able to figure it out.

It was wanting Available = yes and Show as News = yes
In admin I don't want it to show as news so I just needed to delete that from the PHP as well.

Problem resolved!

Jerrad 02-11-2005 03:32 PM

A few months old but exactly what I was looking for!
Got the subscribing working again, thanks to you jds!! :D :D :D


All times are GMT -8. The time now is 11:42 AM.

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