packages/web/353/control_panel/change_IP.php

Go to the documentation of this file.
00001 <?php
00002 function changeIP() {
00003         $myFile = "/etc/conf.d/net.eth0";
00004         $fr = fopen($myFile, 'r') or die("Can't open file in read mode");
00005         $data = fread($fr, filesize($myFile));
00006         $replace_value = "IP=" . $_POST['new_ip'];
00007         fclose($fr);
00008         preg_match('/IP=\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/', $data, $matches);
00009         $replace = str_replace($matches[0], $replace_value, $data);
00010         $fw = fopen($myFile, 'w') or die ("Can't open file in write mode");
00011         fwrite($fw, $replace);
00012         fclose($fw);
00013         }
00014 changeIP();
00015 print "IP Address is now set to " . "<b>" . $_POST['new_ip'] . "</b>" . "<br />";
00016 print "Reboot camera for these changes to take effect.";
00017 ?>

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