Forums

add the actually site where submit

chevron08 21 Oct, 2013
Hi,
first sorry for my bad english😉

i use one form in many sites under Joomla 2.5 and i wish to add the actually site where the user is submit the form.
This info should send in the subject field if it possible, outherwise the info could send in the content area.

In the v3 i have a php code but i don´t know where i can placed this.

regards
chevron08
GreyHead 21 Oct, 2013
Hi chevron08,

You can add PHP in a Custom Code action in the form ON Load event (or in the Others tab if you are using the Easy Wizard).

Bob
chevron08 21 Oct, 2013
can i use the php code from the v3 also in the v4?

<?php
/**
* @package ChronoForms
* @copyright Copyright (C) 2010 Bob Janes. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
/* ensure that this file is not called directly */
// uncomment the following line if you include this code from a file
// defined('_JEXEC') or die('Restricted access');
$gh_session =& JFactory::getSession();
$gh_ip =& $gh_session->get('gh_ip', '000.000.000.000', 'gh');
$gh_pages =& $gh_session->get('gh_pages', array(), 'gh');
$gh_referers =& $gh_session->get('gh_referers', array(), 'gh');
// add the user IP address
$message = "";
$message .= "<div >IP: $gh_ip</div>";
// add the referer URL

if ( count($gh_referers) ) {

  $message .= "<p>Last referer: end($referers)</p>";
}

// add the pages visited
if ( count($gh_pages) ) {
$i = 1;
$temp = array();
foreach ( $gh_pages as $page ) {
if ( $page ) {
$temp[] = "<p>Page visited $i: $page</p>";
$i++;
}
}
$message .= "<div>".implode('br />', $temp)."</div>";
}
// add the search engine keywords
if ( count($keywords) ) {
$i = 1;
$temp = array();
foreach ( $keywords as $keyword ) {
$temp[] = "Keyword $i: $keyword";
$i++;
}
$message .= "<div>".implode('br />', $temp)."</div>";
}
JRequest::setVar('tracker_message', $message, 'post');
// function to extract keyword form a search engine URI
function getKeywords($query)
{
if ( strpos($query, "google.") ) {
$pattern = '%^.*/(?:search|maps).*[?&]q=(.*)%';
} elseif ( strpos($query, "msn.") || strpos($query, "live") ) {
$pattern = '/^.*q=(.*)$/';
} elseif ( strpos($query, "yahoo.") ) {
$pattern = '/^.*[?&]p=(.*)$/';
} elseif ( strpos($query, "ask.") ) {
$pattern = '/^.*[?&]q=(.*)$/';
} elseif ( strpos($query, "bing.") ) {
$pattern = '/^.*[?&]q=(.*)$/';
} else {
return false;
}
preg_match($pattern, $query, $matches);
if ( strpos($matches[1], '&') ) {
$querystr = substr($matches[1], 0, strpos($matches[1], '&'));
} else {
$querystr = $matches[1];
}
return urldecode($querystr);
}
?>


my favorite are that i put the Sitetitle into the email subject like "send from %sitetitle". Is this possible?

regards
chevron08 22 Oct, 2013
HI,
i tested the Code in the tab custom PHP code, look screen.
http://screencast.com/t/nSvyWaCPFnS

but this is not working😟

I think the Code is only for v3 and i use v4 in joomla2.5, did you have an code for v4?

regards
chevron08
GreyHead 22 Oct, 2013
Hi chevron08,

I haven't seen that code for a long time. I had a quick look through and it should still work with the current version of Joomla! but it isn't complete. That snippet just saves a list - it doesn't do anything with it. There must be some more somewhere.

Bob
chevron08 24 Oct, 2013
Hi,
i didn´t find more code in old v3.
Is there any code snippet gallery?
or do you have a code for me?
it very important for me.
thanks
regards
chevron08
chevron08 24 Oct, 2013
hi,
i buy this tutorial again.
but this is not working.
i install jumi and put the code in it and the other code i put in the Before Emails Code Area.
an other problem is i get the same email 3 times!?! 1 with data 2 without data, very strange.
regards
chevron08
GreyHead 24 Oct, 2013
Hi chevron08,

I can't tell from this why the code isn't working :-(

Do you have all three emails enabled on your form?

Bob

PS I refunded your re-purchase of the document as you'd bought it before.
chevron08 24 Oct, 2013
hi,
ok it´s send only one mail now.
but i´m so defused how is jumi worked. if i paste the code in a jumi module the beginning php was missing after saving.
If there any step by step tutorial to implement a user tracking. I need only the information of the sending page (url).
regards
GreyHead 25 Oct, 2013
Hi chevron08,

There does seem to be a problem with adding PHP in the Jumi Module - I think that the more recent versions of Joomla! sanitize the values from the boxes. I got it to work recently by adding the code to the Jumi component and then adding the record ID (something like *3 I think) in a box in the Module.

Bob
chevron08 13 Nov, 2013
Hi Bob,

now i have put the code into the jumi compo directly and in the Module i set *4 for the ID. No Error were display but the tracking didn´t work😟

this is the Code that i use in for Jumi:
<?php
/**
* @package Jumi
* @copyright Copyright (C) 2010 Bob Janes. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
/* ensure that this file is not called directly */
// uncomment the following line if you include this code from a file
//defined("_JEXEC") or die("Restricted access");
// load the user session
$gh_session =& JFactory::getSession();
// store ip address
if ( !$gh_session->has('gh_ip', 'gh') ) {
$gh_session->set('gh_ip', gh_getip(), 'gh');
}// store referer
$gh_referers =& $gh_session->get('gh_referers', array(), 'gh');
$gh_referer = JRequest::getString('HTTP_REFERER', 'HTTP_REFERER not set', 'server');
if ( (strpos($gh_referer, JURI::base()) === false )
&& !in_array($gh_referer, $gh_referers) ) {
$gh_referers[] = $gh_referer;
$gh_session->set('gh_referers', $gh_referers, 'gh');
}
// store page
$gh_uri =& JFactory::getURI();
$gh_pages =& $gh_session->get('gh_pages', array(), 'gh');
if ( end($gh_pages) != $gh_uri->toString() ) {
$gh_pages[] = $gh_uri->toString();
$gh_session->set('gh_pages', $gh_pages, 'gh');
}
function gh_getip() {
if ( isset($_SERVER) ) {
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$ip_addr = $_SERVER["HTTP_X_FORWARDED_FOR"];
} else if (isset($_SERVER["HTTP_CLIENT_IP"])) {
$ip_addr = $_SERVER["HTTP_CLIENT_IP"];
} else {
$ip_addr = $_SERVER["REMOTE_ADDR"];
}
} else {
if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
$ip_addr = getenv( 'HTTP_X_FORWARDED_FOR' );
} else if ( getenv( 'HTTP_CLIENT_IP' ) ) {
$ip_addr = getenv( 'HTTP_CLIENT_IP' );
} else {
$ip_addr = getenv( 'REMOTE_ADDR' );
}
}
return $ip_addr;
}
?>


And this is the Code i put into the chronofrom (before HTML):
<?php
/**
* @package ChronoForms
* @copyright Copyright (C) 2010 Bob Janes. All rights reserved.
* @license GNU/GPL, see LICENSE.php
*/
/* ensure that this file is not called directly */
// uncomment the following line if you include this code from a file
// defined('_JEXEC') or die('Restricted access');
$gh_session =& JFactory::getSession();
$gh_ip =& $gh_session->get('gh_ip', '000.000.000.000', 'gh');
$gh_pages =& $gh_session->get('gh_pages', array(), 'gh');
$gh_referers =& $gh_session->get('gh_referers', array(), 'gh');
// add the user IP address
$message = "";
$message .= "<div >IP: $gh_ip</div>";
// add the referer URL
if ( count($gh_referers) ) {
$i = 1;
$temp = $keywords = array();
foreach ( $gh_referers as $referer ) {
$temp[] = "<p>Referer $i: $referer</p>";
$keywords_used = getKeywords($referer);
if ( $keywords_used ) {
	$keywords[] = $keywords_used;
}
$i++;
}
$message .= "<div>".implode('br />', $temp)."</div>";
}
// add the pages visited
if ( count($gh_pages) ) {
$i = 1;
$temp = array();
foreach ( $gh_pages as $page ) {
if ( $page ) {
$temp[] = "<p>Page visited $i: $page</p>";
$i++;
}
}
$message .= "<div>".implode('br />', $temp)."</div>";
}
// add the search engine keywords
if ( count($keywords) ) {
$i = 1;
$temp = array();
foreach ( $keywords as $keyword ) {
$temp[] = "Keyword $i: $keyword";
$i++;
}
$message .= "<div>".implode('br />', $temp)."</div>";
}
JRequest::setVar('tracker_message', $message, 'post');
// function to extract keyword form a search engine URI
function getKeywords($query)
{
if ( strpos($query, "google.") ) {
$pattern = '%^.*/(?:search|maps).*[?&]q=(.*)%';
} elseif ( strpos($query, "msn.") || strpos($query, "live") ) {
$pattern = '/^.*q=(.*)$/';
} elseif ( strpos($query, "yahoo.") ) {
$pattern = '/^.*[?&]p=(.*)$/';
} elseif ( strpos($query, "ask.") ) {
$pattern = '/^.*[?&]q=(.*)$/';
} elseif ( strpos($query, "bing.") ) {
$pattern = '/^.*[?&]q=(.*)$/';
} else {
return false;
}
preg_match($pattern, $query, $matches);
if ( strpos($matches[1], '&') ) {
$querystr = substr($matches[1], 0, strpos($matches[1], '&'));
} else {
$querystr = $matches[1];
}
return urldecode($querystr);
}
?>


You know that is the Code out of the v3 and i use the v4. It´s very important for me to have a tracking for my forms. I use one form in many sites and i must know from where the form was sending!

regards
chevron08
chevron08 25 Nov, 2013
Hy Bob,
do you have some tips for me!
regards
chevron08
chevron08 04 Apr, 2014
Hi Bob,
here i´m again😟
the problem with the tracker i didn´t solve this...
here is a screen where i put the code in the form, i this code position correct?
http://screencast.com/t/8ksXoLh0wp
please i can´t fix this without your brain😉
regards
chevron08
Max_admin 05 Apr, 2014
Hi Chevron,

Which Chronforms version do you have ?

You just need to get the url at which the form was submitted in the email, correct ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
chevron08 08 Apr, 2014
Hi,
i use the version 4.0 RC3.5.1
and yes i need the url in the email from was submitted!
thanks for your help
regards
chevron08
Max_admin 09 Apr, 2014
Try to add a hidden field in your form and set its value to:
<?php echo $_SERVER["REQUEST_URI"]; ?>


Then use the field's name in your email between 2 brackets {field_name}

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
chevron08 09 Apr, 2014
Answer
Hi Max,

YOU MAKE MY DAY😀😀😀

Thank you very much

regards
chevron08
This topic is locked and no more replies can be posted.