On my website I use a custom prefix to launch programs connected to an IP address if a user clicks the button; one example of this is "ts3server://IP:PORT".
The issue is that if the user doesn't have the program installed then absolutely nothing happens; I was looking at PHP functions such as "file_exists" but they all only seem to be working locally.
My question is; How do I make a website check if either a program exists on the users computer, or if a registry key exists AFTER the person clicks this button so it works like below
<?php
$filename = '/path/to/foo.txt';
if (file_exists($filename)) {
header("Location: ts3server:\\IP:PORT");
} else {
echo "This program does not exist on your machine";
}
?>
You can't.
PHP is server side scripting language, and only has access to the server machine's file system. Anyone connecting to your server, is accessing it via the browser or another client. Usually, browsers (or most clients) have security measures to prevent you from accessing the clients file system.
You can only access the information the client (browser) provides, within it's sandbox, such as a cookie.
Typically, one would prompt the user if they have that application installed on their machine, and follow accordingly.
EDIT
"header("Location: ts3server:\IP:PORT");"
I'm not sure even if you want to use PHP to achieve this.. or what you would want to do with the ts3server:\IP:PORT location, however, you could run that as an AJAX request, and check the response code.. If response is anything other than 2**, you know it's not installed on their system.