Showing posts from June, 2016

Raspberry pi change IP via webpage

  Raspberry pi change IP via webpage  Save this as ip.php and put inside /var/www do not forget to change permissions for /etc/network/interfaces chown root:www-data /etc/network/interfaces chmod g+w /etc/network/interfaces   <?php // configuration $localIP = getHostByName(getHostName()); $url1 = 'http://'.$_SERVER['HTTP_HOST']; $url2 = '/ip.php'; //echo '{$url1 . $url2'}; $url = $url1.$url2; echo $url; $file = '/etc/network/interfaces'; // check if form has been submitted if (isset($_POST['text'])) {     // save the text contents     file_put_contents($file, $_POST['text']);     // redirect to form again     header(sprintf('Location: %s', $url));     printf('<a href="%s">Moved</a>.', htmlspecialchars($url));     exit(); } // read the textfile $text = file_get_contents($file); ?> <!-- HTML form --> <form action="" method="post"> <textarea row