Welcome Guest, Not a member yet? Register   Sign In
Page not found
#1

These are the codes:

controllers/register.php


Code:
<?
/*
Tanpa session
Tanpa encripsi
Password merupakan text biasa
*/
class Register extends Controller {
   function Register()// in php5 use function _construct{
   {/*
           parent::Controller();    
           $this->load->library(array('form_validation'));
           $this->load->model(array('Mediatutorialcaptcha'));
           $this->load->helper(array('form', 'url'));
           $this->load->database(); */
   }

   function index(){
       $data['title'] = 'Join MediaTutorial Mobile';
       $sub_data['captcha_return'] ='';
       $sub_data['cap_img'] = $this ->Mediatutorialcaptcha->make_captcha();
       if($this->input->post('submit')) {
           $this->form_validation->set_rules('username', 'User name', 'trim|required|alpha_dash|min_length[3]|max_length[20]|xss_clean');
           $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[3]|max_length[20]|xss_clean');
           $this->form_validation->set_rules('email', 'Email',  'trim|required|min_length[3]|max_length[30]|valid_email');
           $this->form_validation->set_rules('captcha', 'Captcha', 'required');
           if ($this->form_validation->run() == FALSE){
               $data['body']  = $this->load->view('_join_form', $sub_data, true);
           }
           else{
               if($this->Mediatutorialcaptcha->check_captcha()==TRUE){
                   $username = $this->input->post('username');
                   $password = $this->input->post('password');
                   $email = $this->input->post('email');
                   $check_query = "SELECT * FROM `user_codeigniter` WHERE `username`='$username' OR `email`='$email'";
                   $query = $this->db->query($check_query);
                   if ($query->num_rows() > 0){
                       $sub_data['captcha_return'] = 'Maap, username atau email yang anda masukkan telah digunakan pihak lain, silahkan ganti<br/>';
                       $data['body']  = $this->load->view('_join_form', $sub_data, true);
                   }
                   else{
                       $input_data = array(
                           'username' => $username,
                           'password' => $password,
                           'email' => $email,
                       );
                       if($this->db->insert('user_codeigniter', $input_data)){
                           $data['body']  = "join success, silahkan login<br/>";
                       }
                       else
                           $data['body']  = "error on query";
                   }
               }
               else{
                       $sub_data['captcha_return'] = 'Maap captcha salah<br/>';
                       $data['body']  = $this->load->view('_join_form', $sub_data, true);
               }
         }

       }
       else{
               $data['body']  = $this->load->view('_join_form', $sub_data, true);
       }
       $this->load->view('_output_html', $data);
           
   }
}
?>


config/autoload.php


Code:
$autoload['libraries'] = array('form_validation');


/*
| -------------------------------------------------------------------
|  Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
|    $autoload['helper'] = array('url', 'file');
*/

$autoload['helper'] = array('form', 'url');


/*
| -------------------------------------------------------------------
|  Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
|    $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files.  Otherwise, leave it blank.
|
*/

$autoload['config'] = array();


/*
| -------------------------------------------------------------------
|  Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
|    $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file.  For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/

$autoload['language'] = array();


/*
| -------------------------------------------------------------------
|  Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
|    $autoload['model'] = array('model1', 'model2');
|
*/

$autoload['model'] = array('Mediatutorialcaptcha');


/* End of file autoload.php */
/* Location: ./application/config/autoload.php */


routes.php


Code:
$route['default_controller'] = "register";
$route['404_override'] = '';


How to fix the output:

--------------------------------------------------

http://localhost/CI-202-registration/

load->library(array('form_validation')); $this->load->model(array('Mediatutorialcaptcha')); $this->load->helper(array('form', 'url')); $this->load->database(); */ } function index(){ $data['title'] = 'Join MediaTutorial Mobile'; $sub_data['captcha_return'] =''; $sub_data['cap_img'] = $this ->Mediatutorialcaptcha->make_captcha(); if($this->input->post('submit')) { $this->form_validation->set_rules('username', 'User name', 'trim|required|alpha_dash|min_length[3]|max_length[20]|xss_clean'); $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[3]|max_length[20]|xss_clean'); $this->form_validation->set_rules('email', 'Email', 'trim|required|min_length[3]|max_length[30]|valid_email'); $this->form_validation->set_rules('captcha', 'Captcha', 'required'); if ($this->form_validation->run() == FALSE){ $data['body'] = $this->load->view('_join_form', $sub_data, true); } else{ if($this->Mediatutorialcaptcha->check_captcha()==TRUE){ $username = $this->input->post('username'); $password = $this->input->post('password'); $email = $this->input->post('email'); $check_query = "SELECT * FROM `user_codeigniter` WHERE `username`='$username' OR `email`='$email'"; $query = $this->db->query($check_query); if ($query->num_rows() > 0){ $sub_data['captcha_return'] = 'Maap, username atau email yang anda masukkan telah digunakan pihak lain, silahkan ganti

'; $data['body'] = $this->load->view('_join_form', $sub_data, true); } else{ $input_data = array( 'username' => $username, 'password' => $password, 'email' => $email, ); if($this->db->insert('user_codeigniter', $input_data)){ $data['body'] = "join success, silahkan login
"; } else $data['body'] = "error on query"; } } else{ $sub_data['captcha_return'] = 'Maap captcha salah
'; $data['body'] = $this->load->view('_join_form', $sub_data, true); } } } else{ $data['body'] = $this->load->view('_join_form', $sub_data, true); } $this->load->view('_output_html', $data); } } ?>
404 Page Not Found
The page you requested was not found.
" If I looks more intelligence please increase my reputation."
Reply
#2

Fix your question first. Are you indonesian ? me too
Reply
#3

You need to Validate all your PHP code..
I can suggest you to use some PHP IDE just to be sure that you don't have a syntax bug.

Second thing is to validate your server PHP support > make simple PHP file with
Code:
<?php phpinfo();
to see if its ok
Best VPS Hosting : Digital Ocean
Reply
#4

What's PHP IDE that could works with codeigniter ?

phpinfo.php

PHP Version 5.4.22

System Windows NT TOSHIBA-PC 6.1 build 7601 (Windows 7 Enterprise Edition Service Pack 1) i586
Build Date Nov 13 2013 21:14:18
Compiler MSVC9 (Visual C++ 2008)
Architecture x86
Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" "--with-pgo"
Server API Apache 2.0 Handler
Virtual Directory Support enabled
Configuration File (php.ini) Path C:\Windows
Loaded Configuration File C:\xampp\php\php.ini
Scan this dir for additional .ini files (none)
Additional .ini files parsed (none)
PHP API 20100412
PHP Extension 20100525
Zend Extension 220100525
Zend Extension Build API220100525,TS,VC9
PHP Extension Build API20100525,TS,VC9
Debug Build no
Thread Safety enabled
Zend Signal Handling disabled
Zend Memory Manager enabled
Zend Multibyte Support provided by mbstring
IPv6 Support enabled
DTrace Support disabled
Registered PHP Streams php, file, glob, data, http, ftp, zip, compress.zlib, compress.bzip2, https, ftps, phar
Registered Stream Socket Transports tcp, udp, ssl, sslv3, sslv2, tls
Registered Stream Filters convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, zlib.*, bzip2.*
" If I looks more intelligence please increase my reputation."
Reply
#5

(This post was last modified: 11-19-2014, 01:31 AM by tapan.thapa.)

Is it duplicate issue?

I replied to this....Let me know if it works for you.

http://forum.codeigniter.com/thread-294-...ml#pid1224
Reply
#6

It should be extends CI_Controller

and __construct()
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB