Visitor IP address

Can someone help me?

My old website used Wordpress. There is the contact form contained the user IP address information too.
I’m curious, it is possible in Blocs?
When somebody send me a message through the contact form, I would like to know those IP address.
Is this possible?

When somebody visited a page, or click a button on my website would send me an e-mail notification.
Maybe with the user IP address.


1 Like

Hi Ben,

I’m by no means a coder or know PHP coding but I got it working :slight_smile:

After you’ve exported your site open the file “form_1.php” in the “includes” folder.
On line 16 you have this:

“Name: $name \nEmail: $email \nMessage: $message \n”;

change it to this:

"Name: $name \nEmail: $email \nMessage: message \n\nIP: "._SERVER[‘REMOTE_ADDR’];

Now you should get the IP in the receiving mail like this.

Your #2 question doesn’t sound like a good idea.
Better to use google analytics and get statistics that way.



Hi Jakerlund,

Thank you! :slight_smile:
I did it, but doesn’t working for me. :frowning:

The line “IP:” is empty.
I got an error message: error_log

PHP Notice:  Undefined variable: SERVER in .../includes/form_1.php on line 16

This is what I used. (copy/paste)

"Name: $name \nEmail: $email \nMessage: $message \n\nIP: ".$SERVER['REMOTEADDR'];

Do you have an idea?


1 Like

Hi again Ben,

The forum removed two underscores in the code.
Just put them back like in this image and it should be OK.


Hi Jakerlund,

Yes! Working! :slight_smile: :slight_smile: :slight_smile:
Thank you very much!

@Norm: Please build it into the next version. Simple but great and helpful information. Only plus 30 characters. Thanks in advance. :slight_smile:


Yay… glad it worked.

@Norm request for reCAPTCHA as well.

Ben you could either just have a patched file ready when needed.
Or… “probably not Norms choice” :innocent: but you could add it to Blocs app and it would get exported each time.


Hi Jakerlund,

How can I do it?

1 Like

Sorry that was a little more complicated and probably best left to professionals like Norm :innocent:
We don’t want to mess up Blocs.

1 Like

Recapture is coming.


@Norm: What about my request? I trust in you positive judgment. :slight_smile:

1 Like

Sorry, it has not been requested enough, maybe if 20 or 30 more users request it. I currently have other priorities with forms such as recapture and SMTP posting. This thread contains all you need to edit the posting script after export. It’s a very specific requirement I don’t think the majority of uses require at the moment.


Copy that.

If anybody wants this function, please push the like :heart: button.


Personally i think forms look good on a page but i prefer a regular mail.
In a form people can accidentally type their email wrong and you can’t reply them.
Or just put any mail for the fun of it, or use a VPN or fill the form from any place with wi-fi and so on.
If someone is serious and would like to get in contact they don’t mind using a regular mail link/button as they probably use regular mail daily.

Meanwhile if you still want this function just keep a patched file ready and upload/replace it when you publish.
Next time you publish just rename the patched file on the server, upload new content, delete the new file, rename the patched file back again. Voila :slight_smile:

1 Like

Hi Jakerlund,

I can do it. Even though I’m a designer, not a programmer.
Thank you again for your help. :slight_smile:

The main reason why I chose the Blocs:
“You don’t need to understand or use any coding to build a website with Blocs.”

I already have a list, post-export modifications.
It is currently approx 15 minutes. Every time I change something on my site.

1 Like

I’d love to see the list. You may be doing things others might want to see as part of blocsapp.


Yes I’d like to see that too.

The PHP file addition is the first on my list.

T’anks, Ben

1 Like

Hello, couple days late but, figured I would chime in on this one.

There are several issues that can arise with the mail to link. Its not compatible with every mail client for start, I couldn’t imagine testing a link in every mail client, bet there are a few, most will typically launch the client, typically something gets left out, maybe the subject in Outlook, or Cc in Gmail, Thunder Bird, whatever.

A form sends those variables (message, subject, to) via a POST request, its far safer because its not stored in the browser cache, what if the message contained privileged info, anybody can see it .

The mail to link can also be modified on the client side easily, so anybody could inject javascript in and alter any part of the message, view it, delete it, whatever. Forms ensure the data being sent can be verified by your server before anything happens, check for data integrity, validity, SQL injections, spell their own name wrong :wink: ect… where as the links, once that button is clicked, its go baby go, straight to the mail client, no integrity checking.

And lastly, this is my favorite btw, browser bots, more so email harvesting, its an awesome way to get spam, junk, malicious material, and once one gets that address, its for sale. Almost ruin an email account.

Anyways, to each is own, they both work, but thats why forms are the industry standard. Cheers!

1 Like

Nothing special.
Text animation - provided by @ckissi
Everywhere when I use toggle visibility, add manually onclick=“scrollToTarget(’#gxx’)”. This guarantees the original position. - I figured out. (I asked @Norm to integrate.)
From now on visitor IP address - provided by @Jakerlund . (I asked @Norm to integrate.)

1 Like

yay! Will you be integrating Google’s ReCaptcha @Norm? Or a different type of Captcha? (ie: distorted text image that user needs to recognize and type into a box, etc.) I prefer Google’s ReCaptcha as it’s the easiest for the user. (ie: “I am not a robot.” checkbox) - Warm Regards, - Randy

1 Like