Jump to content
Sign in to follow this  
Druide

User Tracking with Admin 1.31 Released

Recommended Posts

The title was Men's Leather Wallet. I have since taken out the apostrophe and it appears to be ok now.

 

please put it back and try this code,

 

replace at bottom of catalog/includes/functions/user_tracking.php

 

start at

$current_time = time();

 

// my replacement code for the server time issue

// if (!defined("TIME")) { $current_time = time(); } else { $current_time = TIME;}

$current_time = time();

   if ($skip_tracking[$wo_ip_address] != 1) 

  $corrected_page_desc = ereg_replace("[']", "'", $page_desc);

     tep_db_query("insert into " . TABLE_USER_TRACKING . " (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url, page_desc) values ('" . $wo_customer_id . "', '" . $wo_full_name . "', '" . $wo_session_id . "', '" . $wo_ip_address . "', '" . $current_time . "', '" . $current_time . "', '" . $wo_last_page_url . "', '" . $corrected_page_desc . "')");

 }

?>

 

 

let me know if it works, i'm not 100% sure just put some code together in a minute

 

I get Mysql errors too:

 

MYSQL QUERY ERROR REPORT 

--------------------------------------- 

1064 - You have an error in your SQL syntax near 'Da Pimp')' at line 1 



insert into user_tracking (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url, page_desc) values ('', 'Guest', '******************************', '**.***.**.**', '10******7', '104******7', '/product_info.php?products_id=127', 'Four Hos N' Da Pimp')

 

Ive applied this code but i keep getting errors.

 

Replaced:

        $current_time = time();

   if ($skip_tracking[$wo_ip_address] != 1)

     tep_db_query("insert into " . TABLE_USER_TRACKING . " (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url, page_desc) values ('" . $wo_customer_id . "', '" . $wo_full_name . "', '" . $wo_session_id . "', '" . $wo_ip_address . "', '" . $current_time . "', '" . $current_time . "', '" . $wo_last_page_url . "', '" . $page_desc . "')");

 }



?>

 

with:

 

$current_time = time();

   if ($skip_tracking[$wo_ip_address] != 1) 

  $corrected_page_desc = ereg_replace("[']", "'", $page_desc);

     tep_db_query("insert into " . TABLE_USER_TRACKING . " (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url, page_desc) values ('" . $wo_customer_id . "', '" . $wo_full_name . "', '" . $wo_session_id . "', '" . $wo_ip_address . "', '" . $current_time . "', '" . $current_time . "', '" . $wo_last_page_url . "', '" . $corrected_page_desc . "')");

 }

?>

Share this post


Link to post
Share on other sites

and your point is ???

 

i wrote the above code

 

you lost me here

wazzup ???


Robert

 

We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;)

Share this post


Link to post
Share on other sites

if im right then you have just changed the coding and was looking back or so, i am trying but i have absolutely NO CLUE what you want to point out in your message.

 

When did you got it ? , and how ?

version of osC ?, user tracking ?

 

YAIKS....

 

I am trying but ????


Robert

 

We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;)

Share this post


Link to post
Share on other sites

Im using User Tracking with Admin 1.34 on the M1 milestone.

 

I get this weird error when a user looks at a product:

 

MYSQL QUERY ERROR REPORT 

--------------------------------------- 

1064 - You have an error in your SQL syntax near 'Da Pimp')' at line 1 



insert into user_tracking (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url, page_desc) values ('', 'Guest', '******************************', '**.***.**.**', '10******7', '104******7', '/product_info.php?products_id=127', 'Four Hos N' Da Pimp')

 

Any idea whats wrong?

 

Thanks.

Share this post


Link to post
Share on other sites

was that from a date before you added

 

$corrected_page_desc = ereg_replace("[']", "'", $page_desc);

 

or AFTER you added it ?


Robert

 

We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;)

Share this post


Link to post
Share on other sites

In includes/functions/user_tracking.php i have this:

 

    $current_time = time();

   if ($skip_tracking[$wo_ip_address] != 1)

     tep_db_query("insert into " . TABLE_USER_TRACKING . " (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url, page_desc) values ('" . $wo_customer_id . "', '" . $wo_full_name . "', '" . $wo_session_id . "', '" . $wo_ip_address . "', '" . $current_time . "', '" . $current_time . "', '" . $wo_last_page_url . "', '" . $page_desc . "')");

 }



?>

 

I changed it to the code you posted above:

$current_time = time(); 

   if ($skip_tracking[$wo_ip_address] != 1) 

  $corrected_page_desc = ereg_replace("[']", "'", $page_desc); 

     tep_db_query("insert into " . TABLE_USER_TRACKING . " (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url, page_desc) values ('" . $wo_customer_id . "', '" . $wo_full_name . "', '" . $wo_session_id . "', '" . $wo_ip_address . "', '" . $current_time . "', '" . $current_time . "', '" . $wo_last_page_url . "', '" . $corrected_page_desc . "')"); 

 } 

?>

 

but it game me errors.

Share this post


Link to post
Share on other sites

The problem is the apostrophe after N in 'Four Hos N' Da Pimp'

 

either use the HTML tag for an apostrophe in your product names or use urlencode() in catalog/includes/functions/user_tracking.php to get the product name into the database in the right format:

if ($HTTP_GET_VARS['products_id']) {

   $page_desc_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and language_id = '" . $languages_id . "'");

   $page_desc_values = tep_db_fetch_array($page_desc_query);

$page_desc = urlencode($page_desc_values['products_name']);

} elseif ($HTTP_GET_VARS['cPath']) {

$cPath = $HTTP_GET_VARS['cPath'];

   $cPath_array = tep_parse_category_path($cPath);

   $cPath = implode('_', $cPath_array);

   $current_category_id = $cPath_array[(sizeof($cPath_array)-1)];

   $page_desc_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $current_category_id . "' and language_id = '" . $languages_id . "'");

   $page_desc_values = tep_db_fetch_array($page_desc_query);

$page_desc = urlencode($page_desc_values['categories_name']);

} else {

$page_desc = urlencode(addslashes(HEADING_TITLE));

}

 

Then, use urldecode() in admin/user_tracking.php to display the value properly:

<td class="dataTableContent" nowrap valign=top align="left"> <a href="<?php echo $pu['value']; ?>" target="_new"><?php if ($du['value']!=''){ echo urldecode($du['value']);} ?></a> </td>

 

- Greg

Share this post


Link to post
Share on other sites

Thanks. I applied the code change and will also update the product's description.

Will let you know if i get anymore errors.

 

Thanks for a wonderful script.

Share this post


Link to post
Share on other sites

I have found USER TRACKING to be one f the most

useful contributions with great commercial value to th

store owner.

 

I have installed recently and is working fine

atmy site http://affiliatesexcel.com

 

I have also installed another MUST HAVE contribution

Newsletter & Subscribers

 

However I get a conflict with a file snoopy1.class.php

which I presume is from USER TRACKING when I try to

post the subsriber info of the Newsletter & Subscribers

 

I get the following eror message

 

Warning: Cannot add header information - headers already sent by (output started at /home/affili43/affili43-www/catalog/includes/classes/snoopy1.class.php:2104) in /home/affili43/affili43-www/catalog/newsletters_subscribe.php on line 73

 

 

Is there any way to get these TWO cotributionsto work together ?

Any help will be great.

Share this post


Link to post
Share on other sites
I get the following eror message  

 

Warning: Cannot add header information - headers already sent by (output started at /home/affili43/affili43-www/catalog/includes/classes/snoopy1.class.php:2104) in /home/affili43/affili43-www/catalog/newsletters_subscribe.php on line 73  

 

 

Is there any way to get these TWO cotributionsto work together ?  

Any help will be great.  

It sounds like

you have a space or a blank line at the end of your newsletters_subscribes.php file. Check right after the ?> at the bottom. 8)


:-) Tony Was Here :-)

Share this post


Link to post
Share on other sites

Hello Tony,

 

Many thanks for yur reply

 

I have checked and couldn't find anything

 

Here is the end of the file

 

?>

<html>

<BODY text=#1D250D vLink=#848036 aLink=#555531 link=#3D451E bgColor=#FFFFFF topmargin="0" leftMargin="0" marginheight="2" marginwidth="0">

</body></html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites

That's the END of the file? That's a weird place to start an <html> tag. Could you either post or PM the whole file?

 

I suspect you'll just have to pull:

<html> 

<BODY text=#1D250D vLink=#848036 aLink=#555531 link=#3D451E bgColor=#FFFFFF topmargin="0" leftMargin="0" marginheight="2" marginwidth="0"> 

</body></html>

 

- Greg

Share this post


Link to post
Share on other sites

looks to me like

</body></html>  

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Looks like the php terminator is in the wrong place. try putting the ?> on its own line and make sure there is no space or linefeed after it.

 

hth, Tony


:-) Tony Was Here :-)

Share this post


Link to post
Share on other sites

Here is the file which came with the download

 

<? require('includes/application_top.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_NEWSLETTERS);

include "includes/classes/snoopy1.class.php";

if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"] !=

""){

$IP = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];

$proxy = $HTTP_SERVER_VARS["REMOTE_ADDR"];

$host =

@gethostbyaddr($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]);

}else{

$IP = $HTTP_SERVER_VARS["REMOTE_ADDR"];

$host =

@gethostbyaddr($HTTP_SERVER_VARS["REMOTE_ADDR"]);

}

 

//$host = gethostbyaddr($ipa);

$host = 'a';

$at = $host;

$hostdot = ".";

$cntry = strrchr($at, $hostdot);

$product_info = tep_db_query("select subscribers_id from " . TABLE_SUBSCRIBERS . " where subscribers_email_address = '" . $HTTP_POST_VARS['Email'] . "' ");

$date_now = date('Ymd');

 

if (!tep_db_num_rows($product_info)) {

 

$gender = '' ;

tep_db_query("insert into " . TABLE_SUBSCRIBERS . " (subscribers_email_address, subscribers_firstname, subscribers_lastname, subscribers_city, subscribers_state, subscribers_zip, subscribers_country_id, language, birthdate, subscribers_gender, subscribers_email_type, date_account_created, customers_newsletter, subscribers_blacklist, ip_address, hardiness_zone, interest1, interest2, interest3, interest4, interest5, status_sent1, source_import) values ('" . strtolower($HTTP_POST_VARS['Email']) . "', '" . ucwords(strtolower($HTTP_POST_VARS['firstname'])) . "', '" . ucwords(strtolower($HTTP_POST_VARS['lastname'])) . "', '" . ucwords(strtolower($HTTP_POST_VARS['city'])) . "', '" . $state . "', '" . $HTTP_POST_VARS['zip'] . "' , '" . $HTTP_POST_VARS['country'] . "', 'English', '01/01/1900', '" . $HTTP_POST_VARS['gender'] . "' , '" . $HTTP_POST_VARS['email_type'] . "', now() , '1','0', '" . $IP . "', '" . $domain4 . "', '1', '1', '1', '1', '1', '1', 'subscribe_newsletter')");

} else {

tep_db_query("update " . TABLE_SUBSCRIBERS . " set subscribers_firstname = '" . ucwords(strtolower($HTTP_POST_VARS['firstname'])) . "', subscribers_lastname = '" . ucwords(strtolower($HTTP_POST_VARS['lastname'])) . "', subscribers_email_type = '" . $HTTP_POST_VARS['email_type'] . "', subscribers_city = '" . $HTTP_POST_VARS['city'] . "' where subscribers_email_address = '" . $HTTP_POST_VARS['Email'] . "' ");

}

 

if ($email_type == "HTMLXX") {

// build the message content

$newsletter_id='3';

$update1_query = "select p.newsletter_info_subject, p.newsletter_info_logo, p.newsletter_info_title, p.newsletter_info_greetings, p.newsletter_info_intro, p.newsletter_info_promo1_name, p.newsletter_info_promo1_des, p.newsletter_info_promo1_img, p.newsletter_info_promo1_url, p.newsletter_info_promo1_link, p.newsletter_info_promo2_name, p.newsletter_info_promo2_des, p.newsletter_info_promo2_img, p.newsletter_info_promo2_url, p.newsletter_info_promo2_link, p.newsletter_info_final_para, p.newsletter_info_closing, q.newsletter_email_address, q.newsletter_template, q.newsletter_user, q.newsletter_site_name, q.newsletter_site_url, q.newsletter_phone, q.newsletter_mailing_address, q.newsletter_template from newsletter_info p , newsletter q where p.newsletter_id = '" . $newsletter_id . "' and q.newsletter_id = p.newsletter_id ";

$update1 = tep_db_query($update1_query);

$update1_values = tep_db_fetch_array($update1);

$gender = $HTTP_POST_VARS['gender'];

if ($gender == 'F') {

$email_greet1 = EMAIL_GREET_MS;

} else {

$email_greet1 = EMAIL_GREET_MR;

}

$customers_email_address = $HTTP_POST_VARS['Email'] ;

$from = 'STORE <customerservice@mystore.com>' ;

$subject = $update1_values['newsletter_info_subject'] ;

$firstname = $HTTP_POST_VARS['firstname'];

$lastname = $HTTP_POST_VARS['lastname'];

$name = $HTTP_POST_VARS['firstname'] . " " . $HTTP_POST_VARS['lastname'];

$store_owner = '';

$store_owner_email = '';

$domain4 = trim($domain4);

$email_address = strtolower($HTTP_POST_VARS['Email']);

$gender = $gender;

$email_text .= BLOCK1 . $update1_values['newsletter_info_title'] . BLOCK2 . $update1_values['newsletter_info_promo1_name'] . BLOCK3 . $update1_values['newsletter_info_promo1_url'] . BLOCK4 . $update1_values['newsletter_info_promo1_img'] . BLOCK5 . $update1_values['newsletter_info_promo1_des'] . BLOCK6 . $update1_values['newsletter_info_promo1_url'] . BLOCK7 . $update1_values['newsletter_info_promo1_link'] . BLOCK8 . BLOCK9 . $email_greet1 . $firstname . ' ' . $lastname . ', ' . $update1_values['newsletter_info_greetings'] . '<br>' . BLOCK10 . '<br>' . $update1_values['newsletter_info_intro'] . BLOCK11 . BLOCK12 . BLOCK13 . BLOCK14 . BLOCK15 . BLOCK16 . BLOCK17 . $update1_values['newsletter_info_final_para'] . BLOCK18 . $update1_values['newsletter_info_closing'] . BLOCK19 . BLOCK20 . $email_address . BLOCK22 . BLOCK23 . 'email=' . $email_address . '&action=view' . BLOCK23A . BLOCK24 . 'email=' . $email_address . '&action=view' . BLOCK24A . BLOCK25 ;

tep_mail1($name, $email_address, $subject, $email_text, $store_owner, $store_owner_email, '');

 

} else {

 

$message .= EMAIL_WELCOME . EMAIL_WELCOME1 . CLOSING_BLOCK1 . $HTTP_POST_VARS['Email'] . CLOSING_BLOCK2 . $HTTP_POST_VARS['Email'] . CLOSING_BLOCK3 . $HTTP_POST_VARS['Email'] . CLOSING_BLOCK4 ;

mail(strtolower($HTTP_POST_VARS['Email']), EMAIL_WELCOME_SUBJECT, $message, "From: " . EMAIL_FROM);

}

if ($HTTP_POST_VARS['origin']) {

 

if (@$HTTP_POST_VARS['connection'] == 'SSL') {

$connection_type = 'SSL';

} else {

$connection_type = 'NONSSL';

}

header('Location: ' . tep_href_link($HTTP_POST_VARS['origin'], '', $connection_type));

tep_exit();

} else {

header('Location: ' . tep_href_link(FILENAME_NEWSLETTERS_SUBSCRIBE_SUCCESS, '', 'NONSSL'));

tep_exit();

}

?>

<html>

<BODY text=#1D250D vLink=#848036 aLink=#555531 link=#3D451E bgColor=#FFFFFF topmargin="0" leftMargin="0" marginheight="2" marginwidth="0">

</body></html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites

you are in a complete wrong thread or did posted a COMPLETELY WRONG file !!!

 

waste of bandwidth is getting worse by the minute lately....


Robert

 

We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;)

Share this post


Link to post
Share on other sites

Hi Robert

 

I am sorry about the file but I thought Greg

had asked to see it

 

I realise that it is not the right thread but I have got this

problem when I have installed another contribution after

I got the USER TRACKING to work

Share this post


Link to post
Share on other sites

Look at the very last line of the file, change the bottom from this:

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

to this:

<?php 

 require(DIR_WS_INCLUDES . 'application_bottom.php'); 

?>

 

and see if that helps. 8)


:-) Tony Was Here :-)

Share this post


Link to post
Share on other sites

Hi Robert,

 

Could you please let me know how to

move this topic out of this thread.

I hope the moderator can do this

 

For Tony,

 

I did make the chane but still get the error message

 

home/affili43/affili43-www/catalog/newsletters_subscribe.php on line 73

 

Line 73 is

header('Location: ' . tep_href_link(FILENAME_NEWSLETTERS_SUBSCRIBE_SUCCESS, '', 'NONSSL'));

Share this post


Link to post
Share on other sites

Maybe it is a space right after the semicolon, other than that I haven't a clue! I think I was wrong in my previous post about the last line, that code should work just fine I think.

 

 

Tony


:-) Tony Was Here :-)

Share this post


Link to post
Share on other sites

Just to test and see if its working, have you tried:

 

<?php 

 require('includes/application_bottom.php'); 

?>

 

?

Share this post


Link to post
Share on other sites

Hi,guys

 

Is there a way i can delete all session at one time rather than each one?

 

a little tried of deleting each one every time.

 

thanks

sean

Share this post


Link to post
Share on other sites
Hi,guys

 

Is there a way i can delete or empty all session at one time rather than each one?

 

a little tried of deleting each one every time.

 

thanks

sean

Share this post


Link to post
Share on other sites
Look at the very last line of the file, change the bottom from this:

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

to this:

<?php 

 require(DIR_WS_INCLUDES . 'application_bottom.php'); 

?>

 

and see if that helps. 8)

 

 

that doesn't make ANY difference if you want to know

 

Just keep an EYE to those extra spaces or lines is enough but you will learn that the first day of using PHP


Robert

 

We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×