Skip to content

Commit

Permalink
Update function now uses md5 for password
Browse files Browse the repository at this point in the history
  • Loading branch information
optiwariindia committed Apr 22, 2021
1 parent dd79d35 commit c9e76da
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "optiwariindia/database",
"description": "A library to connect database and use basic activities in database like create,select,insert,update,delete and drop using predefined methods",
"type": "library",
"version":"1.2.0",
"version":"1.2.1",
"license": "MIT",
"authors": [
{
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# version 1.2.1
function update has been aligned with insert
4 changes: 3 additions & 1 deletion src/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ public function update($table, $data, $where = "")
$sql = "update `{$table}` set ";
$fld = array();
foreach ($data as $key => $value) {
if ($value == "now()") {
if (($key == "pass") || ($key == "passwd")) {
$fld[] = " $key=md5('{$value}')";
}elseif ($value == "now()") {
$fld[] = " $key = $value ";
} else {
if (is_array($value)) {
Expand Down

0 comments on commit c9e76da

Please sign in to comment.