0

My code:

<?php
   if(isset($_GET['login']) && isset($_GET['login']) && isset($_GET['password'])){
      $_login_url = "http://testing.wialon.com/wialon/ajax.html?svc=core/login&params={user:%s,password:%s}";
      $login = $_GET['login'];
      $password = $_GET['password'];    
      $handle = fopen(sprintf($_login_url, $login, $password), "r");
      $line = fgets($handle);
      fclose($handle);
      $responce = explode(",",$line);
      if(count($responce) < 2) {
         echo "Invalid user or password";
      } else {
         $sessid = explode(":",$responce[1]);
         $lastid = str_replace("\"","",$sessid[1]);
         echo "http://testing.wialon.com/index.html?sid=".$lastid."";
      }
  }
?>

when I access this script with the server hosting the script everything works perfectly, The sessions are generated with my IP address.

But when I access it with another computer any user trying to login the script generates session using the servers IP address. can I send the request with the users IP address?

Hailwood
  • 89,623
  • 107
  • 270
  • 423
Dest
  • 678
  • 2
  • 9
  • 27

2 Answers2

1

No, you cannot send the request with the users IP address.

However, you might be able to indicate that the request is being performed on behalf of another IP by using the HTTP_X_FORWARDED_FOR request header or similar, but without looking at their documentations (which doesn't seem to be publicly available) I can't be sure of it. You'll need to ask 'em.

Community
  • 1
  • 1
Alix Axel
  • 151,645
  • 95
  • 393
  • 500
0

This is an old thread but, let me put in my two cents. There are two new wialon athentication methods Token login and by passing the athorization hash . the second method is best suited for maintaining session across servers.

http://sdk.wialon.com/wiki/en/kit/remoteapi/apiref/core/create_auth_hash

http://sdk.wialon.com/wiki/en/kit/remoteapi/apiref/token/token

//get the Token from here http://hosting.wialon.com/login.html?client_id=wialon&access_type=-1&activation_time=0&duration=0&flags=1 // You should have your existing username from wialon with SDK access

 $params = "{'token':'$token','operateAs','$username'}";

        $baseurl = "http://hst-api.wialon.com/wialon/ajax.html";
        $url = "$baseurl?params=".urlencode($params)."&svc=token/login";
        $o = json_decode(file_get_contents($url),true);  
        $sid = $o['eid'];
Kaippally
  • 96
  • 10