reset_password fix
[mirrors/Kyberia-bloodline.git] / wwwroot / backend / mysql / backend.inc
index deacb13a808a0d367d1a47ff158b26fbddb6ee3f..560c5b8f9f845aa0b6aa1aa8adeb6e7bf25c82d8 100644 (file)
@@ -683,6 +683,57 @@ public static function getThreadedChildren($node_id,$node_vector,$offset,$limit,
        return $get_children_array;
 }
 
+// XXX
+
+public static function getPoll($user_id,$poll_id) {
+       global $db;
+               
+       $set=$db->query("select nodes.*,node_access.node_permission from nodes 
+               left join node_access on (nodes.node_id=node_access.node_id and node_access.user_id='$user_id') 
+               where node_parent='$poll_id' and template_id='1549834' order by node_id desc limit 1");
+
+       $set->next();
+       $array=$set->getRecord();
+       
+       return $array;
+}
+
+// XXX
+
+public static function resetPassword($login_id,$login,$vercode,$password) {
+       global $db;
+
+       // Security checks
+       $login = db_escape_string($login);
+       if (!is_numeric($login_id)) { return false; } 
+
+       if ($login == '') {
+               $error="Please enter name or id";
+               return false;
+       }
+
+       if ($login_id = 0) {
+               $set=$db->query("select * from users where login='$login'");
+       } else {
+               $set=$db->query("select * from users where user_id='$login'");
+       }
+
+       $set->next();
+       $user_name=$set->getString('login');
+       $user_id=$set->getString('user_id');
+       $hash=$set->getString('hash');  
+
+       if ($hash != $vercode) {
+               $error="Bad verification code!";
+               return false;
+       }
+
+       $password = sha1($password);
+       $q="update users set password='$password',hash='' where user_id='$user_id'";
+       $db->query($q);
+
+       return 0;
 }
 
+}
 ?>
This page took 0.105101 seconds and 4 git commands to generate.