Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  agyat : (23 May 2013 - 01:23 AM) Wow! Mr. Sb Back Home.
@  OpaQue : (23 May 2013 - 12:44 AM) Ting
@  OpaQue : (24 April 2013 - 02:44 PM) I guess, Time to run Mycent script.
@  OpaQue : (24 April 2013 - 02:43 PM) wow.. not much spam. except habatt posting lot of links.. :P
@  yordan : (23 April 2013 - 01:04 PM) You're welcome, agyat. Nice to have been helpful. Second lesson: try full words, "you" instead of "EW".
@  agyat : (23 April 2013 - 05:03 AM) @YORDAN: tHANK EW FOR YOUR FIRST LESSON.   :D
@  yordan : (22 April 2013 - 09:43 PM) @agyat : "why don't you help me", or "please help me", or "please teach us"
@  yordan : (22 April 2013 - 09:42 PM) welcome back, velma
@  velma : (22 April 2013 - 07:51 AM) **yawns** Good to be back, wonder what is going on here :)
@  agyat : (22 April 2013 - 03:50 AM) Oh! so, why don't help me learn english..
@  yordan : (21 April 2013 - 08:38 PM) The goal mentioned by shiu : "learning english, learning computer"
@  agyat : (21 April 2013 - 06:31 PM) WHAT GOAL?
@  yordan : (20 April 2013 - 10:39 AM) yes, that's our goal. simultaneouly learning English and teaching/learning computer using.
@  shiyu : (20 April 2013 - 07:30 AM) learning english,learning computer
@  yordan : (19 April 2013 - 01:11 PM) Oh, I see, it's just a trick in order to force people looking at your texte. Somehow smart, maybe.
@  agyat : (19 April 2013 - 02:54 AM) And of course I know it is not SEO friendly.
@  agyat : (19 April 2013 - 02:52 AM) There may be two possible answers for that ....


1) Shout was posted using mobile keypad.

2) To force people read content carefully and/or with more concentration.
@  agyat : (19 April 2013 - 02:49 AM) There may be two possible answers for that ....
@  yordan : (18 April 2013 - 09:35 PM) however, why this mixing of capital letters in the middle of your text?
@  agyat : (18 April 2013 - 11:10 AM) false feelings.

Replying to Getting Ip


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

Quatrux

Posted 12 August 2008 - 10:42 AM

Here is also a way to get the ip address from a user using php language, even though this is not the best method, but I am using it and don't really have problems, I will show this example in a class, those who know php could easily just change it or something like that :mellow:

class MyClass {

	/**
	 * @access public
	 * @variables
	 */

	var $ipAddress, $proxyAddress = '';

	function setIPAddress() {

			if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {

				if (isset($_SERVER['HTTP_CLIENT_IP'])) { $this->proxyAddress = $_SERVER['HTTP_CLIENT_IP']; }
				else 												{ $this->proxyAddress = $_SERVER['REMOTE_ADDR']; }
																	  $this->ipAddress	= $_SERVER['HTTP_X_FORWARDED_FOR']; }
		elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {	  $this->ipAddress	= $_SERVER['HTTP_CLIENT_IP']; }
		  else 												 {	  $this->ipAddress	= $_SERVER['REMOTE_ADDR']; }

	}
}

and whenever you want to show the ip address you just do:

$MyClass = new MyClass();

and you can call the function once like $Myclass->setIPAddress(); and you'll get the value and you could use it like this:

echo $MyClass->ipAddress or echo $MyClass->proxyAddress but I would do it in a constructor of that class, the class constructor is a function/method of that class and needs to have the same name as the class in other languages it also can be init() like on Zend framework on PHP.. A constructor here is good because this function needs to be done/executed/called only once, also it could be done differently as I said, but this is just one of a lot of methods which is possible.

levimage

Posted 05 August 2008 - 06:38 PM

Do you mean like how some online messenger/chat(s) detect if more than one user logs in or is logged in from an IP address or if someone from a specific ip is creating multiple user accounts within a certain time period. Maybe you should just have like a cool off period verses denying or banning someone. Cause their may be multiple people using your services from the same place like a pubic wifi, school, or building.

Just something to think about.

sparkx

Posted 04 August 2008 - 03:49 PM

Just a side message there is NO way to track internet users other then real-time IP lookup or backtracking (which is very hard to do and is usually only used in movies). I would say probably not to even bother making a script like this but rather only accept the referral if the new user is active (for example if it is a forum then make a minimum of 10 posts and remove the referral if the new user gets banned for spamming est.). If one person wants to do that much work just to get a referral then let them have it...

Remember Cookies can be edited or deleted and IPs can be changed in less then 30 seconds.

Hope this helps,
Sparkx

Jeigh

Posted 03 August 2008 - 02:17 PM

You've probably already thought of this, but you might want to store a long term cookie as a secondary check. IP's don't change a lot anymore but they can still depending on the connection type or the users dedication lol, so adding a little cookie when they register just sort of adds a second layer that they would need to think to clear in order to get around your checks. Then again if it's not that important and you just want to limit it from happening frequently then the IP thing would be more then enough obviously.

FirefoxRocks

Posted 02 August 2008 - 06:27 PM

The IP address is stored in a $_SERVER[] variable, in this case it is the REMOTE_ADDR variable. So it would be:
$_SERVER['remote_addr'];

If you want to store that in a variable (which you probably can figure out) and display it, you do this:
$ip = $_SERVER['remote_addr'];
echo($ip);

khalilov

Posted 01 August 2008 - 03:09 PM

Whats the php code to get the users IP, i want to start a referal program and i don't want to people to refer themselves:P

Review the complete topic (launches new window)