Olá,
criei essa rotina pra criptografar senha:
# INSERE
if ((isset($HTTP_POST_VARS["bt_gravar"])) && ($HTTP_POST_VARS["bt_gravar"] == "Gravar"))
{
$v_senha1 = $HTTP_POST_VARS['senha'];
$v_senha2 = $HTTP_POST_VARS['senha2'];
if ( ($v_senha1 != '') and ($v_senha2 != '') and ($v_senha1 == $v_senha2) )
{
$v_senha = md5($v_senha1); // criptografa senha!
$insertSQL = sprintf("INSERT INTO usuario (login,senha,nm_usuario,cd_tipo,mail,situacao,fone,dt_cadastro,dt_acesso) VALUES (%s, %s, %s, %s, %s, %s, %s, now(), now())",
A senha é gravada no banco de dados assim:
81dc9bdb52d04dc20036dbd8313ed055
E agora como faço pra descriptografar ela ?
- Fórum WMO
- → Viewing Profile: Tópicos: Halan
Community Stats
- Group Usuários
- Active Posts 84
- Profile Views 1499
- Member Title Normal
- Age 37 years old
- Birthday August 10, 1987
-
Sexo
Não informado
-
Localidade
Orleans
-
Interesses
Carros, Som Automotivo, Internet, Designer Grafico e Programação (PHP)
Topics I've Started
Descriptografar Essa Senha
04/01/2005, 19:23
Problema Ao Fazer Uma Pesquisa
15/12/2004, 01:03
Olá estou com um formulario de registro que antes de fazer o registro é feito uma consulta no banco de dados para ver se não existe um registro com o mesmo login mais está dando erro e nao estou achando o problema...
Aqui está o a parte que vai a busca pelos registros
<?
include("../include/conexao.php");
?>
<?php
$consulta=mysql_query("SELECT * FROM comunidade WHERE login='$login'",$db);
$inclui = mysql_fetch_row($consulta);
if (empty($inclui[0])) {
$insere=mysql_query("insert into comunidade (nome,cidade,estado,sexo,dia,mes,ano,login,senha,email) VALUES ('$nome','$cidade','$estado','$sexo','$dia','$mes','$ano','$login','$senha','$email')");
echo " ...............
Aqui está o erro que dá...
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/fotov/public_html/brasilfest/comunidade/efetuando.php on line 156
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/fotov/public_html/brasilfest/comunidade/efetuando.php on line 157
Halan S. Batista, seu cadastro foi realizado com sucesso.
Seja bem vindo a comunidade BrasilFest!
Para sua segurança foi enviado um e-mail com todos os dados do seu cadastro.
Aqui está o a parte que vai a busca pelos registros
<?
include("../include/conexao.php");
?>
<?php
$consulta=mysql_query("SELECT * FROM comunidade WHERE login='$login'",$db);
$inclui = mysql_fetch_row($consulta);
if (empty($inclui[0])) {
$insere=mysql_query("insert into comunidade (nome,cidade,estado,sexo,dia,mes,ano,login,senha,email) VALUES ('$nome','$cidade','$estado','$sexo','$dia','$mes','$ano','$login','$senha','$email')");
echo " ...............
Aqui está o erro que dá...
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/fotov/public_html/brasilfest/comunidade/efetuando.php on line 156
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/fotov/public_html/brasilfest/comunidade/efetuando.php on line 157
Halan S. Batista, seu cadastro foi realizado com sucesso.
Seja bem vindo a comunidade BrasilFest!
Para sua segurança foi enviado um e-mail com todos os dados do seu cadastro.
Listar 5 Ultimos Registros
18/08/2004, 17:12
olá to fazendo essa pagina aqui:
http://www.brasilfes...m.br/screen.gif
queria saber como eu faço pra mostrar as ultimas 5 festas registradas no banco de dados.
Pra listar a ultima é assim:
$sql = mysql_query("SELECT * FROM galeriaorle order by id DESC LIMIT 1");
queria saber como faço pra listar o ultimo, depois na tabela do lado a penultima e nas tabelinhas menores as outras 3.
Alguem pode da uma força ?
http://www.brasilfes...m.br/screen.gif
queria saber como eu faço pra mostrar as ultimas 5 festas registradas no banco de dados.
Pra listar a ultima é assim:
$sql = mysql_query("SELECT * FROM galeriaorle order by id DESC LIMIT 1");
queria saber como faço pra listar o ultimo, depois na tabela do lado a penultima e nas tabelinhas menores as outras 3.
Alguem pode da uma força ?
Selecionar Penultimo Registro
04/08/2004, 18:09
Olá, esse comando seleciona o ultimo registro da tabela e ordena em ordem decrescente pelo id,
<?
include("galeria-orle/include/conexao.php");
$sql = mysql_query("SELECT * FROM galeriaorle order by id DESC LIMIT 1");
?>
<?
$dados= mysql_fetch_array($sql) ;
?>
Como q eu faço pra ele selecionar o penultimo registro ?
<?
include("galeria-orle/include/conexao.php");
$sql = mysql_query("SELECT * FROM galeriaorle order by id DESC LIMIT 1");
?>
<?
$dados= mysql_fetch_array($sql) ;
?>
Como q eu faço pra ele selecionar o penultimo registro ?
Botar Mais Um Arquivo Anexo
22/07/2004, 17:56
Como faço pra que esse script mande 5 arquivos anexos pro e-mail informado em vez de um só.
Codigo:
<?
#####################################################################
#Baseado na versão 1.0 do script do Alexander Benatti
#Foram utilizados exemplos extraídos do www.php.net
#Este script é GNU - Licensa Pública
#---------------------------------------------------
#Nelson R. Moura
#nelson@sitecom.com.br
###################################Inicia o form
if ($action != "upload")
{
print '
<FORM METHOD="post" ENCTYPE="multipart/form-data">
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="1000000">
<INPUT TYPE="hidden" NAME="action" VALUE="upload">
<TABLE BORDER="1">
<TR>
<TD>From: </TD>
<TD><input type="text" name="from" size=40><BR></TD>
</TR>
<TR>
<TD>To: </TD>
<TD><input type="text" name="to" size=40><BR></TD>
</TR
<TR>
<TD>Subject: </TD>
<TD><input type="text" name="subject" size=40><BR></TD>
</TR
<TR>
<TD>Cc: </TD>
<TD><input type="text" name="cc" size=40><BR></TD>
</TR
<TR>
<TD>Bcc: </TD>
<TD><input type="text" name="bcc" size=40><BR></TD>
</TR
<TR>
<TD>Body: </TD>
<TD><TEXTAREA NAME="body" ROWS="10" COLS="50"></TEXTAREA></TD>
</TR>
<TR>
<TD>File: </TD>
<TD><INPUT TYPE="file" NAME="anexo"></TD>
</TR>
<TR>
<TD COLSPAN="2"><INPUT TYPE="submit" VALUE="Upload"></TD>
</TR>
</TABLE>
</FORM>
';
}
###################################Depois de clicar no send
if ($action == "upload")
{
$mime_list = array("html"=>"text/html","htm"=>"text/html", "txt"=>"text/plain", "rtf"=>"text/enriched","csv"=>"text/tab-separated-values","css"=>"text/css","gif"=>"image/gif");
$ABORT = FALSE;
$boundary = "XYZ-" . date(dmyhms) . "-ZYX";
$message = "--$boundary\n";
$message .= "Content-Transfer-Encoding: 8bits\n";
$message .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\n\n";
$message .= $body;
$message .= "\n";
#//attachment file names with full path
$attachments[1] = $anexo;
#$attachments[2] = "c:\etc";
#$attachments[3] = "c:\etc";
//check that the attachment files exist and if so then encode
foreach ($attachments as $key => $full_path) {
if ($full_path !='') {
if (file_exists($full_path)){
//try to open
if ($fp = fopen($full_path,"rb")) {
//get the file name from the path
$filename = array_pop(explode(chr(92),$full_path));
$contents = fread($fp,filesize($full_path));
//encode data
$encoded = base64_encode($contents);
//*****SPLIT THE ENCODED DATA*****
$encoded_split = chunk_split($encoded);
fclose($fp);
$message .= "--$boundary\n";
$message .= "Content-Type: $anexo_type\n";
$message .= "Content-Disposition: attachment; filename=\"$anexo_name\" \n";
$message .= "Content-Transfer-Encoding: base64\n\n";
$message .= "$encoded_split\n";
}
else {
echo "Cannot open file$key: $filename";
$ABORT = TRUE;
}
}
else {
echo "File$key does not exist: $filename";
$ABORT = TRUE;
}
}
}
$message .= "--$boundary--\r\n";
$headers = "MIME-Version: 1.0\n";
$headers .= "From: <$from>\r\n";
$headers .= "Content-type: multipart/mixed; boundary=\"$boundary\"\r\n";
$mensagem=mail($to, $subject, $message, $headers);
if ($mensagem) {
print "Mensagem enviada!";
} else {
print "O envio da mensagem falhou!";
}
}
?>
Codigo:
<?
#####################################################################
#Baseado na versão 1.0 do script do Alexander Benatti
#Foram utilizados exemplos extraídos do www.php.net
#Este script é GNU - Licensa Pública
#---------------------------------------------------
#Nelson R. Moura
#nelson@sitecom.com.br
###################################Inicia o form
if ($action != "upload")
{
print '
<FORM METHOD="post" ENCTYPE="multipart/form-data">
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="1000000">
<INPUT TYPE="hidden" NAME="action" VALUE="upload">
<TABLE BORDER="1">
<TR>
<TD>From: </TD>
<TD><input type="text" name="from" size=40><BR></TD>
</TR>
<TR>
<TD>To: </TD>
<TD><input type="text" name="to" size=40><BR></TD>
</TR
<TR>
<TD>Subject: </TD>
<TD><input type="text" name="subject" size=40><BR></TD>
</TR
<TR>
<TD>Cc: </TD>
<TD><input type="text" name="cc" size=40><BR></TD>
</TR
<TR>
<TD>Bcc: </TD>
<TD><input type="text" name="bcc" size=40><BR></TD>
</TR
<TR>
<TD>Body: </TD>
<TD><TEXTAREA NAME="body" ROWS="10" COLS="50"></TEXTAREA></TD>
</TR>
<TR>
<TD>File: </TD>
<TD><INPUT TYPE="file" NAME="anexo"></TD>
</TR>
<TR>
<TD COLSPAN="2"><INPUT TYPE="submit" VALUE="Upload"></TD>
</TR>
</TABLE>
</FORM>
';
}
###################################Depois de clicar no send
if ($action == "upload")
{
$mime_list = array("html"=>"text/html","htm"=>"text/html", "txt"=>"text/plain", "rtf"=>"text/enriched","csv"=>"text/tab-separated-values","css"=>"text/css","gif"=>"image/gif");
$ABORT = FALSE;
$boundary = "XYZ-" . date(dmyhms) . "-ZYX";
$message = "--$boundary\n";
$message .= "Content-Transfer-Encoding: 8bits\n";
$message .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\n\n";
$message .= $body;
$message .= "\n";
#//attachment file names with full path
$attachments[1] = $anexo;
#$attachments[2] = "c:\etc";
#$attachments[3] = "c:\etc";
//check that the attachment files exist and if so then encode
foreach ($attachments as $key => $full_path) {
if ($full_path !='') {
if (file_exists($full_path)){
//try to open
if ($fp = fopen($full_path,"rb")) {
//get the file name from the path
$filename = array_pop(explode(chr(92),$full_path));
$contents = fread($fp,filesize($full_path));
//encode data
$encoded = base64_encode($contents);
//*****SPLIT THE ENCODED DATA*****
$encoded_split = chunk_split($encoded);
fclose($fp);
$message .= "--$boundary\n";
$message .= "Content-Type: $anexo_type\n";
$message .= "Content-Disposition: attachment; filename=\"$anexo_name\" \n";
$message .= "Content-Transfer-Encoding: base64\n\n";
$message .= "$encoded_split\n";
}
else {
echo "Cannot open file$key: $filename";
$ABORT = TRUE;
}
}
else {
echo "File$key does not exist: $filename";
$ABORT = TRUE;
}
}
}
$message .= "--$boundary--\r\n";
$headers = "MIME-Version: 1.0\n";
$headers .= "From: <$from>\r\n";
$headers .= "Content-type: multipart/mixed; boundary=\"$boundary\"\r\n";
$mensagem=mail($to, $subject, $message, $headers);
if ($mensagem) {
print "Mensagem enviada!";
} else {
print "O envio da mensagem falhou!";
}
}
?>
- Fórum WMO
- → Viewing Profile: Tópicos: Halan
- Privacy Policy
- Regras ·