リビジョン 304d523f app/Controller/TopController.php
| app/Controller/TopController.php | ||
|---|---|---|
| 47 | 47 |
* index |
| 48 | 48 |
*/ |
| 49 | 49 |
public function index() {
|
| 50 |
if($this->Auth->user()){
|
|
| 50 |
if($this->Auth->user('status')==1){
|
|
| 51 | 51 |
$this->redirect('/users/login_top');
|
| 52 | 52 |
} |
| 53 | 53 |
} |
| ... | ... | |
| 174 | 174 |
|
| 175 | 175 |
//formのパラメータ取得 |
| 176 | 176 |
$post = $this->request->data['ContactValidate']['postcode']; |
| 177 |
// var_dump($post); |
|
| 178 |
// exit; |
|
| 179 |
// $options = array( |
|
| 180 |
// 'conditions'=>array( |
|
| 181 |
// 'postcode like' => $post.'%' , |
|
| 182 |
// ) |
|
| 183 |
// ); |
|
| 184 |
$result = $db->query('select * from zipcodes where postcode like "'.$post.'%" limit 1');
|
|
| 185 |
|
|
| 186 |
// データをjsonに変換して出力 |
|
| 187 |
echo json_encode($result); |
|
| 177 |
if(mb_strlen($post)>2){
|
|
| 178 |
$result = $db->query('select * from zipcodes where postcode like "'.$post.'%" limit 1');
|
|
| 179 |
|
|
| 180 |
// データをjsonに変換して出力 |
|
| 181 |
echo json_encode($result); |
|
| 182 |
} |
|
| 188 | 183 |
|
| 189 | 184 |
} |
| 190 | 185 |
} |
他の形式にエクスポート: Unified diff