Adding Referring URLs to RS Form
STEP 1
1. Back up the site files of the site you are working on.
2. Login to the backend of the site(www.domain.com/administrator) mouse-over Extensions -> click on Template Manager and check to see which template is in use as default (you don't need to do/change anything, you just need to know which template files you will be working with)
3. Go to Filezilla (or your preferred FTP tool) and connect to the relevant site. Browse out to the Templates folder, go into the directory structure of your active template and download the index.php.
4. When you have the file downloaded, open it up in dreamweaver (or notepad) and search for the closing head tag - </head>
- Add this piece of code above it (as per below image):
//$document->setGenerator('Atlanta Web Design, Search Engine Optimization, and Internet Marketing Company | Grossiweb.com');
if ($_SESSION['source']=="") {
if($_SERVER['HTTP_REFERER']) { // referred from another web page
$_SESSION['source'] = $_SERVER['HTTP_REFERER'];
} //else {
//$_SESSION['source'] = "http://www.grossiweb.com/" ;// typed yourdomain.com directly into browser
//}
}
?>
5. Save the file and upload it to the same directory - templates/{template name}
STEP 2
1. Go to filezilla again, and go up to the root directory - Go to the components->com_rsform->controller directory and download the functions.php file to your hard drive (please note there are two files functions.php and functions.js - DO NOT TOUCH THE functions.js FILE)
2. When you have the functions.php file downloaded, open it up in dreamweaver and search for //mail admins
4. Replace the code that was within //mail admins and the closing } tag above functionRSgetSubmissionValue ($SubmissionId, $ComponentId) with this code:
//mail admins
$recipients = explode(',',$adminEmail['to']);
if(!empty($recipients))
foreach($recipients as $recipient)
if(!empty($recipient)){
$adminEmail['text']=$adminEmail['text']."<p>Refering Url: ".$_SESSION['source']."</p><p>test: ".$_SERVER['HTTP_REFERER']."</p><p>IP: ".$_SERVER['REMOTE_ADDR']."</p>";
//$adminEmail['text']=$adminEmail['text']."<p>Refering Url: ".$_SESSION['source']."</p>";
if($_GET['referid']!="")
$adminEmail['text'] .="<p>Refer ID: ".$_GET['referid']."</p>";
$RSadapter->mail($adminEmail['from'], $adminEmail['fromName'], $recipient, $adminEmail['subject'], $adminEmail['text'], $adminEmail['mode'], !empty($adminEmail['cc']) ? $adminEmail['cc'] : null, !empty($adminEmail['bcc']) ? $adminEmail['bcc'] : null, $adminEmail['files'], !empty($adminEmail['replyto']) ? $adminEmail['replyto'] : '');
}
$thankYouMessage = RSprocessField($r['Thankyou'],$SubmissionId);
eval($ScriptProcess2);
// SESSION quick hack - we base64 encode it here and decode it when we show it
$_SESSION['form'][$formId]['thankYouMessage'] = base64_encode($thankYouMessage);
$_SESSION['form'][$formId]['submissionId'] = $SubmissionId;
$_SESSION['rsform']="yes";
$RSadapter->redirect(JRequest::getURI());
}
return false;
}
5. Save the file, upload the file back to where it was (/public_html/components/com_rsform/controller) and test the form to see if it works. Please also go to backend and click on RS Form Component under Components -> RSForms PRo and ensure that everything is working correctly.
ALWAYS BACKUP THE SITE FIRST BEFORE YOU START - So we can revert back if accidents happen (and they do happen)