Jump to content

Recommended Posts

hey all;

 

I had a post in here I was getting help with and I can't figure out how to search for all my post so for that i apologize...

 

I'm needing to give a user an ip address prob is when I try to store in the the database it don't store.. it cuts it?

 

anyone help on how to do this and be able to refer to it per user

Link to comment
https://forums.phpfreaks.com/topic/221924-storing-and-retv-ipaddress/
Share on other sites

Pikachu2000 maybe you might have a way for me to do what I'm trying to do.. I want that when the user registers to inster into IPaddress feild a random ip address, then for me to be able reference that IP later as a way of pulling that user info

Here's your existing thread where you first asked the question - http://www.phpfreaks.com/forums/mysql-help/how-to-get-database-to-accept/

 

Here's your existing thread after you added inet_aton() to the code - http://www.phpfreaks.com/forums/php-coding-help/this-was-working-fine/

 

 

hey all;

 

I had a post in here I was getting help with and I can't figure out how to search for all my post so for that i apologize...

 

I'm needing to give a user an ip address prob is when I try to store in the the database it don't store.. it cuts it?

 

anyone help on how to do this and be able to refer to it per user

 

This script works, I didnt write it but I have used it successfully to store ip addresses

$ip = getRealIpAddr();

function getRealIpAddr() 
{ 
    if (!empty($_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet 
    { 
      $ip=$_SERVER['HTTP_CLIENT_IP']; 
    } 
    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy 
    { 
      $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; 
    } 
    else 
    { 
      $ip=$_SERVER['REMOTE_ADDR']; 
    } 
    return $ip; 
} 

 

ya thats using there real IP address what I'm trying to accomplish is when a user registers for the game they are given a random IP address, this ip address is stored in the database under a field IPaddress, later I want to be able to SELECT the user if there IP address matches the one entered into a form...

 

so really just a way of given a user a random ip address on register as a feild that is INSERTED into the database when they register and then being able to reference that IP address later...

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.