DIR Return Create A Forum - Home
---------------------------------------------------------
IMVUElite
HTML https://imvusins.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: IMVU Tricks
*****************************************************
#Post#: 78--------------------------------------------------
Getting Profile Visitors IPs
By: Lags Date: December 28, 2017, 7:26 pm
---------------------------------------------------------
Things You Will Need:
. Notepad (I recommend Notepad++)
. An IMVU account (of course)
. A webhost which provides PHP hosting and email service
. At least some basic knowledge of PHP and JavaScript
Step One:
Open up notepad and paste this script in it (I'll explain what
it does):
[quote]<?php
$ip = getenv(REMOTE_ADDR);
$avi = $_GET['AviName'];
mail("Your Email Address", "Your homepage visitor", "IP:
".$ip."\nAvatar: ".$avi);
?>[/quote]
First off, remove the part with "Your Email Address" with your
actual email address so that it emails it to you and the script
works.
We declare a variable named "$ip" and tell it to store the value
returned by the PHP function "getenv(REMOTE_ADDR);" which is the
function in PHP to get the IP address. Keep in mind that we're
dealing with two languages that are technically opposite to each
other. PHP is server oriented, it works on servers only and
performs server tasks. JavaScript is a client oriented language,
it cannot deal with IP obtaining or other server related tasks.
Another variable declaration by the name "$avi" which has the
return value of the function "$_GET['AviName'];" which is
the easiest way to send information to a PHP document is by
using the GET method, which appends information to the end of
the URL as a parameter/argument (for example,
"page.php?arg1=value"). PHP can access GET information by
accessing $_GET[x], where x is a string containing the name of
the argument. This is the most efficient method of passing
variable values from JavaScript to PHP in my opinion.
The last one is pretty self explanatory. It's the PHP mail()
function, whose first parameter is the email address to send the
email to, the second is the subject and the third and last one
is the actual body of the email message. Remember to always give
parameters to this function in quotes (preferably double
quotes).
Save the file with the name "get_info.php".
Step Two:
Sign up for a webhost which provides PHP hosting and email
service or log in to your account if you already have an account
with a host that provides those two things. Go to your file
manager and put the file "get_info.php" into preferably the root
dirctory, where the homepage of your website is present. It is
actually the folder which is sometimes called "htdocs" or
"public_html" or something like that. Upload the file and place
it there. The URL to your "get_info.php" file would be as
follows:
HTML http://www.yourwebsite.com/get_info.php
where "yourwebsite" replaces your website's address.
Step Three:
Go to your IMVU HP and edit one of the panels that have been set
to visible. REMEMBER: it is important that the panel you are
putting this script into is set to visible otherwise it won't
work. Edit the HTML of the panel and put this script in it and
save it:
[quote]<script type="text/javascript">
var ifr = document.createElement("iframe");
var vName =
document.getElementById("mininav-avname").innerHTML;
ifr.src = "
HTML http://www.yourwebsite.com/get_info.php?AviName="<br
/>+ vName;
ifr.style.visibility = "hidden";
document.body.appendChild(ifr);
</script>[/quote]
Remember to replace the part yourwebsite with your actual
website's URL. Right then, the first line declares a variable
named "ifr" which contains an iframe element (it is built-in in
JavaScript). The next line declares a variable named "vName"
which contains the avatar name of the person who visits your HP.
The next line directs the iframe to the get_info.php file with
an argument "AviName" followed by putting in the value contained
by the variable "vName".
Remember we used "$_GET['AviName']" in our PHP file? Well,
that's what is being used here.
The second-last line simply makes the iframe invisible/hidden.
The last line appends the created iframe to the body of the
parent page.
To test, after saving, refresh your HP or preview it. It should
send an email to you containing your IP address and your avatar
name.
*****************************************************