Jump to content

303tech

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

303tech's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Heres what I have: Computer A: File Server which reports information from INI file. Computer B: Web Server which collects information from INI to store in SQL GOAL: Computer A wants to send information of the ini and PUBLIC IP address everytime the related application loads, to Computer B's SQL server. The admin backend would have access to this information. The script i have. <?php //connection include ("connect.php"); //PARSE INI FILE. $ini = parse_ini_file('prog.ini'); //REMOVE APOSTROPHES FROM NAME. $un=$ini['UNITNAME']; $replace=str_replace("'","",$un); echo $replace; $ip=$_SERVER['REMOTE_ADDR']; echo $ip; //DEFINE KEYS $sec1=$ini['SEC1']; echo $sec1; $sec2=$ini['SEC2']; echo $sec2; $sec3 = $ini['SEC3']; $sec4 = $ini['SEC4']; $sec5=$ini['SEC5']; $sec6=$ini['SEC6']; //IF STATEMENT $rows=mysql_query("SELECT * FROM customer WHERE sec1='$sec1'"); $num_rows= mysql_num_rows($rows); if ($num_rows>=1) { echo "There is already a unit assigned."; mysql_query("UPDATE customer SET unitname='$replace2' WHERE sec1='$sec1'"); echo "UPDATED CUSTOMER"; exit; } echo "No rows found, so i will insert"; //INSERT VALUES $insert="INSERT INTO customer (unitname,sec1, sec2, sec3, sec4, sec5, sec6,ip,c1) VALUES ('$replace','$sec1','$sec2','$sec3','$sec4','$sec5','$sec6','$ip','$c1')"; mysql_query($insert); ?> The problem i have is.... Either i can put this insert.php file on the Computer A and when it runs it will look on the c:\targetdir\ - (and have to install WAMP or php/apache) which works okay, but when i try to get the local IP its the loopback 127.0.0.1 addy. With this I am able to do everything i need except get the correct ip. The downfall is that i have to install WAMP or php/apache. OR I can ideally have the php page run remotely from Computer B where when the related application loads, it would either: A. Somehow reach into Computer A on the C:\targetdir\ and parse the ini remotely. (please let me know if theres a way) B. Upload the ini somewhere on the webserver daily with scheduled task, but then the php insert file would have to tell the webserver an ID to look up (which i think i would have to assign at the beginning of each Computer A (There will be hundreds of Computer A locations) This would be a hassle.... Thanks in advance for any ideas. Nick
  2. I'm having problems when the string has &'s in it, as well as 's. I was able to remove the 's. But i get a return value of 0 when trying to do the same thing with &'s. If i take out the part where I'm trying to remove &, the value of $replace is OK. Also, is there a way that I can put chars like this in db fields?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.