初めて質問を致します。
お手柔らかにお願い致します
Codeigniterで管理者ログイン画面作成しています。
無事にログインできたが、
URLは
http://xxx.xxx.com/admin/user_list
のはずだが、
http://xxx.xxx.com/admin/login_validation
のままになっています。
また、user_listに同じ結果が二回繰り返されていますが、それはなぜでしょうか?
lang
1<?php 2defined('BASEPATH') OR exit('No direct script access allowed'); 3 4class Admin extends CI_Controller { 5 6 public function __construct(){ 7 parent::__construct(); 8 9 $this->load->model('Abstruct'); 10 } 11 12 public function login(){ 13 14 $this->load->helper('form'); 15 $this->load->view('admin/login'); 16 17 } 18 19 public function login_validation(){ 20 $this->load->library("form_validation"); 21 22 $this->form_validation->set_rules("account", "アカウント", "required|trim|callback_validate_credentials"); 23 $this->form_validation->set_rules("password", "パスワード", "required|trim"); 24 //エラーメッセージ 25 $this->form_validation->set_message('required', '%sを入力してください。'); 26 27 if($this->form_validation->run()){ 28 $this->validate_credentials(); 29 } else { 30 $this->load->view("admin/login"); 31 } 32 } 33 34 public function validate_credentials(){ 35 36 $admin_account = "admin"; 37 $admin_passwd = "admin"; 38 $check_posted_account = $this->input->post("account"); 39 $check_posted_passwd = $this->input->post("password"); 40 41 if ($check_posted_account == "admin" and $check_posted_passwd == "admin"){ 42 $this->user_list(); 43 } else { 44 $this->form_validation->set_message("validate_credentials", "ユーザー名かパスワードが異なります。"); 45 return false; 46 } 47 } 48 public function user_list(){ 49 50 $data['records'] = $this->db->get('user')->result_array(); 51 $this->load->view('admin/user_list',$data); 52 } 53 54}
設定画面
lang
1<!doctype html> 2<html lang="ja"> 3<head> 4<meta charset="UTF-8"> 5<title>大事なワードは28文字以内に。平均32文字程度に。</title> 6 7</head> 8 9<body> 10 11<?php foreach ($records as $row): ?> 12<table border="1"> 13<tr> 14<td>FB_ID</td> 15<td>FB_NAME</td> 16<td>TYPE</td> 17</tr> 18<tr> 19<td><?=$row['fb_id']?></td> 20<td><?=$row['name']?></td> 21<td><?=$row['type']?></td> 22</tr> 23<?php endforeach; ?> 24</table> 25 26</body> 27</html>
表示画面
lang
1<!doctype html> 2<html lang="ja"> 3<head> 4<meta charset="UTF-8"> 5<title>大事なワードは28文字以内に。平均32文字程度に。</title> 6 7</head> 8 9<body> 10 11<table border="1"> 12<tr> 13<td>FB_ID</td> 14<td>FB_NAME</td> 15<td>TYPE</td> 16</tr> 17<tr> 18<td>XXXXX</td> 19<td>XXXXX</td> 20<td>XXXXX</td> 21</tr> 22</table> 23 24</body> 25</html> 26<!doctype html> 27<html lang="ja"> 28<head> 29<meta charset="UTF-8"> 30<title>大事なワードは28文字以内に。平均32文字程度に。</title> 31 32</head> 33 34<body> 35 36<table border="1"> 37<tr> 38<td>FB_ID</td> 39<td>FB_NAME</td> 40<td>TYPE</td> 41</tr> 42<tr> 43<td>XXXXX</td> 44<td>XXXXX</td> 45<td>XXXXX</td> 46</tr> 47</table> 48 49</body> 50</html>
以上二点の解決策を教えて頂けると幸いです。
どうぞよろしくお願い致します。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/07/16 07:37
2015/07/16 07:48