Hey guys. I’m experimenting with flash and I need some help:
There’s a variable called address. Question: How can I make this variable show the IP address of a person using php?
There’s another variable called nickname. This is just name for people to put in.
There’s a button.
Question: After clicking the button…How would I send both these variables to a notepad in a ordered way (I mean like showing your name with your IP next to it)? And each time someone clicks this button, the vars are sent to the notepad in lines. I also need the variables to be saved to the notepad so I can view it.
I tested the .php file before I posted and it worked perfect for me. It’s pretty simple:
The if else statement determines wether or not we have clicked the ‘submit’ button. When we click submit we ‘reload’ this same page but now the two variables defined in the form(ipAddr and nickname) exist in the PHP $_POST variable bacause our form uses the post method.
Back to the if else statement…if nickname is empty then we prompt the user for a nickname and we get her IP Address with the variable $REMOTE_ADDR.
Then we click submit and nickname is not empty. So we right ‘thank you’. We then open file ‘myText.txt’ in append mode so anything we right to it is added to the end. We right one line containing the nickname and the IP address and then we close the file.
Ok let me clear this for you. This has to be done in FLASH MX! I don’t want any Thank You’s. I want this to be done exactly as I said. I don’t want php controlling my variables, if nickname is empty, leave it alone, I’ll handle that with actionscript. I just want these 2 variables to be sent to logdata.txt on the click of a button.
It has to stay like these for reasons:
: IP’s variable (in flash) is called address.
: Nickname’s variable (in flash) is called nickname.
: The text file’s name is called logdata.txt.
Sorry for your trouble. I just need this asap and I’m getting frustrated.
Can you reattach the correct file? And also tell me what AS to use on the button. Thanks. :beam:
well what have you done so far? I’m not gonna post an fla showing how to get an IP, show me what you have so far and i can fix it… if you have nothing, [search][/search] instead of complaining!
Currently, I have only the php file and the .txt file I downloaded. It works really good cause I can view the ip’s and the name in the .txt file. Now, how would I set this up to work with flash?
I tried using loadVariablesNum(getAddr.php, 0); but it doesn’t load the IP from that file…
Never Mind. I changed your code to Jubba’s counterscript code and edited it…a lot. And it works perfectly with flash. One thing that still doesn’t happen is that the variable ipAddr doesn’t show the IP. I set my php code to: