IP Address on Form

Is it possible I can show the user their ip address before they send their form? If so how would I do this when creating the element?
 
Oh, I'm really sorry about that... I didn't saw that your message was in the Fabrik 1.x forum... sorry sorry sorry...
Depending on what allows you to use PHP in Fabrik 1 (a FabrikCalc element?) you could use:
return $_SERVER['REMOTE_ADDR']; or return $_SERVER->REMOTE_ADDR; (I can't remember if it's an array or an object... an object I think)
 
I don't think we had a Calc element in 1.0. To be honest, I don't even have a working test install of 1.0 any more, it got broke when I was migrating to m new hardware last month.

You could use an eval'ed default on a simple field/text element. And it's an array, BTW, so it'd be ...

return $_SERVER['REMOTE_ADDR'];

But of course this will only get applied when creating a new form, not when editing an existing row from a table.

The alternative, if you don't need it submitted as form data, is to clone a template and add your own formatted output for it.

-- hugh


-- hugh
 
It's working now!!!!!!!!!!!!!!!!!!

Thanks!!!!!!!

return $_SERVER['REMOTE_ADDR'];

The above code works on the first try. I just created a text field element and it's all good now thanks.
 
Just remember, that's a "write once" thing, when submitting a new form. If you edit an existing row (from a different IP) and save it, the IP won't update.

-- hugh
 
Question about akismet rule

http://fabrikar.com/forums/showthread.php?t=7671

I created this just as you've suggested. The problem I have is that maybe it's not a machine sending in a bogus form but some kid just playing around. I want to stop that one IP address from re-filling out the form. I created the form and took your suggestings http://fabrikar.com/forums/showthread.php?p=67827#post67827 but now that I can save the IP Address in my email, I want to block a certain IP Address. Is this possible? To say I want to block 127.12.58.125 (for example). So the next time somebody from this ipaddress cannot send in the form again.
 
You'd probably have to clone a template for that form and customize it. Wrap the existing template code (the default.php file for whatever for template you are using) in something like:
PHP:
$ipaddress = $_SERVER['REMOTE_ADDR'];
if ($ipaddress == 'x.x.x.x') {
   echo "Go away!";
}
else {
   // usual template code goes here
}

Alternatively you could do this outside of J!/Fabrik entirely, and use a .htaccess to ban that IP from your site entirely.

-- hugh
 
Hugh: could that be an interesting form plugin to make (plugin Block IP with a textarea to enter the IPs to ban)?

EDIT: for Fabrik 2.0 of course
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top