SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2009
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with gathering a variable amont

    Hi , This is not intricate situation however I can't figure out what must I do here , just suppose I have two box A and B and I have a script on both .

    The box A has valid ip and the B has invalid ip so the script located in box B can only connect to box A .

    The script in box A :
    PHP Code:
    $sql "SELECT `cmd` FROM `clients` ";
                    
    $res_cmd mysql_query($sql);
                    
    $rowcount mysql_num_rows($res_cmd);
                    if (
    $rowcount 0) {
          while (
    $row mysql_fetch_array($res_cmd)) {
              
    $command $row[cmd];
                    }
                    }
    # $command ===> Has an information that I want 
    How can I get the value of $command variable by a script in box B ?
    note that I can't post it to box B because it does not have valid IP , I meant only the script located on box A can connect to script located on B .

    I hope I could clear it completely

  2. #2
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by php_lover View Post
    PHP Code:
    $sql "SELECT `cmd` FROM `clients` ";
                    
    $res_cmd mysql_query($sql);
                    
    $rowcount mysql_num_rows($res_cmd);
                    if (
    $rowcount 0) {
          while (
    $row mysql_fetch_array($res_cmd)) {
              
    $command $row[cmd];
                    }
                    }
    # $command ===> Has an information that I want 
    Oh my, what kind of code formatting is it?

    Quote Originally Posted by php_lover View Post
    How can I get the value of $command variable by a script in box B ?
    note that I can't post it to box B because it does not have valid IP , I meant only the script located on box A can connect to script located on B .
    What do you mean it doesn't have a valid IP? If it doesn't have a valid IP then it isn't connected to any network. If it's not connected to any network then it's impossible to transfer any data, unless you burn it onto a CD and move to box A

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2009
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If it doesn't have a valid IP then it isn't connected to any network
    My Ip is invalid now but I'm connecting to network

    I have invalid ip so you can not ping me but I can ping the valid ip / my solution was that I put the value of $command to the text file on server A :
    PHP Code:
    $hande fopen('command.txt' 'w');
                    
    fputs $hande $command );
                    
    fclose($hande); 
    ip of box A/command.txt

    and Got it by script on box B :

    PHP Code:
    $comdir 'path of command.txt file';
    $handle fopen($comdir ,  "r");
    $contents fread($handle2000);
    fclose($handle); 
    And I had it ==> $contents

    but I don't want to use text file for some resons ... I want to know is taht any method

    ty


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •