function save_after($aid) {
     //$tag=preg_replace('/\s+/',' ',trim(front::$post['tag']));
     $tags=explode(',',trim(front::$post['tag']));
     //var_dump($tags);
     $tag_table=new tag();
     $arctag_table=new arctag();
     foreach($tags as $tag) {
         if($tag)
             if(!$tag_table->getrow('tagname="'.$tag.'"'))
                 $tag_table->rec_insert(array('tagname'=>$tag));
         $tag=$tag_table->getrow('tagname="'.$tag.'"');
         $arctag_table->rec_replace(array('aid'=>$aid,'tagid'=>$tag['tagid']));
     }
     //exit;
     $doit = false;
     if(session::get('attachment_id') ||front::post('attachment_id')) {
         $attachment_id=session::get('attachment_id')?session::get('attachment_id'):front::post('attachment_id');
         $attachment=new attachment();
         $attachment->rec_update(array('aid'=>$aid,'intro'=>front::post('attachment_intro')),$attachment_id);
         $doit = true;
         if(session::get('attachment_id')) session::del('attachment_id');
     }
     if(front::post('attachment_path') != '' && $doit == false) {
         $attachment=new attachment();
         $attachment->rec_insert(array('aid'=>$aid,'path'=>front::post('attachment_path'),'intro'=>front::post('attachment_intro'),'adddate'=>date('Y-m-d H:i:s')));
         $doit = false;
     }
     if(front::post('_ranks')) {
         $_ranks=serialize(front::post('_ranks'));
         $rank=new rank();
         if(is_array($rank->getrow(array('aid'=>$aid))))
             $rank->rec_update(array('ranks'=>$_ranks),'aid='.$aid);
         else
             $rank->rec_insert(array('aid'=>$aid,'ranks'=>$_ranks));
     }
     else {
         $rank=new rank();
         $rank->rec_delete('aid='.$aid);
     }
     if(front::post('vote')) {
         $votes=front::$post['vote'];
         $images=front::$post['vote_image'];
         $vote=new vote();
         $_vote=$vote->getrow('aid='.$aid);
         if(!$_vote) $_vote=array('aid'=>$aid);
         $_vote['titles']=serialize($votes);
         $_vote['images']=serialize($images);
         $vote->rec_replace($_vote,$aid);
     }
 }