Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

click the url-link and link to streaming media


j158y

Recommended Posts

I got an idea that I want to set a link in my osc which can link to the streaming media of my media server. So I found that contribution about article mod is the good way that I can use the url because the mod doesn't has a shopping cart. But here comes the problem is I have to have customers click on the url and customers' data should be inserted to the database. I try to add php in article_info.php. It is not quit right. Because when the article_info is opened, the data is inserted right away even the url is not clicked. So I past the php in redirect.php this time is just what I want. Click the url and data was inserted in the database. But it is still wrong. I found the fields are empty except one field. Can somebody figure out my problem is? Thanks a lot.

 

article_info.php(red color's part is what I add in)

<?php

}

 

if ($article_info_values['articles_url']) {

 

$a='action=url&goto=';

 

if (isset($a)) {

$customer = tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");

$customer_values = tep_db_fetch_array($customer);

$articles = tep_db_query("select articles_id, articles_name from " . TABLE_ARTICLES_DESCRIPTION . " where articles_id = '" . $HTTP_GET_VARS['articles_id'] . "'");

$articles_values = tep_db_fetch_array($articles);

$articles_points = tep_db_query("select articles_id, articles_price from " . TABLE_ARTICLES . " where articles_id = '" . $HTTP_GET_VARS['articles_id'] . "'");

$articles_points_values = tep_db_fetch_array($articles_points);

$date_now = date('Ymd');

 

tep_db_query("insert into " . TABLE_ARTICLES_POINTS . " (customers_id,customers_name,articles_id,articles_name,date,articles_points) values ('" . $customer_id . "', '" . addslashes($customer_values['customers_firstname']) . "','" . $HTTP_GET_VARS['articles_id'] . "','" . addslashes($articles_values['articles_name']) . "',now(),'" . addslashes($articles_points_values['articles_price']) . "')");

} else {

tep_redirect(tep_href_link(FILENAME_DEFAULT));

}

 

 

?>

<tr>

<td class="main"><br>

 

<?php

echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_ARTICLE_INFO, 'action=url&goto=' . urlencode($article_info_values['articles_url']), 'NONSSL', true, false));

 

?>

 

redirect.php

 

require('includes/application_top.php');

 

switch ($HTTP_GET_VARS['action']) {

case 'banner': $banner_query = tep_db_query("select banners_url from " . TABLE_BANNERS . " where banners_id = '" . $HTTP_GET_VARS['goto'] . "'");

if (tep_db_num_rows($banner_query)) {

$banner = tep_db_fetch_array($banner_query);

tep_update_banner_click_count($HTTP_GET_VARS['goto']);

 

tep_redirect($banner['banners_url']);

} else {

tep_redirect(tep_href_link(FILENAME_DEFAULT));

}

break;

 

case 'url': if (isset($HTTP_GET_VARS['goto'])) {

$customer = tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");

$customer_values = tep_db_fetch_array($customer);

 

$articles_points = tep_db_query("select articles_id, articles_price from " . TABLE_ARTICLES . " where articles_id = '" . (int)$HTTP_GET_VARS['articles_id'] . "'");

$articles_points_values = tep_db_fetch_array($articles_points);

$date_now = date('Ymd');

 

tep_db_query("insert into " . TABLE_ARTICLES_POINTS . " (customers_id,customers_name,articles_id,date,articles_points) values ('" . $customer_id . "', '" . addslashes($customer_values['customers_firstname']) . "','" .(int)$HTTP_GET_VARS['articles_id'] . "',now(),'" . addslashes($articles_points_values['articles_price']) . "')");

 

tep_redirect('http://' . $HTTP_GET_VARS['goto']);

} else {

tep_redirect(tep_href_link(FILENAME_DEFAULT));

}

break;

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...