Best way to record users ip address in flash

Hi all

Does anyone know if its possible to get the persons ip address within flash i knwo its possible with php using $_server[‘remote+_address’]; but can somthing like that b done within flash too or is it only php that can do that?

ive been asked to change the controls of the the game so u can control the character only thing is that not sure how i should go about it being based on user ip for loading and saving of controls in the mysql database.

I don’t think Flash can get the user’s IP itself.

However as you mentioned you can use a server-side script like PHP. So what you can do is get Flash to request the IP information from PHP.

Why not save the control settings to a cookie? It would reduce the server utilisation (which seems unnecessary) and the end user can reset to defaults simply by deleting the cookie itself. IP addresses are NOT a good measure for saving settings or information, some people use dynamic IP’s or proxy servers, which would immediately have people sharing or potentially overwriting each others settings. That or have a page login script for each user. :slight_smile:

are there any good flash login system tutorials around??

one way i have in mind is storing user name and password in a file and all their controls for the game be maintained in a txt document is this possible in flash as3?

IP addresses are NOT a good measure for saving settings or information, some people use dynamic IP’s or proxy servers

Good point Alex.

are there any good flash login system tutorials around??

You could try Googling.

Here is an example of a simple login system. It isn’t integrated with cookies/sessions but hopefully it can help you get started.

use LoadVars to call a php script that will return your IP address.