user_model.php 876 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. class User_model extends Model{
  3. function uyelistesi(){return DB::get('kullanici')->result();}
  4. function duzenle($post){return DB::where('kullanici_id',$post)->get('kullanici')->row();}
  5. function duzenle_kayit($post){
  6. DB::where('kullanici_id',$post['kullanici_id'])->update('kullanici',[
  7. 'isim' => $post['isim'],
  8. 'rumuz' => $post['rumuz'],
  9. 'mail' => $post['mail'],
  10. 'telefon' => $post['telefon'],
  11. ]);
  12. if(DB::affectedRows()){redirect('admin/uye');}
  13. }
  14. function login($post){
  15. $pass = md5($post['pass']);
  16. $ctrl = DB::where('email',$post['mail'],'and')
  17. ->where('password',$pass,'and')
  18. ->where('authority','66')
  19. ->get('user')
  20. ->row();
  21. if(DB::affectedRows()){
  22. Session::insert('username', $ctrl->name);
  23. Session::insert('userid', $ctrl->id);
  24. redirect(baseUrl('admin'));
  25. }
  26. }
  27. }