-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauthUpdateClient.php
More file actions
53 lines (47 loc) · 1.5 KB
/
Copy pathauthUpdateClient.php
File metadata and controls
53 lines (47 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/*
* Auth Client
* cokeeffe <cokeeffe@gmail.com>
*
* Add this code to your application, to connect, auth, and check for verion updates
* Response Codes:
* 0 => "Database Error"
* 1 => "Authenticated"
* 2 => "Authentication Error"
* 3 => "Version up-to-date"
* 4 => "New Version Available"
* 5 => "Unknown"
*/
mysql_connect('host','username','password');
mysql_select_db('database');
function checkForUpdates() {
$_URL = "http://localhost/"; //end with slash
$_VERSIONID = 0;
$_USERKEY = 0;
$_AUTHSALT = 0;
$_CUSTOMERID = 0;
//these values should be changed per client install
$_VERSIONID = 'c4ca4238a0b923820dcc509a6f75849b';
$_USERKEY = '4195fd5cfaf00ade971f8d933584d2e2';
$_AUTHSALT = '4b56240622699097749b37f317919259';
$_CUSTOMERID = 1;
$token = hash_hmac('md5', $_USERKEY, $_AUTHSALT);
$curl = curl_init();
// Set some options - we are passing in a useragent too here
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $_URL."authUpdateServer.php?customerID=".$_CUSTOMERID."&versionID=$_VERSIONID&authToken=$token",
CURLOPT_USERAGENT => 'SomethingHere'
));
// Send the request & save response to $resp
$resp = curl_exec($curl);
// Close request to clear up some resources
curl_close($curl);
$response = json_decode($resp);
return $response;
}
$resp = checkForUpdates();
echo $resp->response_code;
echo "</br>";
echo $resp->response_message;
?>