usercp.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. class usercp_c extends Control
  3. {
  4. function __construct()
  5. {
  6. parent::Control();
  7. $this->load_model("user");
  8. $this->load_model("usergroup");
  9. }
  10. function usercp_c()
  11. {
  12. $this->__construct();
  13. }
  14. function index_f()
  15. {
  16. if(!$_SESSION["user_id"])
  17. {
  18. error('',$this->url('login'));
  19. }
  20. $rs = $this->user_m->user_from_id($_SESSION["user_id"]);
  21. if($_SESSION["oauthuser_info"])
  22. {
  23. $rs["picture"]=$_SESSION["oauthuser_info"]->headimgurl;
  24. }
  25. $this->tpl->assign("rs",$rs);
  26. $sitetitle = $this->lang["usercp_changepass"]." - ".$this->lang["usercp"];
  27. $this->tpl->assign("sitetitle",$sitetitle);
  28. $array[0]["title"] = $this->lang["usercp"];
  29. $array[0]["url"] = site_url("usercp");
  30. $array[1]["title"] = $this->lang["usercp_changepass"];
  31. $this->tpl->assign("leader",$array);
  32. $this->tpl->display("usercp.".$this->tpl->ext);
  33. }
  34. function info_f()
  35. {
  36. if(!$_SESSION["user_id"])
  37. {
  38. error('',$this->url('login'));
  39. }
  40. $rs = $this->user_m->user_from_id($_SESSION["user_id"]);
  41. $this->tpl->assign("rs",$rs);
  42. $this->tpl->display("usercp_info.".$this->tpl->ext);
  43. }
  44. function ok_f()
  45. {
  46. if(!$_SESSION["user_id"])
  47. {
  48. error('',$this->url('login'));
  49. }
  50. $rs = $this->user_m->user_from_id($_SESSION["user_id"]);
  51. $array = array();
  52. $array["username"] = $this->trans_lib->safe("name");
  53. $array["job"] = $this->trans_lib->safe("job");
  54. $array["company"] = $this->trans_lib->safe("company");
  55. if(!$array["username"] || !$array["job"])
  56. {
  57. echo "信息输入不完整";
  58. exit;
  59. }
  60. //更新密码
  61. $this->user_m->update($array,$_SESSION["user_id"]);
  62. echo "1";
  63. exit;
  64. }
  65. function bank_f()
  66. {
  67. if(!$_SESSION["user_id"])
  68. {
  69. error('',$this->url('login'));
  70. }
  71. $rs = $this->user_m->user_from_id($_SESSION["user_id"]);
  72. $this->tpl->assign("rs",$rs);
  73. $this->tpl->display("usercp_bank.".$this->tpl->ext);
  74. }
  75. function savebank_f()
  76. {
  77. if(!$_SESSION["user_id"])
  78. {
  79. error('',$this->url('login'));
  80. }
  81. $rs = $this->user_m->user_from_id($_SESSION["user_id"]);
  82. $array = array();
  83. $array["bankAccount"] = $this->trans_lib->safe("bankAccount");
  84. $array["cardCode"] = $this->trans_lib->safe("cardCode");
  85. $array["bankName"] = $this->trans_lib->safe("bankName");
  86. if(!$array["bankAccount"] || !$array["cardCode"] || !$array["bankName"])
  87. {
  88. echo "信息输入不完整";
  89. exit;
  90. }
  91. //更新密码
  92. $this->user_m->update($array,$_SESSION["user_id"]);
  93. echo "1";
  94. exit;
  95. }
  96. }
  97. ?>