N-Computing:-Get Client IP of virtual desktops in php? - php

I am using N-Computing(N-Computing is hardware which create virtual desktops which enable multiple users to simultaneously share a single operating system instance.) server to run the project on LAN.
I run the system at client PC using server ip insted of localhost
i.e.192.168.1.33/demo/demo.php .
My Problem is i want to fetch ip address of client PC using php code which run at server.
I tried some code which gives the ip address of server.

This is not possible because with N-Computing, it actually creates multiple OS users on the same physical computer. In reality its like multiple users logged in onto one laptop/computer with different accounts. And as you might suspect, it means these users share the same hardware, mac addresses and ip address on all the network interfaces that they have.
If you do ipconfig on any of you users you will notice the ip address will always be 192.168.1.33. This means PHP will give you the same IP address for all your logged in users..
That said, you could maybe give more information as to what exactly you want to achieve, so that we can suggest a workaround.
EDIT
To get different IPs please try NComputing IP Utility, this will give different ips for your clients, THEN you can use the php script.
echo $_SERVER['REMOTE_ADDR'];
to get the IP address of the user.....

Related

Why am i getting different ip by using get content - PHP

So why am I need my own ip by using get content? I want to use some tv channels which is m3u8 file and using m3u8?wmsAuthSign=code
wmsAuthSign code is changing everytime the page refresh it self and they are getting ip adrress inside of that code.
So i can't play the tv channel by my servers ip !
the code i gave down below is just an example :D
<?php
$myURL = "https://whatismyipaddress.com/ip-lookup";
$lines = file($myURL);
echo $lines[145];
?>
Is there any way that i can change it to my one ip adresse?
If you mean the client (browsers) IP:
That code is being executed on your server, so the machine fetching that URL is your server. The response then has your server's IP address.
If you want to get the IP address of the user that's accessing the server, you could use some of the $_SERVER variables (like $_SERVER['REMOTE_ADDR']) but due to the way the internet works, that may not be the user's IP address.
Your best bet there is to use javascript that runs on the user's browser to identify the user's IP address - though, since that is really under the user's control, you can't be certain it's accurate either.
If you mean you're getting the IP of a different server, not your web server: the method you're using only determines the IP address of the server acting as a gateway to the greater internet. If your web server is behind a firewall, you'll be getting the IP of the firewall. You may want to identify the web server's local IP address instead.
Because the server is executing the PHP code and is requesting the website, if you want to get the IP address of the current user see How to get the client IP address in PHP?

How can i access to my PHP application on my smartphone using a DNS local adress

I have a PHP application running on wamp3. I have being able to enable people of my local network getting access to the application while typing 192.168.2.22/myapps. I'm looking how to make them instead type www.myapps.dev for to get access to the application.
French speaking to... but answer will be in English ;)
So, in order to access a server, you need its IP.
First way to access
Like you already do, directly through the IP
Common way to access
The user is calling a DNS name which is translated by an IP using a DNS server. Using this technique will imply technical abilities in server management and networking.
Developer way
The user configures the specified host on his terminal. On Linux and Android, you can update /etc/hosts file in order to add IP / DNS correlations. You may find "Hosts editor" application in Play Store.
Note that this technique won't be available for iOS users.

accessing application from different computer

I have an application created in php and using MySQL for back-end. I connect to the front-end of application on my PC by typing
(http://localhost:8080/my_data/login.php)
in the browser. the database is in my computer and php files are also in my computer. i don't know how can other users can get access to the application from the browser in their pc..i am not good with networking stuff.
(I am assuming Windows). At your machine at a command prompt type ipconfig to get your IP address:
specific instructions:
click windows orb,
then type cmd in text area
type ipconfig and press enter
line reading IPv4 Address will have an IP address x.x.x.x... use that IP address in place of localhost.
Assuming others on network are within the same subnet and not have vlans and what not, it should work.
a URL uses something called DNS or a hosts file to lookup that name and translate that common name to an IP address, by specifying the IP address and port, you avoid the need for the DNS, assuming the IP address is "Routable" for the users needed to access it.
Here's an example: Type http://74.125.225.176 in a browser and you get google search! There's a lot more to this really, but this is just the basic workings.

PHP ,How to detect if somebody logins with two account from one PC?

I need to prevent my users to log in with two accounts at the same time with one PC , i tried to shoot out users with the same IP addresses but it will not allow to the users that they logging in from one router with different PCs, because they have equal IP addresses.
In other word i want to know if some guys with equal IPs using one device or different devices.
In your case, using both MAC address and IP address should satisfy your request.
MAC Address can used to classify clients within a local network.
So it can classify client share the same IP address by a router.
But get the MAC adddress of client may not possible by using PHP.
Here is some reference and a case using Java Applet. I hope it can help you.
GET the Mac Address
`if($_SESSION['userid']=='')
{
$_SESSION['userid']=strtotime("now");
}`

accessing php file on a computer from another computer via internet

i have php files on my computer and i can very well access those from IIS using eighter localhost or loop-back address . But now if i want to access the same file of php from another computer not in the LAN but in a different computer on the internet what should i do? i was thinking of IP address(static) as an option but then i was not successful in finding a way to do the same .
thanks in advance....
I don't completely understand your question. Is your problem
1) You don't have a static IP? Then:
There are services as "No-IP" where you can create redirects. At their site, you can create a free domain name (which is a static IP as well) such as yourdomain.no-ip.com. Then on your server computer you can run their tool. This tool updates the IP all the time so it will be always correct.
2) You don't know how to access the server from out of the LAN because the IP of your network is the same for all computers (if you're looking from the outside)? Then:
Check your router settings, normally at: http://192.168.1.1. There you will be able to define rules how to redirect requests from the outside. For http, you should redirect requests to port 80 to the IP of the server computer (note: you can even use an other port on the server computer)!

Categories