Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function activation($id, $token)
- {
- $db = new Dbc();
- $activation = $db->pdo-> prepare('SELECT id, user_id FROM gd_activation WHERE user_id =:id AND token=:token LIMIT 1');
- $activation-> bindValue(':id', $id, PDO::PARAM_INT);
- $activation-> bindValue(':token', $token, PDO::PARAM_STR);
- $activation-> execute();
- $count = $activation-> rowCount();
- $row = $activation-> fetch();
- $activation-> closeCursor();
- //vd($id);
- if(isset($count) AND $count > 0)
- {
- $update = $db->pdo-> prepare('UPDATE gd_users SET user_access_panel=1 WHERE id=:id');
- $update-> bindValue(':id', $row['user_id'], PDO::PARAM_INT);
- $update-> execute();
- $success = $update-> rowCount();
- $update-> closeCursor();
- if(isset($success) AND $success > 0)
- {
- $delete = $db->pdo-> prepare('DELETE FROM gd_activation WHERE id=:id AND user_id=:user_id AND token=:token');
- $delete-> bindValue(':id', $row['id'], PDO::PARAM_INT);
- $delete-> bindValue(':user_id', $row['user_id'], PDO::PARAM_INT);
- $delete-> bindParam(':token', $token, PDO::PARAM_STR);
- $delete-> execute();
- $status = $delete-> rowCount();
- $delete-> closeCursor();
- if(isset($status) AND $status > 0)
- {
- return true;
- }
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement