GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Tech Why isnt this capturing & sending the ip address? (https://gfy.com/showthread.php?t=1355854)

Publisher Bucks 06-28-2022 10:37 AM

Why isnt this capturing & sending the ip address?
 
Quote:

<form action="https://www.domain.com/submission.php" method="post">
<input type="text" name="name" id="name" style="width: 180px" value="Full Name" />
<input type="text" name="email" id="email" style="width: 180px" value="Email Address" />
<input type="hidden" name="date" id="date" style="width: 180px" value="June 28, 2022, 12:28 pm" />
<input type="hidden" name="ip" id="ip" style="width: 180px" value="123.12.12.123" />
<input type="submit" value="Get Updates" />
</form>
When I view the source of the page, the ip address shows, it just doesnt seem to be storing it in the DB?

These are the row settings I'm using in the table, are these right?

Row: address
Type: varbinary(16)
Null: No
Default: None

Is there a specific setting needed to store the ip address of a submission? If i use varbinary(16) I get nothing and binary(16) gives me this:

0x00000000000000000000000000000000

:Oh crap

Publisher Bucks 06-28-2022 10:39 AM

Oh, and this is how I'm attempting to capture the ip on the form:

Quote:

<input type="hidden" name="ip" id="ip" style="width: 180px" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>" />

Publisher Bucks 06-28-2022 10:43 AM

Nmind, found the issue as soon as posted :1orglaugh

I had the wrong form field in the code.

k0nr4d 06-28-2022 10:51 AM

You could also just use $_SERVER['REMOTE_ADDR'] directly on submission.php which would prevent anyone from manipulating it...

Publisher Bucks 06-28-2022 12:02 PM

Quote:

Originally Posted by k0nr4d (Post 23016379)
You could also just use $_SERVER['REMOTE_ADDR'] directly on submission.php which would prevent anyone from manipulating it...

Interesting, I didnt even think of that, does that work the same for anything form related, such as time, etc?

Publisher Bucks 06-28-2022 12:04 PM

I'd basically just have to add this right?

Quote:

$address = mysqli_real_escape_string($link, $_SERVER['REMOTE_ADDR']['address']);

k0nr4d 06-28-2022 12:23 PM

Quote:

Originally Posted by Publisher Bucks (Post 23016394)
I'd basically just have to add this right?

$address = mysqli_real_escape_string($link, $_SERVER['REMOTE_ADDR']);

It works for time too.
$date = date("F j, Y, g:i a");

Publisher Bucks 06-28-2022 12:28 PM

Quote:

Originally Posted by k0nr4d (Post 23016399)
$address = mysqli_real_escape_string($link, $_SERVER['REMOTE_ADDR']);

It works for time too.
$date = date("F j, Y, g:i a");

Awesome, thank you for the advice and suggestion :thumbsup

redwhiteandblue 06-28-2022 12:48 PM

Quote:

Originally Posted by Publisher Bucks (Post 23016392)
Interesting, I didnt even think of that, does that work the same for anything form related, such as time, etc?

Time isn't form related! You can always get the current time on the server with time() which returns a UNIX timestamp, you can convert that into a readable date/time string with date(). If you put it in a hidden input field in the form it will give you the time you served the page to the client, not the time the user submitted it. If you get it when processing the POSTed form it will be the time on the server when the form was received back from the client.


All times are GMT -7. The time now is 09:39 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123