Пример #1
0
 function changepassword($userid, $oldpass, $newpass, $newpassrepeat)
 {
     if ($newpass == $newpassrepeat) {
         $enc = new Encryption();
         $db = new dbconnection();
         $db->dbconnect();
         //check oldpass, update password if ok, send message if not
         $password = $enc->oneway_encode($oldpass);
         $db->query = "select userid from " . TABLE_USERS . " where userid={$userid} and password='******'";
         $db->execute();
         if ($db->rowcount() > 0) {
             $newpass = $enc->oneway_encode($newpass);
             $db->query = "update " . TABLE_USERS . " set password='******' where userid={$userid}";
             $db->execute();
             $msg = 'Password updated.';
         } else {
             $msg = 'Incorrect old password.';
         }
     } else {
         $msg = 'New password does not match.';
     }
     return $msg;
 }
Пример #2
0
<?php

require_once "includes/encryption.php";
$enc = new Encryption();
echo $enc->oneway_encode('pass');
?>