Jump to content
Fórum Script Brasil
  • 0

Comando exec("htpasswd -b ".$user."".$se


Slackloco

Question

Boa tarde pessoal !!!

Sou novo no forum e com o PHP estou começando aprender a linguagem, estou com o seguinte problema preciso criar um sistema de criar login e senha para o squid, é simples mais não estou conseguindo puxar o valor do formulario e colocar no comando, segue abaixo o exemplo do codigo.

Preciso de um help rsrsrs. Desde já obrigado.

"<?php

include "valida.php";

?>

<?php

$login = $_POST['login'];

$senha = $_POST['senha'];

$conteudo = "$login,$senha";

$local = "/etc/squid/.password";

if(count($_POST) > 0)

{

$arquivo = fopen("$local", "w+");

fwrite($arquivo, $_POST['arquivo']);

fclose($arquivo);

exec("sudo htpasswd -b "".$local. "".$login."" .$senha.");

exec("sudo /usr/bin/sort $local -o $local");

exec("sudo /usr/sbin/squid -k reconfigure");

}

$arquivo = fopen("$local", "r");

?>

<h3>Criar Usuarios</h3>

<div class="text">

<p>ls

&Aacute;rea destinada a criar usuarios.<br />

Todos os usuário cadastrados.

</p>

</div>

<form name="cadastro" method="post" action="">

<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Login:</font></td>

<td><input name="login" type="text" id="login" maxlength="30"></td>

</tr>

<tr>

<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Senha:</font></td>

<td><input name="senha" type="password" id="senha" maxlength="30"></td>

</tr>

<input type="submit" name="Submit" value="Enviar" /> <br />

</form>

<?php require('rodape.php'); ?>

Edited by Slackloco
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...