I want to embed a verified logo and verified date in the text field to the uploaded document. Need some suggestion guys.
↧
how to insert a verified logo and digital signature in the uploaded document
↧
Issue with facebook login
I want to add login with facebook in my website. so i have been used demo in following url:
https://github.com/LoriKarikari/Social-C...pplication
but i cant able to login because it returns errors.please check following screenshot:
https://snag.gy/Wq86ZB.jpg
Thank You.
https://github.com/LoriKarikari/Social-C...pplication
but i cant able to login because it returns errors.please check following screenshot:
https://snag.gy/Wq86ZB.jpg
Thank You.
↧
↧
IDEA: Controller Extended by Default
I've been reading on the forums a lot, and one thing I keep seeing: there are a lot of requests solved by extending the controller and then using a new base controller to recreate some of the CI3-style "autoload". From a development standpoint, it makes sense to extend the controller initially even if you don't have any modifications to the base yet since making the change down the road involves going back and editing every controller.
So, would it make sense to ship with a basic extended Controller (e.g. app/BaseController.php) that was used by app/Controllers/Home.php and recommended by the User Guide? Doesn't seem that it would cost anything and would set many people up for a best practice.
(reference: https://codeigniter4.github.io/CodeIgnit...re-classes)
EDIT: I suppose a better location would be something like app/Libraries/BaseController.php, or in a new folder like "Core" or "Extensions" in app/.
So, would it make sense to ship with a basic extended Controller (e.g. app/BaseController.php) that was used by app/Controllers/Home.php and recommended by the User Guide? Doesn't seem that it would cost anything and would set many people up for a best practice.
(reference: https://codeigniter4.github.io/CodeIgnit...re-classes)
EDIT: I suppose a better location would be something like app/Libraries/BaseController.php, or in a new folder like "Core" or "Extensions" in app/.
↧
User Alert Library
Hi all! I'm a long-time user with many live CI3 projects. Managing libraries across them got to be almost as much work as each project, so I developed five "zero conf" libraries to add core functions I needed which could be dropped in and used without setup. I never got around to publishing them, but as I rewrite them for CI4 I'll be making them available.
See my first post for the Asset Loader. Now I give you the second library:
Tatter/Alerts - "Zero conf" user alerts for CodeIgniter 4
Basic usage:
1. Install: `> composer require tatter/alerts`
2. Load the helper file: `helper("tatter\alerts");`
3. Set an alert: `alert("success", "Widget updated.");`
4. Add the wrapper & alerts to your view: `alerts();`
I am eager for feedback, suggestions, and contributions - feel free to respond here or on GitHub (https://github.com/tattersoftware/codeigniter4-alerts).
Thanks for reading!
See my first post for the Asset Loader. Now I give you the second library:
Tatter/Alerts - "Zero conf" user alerts for CodeIgniter 4
Basic usage:
1. Install: `> composer require tatter/alerts`
2. Load the helper file: `helper("tatter\alerts");`
3. Set an alert: `alert("success", "Widget updated.");`
4. Add the wrapper & alerts to your view: `alerts();`
I am eager for feedback, suggestions, and contributions - feel free to respond here or on GitHub (https://github.com/tattersoftware/codeigniter4-alerts).
Thanks for reading!
↧
session lock feedback
hi everyone
i want to give feedback when query takes long and user session locked, i mean like "you should wait until query ends" i have tried but no results for me
i have get_lock function in those pages
i guess "SELECT GET_LOCK('".$arg."', 300) AS ci_session_lock")->row()->ci_session_lock" is locked my session but i did comment that line nothing is affected
thanks for suggestions
i want to give feedback when query takes long and user session locked, i mean like "you should wait until query ends" i have tried but no results for me
i have get_lock function in those pages
- Session_database_driver.php
- Session_memcached_driver.php
- session_redis_driver.php
- Session_driver.php
i guess "SELECT GET_LOCK('".$arg."', 300) AS ci_session_lock")->row()->ci_session_lock" is locked my session but i did comment that line nothing is affected
thanks for suggestions
↧
↧
block mapping sequence [CI2]
I am using HMVC and on some pages there is a problem with the sequence of displaying blocks. At the beginning of my view I call
<? = modules :: run ('header')?>
Next comes the HTML code of my page. The problem is that the header code can appear anywhere, in the middle or at the end of my view. I can not find the reason for this, although the time for calling each module is correct.
<? = modules :: run ('header')?>
Next comes the HTML code of my page. The problem is that the header code can appear anywhere, in the middle or at the end of my view. I can not find the reason for this, although the time for calling each module is correct.
↧
CI-Breadcrumb
Hi,
I propose this library for CodeIgniter 3.x.x, CI-Breadcrumb. This one allows to create a menu of navigation of the type "breadcrumb".
Source: https://github.com/domProjects/CI-Breadcrumb
Image may be NSFW.
Clik here to view.
I propose this library for CodeIgniter 3.x.x, CI-Breadcrumb. This one allows to create a menu of navigation of the type "breadcrumb".
Source: https://github.com/domProjects/CI-Breadcrumb
Image may be NSFW.
Clik here to view.
![[Image: screenshot.png]](http://demo.domprojects.com/ci-breadcrumb/screenshot/screenshot.png)
↧
Basic App - Free CMS on CodeIgniter 4
We are pleased to inform you about the release of the public version of the Basic App. The first version of the system implements the management of text pages and a simple blog. In the Basic App, the Cool Admin theme is integrated into site backend, and the public part is done with the Clean Blog theme. Themes in the system are placed in external Composer packages, you can easily change the design of the entire site without interfering with the system code. The system is made extensible, the classes in the system modules use the object-oriented programming inheritance, you can easily extend them with new functions.
Image may be NSFW.
Clik here to view.![[Image: screen_pages.png?raw=true]]()
The Basic App aims to be a reliable foundation for your CodeIgniter 4 based site. The system implements management of administrators, management of access roles to different backend area sections, storing of configs in database and management of them from backend. The Basic App has management of the templates of e-mail messages sent from the site, management of SMTP server settings from the backend, management of the site menus. The PHPMailer package is integrated to send messages from site.
Basic App GUI is multilingual, you can manage translations of the backend area interface through the web interface in the backend.
Client scripts are managed through Bower, the basic version is configured to edit the text of the pages through the visual editor TinyMCE, the editing of site layout blocks is done with code highlighting through CodeMirror, the text of blog posts is edited using Markdown markup. You can change these editors to any others you are used to using.
- Installation Instruction
- Documentation
The system is distributed under the MIT licence, you can freely use it to create your own websites, including selling them to third parties, while maintaining the copyrights of the Basic App in the backend and in the code of the modules of system.
We are waiting for a backlash from you, your advice will help us to make the system better together.
PS: Basic App Dev Team offers services for creating websites on the Basic App, integrating ready-made themes, and developing additional modules for the Basic App.
Image may be NSFW.
Clik here to view.
![[Image: screen_pages.png?raw=true]](http://github.com/basic-app/docs/blob/master/screen_pages.png?raw=true)
The Basic App aims to be a reliable foundation for your CodeIgniter 4 based site. The system implements management of administrators, management of access roles to different backend area sections, storing of configs in database and management of them from backend. The Basic App has management of the templates of e-mail messages sent from the site, management of SMTP server settings from the backend, management of the site menus. The PHPMailer package is integrated to send messages from site.
Basic App GUI is multilingual, you can manage translations of the backend area interface through the web interface in the backend.
Client scripts are managed through Bower, the basic version is configured to edit the text of the pages through the visual editor TinyMCE, the editing of site layout blocks is done with code highlighting through CodeMirror, the text of blog posts is edited using Markdown markup. You can change these editors to any others you are used to using.
- Installation Instruction
- Documentation
The system is distributed under the MIT licence, you can freely use it to create your own websites, including selling them to third parties, while maintaining the copyrights of the Basic App in the backend and in the code of the modules of system.
We are waiting for a backlash from you, your advice will help us to make the system better together.
PS: Basic App Dev Team offers services for creating websites on the Basic App, integrating ready-made themes, and developing additional modules for the Basic App.
↧
Cron job returns "Undefined index: REQUEST_METHOD"
Hi,
I'm attempting to run a cron job using CodeIgniter 3.1.8. The cron job works fine locally from the Windows command line, but when I run it on a Linux server as a CPanel cron, I get this in the output (among various other session related warnings):
<h4>A PHP Error was encountered</h4>
<p>Severity: Notice</p>
<p>Message: Undefined index: REQUEST_METHOD</p>
<p>Filename: core/Security.php</p>
<p>Line Number: 211</p>
Would be grateful for any help...
I'm attempting to run a cron job using CodeIgniter 3.1.8. The cron job works fine locally from the Windows command line, but when I run it on a Linux server as a CPanel cron, I get this in the output (among various other session related warnings):
<h4>A PHP Error was encountered</h4>
<p>Severity: Notice</p>
<p>Message: Undefined index: REQUEST_METHOD</p>
<p>Filename: core/Security.php</p>
<p>Line Number: 211</p>
Would be grateful for any help...
↧
↧
Third Party Migrations
I'm working on a library whose goal is to be plug-and-play, zero conf, whatever you want to call it. CI4 has made this *great* with name spacing everything and PSR4 autoload. My question is about the best practice around database migrations/seeds that come with a library.
The typical way I'd handle a table would be to create the migration and run it from CLI. However, CI4 has the ability to run migrations from a controller or library (https://codeigniter4.github.io/CodeIgnit...ge-example), which makes it appealing to offer "automatic database configuration" - maybe the constructor checks for the existence of the table and runs the migrations if not found.
How do autoloaded Composer packages typically handled migrations? is there an expectation that the user will run it from CLI - every time there's an update / new migration? Can a package pass its own [namespace]/Config/Migrations.php and load it to the migrations service? if so is it customary to use the default "migrations" table? Anyone with experience in the area care to weigh in?
The typical way I'd handle a table would be to create the migration and run it from CLI. However, CI4 has the ability to run migrations from a controller or library (https://codeigniter4.github.io/CodeIgnit...ge-example), which makes it appealing to offer "automatic database configuration" - maybe the constructor checks for the existence of the table and runs the migrations if not found.
How do autoloaded Composer packages typically handled migrations? is there an expectation that the user will run it from CLI - every time there's an update / new migration? Can a package pass its own [namespace]/Config/Migrations.php and load it to the migrations service? if so is it customary to use the default "migrations" table? Anyone with experience in the area care to weigh in?
↧
Queries on Uploading code to Website
I have developed code using CodeIgniter, XAMPP, PHP, HTML, CSS, AJAX, Javascript on a Windows 7 desktop machine. Now, I want to upload to a website. I have below queries, can any one provide information on the same?
1. What changes should I make to the code?
2. Can I buy Linux based Web hosting? In that case what all changes in the code and setup are required? Presently, my development machine is Windows 7 only. Will I need to setup a Linux VM for this purpose and do some specific actions on it?
3. The website is going to be accessed from a windows machine as well as Android TABS - here any specific changes to be made other than updating every view file with - <meta name="viewport" content="width=device-width, initial-scale=1"> (I checked on my windows machine, when browser size is reduced the content gets adjusted to some extent).
Kindly request to suggest on above & also ANY OTHER points which are important.
1. What changes should I make to the code?
2. Can I buy Linux based Web hosting? In that case what all changes in the code and setup are required? Presently, my development machine is Windows 7 only. Will I need to setup a Linux VM for this purpose and do some specific actions on it?
3. The website is going to be accessed from a windows machine as well as Android TABS - here any specific changes to be made other than updating every view file with - <meta name="viewport" content="width=device-width, initial-scale=1"> (I checked on my windows machine, when browser size is reduced the content gets adjusted to some extent).
Kindly request to suggest on above & also ANY OTHER points which are important.
↧
Code Modules + Filters + Routes = ERR_TOO_MANY_REDIRECTS. Where am I going wrong?
Ok here we go. My folder structure looks like this:
Image may be NSFW.
Clik here to view.
Screen Shot 2019-03-20 at 10.41.53 am.png (Size: 75.86 KB / Downloads: 4)
And before anyone asks, Yes I've added my namespace to app/Config/Autoload.php. That part works fine.
What I want to do is basically roll-my-own auth system. I know there a plenty of choices even at this early stage of the beta, but I figured making my own would help wrap my head around CI4 and namespaces. So far so good.
So the entry point of the app is the Dashboard (app/Controllers/Dashboard.php). On its own, it works fine.
I've also created a controller and view in my Auth module (Ariom/Auth/Controllers/Auth.php, and Ariom/Auth/Views/Login.php). On their own, they also works fine.
Where I'm having problems is when it comes to Routes and Filters. I want to redirect the user to login if there is no active session. The way I've seen it come up here in this forum a couple of times is to use a Filter. Ok great, so I've tried to have a go at this.
(Ariom/Auth/Filters/Auth.php)
(app/Config/Filters.php)
(Ariom/Auth/Config/Routes.php)
So what I know is this:
Although I do get redirected to /login, I time out with ERR_TOO_MANY_REDIRECTS. I have no idea where to begin debugging this. Any ideas, anyone?
Image may be NSFW.
Clik here to view.

And before anyone asks, Yes I've added my namespace to app/Config/Autoload.php. That part works fine.
PHP Code:
$psr4 = [
'Config' => APPPATH . 'Config',
APP_NAMESPACE => APPPATH, // For custom namespace
'App' => APPPATH, // To ensure filters, etc still found,
'AriomAuth' => ROOTPATH . 'Ariom/Auth',
];
What I want to do is basically roll-my-own auth system. I know there a plenty of choices even at this early stage of the beta, but I figured making my own would help wrap my head around CI4 and namespaces. So far so good.
So the entry point of the app is the Dashboard (app/Controllers/Dashboard.php). On its own, it works fine.
PHP Code:
<?php namespace App\Controllers;
use CodeIgniter\Controller;
class Dashboard extends Controller {
public function __construct() {
}
public function index() {
helper('html');
echo view('templates/header');
echo view('Dashboard/Dashboard');
echo view('templates/footer');
}
}
I've also created a controller and view in my Auth module (Ariom/Auth/Controllers/Auth.php, and Ariom/Auth/Views/Login.php). On their own, they also works fine.
PHP Code:
<?php namespace AriomAuth\Controllers;
use CodeIgniter\Controller;
class Auth extends Controller {
public function login() {
echo view('AriomAuth\Views\Login');
}
}
Where I'm having problems is when it comes to Routes and Filters. I want to redirect the user to login if there is no active session. The way I've seen it come up here in this forum a couple of times is to use a Filter. Ok great, so I've tried to have a go at this.
(Ariom/Auth/Filters/Auth.php)
PHP Code:
<?php namespace AriomAuth\Filters;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Filters\FilterInterface;
use Config\Services;
class Auth implements FilterInterface
{
public function before(RequestInterface $request) {
$session = Services::session();
if(!$session->has('authenticated')) {
return redirect('login');
}
}
public function after(RequestInterface $request, ResponseInterface $response) {
}
}
PHP Code:
//--code--
public $aliases = [
'csrf' => \CodeIgniter\Filters\CSRF::class,
'toolbar' => \CodeIgniter\Filters\DebugToolbar::class,
'honeypot' => \CodeIgniter\Filters\Honeypot::class,
'auth' => \AriomAuth\Filters\Auth::class,
];
public $globals = [
'before' => [
//'honeypot'
// 'csrf',
'auth',
],
'after' => [
'toolbar',
//'honeypot'
],
];
//--endcode--
(Ariom/Auth/Config/Routes.php)
PHP Code:
<?php namespace AriomAuth\Config;
$routes->add('login', 'AriomAuth\Controllers\Auth::login');
So what I know is this:
- the filter does run
- the session is checked and correctly runs the redirect when no session variables are found
- the redirect is triggered and loads the custom route
Although I do get redirected to /login, I time out with ERR_TOO_MANY_REDIRECTS. I have no idea where to begin debugging this. Any ideas, anyone?
↧
20.03.19 Message: Object of class stdClass could not be converted to string
Hello Guys, please i need a Light!
I've already read some cases identical as my issue here in the Forum, but i don't get STILL see what should i do.
The best answer was:
-------------------------------------------------------
eluser]Massaki[/eluser]
The variable $var is an object.
If you want to show an attribute from the object, then
Code:
echo $var->name_of_the_attribute
-------------------------------------------------------
But i still stuck.
I'm using this block of code from the documentation:
https://www.codeigniter.com/user_guide/d...esult-rows
This is my Controller/Method
_____________________________
This is my Model
_____________________________
This is my VIEW
_____________________________
If i try to show the variable this way: <?php echo $totalrows; ?> i got the error message.
If i try to show the variable this way: <?php echo $totalrows->v_id; ?> i got the error message.
This is the result of my First print_r() <?php print_r($totalrows); ?>
_____________________________
This is the result of my Second print_r() <?php print_r($totalrows); ?>
_____________________________
What should i do please? v_id is the table_field_id and i just want to show a single row as explained in the documentation.
i've already tried using row_array(), But i stuck the same way.
Thank you so much in advance!
I've already read some cases identical as my issue here in the Forum, but i don't get STILL see what should i do.
The best answer was:
-------------------------------------------------------
eluser]Massaki[/eluser]
The variable $var is an object.
If you want to show an attribute from the object, then
Code:
echo $var->name_of_the_attribute
-------------------------------------------------------
But i still stuck.
I'm using this block of code from the documentation:
https://www.codeigniter.com/user_guide/d...esult-rows
This is my Controller/Method
_____________________________
Code:
public function votecounting($page = 'vote_detail1')
{
if ( ! file_exists(APPPATH.'views/content/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
show_404();
}
$data['title'] = ucfirst($page); // Capitalize the first letter
$data['totalrows'] = $this->Voting_counter_model->totalparticipants();
$this->load->view('theme/header');
$this->load->view('content/vote_detail1', $data);
$this->load->view('theme/footer');
}
This is my Model
_____________________________
Code:
public function totalparticipants()
{
$query = $this->db->query("SELECT count(v_id) FROM ci_voting_counter WHERE v_column IN ('A', 'B', 'C', 'D', 'E')");
$resultrows = $query->row();
return $resultrows;
}
This is my VIEW
_____________________________
Code:
<div class="XXX">
<span class="current">Votes<strong> <?php print_r($totalrows); ?></strong> </span>
</div>
<div class="block lrg">
<div class="title">Vote results</div>
<div class="info">The number who participated in the Vote yet <strong> <?php echo print_r($totalrows); ?> </strong> VOTER</div>
<div class="info">The number who participated in the Vote yet <strong> <?php echo $totalrows; ?> </strong> VOTER</div>
If i try to show the variable this way: <?php echo $totalrows; ?> i got the error message.
Code:
A PHP Error was encountered
Severity: 4096
Message: Object of class stdClass could not be converted to string
Filename: content/vote_detail1.php
Line Number: 24
Backtrace:
File: C:\xampp\htdocs\poll\application\views\content\vote_detail1.php
Line: 24
If i try to show the variable this way: <?php echo $totalrows->v_id; ?> i got the error message.
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$v_id
Filename: content/vote_detail1.php
Line Number: 24
This is the result of my First print_r() <?php print_r($totalrows); ?>
_____________________________
Code:
Votes stdClass Object ( [count(v_id)] => 498 )
This is the result of my Second print_r() <?php print_r($totalrows); ?>
_____________________________
Code:
The number who participated in the Vote yet stdClass Object ( [count(v_id)] => 498 ) 1 VOTER
What should i do please? v_id is the table_field_id and i just want to show a single row as explained in the documentation.
i've already tried using row_array(), But i stuck the same way.
Thank you so much in advance!
↧
↧
Charts in Codignater
Hi,
I would like to know which is the best practice to implement charts in CodeIgniter ?
I would like to know which is the best practice to implement charts in CodeIgniter ?
↧
Can't update Profile
Hello everyone, so now I'm building an update function on my profile in my website template but it didn't work, it only shows a blank page after I click the submit button. Can someone check what did I do wrong on my coding? Thanks in advance Image may be NSFW.
Clik here to view.
This is my controller :
My model :
and my edit/view page :
Clik here to view.

This is my controller :
Code:
<?php
class Users extends CI_Controller{
//register user
public function register(){
$this->load->helper('general_helper');
$this->load->library('bcrypt');
$data['title'] = 'Sign Up';
$this->form_validation->set_rules('username', 'Username', 'required|callback_check_username_exists');
$this->form_validation->set_rules('email', 'Email', 'required|callback_check_email_exists');
$this->form_validation->set_rules('tel', 'Telephone', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->form_validation->set_rules('password2', 'Confirm Password', 'matches[password]');
if($this->form_validation->run() === FALSE)
{
$this->load->view('templates/header');
$this->load->view('users/register', $data);
$this->load->view('templates/footer');
} else {
//upload image
$config['upload_path'] = './assets/upload';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '2048';
$config['max_width'] = '2000';
$config['max_height'] = '2000';
$this->load->library('upload', $config);
if(!$this->upload->do_upload('avatar')){
$errors = array ('error' => $this->upload->display_errors());
$avatar = 'noimage.jpg';
} else {
$data = array('upload_data' => $this->upload->data());
$avatar = $_FILES['avatar']['name'];
}
// Encrypt password
$enc_password = $this->bcrypt->hash($this->input->post('password'));
$this->user_model->register($enc_password, $avatar);
// set message
$this->session->set_flashdata('user_registered','You are now registered and can log in');
redirect('users/login');
}
}
//login user
public function login(){
$this->load->helper('general_helper');
$this->load->library('bcrypt');
$data['title'] = 'Sign In';
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
if($this->form_validation->run() === FALSE)
{
$this->load->view('templates/header');
$this->load->view('users/login', $data);
$this->load->view('templates/footer');
} else {
//Get username
$username = $this->input->post('username');
//Get and encrypt the password
$password = $this->bcrypt->verify('password');
// Login user
$user_id = $this->user_model->login($username, $password);
if($user_id){
// Create Session
$user_data = array(
'user_id' => $user_id,
'username' => $username,
'logged_in' => true
);
$this->session->set_userdata($user_data);
// set message
$this->session->set_flashdata('user_loggedin','You are now log in');
redirect('home');
}else {
// set message
$this->session->set_flashdata('login_failed','Login is invalid');
redirect('users/login');
}
}
}
//update profile
public function updateprofile(){
// Check login
if(!$this->session->userdata('logged_in')){
redirect('users/login');
}
$data['userInfo'] = $this->user_model->fetchUserData($this->session->userdata('user_id'));
$data['title'] = 'Update Profile';
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('email', 'Email', 'required');
$this->form_validation->set_rules('tel', 'Telephone', 'required');
if($this->form_validation->run() === FALSE)
{
$this->load->view('templates/header');
$this->load->view('users/edit', $data);
$this->load->view('templates/footer');
} else {
//upload image
$config['upload_path'] = './assets/upload';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '2048';
$config['max_width'] = '2000';
$config['max_height'] = '2000';
$this->load->library('upload', $config);
if(!$this->upload->do_upload('avatar')){
$errors = array ('error' => $this->upload->display_errors());
$avatar = 'noimage.jpg';
} else {
$data = array('upload_data' => $this->upload->data());
$avatar = $_FILES['avatar']['name'];
$status = $this->user_model->update($this->session->userdata('user_id'), $avatar);
if ($status == TRUE) {
redirect('home');
}
echo 'Your Profile has successfully been updated';
}
}
}
//log user out
public function logout(){
//Unset user data
$this->session->unset_userdata('logged_in');
$this->session->unset_userdata('user_id');
$this->session->unset_userdata('username');
// set message
$this->session->set_flashdata('user_loggedout','You are now logged out');
redirect('users/login');
}
//check if username exists
public function check_username_exists($username){
$this->form_validation->set_message('check_username_exists','That username is taken. Please choose a different one');
if($this->user_model->check_username_exists($username)){
return true;
} else {
return false;
}
}
//check if email exists
public function check_email_exists($email){
$this->form_validation->set_message('check_email_exists','That Email is taken. Please choose a different one');
if($this->user_model->check_email_exists($email)){
return true;
} else {
return false;
}
}
}
My model :
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User_model extends CI_Model {
public function register($enc_password, $avatar){
//User data array
$data = array(
'username' => $this->input->post('username'),
'password' => $enc_password,
'email' => $this->input->post('email'),
'name' => $this->input->post('name'),
'avatar' => $avatar,
'address' => $this->input->post('address'),
'fax' => $this->input->post('fax'),
'tel' => $this->input->post('tel'),
'email' => $this->input->post('email'),
'website' => $this->input->post('website'),
'type_user' => 0,
'created_date' => date('Y-m-d H:i:s', time())
);
$save = $this->db->insert('omg_user', $data);
$id = $this->db->insert_id();
$slug = formatTitle($this->input->post('name'));
$slug_exist = $this->db->where('user_id !=', $id)->where('slug', $slug)->where('deleted', 0)->get('omg_user')->row();
if(!empty($slug_exist)){
$slug = $slug.'-'.$id;
}
$save = $this->db->update('omg_user', array('slug'=>$slug), array('user_id'=>$id));
}
//Login user in
public function login($username, $password){
$this->db->where('username', $username);
$this->db->where('password', $password);
$result = $this->db->get('omg_user');
if($result->num_rows() == 1){
return $result->row(0)->user_id;
} else {
return false;
}
}
public function update($avatar){
$data = array(
'username' => $this->input->post('username'),
'email' => $this->input->post('email'),
'name' => $this->input->post('name'),
'avatar' => $this->input->post('avatar'),
'address' => $this->input->post('address'),
'website' => $this->input->post('website'),
'tel' => $this->input->post('tel'),
'fax' => $this->input->post('fax')
);
$this->db->where('user_id', $this->input->post('user_id'));
$save = $this->db->update('omg_user', $data);
$id = $this->db->insert_id();
$slug = formatTitle($this->input->post('name'));
$slug_exist = $this->db->where('user_id !=', $id)->where('slug', $slug)->where('deleted', 0)->get('omg_user')->row();
if(!empty($slug_exist)){
$slug = $slug.'-'.$id;
}
$save = $this->db->update('omg_user', array('slug'=>$slug), array('user_id'=>$id));
}
//chech username exists
public function check_username_exists($username){
$query = $this->db->get_where('omg_user', array('username' => $username));
if(empty($query->row_array())){
return true;
} else {
return false;
}
}
//chech email exists
public function check_email_exists($email){
$query = $this->db->get_where('omg_user', array('email' => $email));
if(empty($query->row_array())){
return true;
} else {
return false;
}
}
public function fetchUserData($userId = null, $slug = FALSE){
if($userId){
$sql = "SELECT * FROM omg_user WHERE user_id = ?";
$query = $this->db->query($sql, array($userId));
$result = $query->row_array();
return $result;
}
}
}
and my edit/view page :
Code:
<!--================================
= Page Title =
=================================-->
<section class="page-title">
<!-- Container Start -->
<div class="container">
<div class="row">
<div class="col-md-8 offset-md-2 text-center">
<!-- Title text -->
</div>
</div>
</div>
<!-- Container End -->
</section>
<?php echo validation_errors(); ?>
<?php echo form_open('users/updateprofile'); ?>
<section class="blog single-blog section">
<div class="container">
<div class="row">
<div class="col-md-4 offset-md-4">
<h1 class="text-center"><?= $title; ?></h1>
<div class="form-group">
<label> Username </label>
<input type="text" class="form-control" name="username" value="<?php print $userInfo['username']; ?>">
</div>
<div class="form-group">
<label> Your Name </label>
<input type="text" class="form-control" name="name" value="<?php print $userInfo['name']; ?>">
</div>
<div class="form-group">
<label> Picture </label>
<input type="file" class="form-control" name="avatar" value="<?php print $userInfo['avatar']; ?>">
</div>
<div class="form-group">
<label> Address </label>
<input type="text" class="form-control" name="address" value="<?php print $userInfo['address']; ?>">
</div>
<div class="form-group">
<label> Fax </label>
<input type="text" class="form-control" name="fax" value="<?php print $userInfo['fax']; ?>">
</div>
<div class="form-group">
<label> Telephone </label>
<input type="text" class="form-control" name="tel" value="<?php print $userInfo['tel']; ?>">
</div>
<div class="form-group">
<label> Email </label>
<input type="text" class="form-control" name="email" value="<?php print $userInfo['email']; ?>">
</div>
<div class="form-group">
<label> Website </label>
<input type="text" class="form-control" name="website" value="<?php print $userInfo['website']; ?>">
</div>
<input type="submit" class="btn btn-default" value="Submit">
</div>
</div>
</div>
</section>
<?php echo form_close(); ?>
↧
Updated 3.1.10 this->input->method('post') doesn't work
Hello,
Firstly, I m sorry about my English. I used ci 3.1.9 and today i see 3.1.10 relased version and i updated. but when i check my codes are working true, i find the following codes not work :
where i used this if statement doesn't work. when i debug :
result on display
GET
how can i fixed that? I don't wanna use the following code :
Thank you for helping.
Firstly, I m sorry about my English. I used ci 3.1.9 and today i see 3.1.10 relased version and i updated. but when i check my codes are working true, i find the following codes not work :
PHP Code:
if($this->input->method('post')){
...
}
else
redirect('404');
PHP Code:
echo $this -> input -> method('post'); die();
GET
how can i fixed that? I don't wanna use the following code :
PHP Code:
if($this->input->post()){
...
}
else{
redirect('404')
↧
Routing and $_SERVER['REQUEST_URI']
Hi, I have a website built using CodeIgniter 3.1.9.
I have Apache configured with the following RewriteRule as recommended here https://www.codeigniter.com/userguide3/g...x-php-file so that the index.php part of a url is optional.
I noticed that the following url: http://www.example.com/index.phptest loads the same page as http://www.example.com/index.php/test. I had a look through the routing code in core/URI.php and saw that the following code was responsible:
I replaced this code with the following to fix the issue:
Additionally, I checked out a list of sites that use CodeIgniter and found the following with the same issue:
**links redacted**
I have Apache configured with the following RewriteRule as recommended here https://www.codeigniter.com/userguide3/g...x-php-file so that the index.php part of a url is optional.
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
I noticed that the following url: http://www.example.com/index.phptest loads the same page as http://www.example.com/index.php/test. I had a look through the routing code in core/URI.php and saw that the following code was responsible:
Code:
...
if (isset($_SERVER['SCRIPT_NAME'][0]))
{
if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0)
{
$uri = (string) substr($uri, strlen($_SERVER['SCRIPT_NAME']));
}
elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0)
{
$uri = (string) substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME'])));
}
}
...
I replaced this code with the following to fix the issue:
Code:
...
if (isset($_SERVER['SCRIPT_NAME'][0]))
{
if ($uri === $_SERVER['SCRIPT_NAME'])
{
$uri = '';
}
elseif (strpos($uri, $_SERVER['SCRIPT_NAME'] . '/') === 0)
{
$uri = (string) substr($uri, strlen($_SERVER['SCRIPT_NAME'] . '/'));
}
elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0)
{
$uri = (string) substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME'])));
}
}
...
Additionally, I checked out a list of sites that use CodeIgniter and found the following with the same issue:
**links redacted**
↧
↧
Matrix Admin Template CI v3.1.10
If anyone is interested in the Matrix Admin Free template built with bootstrap v4 integrated with Codeigniter v3.1.10, here is a link for it:
https://github.com/mihai-c/matrix_admin
Best regards!
https://github.com/mihai-c/matrix_admin
Best regards!
↧
New subforum
I have created a new forum for CodeIgniter 4 addins ... it is time Image may be NSFW.
Clik here to view.![Smile Smile]()
I moved a couple of posts that were here, to the new subforum.
Clik here to view.

I moved a couple of posts that were here, to the new subforum.
↧
Ion-auth 4 routes not working
I used the manual installation method of CI4, and did the same for the updated version of Ion-Auth designed to work with CI4. After copying over the files into my CI4 installation I discovered that it is not routing correctly. When navigating to /auth/login, I get the error message "Controller or its method is not found: App\Controllers\Auth::login".
I suspect I've not done something correctly related to namespacing, since if I change:
namespace IonAuth\Controllers;
class Auth extends \CodeIgniter\Controller
To
namespace App\Controllers;
use CodeIgniter\Controller;
class Auth extends Controller
It works routes correctly, but I then get the error: "Class 'IonAuth\Libraries\IonAuth' not found".
What am I doing wrong here?
I suspect I've not done something correctly related to namespacing, since if I change:
namespace IonAuth\Controllers;
class Auth extends \CodeIgniter\Controller
To
namespace App\Controllers;
use CodeIgniter\Controller;
class Auth extends Controller
It works routes correctly, but I then get the error: "Class 'IonAuth\Libraries\IonAuth' not found".
What am I doing wrong here?
↧