Advertisement
Guest User

Untitled

a guest
Dec 31st, 2014
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.57 KB | None | 0 0
  1. public function activation($id, $token)
  2.     {
  3.         $db = new Dbc();
  4.         $activation = $db->pdo-> prepare('SELECT id, user_id FROM gd_activation WHERE user_id =:id AND token=:token LIMIT 1');
  5.         $activation-> bindValue(':id', $id, PDO::PARAM_INT);
  6.         $activation-> bindValue(':token', $token, PDO::PARAM_STR);
  7.         $activation-> execute();
  8.         $count = $activation-> rowCount();
  9.         $row = $activation-> fetch();
  10.         $activation-> closeCursor();
  11.         //vd($id);
  12.         if(isset($count) AND $count > 0)
  13.         {
  14.             $update = $db->pdo-> prepare('UPDATE  gd_users SET user_access_panel=1 WHERE id=:id');
  15.             $update-> bindValue(':id', $row['user_id'], PDO::PARAM_INT);
  16.             $update-> execute();
  17.             $success = $update-> rowCount();
  18.             $update-> closeCursor();
  19.            
  20.             if(isset($success) AND $success > 0)
  21.             {
  22.                 $delete = $db->pdo-> prepare('DELETE FROM gd_activation WHERE id=:id AND user_id=:user_id AND token=:token');
  23.                 $delete-> bindValue(':id', $row['id'], PDO::PARAM_INT);
  24.                 $delete-> bindValue(':user_id', $row['user_id'], PDO::PARAM_INT);
  25.                 $delete-> bindParam(':token', $token, PDO::PARAM_STR);
  26.                 $delete-> execute();
  27.                 $status = $delete-> rowCount();
  28.                 $delete-> closeCursor();
  29.                
  30.                 if(isset($status) AND $status > 0)
  31.                 {
  32.                     return true;
  33.                 }
  34.             }
  35.         }
  36.         return false;
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement