PDA

View Full Version : A Little help



Jamie
09-02-2005, 02:55 PM
I need abit of help
What is the Script for telling the users what they're IP is,
And what is the HTML/Script, for everytime you refresh the page a diff image comes up.
Like Habbohut (http://www.habbohut.com) Or Habbohotel
Thanks :)

Mentor
09-02-2005, 05:32 PM
IP can ether be done with php or shtml

shtml

just write

<!--#echo var="REMOTE_ADDR" -->


a good php script for it (can see threw proxies etc

<?php

$ip = "";
if ((isset($_SERVER['HTTP_X_FORWARDED_FOR'])) && (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])))
{
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
elseif ((isset($_SERVER['HTTP_CLIENT_IP'])) && (!empty($_SERVER['HTTP_CLIENT_IP'])))
{
$ip = explode(".",$_SERVER['HTTP_CLIENT_IP']);
$ip = $ip[3].".".$ip[2].".".$ip[1].".".$ip[0];
}
elseif ((!isset($_SERVER['HTTP_X_FORWARDED_FOR'])) || (empty($_SERVER['HTTP_X_FORWARDED_FOR'])))
{
if ((!isset($_SERVER['HTTP_CLIENT_IP'])) && (empty($_SERVER['HTTP_CLIENT_IP'])))
{
$ip = $_SERVER['REMOTE_ADDR'];
}
}
else
{
$ip = "0.0.0.0";
}

echo ( $ip );

?>

Random image can be done with a simple javascript

<SCRIPT LANGUAGE="JavaScript">

var newurls=new Array()
newurls[0]="http://www.thybag.co.uk/page"
newurls[1]="http://www.thybag.co.uk/page2"
newurls[2]="http://www.thybag.co.uk/page3"

var Images=new Array()
Images[0]="image1.gif"
Images[1]="image2.gif"
Images[2]="image3.gif"

now=new Date()
num=(now.getSeconds())%3

var adrs = newurls[num]
var pic = Images[num]

document.write("<A HREF=" + adrs + "><IMG SRC=" + pic +" BORDER=0></A>")

</SCRIPT>

it simply rendomly selcts one, and then attachesr the image and the url. u can ad exstra options with the

newurls[3]="http://www.thybag.co.uk/page4"

Images[3]="image4.gif"
by just adding them so they fit in with the above code

-JT-
09-02-2005, 06:36 PM
are you gonna help me with my site mentor?

Jamie
09-02-2005, 08:20 PM
Thanks alot for that :)

Want to hide these adverts? Register an account for free!