Search Results

Search found 19375 results on 775 pages for 'codeigniter url'.

Page 23/775 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • codeigniter: how to redirect after login to current controller (php_self in regular php)

    - by krike
    Well it's not really a problem but I check if the user exist and log them in and redirect to site/members_area, but I don't want to send the user to a specific page but i want to reload the current controller. So if I login in index/home I would like to be redirected at index/home, how should I proceed? in regular php I would put in the action to redirect to current page <?php echo $_SERVER['PHP_SELF']; ?> This is the code in the framework function validate_credentials() { $this->load->model('membership_model'); $query = $this->membership_model->validate(); if($query) // if the user's credentials validated... { $data = array( 'username' => $this->input->post('username'), 'is_logged_in' => true ); $this->session->set_userdata($data); redirect('site/members_area'); //<-- this line here should be dynamic } else // incorrect username or password { $this->index(); } }

    Read the article

  • 500 error on function call in Codeigniter

    - by Ilia Lev
    I am using just installed CI 2.1.3 Following phpacademy tutorial I wrote in the routes.php: $route['default_controller'] = "site"; (instead of: $route['default_controller'] = "welcome";) and in controllers/site.php: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Site extends CI_Controller { public function index() { echo "default function started.<br/>"; } public function hello(){ echo "hello function started.<br/>"; } } After uploading it to the server and going to the [www.mydomain.ext] it works ok (writes: "default function started.") BUT if I add 'this-hello();' to the index() function it throws a 500 error. Why does it happen and how can I resolve this? Thank you in advance.

    Read the article

  • sending email with codeigniter

    - by Maru
    I have this MODEL and I get the email which I want to send class Cliente_Model extends CI_Model{ public function getInfo($id){ $this->db->select('*'); $this->db->from('pendientes'); $query = $this->db->get(); if($query->num_rows() > 0) { foreach ($query->result_array() as $row) { return $row['email']; } } else { return FALSE; } } } CONTROLLER $this->load->model('cliente_model', 'client'); $clientInfo = $this->client->getInfo($id); $this->email->from('[email protected]', 'Demo'); $this->email->to($clientInfo); $this->email->subject('Email Test'); $this->email->message('your user is '.$clientInfo.' and your password is '.$clave); $this->email->send(); and I need some help here, I can get the email and it can send it perfectly but in the message I need to send the password also and I don't know how I can get it from the model. thanks in advance!

    Read the article

  • Codeigniter Form validation problem

    - by ben robinson
    Please please please can someone help me $this-load-library('form_validation'); $this-load-helper('cookie'); $data = array(); if($_POST) { // Set validation rules including additional validation for uniqueness $this-form_validation-set_rules('yourname', 'Your Name', 'trim|required'); $this-form_validation-set_rules('youremail', 'Your Email', 'trim|required|valid_email'); $this-form_validation-set_rules('friendname', 'Friends Name', 'trim|required'); $this-form_validation-set_rules('friendemail', 'Friends Email', 'trim|required|valid_email'); // Run the validation and take action if($this-form_validation-run()) { echo 'valid; } } else{ echo 'problem'; } Form validation is coming back with no errors can cany one see why?

    Read the article

  • Codeigniter how to access class variables

    - by Obay
    I thought this was going to be a no-brainer but I can't seem to access member variables: class MyObject extends Controller { private $START_OF_WEEK = 1; /* constructor here */ function index() { echo $this->$START_OF_WEEK; } } echo $this->$START_OF_WEEK; says Cannot access empty property How do I access member variables? Or... how do I declare them correctly?

    Read the article

  • How to make a proper index page for subdirectories in CodeIgniter

    - by iamdadude
    I'm building an app that has a section for consumers and businesses, and I want to separate the controllers folder appropriately, so it looks like this - http://domain.com/users/signup/ http://domain.com/business/signup/ I have it working by creating a separate folder for each section in the "controllers" folder, but I want to know how to make an appropriate page when the user visits the http://domain.com/users/. It currently just loads the homepage. How can I fix this?

    Read the article

  • CodeIgniter helper inside controllers

    - by kapitanluffy
    can i call helper functions inside controller classes? let's say i have this controller with the _open_form method class User extends Controller { function _open_form($action){ print_r(form_open($action)); } } i tried echoing out the result of form_open() but it returns null. it seems that helper functions can't be called inside controllers if your wondering why i need to use it inside the controller instead in the view because we are required to use the given template parser xD

    Read the article

  • Auto complete from database using CodeIgniter (Active Record)

    - by Ralph David Abernathy
    I have a form on my website in which one is able to submit a cat. The form contains inputs such as "Name" and "Gender", but I am just trying to get the auto completion to work with the "Name" field. Here is what my jquery looks like : $(document).ready(function() { $( "#tags" ).autocomplete({ source: '/Anish/auto_cat' }); }); Here is what my model looks like: public function auto_cat($search_term) { $this->db->like('name', $search_term); $response = $this->db->get('anish_cats')->result_array(); // var_dump($response);die; return $response; } } Here is my controller: public function auto_cat(){ $search_term = $this->input->get('term'); $cats = $this->Anish_m->auto_cat($search_term); } And here is my view: <head> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> </head> <h1>Anish's Page</h1> <form action="/Anish/create" method="POST"> <div class="ui-widget"> <label for="tags">Name</label><input id="tags" type="text" name="name"> </div> <div> <label>Age</label><input type="text" name="age"> </div> <div> <label>Gender</label><input type="text" name="gender"> </div> <div> <label>Species</label><input type="text" name="species"> </div> <div> <label>Eye Color</label><input type="text" name="eye_color"> </div> <div> <label>Color</label><input type="text" name="color"> </div> <div> <label>Description</label><input type="text" name="description"> </div> <div> <label>marital status</label><input type="text" name="marital_status"> </div> <br> <button type="submit" class="btn btn-block btn-primary span1">Add cat</button> </form> <br/><br/><br/><br/> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Name</th> <th>Gender</th> <th>Age</th> <th>Species</th> <th>Eye Color</th> <th>Color</th> <th>Description</th> <th>Marital Status</th> <th>Edit</th> <th>Delete</th> </tr> </thead> <tbody> <?php foreach ($cats as $cat):?> <tr> <td> <?php echo ($cat['name']);?><br/> </td> <td> <?php echo ($cat['gender']);?><br/> </td> <td> <?php echo ($cat['age']);?><br/> </td> <td> <?php echo ($cat['species']);?><br/> </td> <td> <?php echo ($cat['eye_color']);?><br/> </td> <td> <?php echo ($cat['color']);?><br/> </td> <td> <?php echo ($cat['description']);?><br/> </td> <td> <?php echo ($cat['marital_status']);?><br/> </td> <td> <form action="/Anish/edit" method="post"> <input type="hidden" value="<?php echo ($cat['id']);?>" name="Anish_id_edit"> <button class="btn btn-block btn-info">Edit</button> </form> </td> <td> <form action="/Anish/delete" method="post"> <input type="hidden" value="<?php echo ($cat['id']);?>" name="Anish_id"> <button class="btn btn-block btn-danger">Delete</button> </form> </td> </tr> <?php endforeach;?> </tbody> </table> I am stuck. In my console, I am able to see this output when I type the letter 'a' if I uncomment the var_dump in my model: array(4) { [0]=> array(9) { ["id"]=> string(2) "13" ["name"]=> string(5) "Anish" ["gender"]=> string(4) "Male" ["age"]=> string(2) "20" ["species"]=> string(3) "Cat" ["eye_color"]=> string(5) "Brown" ["color"]=> string(5) "Black" ["description"]=> string(7) "Awesome" ["marital_status"]=> string(1) "0" } [1]=> array(9) { ["id"]=> string(2) "16" ["name"]=> string(5) "Anish" ["gender"]=> string(2) "fe" ["age"]=> string(2) "23" ["species"]=> string(2) "fe" ["eye_color"]=> string(2) "fe" ["color"]=> string(2) "fe" ["description"]=> string(2) "fe" ["marital_status"]=> string(1) "1" } [2]=> array(9) { ["id"]=> string(2) "17" ["name"]=> string(1) "a" ["gender"]=> string(1) "a" ["age"]=> string(1) "4" ["species"]=> string(1) "a" ["eye_color"]=> string(1) "a" ["color"]=> string(1) "a" ["description"]=> string(1) "a" ["marital_status"]=> string(1) "0" } [3]=> array(9) { ["id"]=> string(2) "18" ["name"]=> string(4) "Matt" ["gender"]=> string(6) "Female" ["age"]=> string(2) "80" ["species"]=> string(6) "ferret" ["eye_color"]=> string(4) "blue" ["color"]=> string(4) "pink" ["description"]=> string(5) "Chill" ["marital_status"]=> string(1) "0" } }

    Read the article

  • PHP & CodeIgniter Error: open_basedir restriction in effect

    - by iamdadude
    open_basedir restriction in effect. File(/var/www/vhosts/domain.com) is not within the allowed path(s): (/var/www/vhosts/domain.com/httpdocs:/tmp) How do I securely fix this? This is preventing me from listing and creating directories outside of the current directory. What I mean by securely is that I don't want to remove a piece of code from a configuration file and potentially make it easier for hackers to do whatever.

    Read the article

  • Enable Query Strings in Code Igniter

    - by tarnfeld
    Hey, I am trying to implement Twitter's OAuth into my Code Igniter web application at which the callback URL is /auth/ so once you have authenticated with Twitter you are taken to /auth/?oauth_token=SOME-TOKEN. I want to keep the nice clean URL's the framework provides using the /controller/method/ style of URL but I want to enable query strings as well, there will only ever be one name of the data oauth_token so it's ok if it has to be hard coded. Any ideas? I have tried tons of the things people are saying to do, but none work :( PS: I'm using the .htaccess method of URL rewriting.

    Read the article

  • Codeigniter - form not rendering on live server?

    - by pingu
    hi guys, I've written a small website with CI, which is all working fine on dev. However, when I copy the files over for live, everything works except for my form which is not being rendered. I am using <?php echo form_open('home'); ?> and <?php echo form_close(); ?> The form fields within the form, which I'm generating as follows are being rendered fine, but there is simply no form around them?! <?php $data = array( 'name'=> 'name', 'id'=> 'name', 'class'=>'textfield', 'value' => set_value('name') ); echo form_input($data); ?> Any ideas - I've used CI on a few apps, and this is the first time I've come across this issue. I've got all the helpers etc called correctly, as this is working perfectly in the development environment.

    Read the article

  • Passing Results from SQL to Google Maps API in CodeIgniter

    - by Jason Shultz
    I'm hoping to use google maps on my site. My addresses are stored in a db. I’m pulling up a page where the information is all dynamic. For example: mysite.com/site/business/5 (where 5 is the id of the business). Let’s say I do a query like this: function addressForMap($id) { $this->db->select(‘b.id, b.busaddress, b.buscity, b.buszip’); $this->db->from(‘business as b’); $this->db->where(‘b.id, $id); } How can I output the info to the google maps api correctly so that it display’s the map appropriately? The API interface takes the results like this: $marker['address'] = 'Crescent Park, Palo Alto';

    Read the article

  • rewrite rule for codeigniter

    - by John
    this is my controller in CI class Welcome extends Controller { function Welcome() { parent::Controller(); } function index() { } function bil($model='') { } I want to do a rewrite so that http://example.com/index.php/welcome/bil/model becomes http://example.com/model in my htaccess I have RewriteBase / RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/welcome/$1 [L] #RewriteRule ^(.*)$ /index.php/welcome/bil/$1 [L] I thought it should be as easy as removing the /index.php/welcome/ part but when I uncomment the last line it get 500 internal server error

    Read the article

  • How to change Controllers/Models source directory in CodeIgniter

    - by Ady Mareshal
    I need to load controllers and models from a different folder than the default one. I am using a Linux system. I am building a simple CI application for some people, for use on a shared hosting I own. But I want to give them access only to /views folder and some /config files. And this is why I need to store the controllers and models in a different folder on the same level as /public_html folder or maybe somewhere in the linux system. I consider this would be a better solution than encoding files

    Read the article

  • Cannot exit in CodeIgniter constructor

    - by gzg
    I'm basically trying a session control. If the user is logged in, it's ok to move on. But if he's not logged in, then it will show a log-in screen and then die. However, when I use die or exit in the constructor, it does not show the log-in screen; it immediately dies. The code is as following: private $username = null; private $mongoid = null; private $neoid = null; public function __construct(){ parent::__construct(); // session to global $this->username = $this->session->userdata( 'username'); $this->mongoid = $this->session->userdata( 'mongoid'); $this->neoid = $this->session->userdata( 'neoid'); // check if user is logged in if( $this->username == "" || empty( $this->username)){ $this->load->view( 'access/login'); die; } } It shows the log-in page if die is not written there, but with die, it does not show. Why do I want to use die? Because if I don't use, it moves on the index function and I don't want it to execute index function if the user is not logged in. What is wrong here? What should I use to stop executing?

    Read the article

  • Codeigniter: Library function--I'm stuck

    - by Kevin Brown
    I have a library function that sets up my forms, and submits data. They're long, and they work, so I'll spare you reading my code. :) I simply need a way for my functions to determine how to handle the data. Until now, the function did one thing: Submit a report for the current user. NOW, the client has requested that an administrator also be able to complete a form--this means that the form would be filled out, and it would CREATE a user at the same time, whereas the current function EDITS and is accessed by an EXISTING user. Do I need a separate function to do essentially the same thing? How do I make one function perform two tasks? One to update a user, and if there is no user, create one. Current controller: function survey() { $id = $this->session->userdata('id'); $data['member'] = $this->home_model->getUser($id); //Convert the db Object to a row array $data['manager'] = $data['member']->row(); $manager_id = $data['manager']->manager_id; $data['manager'] = $this->home_model->getUser($manager_id); $data['manager'] = $data['manager']->row(); $data['header'] = "Home"; $this->survey_form_processing->survey_form($this->_container,$data, $method); } Current Library: function survey_form($container) { //Lots of validation stuff $this->CI->validation->set_rules($rules); if ( $this->CI->validation->run() === FALSE ) { // Output any errors $this->CI->validation->output_errors(); } else { // Submit form $this->_submit(); } $this->CI->load->view($container,$data); The submit function is huge too. Basically says, "Update table with data where user_id=current user" I hope this wasn't too confusing. I'll create two functions if need be, but I'd like to keep redundancy down! }

    Read the article

  • Access Codeigniter database functions from file

    - by Manny Calavera
    Hello. I am using a SWFupload script and I can't make a request from flash with mod_rewrite, I don't know why... I just need to point the Flash request to that file directly. This file runs an upload script that works ok but now I need to save some info to the database and I would like to know what should I write to have access from that file that is not called from the controller and does not extend the model in order to run a mysql query. Thanks.

    Read the article

  • Passing jquery JSON from Codeigniter controller to view

    - by dede
    I've been struggling to make it work, but cannot pass the inserted data from the controler to the view in CI using JSON. The input value from the form is successfully inserted into the database, but cannot make it appear in the view. This is my view file ajax_view.php: <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery-1.4.2.min.js"></script> $(document).ready(function(){ $("#submit").click(function(){ var inp = $('#inp').val(); $.post("ajax/ajax_input", { 'send' : inp }, function(data){ alert(data.input_text); }, "json"); }); }); </script> </head> <body> <form id="form1" method="post" action=""> <label for="inp">Text</label> <input type="text" name="inp" id="inp" /> <label for="submit"></label> <input type="submit" name="submit" id="submit" value="Submit" /> And this is the ajax_input method of the ajax.php controller: <?php // Initializing controller ..... // ............................. //ajax method function ajax_input(){ $var_1 = trim($this->input->post('send')); $array = array('input_text' => $var_1); echo json_encode($array); $this->db->insert('ajax',$array); } Trying to debug it with Firebug, it gives me that data.input_text is empty. What am I doing wrong? EDIT: I'm using XAMPP on Win, so is it posible that json configuration is the problem?

    Read the article

  • Codeigniter database update

    - by Carry All
    The table is like this and I want to update DecryptionDate by specify ArchiveID and RecipientID this is my code $this->load->database(); $date = date("Y-m-d H:i:s"); $data = array('DecryptionDate' => $date); $array = array('ArchiveID'=>$archiveID.'','RecipientID'=>$userID.''); $this->db->where($array); $this->db->update('log', $data); if ($this->db->affected_rows() > 0) { echo "SUCCESS"; } else { echo "FAIL"; } my problem is I can update the data only when $archiveID is 911 and $userID is test01 but the program fail to update when $archiveID is 911 and $userID is test02

    Read the article

  • CodeIgniter: Weird echo of $config coming back when I load Email Library

    - by k00k
    Version info: CI version 1.7.2 - PHP 5.3.1 - Apache2 - Mac OSX 10.6.3 For some reason, when I load CI's email library, either in my controller, or in autoload.php, it automatically and immediately echoes the config info like so: $config['protocol'] = 'sendmail'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['charset'] = 'iso-8859-1'; $config['wordwrap'] = TRUE If I autoload the email library in autoload.php, it is echoed before anything else in my source/page. If I call it explicitly within my controller, it's echoed at that exact point. I'm stumped, never seen that before. Any ideas on how to surpress/eliminate?

    Read the article

  • PHP/codeigniter - use of exit()

    - by Patrick
    I have a few pages that require login, so all controllers that link to these pages start with $this->checkSession(); //...rest of the code CheckSession should verify the session is still live, otherwise display a message and stop the execution of the rest of the code in the controller: function checkSession() { if (!$this->session->userdata('is_logged_in')) { //the session has expired! $data['main'] = 'confirmation_message'; $data['title'] = "Session expired"; $this->load->vars($data); $this->load->view('template'); exit(); } } . I was expecting these instructions to happen in sequence, but I only get a blank page. How can I make sure exit() gets executed only after all views are loaded?

    Read the article

  • Codeigniter Template library, add_js() method

    - by Karl
    using This Template Library when i try and use the add_js() function it errors out. I add the regions $_scripts to the template header file but when i load the page it says undefined variable _scripts. any thoughts? changed <?= $_scripts ?> to <?= (isset($_scripts)) ? $_scripts : “”; ?> and obviously i lose the error but the js file still isnt loading. I did an echo at each step though the add_js() method and the output is correct. I also did an output of $this-js and they both had the corret output. So it gets through the get_js method fine and sets the class variable fine but i dont get anything added to the actual page.

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >