packages/web/353/control_panel/ipchange.php

Go to the documentation of this file.
00001 <?php
00002 function change_ip(){
00003                 //Opens file in read mode and copies excisting data to the $data string
00004                 $myFile = "/etc/conf.d/net.eth0";
00005                 $fr = fopen($myFile, 'r') or die("Can't open file1");
00006                 $data = fread($fr, filesize($myFile));
00007                 //finds and replaces values in the $data string, writes changed string to $replace
00008                 $replace = str_replace($_SERVER['SERVER_ADDR'], $_POST['new_ip'], $data);
00009                 fclose($fr);
00010                 //Opens File in write mode and writes $replace string over the data
00011                 $fw = fopen($myFile, 'w') or die ("Can't open file2");
00012                 fwrite($fw, $replace);
00013                 fclose($fw);
00014                 echo "Done, the new ip is " . $_POST['new_ip'] . " please restart the camera and navigate to 
00015                 http://" . $_POST['new_ip'];
00016                 }
00017 change_ip();
00018 ?>

Generated on Fri Nov 28 00:06:24 2008 for elphel by  doxygen 1.5.1