Jump to content

Create PHP session outside of HTML?

stack0s

I am working on a website. I want the ability to pull MAC addresses from some visitors for development purposes but came to the understanding because I am using some free shared hosting service I cannot run exec(*) commands. I am using webhost000/hostinger and it appears I do not have access to the php.ini file... so with that being said my options do not seem to include being able to use them. So without asking to many question I would like to say I am open to any of the best possible solutions to this, but specifically I am wondering if it is possible to keep my website there but some how push the client IPs to an alternate server just for PHP content?

 

For example, can I keep my domain name pointed to the same shared hosting server with webhost000 and use them to display all html, process basic php but may I locate specific php files that require elevated privileges on a seperate server that can run them somewhere else (such as a computer I own), and somehow make them work in unison? Ideally, my index.php webpage would still be located at the webhost000 server but since these specific elevated php scripts are not important all the time I would put them on a server at my house that would only be up when needed and process them. I need exec('get-mac') support so if the webhost000 server is doing work between clients and the backend php server (the one at my house) I need to ensure that when 'get-mac' is run that the back end server is indeed referencing the client connected to the server at webhost000 and not webhost000

Link to comment
Share on other sites

Link to post
Share on other sites

Uhmm.. what?

 

The MAC address of a person doesn't go further than that person's ISP routers... your shared hosting server is seeing the MAC of some random server between your hosting and the ISP of that person.

You can get some stuff like IP address , if the person used a proxy or not, the IP before the proxy if the proxy is not fully anonymous etc

 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Host an image file on your own server and load it on the page. When page loads your server will get connection details in it's logs.

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, Bacon soup said:

Host an image file on your own server and load it on the page. When page loads your server will get connection details in it's logs.

Thanks for the replies!

 

To elaborate, I should have explained that the point of this was to discretely redirect certain computers to the development version of the web page and allow normal visitors to a more restricted version of the site. I suppose I could implement your solution however, I think it is fair to say that this method would be more tedious. I suppose I could parse the logs and some craziness. No other way?

Link to comment
Share on other sites

Link to post
Share on other sites

You could just send a cookie to specific computers, and those computers will send you the cookie back every time a page is accessed.

 

You could have some Javascript code on the html page which determines the local IP or some identifiers, sends the stuff in the background to your server, then server replies with some unique code/fingerprint and the script puts the cookie on user's drive.

Link to comment
Share on other sites

Link to post
Share on other sites

On 11/2/2019 at 3:54 PM, stack0s said:

I am working on a website. I want the ability to pull MAC addresses from some visitors for development purposes but came to the understanding because I am using some free shared hosting service I cannot run exec(*) commands. I am using webhost000/hostinger and it appears I do not have access to the php.ini file... so with that being said my options do not seem to include being able to use them. So without asking to many question I would like to say I am open to any of the best possible solutions to this, but specifically I am wondering if it is possible to keep my website there but some how push the client IPs to an alternate server just for PHP content?

 

For example, can I keep my domain name pointed to the same shared hosting server with webhost000 and use them to display all html, process basic php but may I locate specific php files that require elevated privileges on a seperate server that can run them somewhere else (such as a computer I own), and somehow make them work in unison? Ideally, my index.php webpage would still be located at the webhost000 server but since these specific elevated php scripts are not important all the time I would put them on a server at my house that would only be up when needed and process them. I need exec('get-mac') support so if the webhost000 server is doing work between clients and the backend php server (the one at my house) I need to ensure that when 'get-mac' is run that the back end server is indeed referencing the client connected to the server at webhost000 and not webhost000

You should try $_SERVER['REMOTE_ADDR'];

Using exec is pointless while you have the superglobals. I use the same feature on my website, it will redirct my computer to a development server, while other users are redirected to it's domain and production site.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×