Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //DATI DI CONNESSIONE2
- $server2 = "156.54.212.103";
- $username2 = "root";
- $password2 = "vivi1995.";
- //DATI DATABASE
- $user = $_POST['usr'];
- $var1 = $_POST['pass'];
- // richiamo lo script responsabile della connessione a MySQL
- require 'connect.php';
- if($user == ''){
- echo "Selezionare un user di cui modificare la nota";
- exit;
- }else{
- $sql = "UPDATE bex_usr SET password = '".$var1."' WHERE name = '".$user."'";
- // invio la query
- $result = mysql_query($sql);
- //ESECUZIONE E CATTURA DELLA RISPOSTA
- $connection2 = ssh2_connect($server2, 22);
- ssh2_auth_password($connection2, $username2, $password2);
- $stream = ssh2_exec($connection2, $command);
- $command = "sed -i '/\b\('$user'\)\b/d' /etc/ppp/chap-secrets";
- $command2 = "sed -i '$ a\'$user' 'l2tp' '$var1' * #Creato da Bex ' /etc/ppp/chap-secrets";
- $stream = ssh2_exec($connection2, $command);
- stream_set_blocking($stream, true);
- $stream = ssh2_exec($connection2, $command2);
- stream_set_blocking($stream, true);
- echo "$user ha cambiato la sua password in $var1";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement