Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 8,927
» Latest member: dushee
» Forum threads: 66,205
» Forum posts: 415,477

Full Statistics

Latest Threads
How to create resful web ...
Forum: Learn More
7 hours ago
» Replies: 0   » Views: 44
download remote file wit...
Forum: General Help
11 hours ago
» Replies: 2   » Views: 61
Query Caching or NOT?!!!
Forum: Best Practices
11 hours ago
» Replies: 4   » Views: 152
Fetch data in a selected ...
Forum: CodeIgniter 3.x
Today, 09:56 AM
» Replies: 8   » Views: 216
JWT for APIs
Forum: Lounge
Today, 09:37 AM
» Replies: 4   » Views: 203
Common function
Forum: General Help
Today, 08:39 AM
» Replies: 1   » Views: 53
Message before redirect
Forum: General Help
Today, 08:30 AM
» Replies: 2   » Views: 44
Make sure show result at ...
Forum: General Help
Today, 05:51 AM
» Replies: 2   » Views: 52
php mailer
Forum: General Help
Today, 04:55 AM
» Replies: 2   » Views: 56
CodeIgniter Filipino Comm...
Forum: Regional User Groups
Yesterday, 08:28 PM
» Replies: 21   » Views: 7,145

 
  Token to api REST
Posted by: avasquez - 06-20-2017, 12:58 PM - Forum: General Help - No Replies

Greetings to all! Thank you for accepting me in the community.

I am making an api rest and at this time I need to be able to generate random tokens so that users who have permissions to access the api can generate it and review the data.

I already have all the logical part of the api built. The users look for the data according to an 'id' and get the correct result, but, I am missing this authentication.

I will be attentive to what you can help me, if there is any guide I will be grateful if you share it with me.

I have searched the search engines, but I have not been successful in my search.


  PayPal button callback fails to get controllers return value
Posted by: PaulC - 06-20-2017, 11:49 AM - Forum: General Help - Replies (12)

I am trying to integrate a simple PayPal button for express checkout into my website. We are using Ubuntu 14.02 lamp with v2 cofeigniter. The PayPal button uses a .then function to asynchronously wait for a return value from a posted method call. I am certain that call works and returns a Json structure similar to {"payToken":"some value"} but the .then promised function never sees any data and the button dialog fails to open. Tracing complains about the first character being '<' suggestion either some html or perhaps a Php header. Is there something I have missed here within CI?
Sadly I can make no sense of what's wrong here in what at first sight seems quite simple. Any help much appreciated, Paul


  Improve routes by no need to add anyting after /
Posted by: krystian2160 - 06-20-2017, 08:25 AM - Forum: CodeIgniter 4 Feature Requests - No Replies

When we do routing like:

$route['admin/login'] = 'Admin';

will work by accessing

http://url/admin/login

But something like:

$route['admin/'] = 'Admin';

Then accessing by

http://url/admin/

Will show error404.

When we do

$route['admin'] = 'Admin';

We got what we want, we can access by

http://url/admin/

But not exactly.

Cuz we can access it too by 

http://url/admin

(without slash)

And we don't want it.


It would be great to just make route that allows only access by

http://url/admin/

and nothing else, no without slash or something else


  Form validation and native PHP functions
Posted by: cvetan - 06-20-2017, 06:23 AM - Forum: Libraries & Helpers - Replies (4)

I don't understand how the native PHP functions are to be used in form validation.

For instance, i've set this rule 'required|trim|strtolower'.

For test string:

Code:
'   Test'


it doesn't show error, validation passes.

If i missunderstood, what should native functions do in form validation?


  Send Separate Emails Simultaneously
Posted by: johnny_s - 06-20-2017, 04:46 AM - Forum: General Help - Replies (5)

Hi,

First post on here - hopefully someone can help Smile

Using Codeigniter 3, I have a web form that sends an email to the site admin once a form is submitted - this works as expected.

I am using email templates, once the form is submitted template 1 is sent (to the site admin). I would now like to simultaneously send template 2 (to the submitter's email address).

The emails will contain the same content apart from the email intro text, and subject - details below;

Email Template 1 - to admin;
'Hi, a new item has been requested on the site, ...'

Email Template 2 - to submitter;
'Hi, Here is the item you have requested on the site, ...'

My current code is as follows;

Code:
public function sendRequest() {

   $this->load->library('email');

   $from_email     = $this->input->post('email');
   $to_email       = [email protected]';
   $subject        = 'New Item Request - Admin Copy';
   $name           = $this->input->post('name');
   $comment        = $this->input->post('comment');

   $this->email->from($from_email);
   $this->email->to($to_email);
   $this->email->subject($subject);

   $data = array(
       'name'          =>  $name,
       'from'          =>  $from_email,
       'comment'       =>  $comment,
       );
   // send email template 1
   $this->email->message($this->load->view('template/email/item_request_template', $data, true));

  // send email template 2 to submitter - how?
  // change $subject to 'New Item Request - User Copy';

   if($this->email->send()) {
       // send the $data to my email template
       $data = array(
        'item_request_name'    => $this->input->post('name'),
        'item_request_email'   => $this->input->post('email'),
        'item_request_comment' => $this->input->post('comment'),
        );
   }
}

Not sure what I need to add in order to send the second email template?

Any help would be appreciated.


  Is it possible to chance config settings in controller?
Posted by: krystian2160 - 06-20-2017, 04:43 AM - Forum: General Help - Replies (16)

We may have 

$config['title'] = 'This title;

In application/config/config.php

Is it possible to change this from controller? To do a change to config file.
Maybe some method? like $this->config->change_item('title') = 'new title'; Idk, something? Any way?

I mean change this like we would change this directly in the file.


  404 Override Not Working
Posted by: wolfgang1983 - 06-20-2017, 02:18 AM - Forum: General Help - Replies (16)

I this controller Notfound.php

Path: application > controllers > Notfound.php

I place it in the override 404 in routes


PHP Code:
$route['404_override'] = 'notfound'

But still does not show not overriding the 404.

I use virtual hosting with xampp

This is my htaccess

PHP Code:
Options +FollowSymLinks
Options 
-Indexes
DirectoryIndex index
.php
RewriteEngine on
RewriteCond 
$!^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_FILENAME} !-d
RewriteRule 
^(.*)$ index.php/$[L,QSA

I am not sure why it is not overriding it anysuggestions?

My template library is autoloaded


PHP Code:
<?php

class Notfound extends CI_Controller
{
public function 
__construct()
{
parent::__construct();
}

public function 
index()
{
$this->template->set_title('Not Found!');

$this->template->render('error/not_found'$template = array());
}

I trigger the show_404 on my controller viewthread which I have attached.



Attached Files
.php   Viewthread.php (Size: 3.65 KB / Downloads: 6)

  REST
Posted by: jms - 06-20-2017, 01:38 AM - Forum: General Help - Replies (2)

Hi
I want to use Rest_controler to make RESTfull api, but I have problem how can I make user  perm to resources.
For example

users/users  (GET users list only for admin group users)
but
users/user/id/10 (GET user for admin group user but for user with ID=10 too)

I think about constructor in REST_Controller and ion_auth - check user and redirect to proper method of controller or send 401 error to user, but where is information about user from HTTP auth?


best regards Jurek


  JWT for APIs
Posted by: ciadvantage - 06-19-2017, 11:07 PM - Forum: Lounge - Replies (4)

I am thinking of using JWT (Json Web Token) for some of my APIs functions.  Any opinions about this approach?
Basically I pass a token along with the request to server and the token needed to be decoded and response is back!

Regards


  Session Data lost when redirect to a view
Posted by: hafizfarooq - 06-19-2017, 02:45 PM - Forum: General Help - Replies (5)

I have setting a session in my controller  by using

PHP Code:
           $this->load->model('user_m');
 
           $ui $this->user_m->login($username$password);
 
           if ($ui) {
 
               
                $this
->load->library('session');
 
               $this->session->set_userdata('userinfo',$ui); 

But when i redirect it to my view.... it gives nothing... 
1) where's the session data goes.
2)How to get the session data in my view



  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.