-
- 299 Posts
I need some help with a FormIt form where I am attempting to set a preHook that captures the submitter IP address, host and agent then include it in my message to the site admin.
In my call I have:
&preHooks=`submitInfo`
My snippet is:
<?php
function getServer( &$fields ){
// remote_addr
$fields['remote_addr']=$_SERVER['REMOTE_ADDR'];
$fields['remote_host']=$_SERVER['REMOTE_HOST'];
$fields['user_agent']=$_SERVER['HTTP_USER_AGENT'];
//return succes
return true;
}
?>
My form I have:
<input type="hidden" name="remote_addr" id="remote_addr" value="remote_addr">
<input type="hidden" name="remote_host" id="remote_host" value="remote_host">
<input type="hidden" name="remote_agent" id="remote_agent" value="remote_agent">
Any help is much appreciated.
Rico
Genius is one percent inspiration and ninety-nine percent perspiration.
Thomas A. Edison
MODx is great, but knowing how to use it well makes it perfect!
www.virtudraft.com
Security, security, security! |
Indonesian MODx Forum |
MODx Revo's cheatsheets |
MODx Evo's cheatsheets
Author of
Easy 2 Gallery 1.4.x,
PHPTidy,
spieFeed,
FileDownload R,
Upload To Users CMP,
Inherit Template TV,
LexRating,
ExerPlan,
Lingua,
virtuNewsletter,
Grid Class Key,
SmartTag,
prevNext
Maintainter/contributor of
Babel
Because it's hard to follow all topics on the forum, PING ME ON TWITTER
@_goldsky if you need my help.
-
- 299 Posts
I have not, did you have a solution?
from here:
http://rtfm.modx.com/display/ADDON/FormIt.Hooks#FormIt.Hooks-UsingpreHooks
snippet
<?php
$hook->setValue('remote_addr', $_SERVER['REMOTE_ADDR']);
$hook->setValue('remote_host', $_SERVER['REMOTE_HOST']);
$hook->setValue('user_agent', $_SERVER['HTTP_USER_AGENT']);
return true;
form
<input type="hidden" name="remote_addr" id="remote_addr" value="[[+fi.remote_addr]]">
<input type="hidden" name="remote_host" id="remote_host" value="[[+fi.remote_host]]">
<input type="hidden" name="remote_agent" id="remote_agent" value="[[+fi.remote_agent]]">
Rico
Genius is one percent inspiration and ninety-nine percent perspiration.
Thomas A. Edison
MODx is great, but knowing how to use it well makes it perfect!
www.virtudraft.com
Security, security, security! |
Indonesian MODx Forum |
MODx Revo's cheatsheets |
MODx Evo's cheatsheets
Author of
Easy 2 Gallery 1.4.x,
PHPTidy,
spieFeed,
FileDownload R,
Upload To Users CMP,
Inherit Template TV,
LexRating,
ExerPlan,
Lingua,
virtuNewsletter,
Grid Class Key,
SmartTag,
prevNext
Maintainter/contributor of
Babel
Because it's hard to follow all topics on the forum, PING ME ON TWITTER
@_goldsky if you need my help.
-
- 138 Posts
Hi.
I know it is an old topic, but have you managed to make this work ?
I have tried your code above, but only the IP address is working.
Thanks
Webdesigner and musician.