Problema in Script Schimbare parola MD5
Scris: Mie Feb 27, 2013
Salutare, am luat de pe net un script care de login care foloseste parole incriptate md5() adica am modificat eu scriptul sa mearga. md5.
Asta-i codul de LOGIN:
Ok ce vreau si care imi este baiul. Am un script pt ati schimba parola, care iti schimba parola dar acum ca eu am facut ca parola sa fie incriptata nu mai merge si am incercat in toate modurile posibile de al modifica sa mearga dar tot nu reusesc nimic.
Asta-i codul:
Ce vreau eu , daca reuseste cineva sa imi modifice codul acesta in cat sa iti schimbe parola si sa incripteze in acelasi timp.
EU CAND INREGISTREZ UN NOU USER AM FACUT IN FELUL URMATOR.
Multumesc anticipat.
Asta-i codul de LOGIN:
Cod: Selectaţi tot
<?php
if(isset($_POST['submit']))
{
if(!isset($_SESSION['IS_LOGEDIN']))
{
$_SESSION['IS_LOGEDIN'] = 'N';
}
// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes(mysql_real_escape_string($myusername));
$mypassword = stripslashes(mysql_real_escape_string($mypassword));
$encrypted_mypassword=md5($mypassword);
$sql="SELECT * FROM members WHERE username='$myusername' and password='$encrypted_mypassword'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
$_SESSION['myusername'] = $myusername;
$_SESSION['IS_LOGEDIN'] = 'Y';
//$lastlogin = $_POST['date("d/m/y H:i:s", time()+25200)'];
header("location:index.php?pagina=home");
}
else {
echo '<img src="images/delete.png" width="16" height="16" />' . ' ' .'User sau Password gresit!';
}
}
?>
Asta-i codul:
Cod: Selectaţi tot
<?php
if(isset($_POST['submit-password']))
{
$username = $_SESSION['myusername'];
$password = trim(addslashes(strip_tags($_POST['password'])));
$newpassword = trim(addslashes(strip_tags($_POST['newpassword'])));
$confirmnewpassword = trim(addslashes(strip_tags($_POST['confirmnewpassword'])));
$result = mysql_query("SELECT password FROM members WHERE username='$username'") or die('Nu exista userul acesta!');
if(!$result)
{
echo "Userul acesta nu exista!";
}
else if($password!= mysql_result($result, 0))
{
echo "Parola ta este incorecta!";
}
else if($newpassword==$confirmnewpassword)
$sql=mysql_query("UPDATE members SET password='$newpassword' where username='$username'");
if($sql)
{
echo "Parola ta a fost schimbata cu succes!.";
}
else
{
echo "Cele doua parole trebuie sa fie identice INCEARCA DIN NOU.";
}
}
?>
EU CAND INREGISTREZ UN NOU USER AM FACUT IN FELUL URMATOR.
Cod: Selectaţi tot
$password = trim(addslashes(strip_tags(md5($_POST['password']))));