Search Results

Search found 981 results on 40 pages for 'codeigniter 2'.

Page 17/40 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Redirect in codeigniter after login

    - by edelweiss
    Trying to do a redirect after a successful login. The login info is sent using ajax to the controller. My controller code as below public function login_controller_function() { $this->load->model('login_model'); if ($this->input->is_ajax_request()) { $user_name=$this->input->post('username'); $user_password = $this->input->post('password'); $this->load->helper('url'); $result = $this->login_model->verify_user($user_name,$user_password); // echo 'user_logged_in'; if(strcmp($result,'user_logged_in')==0) { redirect('welcome'); } } } But it is not working at all. Anyone knows whats wrong? Hi my html as requested. i am using twitter bootstrap as well <li class="divider-vertical"></li> <li><a href="#" id="login_btn">Login</a></li> <li><a href="<?php echo base_url('register'); ?>">Register</a></li> for the buttons so when i click the login button, a modal window will appear and ask for login info. so when i click on the login button, my js code will send an ajax request my js code as below /*Attempt register user jquery ajax*/ $('#login').click(function(){ var user_name = $('#loginHere').find('#user_name').val(); var user_password = $('#loginHere').find('#login_pwd').val(); if(user_name==""||user_password=="") return; var login_data = { username:user_name, password:user_password}; $.ajax({ type: "POST", dataType: "json", async: false, url:"login_register/login_controller_function", data: login_data, success: function(data) { if(data.login) { alert(data.redirect); window.location.replace(data.redirect); } else if(!data.login) { alert('data login not true'); } }, error:function(data){ alert('ajax error'); } }); }); });

    Read the article

  • CodeIgniter URI routing (dynamic, multilingual)

    - by koteko
    I'm trying to redirect all routs to one main controller. Here is my routes.php $route['default_controller'] = "main"; $route['scaffolding_trigger'] = ""; //$route['(\w{2})/(.*)'] = '$2'; //$route['(\w{2})'] = $route['default_controller']; $route['(en|ge)/(:any)'] = $route['default_controller']."/index/$1"; $route['(:any)'] = $route['default_controller']."/index/$1"; I need language id to be passed with every link (like: http://site.com/en/hello-world) Here is my main controller: class Main extends Controller { function __construct() { parent::Controller(); } function index($page_type=false, $param=false) { die($page_type.' | '.$param.'| Aaa!'); } } I want to check if predefined file type exists (like: http://site.com/en/archive/05-06-2010 - here predefined type would be archive) then do something. If not then search in the database for slug. If not found then go to 404. The problem is that I can't get index function parameters ($page_type, $param). Thanks for help.

    Read the article

  • Using PHP interfaces in Codeigniter

    - by John Stewart
    I am trying to find out how can I used PHP interfaces in my MVC design. I want to make sure that the design enforces an interface so that any new module would follow that. For example: <?php interface BaseAPI { public function postMessage($msg); } class ServiceAPI implements BaseAPI { public function postMessage($msg) { return $msg; } } class Service_Two_API implements BaseAPI { public function postMessage($msg) { return "can't do this: ".$msg; } } ?> I want to do this in CI. Is it possible? how should I design it?

    Read the article

  • CodeIgniter - Calling a function from inside a view

    - by Chris
    Hey, Is it possible to call a function which is located in a controller from a view. This is what i have in my controller, as an example function checkKeyExists($userid, $key){ } Then inside my view i have the following if(checkKeyExists($row->id, $role->key)){ } But when i run it, it says that checkKeyExists is not defined. If anyone can let me know how i could do this, that would be great. Cheers

    Read the article

  • Running CodeIgniter cron on localhost

    - by stef
    I'm trying to get a cron job to run every 5 min on my localhost. Using the Cronnix app I entered the following command 0,5 * * * * root curl http://localhost:8888/site/ > /dev/null The script runs fine when I visit http://localhost:8888/site/ in my browser. I've read some stuff about getting CI to run on Cron, using wget and various other options but none make a lot of sense. In another SO post I found the following command wget -O - -q -t 1 http://www.example.com/cron/run What is the "-O - -q -t 1" syntax exactly? Are there other options?

    Read the article

  • MVC - thin controller idea - Codeigniter/Zend

    - by user505988
    Hi, Could some one possibly clarify this for me. In the MVC paradigm, the idea is to keep the controller as thin as possible, it is also true that the model is the bit that communicates with data sources such as the database, XML-RPC etc and this is where the business logic should go. Is the POST and GET data a 'data source' and should that kind of data be handled by the model or should it be by the controller. I would normally call a method in the model and pass it the post data, the data would be quality checked by the controller and the model method would simply do the insertion or whatever. Should it be though that controller just calls the model method if a post has occured and it is responsible for sanity check, data checks etc.

    Read the article

  • Codeigniter - selecting children and parents from db

    - by Tomek Buszewski
    I want to pull from my database records corresponding to parent_id, like this: function getChildren($id, $parent_id) { $q = $this->db->select('id, name, slug, plat'); $q = $this->db->from('games'); $q = $this->db->where('parent_id',$id); $q = $this->db->or_where('id',$parent_id); $q = $this->db->get(); return $q->result_array(); } It - if it's a children game - get parent_id and search for a game with such id and for other games that has parent_id same as this one. If it's the parent game, it only looks for games with parent_id same as it's id. The problem is... it's not always working. I have four games in db: id | parent_id | title 15 | 0 | Abe 19 | 15 | Abe 20 | 0 | RE2 21 | 20 | RE2 DS First two works, last two - only children (id = 21) shows parent.

    Read the article

  • Getting the hang of CodeIgniter - Templating / loading views

    - by kilrizzy
    Attempting to learn CI and going through the docs to get a better understanding. Without getting a separate library, I could make a template by including a list of views like so: $this->load->view('header'); $this->load->view('navigation'); $this->load->view('sidenav_open'); $this->load->view('blocks/userinfo'); $this->load->view('blocks/stats'); $this->load->view('sidenav_close'); $this->load->view('content',$data); $this->load->view('footer'); This makes sense but would I actually have that on each of my controllers (pages)? Not sure if there is a way to include this in the initial controller (welcome) and then in the others somehow reference it? Or perhaps there is something I am missing completely

    Read the article

  • codeigniter problem at localhost.

    - by sabuj
    Previously i installed CI in xampp. After that i installed wamp on for xampp but the project don't run accurately. It shows the following error- Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Please give me a solution.....

    Read the article

  • temp. download links (with codeigniter)

    - by Ayrton
    Hi everyone I was wondering how I could start generating temporarily download links based on files from a protected directory (e.g. /downloads/). These links need to be valid until someone used it 5 times or so or after a week or so, after that the link shouldn't be accessible anymore. Any help would be appreciated.

    Read the article

  • ajax not working in codeigniter

    - by user1800797
    I'm trying to send a post request using the ajax jquery function and return some data into a window asynchronously. Here's what I have so far. It doesn't seem to be working. in the view: $.ajax({ url: '/dashboard/presskits/media/get_video_link/', type: 'POST', dataType: 'json', data: { encoded_link : encoded_link }, cache: false, success: function(output_string){ // $('#edit_video_info').append(output_string); alert(output_string.url_data); } // End of success function of ajax form }); // End of ajax call }); in the controller: public function get_video_link() { $temp_url = $this->input->post('encoded_link'); $output_string = json_encode(array('url_data' => $temp_url)); return $output_string; }

    Read the article

  • Using Wildcards in CodeIgniter

    - by tpae
    Wildcards are cool. I am trying to do this: $route["(:any)/controller"] = "controller"; basically, I want to put the wildcard in the front. It doesn't quite work, and I don't know any work around.

    Read the article

  • Defautlt Contoller in CodeIgniter

    - by gregavola
    Hello everyone, I am wondering if there is any other configuration options for a default controller. For example - if I have a controller called "site" and I set the default controller in the following file: application/config/routes.php to: $route['default_controller'] = "site"; I should be able to go to http://localhost and that brings up the index(); function in the site controller. However, if I try to do go to http://localhost/index.php/index2 to load the index2(); function I get a 404 error. If i change the URL to http://localhost/index.php/site/index2 it works fine - but I thought already set the default controller. Is there any way around this? Any thoughts?

    Read the article

  • Codeigniter passing variable to URL

    - by CyberJunkie
    I have a list of posts and an edit link for each. When clicking edit it goes to a page where I can edit the specific post I clicked on. For this I will have to pull from the db the id of the post. Would this be the correct way to do it? <a href="<?php echo site_url("post/edit/$row->id"); ?>">Edit</a> post is my controller, edit is my function, and $row->id should pull the id of the post.

    Read the article

  • Use where clause with Like in codeigniter

    - by user2524013
    I am working on a project. I am implementing the Search functionality in my System. I will have to show the search record from two tables base on the current use login. I have tried the following code: function searchActivity($limit,$offset,$keyword1,$keyword2,$recruiter_id) { $q=$this->db->select('*')->from('tbl_activity')->limit($limit,$offset); $this->db->join('tbl_job', 'tbl_job.job_id = tbl_activity.job_id_fk', 'left outer'); $this->db->order_by("activity_id", "ASC"); $this->db->like('job_title',$keyword1,'both'); $this->db->or_like('job_title',$keyword2,'both'); $this->db->or_like('activity_subject',$keyword1,'both'); $this->db->or_like('activity_subject',$keyword2,'both'); $this->db->or_like('activity_details',$keyword1,'both'); $this->db->or_like('activity_details',$keyword2,'both'); $this->db->where('tbl_activity.recruiter_id_fk',$recruiter_id); $ret['rows']=$q->get()->result(); return $ret; } I want to show search results based on the current user id, which is currently store in $recruiter. Thanks in advance.

    Read the article

  • mysql codeigniter active record m:m deletion

    - by sea_1987
    Hi There, I have a table 2 tables that have a m:m relationship, what I can wanting is that when I delete a row from one of the tables I want the row in the joining table to be deleted as well, my sql is as follow, Table 1 CREATE TABLE IF NOT EXISTS `job_feed` ( `id` int(11) NOT NULL AUTO_INCREMENT, `body` text NOT NULL, `date_posted` int(10) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; Table 2 CREATE TABLE IF NOT EXISTS `job_feed_has_employer_details` ( `job_feed_id` int(11) NOT NULL, `employer_details_id` int(11) NOT NULL, PRIMARY KEY (`job_feed_id`,`employer_details_id`), KEY `fk_job_feed_has_employer_details_job_feed1` (`job_feed_id`), KEY `fk_job_feed_has_employer_details_employer_details1` (`employer_details_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; So what I am wanting to do is, if the a row is deleted from table1 and has an id of 1 I want the row in table to that also has that idea as part of the relationship also. I want to do this in keeping with codeigniters active record class I currently have this, public function deleteJobFeed($feed_id) { $this->db->where('id', $feed_id) ->delete('job_feed'); return $feed_id; }

    Read the article

  • Default Contoller in CodeIgniter

    - by gregavola
    I am wondering if there is any other configuration options for a default controller. For example - if I have a controller called "site" and I set the default controller in the following file: application/config/routes.php to: $route['default_controller'] = "site"; I should be able to go to http://localhost and that brings up the index(); function in the site controller. However, if I try to do go to http://localhost/index.php/index2 to load the index2(); function I get a 404 error. If I change the URL to http://localhost/index.php/site/index2 it works fine - but I thought already set the default controller. Is there any way around this?

    Read the article

  • Codeigniter: State Machine how to

    - by Kevin Brown
    I created a db row called "activity_state" to denote which things a user has and hasn't completed. The problem is, I don't know how to use it... How can I use this single row to determine what a user has done? ie. have they completed their profile?, have they completed an assignment? Someone mentioned using it as a bitfield, but I'm unfamiliar with that. Is that a good idea? Any ideas?

    Read the article

  • removing index.php of codeigniter on local

    - by Aldi Aryanto
    i'm trying to remove index.php,in my localhost, but it seems doesn't working,its on http://localhost/testing i put .htacces in 'testing' directory under the htdocs LoadModule rewrite_module modules/mod_rewrite.so at apache/conf also already uncheck here my .htaccess RewriteEngine On RewriteBase /testing/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /testing/index.php/$1 [L] here my config $config['base_url'] = "http://localhost/testing"; $config['index_page'] = ''; $config['uri_protocol'] = 'AUTO'; when i access login controller, it's not found Not Found The requested URL /testing/login was not found on this server. I really don't know what to try next. Any help would be appreciated.

    Read the article

  • Codeigniter xss_clean dilemma

    - by Henson
    I know this question has been asked over and over again, but I still haven't found the perfect answer for my liking, so here it goes again... I've been reading lots and lots polarizing comments about CI's xss_filter. Basically majority says that it's bad. Can someone elaborate how it's bad, or at least give 1 most probable scenario where it can be exploited? I've looked at the security class in CI 2.1 and I think it's pretty good as it doesn't allow malicious strings like document.cookie, document.write, etc. If the site has basically non-html presentation, is it safe to use global xss_filter (or if it's REALLY affecting performance that much, use it on per form post basis) before inserting to database ? I've been reading about pros and cons about whether to escape on input/output with majority says that we should escape on output only. But then again, why allow strings like <a href="javascript:stealCookie()">Click Me</a> to be saved in the database at all? The one thing I don't like is javascript: and such will be converted to [removed]. Can I extend the CI's security core $_never_allowed_str arrays so that the never allowed strings return empty rather than [removed]. The best reasonable wrongdoing example of this I've read is if a user has password of javascript:123 it will be cleaned into [removed]123 which means string like this document.write123 will also pass as the user's password. Then again, what is the odds of that to happen and even if it happens, I can't think of any real harm that can do to the site. Thanks

    Read the article

  • Multidimensional Array To Mysql Codeigniter

    - by rochellecanale
    A little help how can I create an input query using this array? Or how can I pass it in the table? my table layout sample is this: sales_table id | product_name | price | qty | subtotal This is derived from the var_dump() function. Here is my code in array //array code from unserialized function $products = unserialize($this->session->userdata('product_list')); //This is the output. Array ( [2] => Array ( [id] => 2 [product_name] => NOKIA 5110 [product_desc] => Cellphone [product_price] => 500.00 [product_qty] => 1 [product_amount] => 500 [product_code] => NOKI2012-84353 ) [3] => Array ( [id] => 3 [product_name] => HP IPAQ RW6828 [product_desc] => Cellphone [product_price] => 1500.00 [product_qty] => 1 [product_amount] => 1500 [product_code] => HP I2012-08386 ) )

    Read the article

  • Reverse wildcard search in codeigniter

    - by Andy Platt
    I am implementing a snippet-based content management system into my current project. Snippets can be associated with a page either by exact match of the full url falling back to a wildcard match on a partial url or finally a default snippet. To implement this I have a created table of page associations with a wildcard flag, the system first checks the current url against the non-wildcard associations and if it doesn't find a match it checks against the partial url's where the wildcard flag is set. In order to achieve this I am getting all the partial url's from the database and putting them into an array then walking the array to check for a match against the current url: protected function _check_wildcard($url = NULL) { if($url) { $q = $this->db->where('wildcard' ,'Y') ->from('content') ->get(); $wildcards = $q->result_array(); foreach($wildcards AS $wildcard) { if(strpos($url,$wildcard['url']) > 0) { return $wildcard['snipppet_id']; } } } else { return NULL; } } Can anyone suggest a better way to do this - preferably one that doesn't involve having to constantly download the full list of all the wildcards each time I load a page as I am afraid that this will have a negative effect on the scalability of the system down the line?

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >