↧
Microsoft has acquired GitHub
↧
Strange 404 Errors In Logs
Hi all - I've noticed recently I've been getting a lot of strange 404 errors in my logs. A few examples:
Some of them are things that exist (apple-touch-icon.png), but the 404 error has missing file extensions, and a "/index" after it. Some of them are files that don't even exist (404testpage4525d2fdc). I've run through the entire site looking for broken links, and there are none. I'm also not getting any 404 errors showing on the actual site - just in the logs.
My .htaccess file:
And my routes file:
Like I said, the site itself seems to be working fine, but I can't figure out what's causing these errors to show up in the logs. I've tried searching for answers, but they all seem to be dealing with 404 errors that are showing up on the site, and are actual resources that should be on the server. If it's just bots, is there anyway to stop these errors from clogging up my log files? Any help would be greatly appreciated!
PHP Code:
404 Page Not Found: Apple-touch-iconpng/index
404 Page Not Found: Apple-touch-icon-precomposedpng/index
404 Page Not Found: 404javascriptjs/index
404 Page Not Found: 404testpage4525d2fdc/index
404 Page Not Found: Faviconico/index
Some of them are things that exist (apple-touch-icon.png), but the 404 error has missing file extensions, and a "/index" after it. Some of them are files that don't even exist (404testpage4525d2fdc). I've run through the entire site looking for broken links, and there are none. I'm also not getting any 404 errors showing on the actual site - just in the logs.
My .htaccess file:
PHP Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
And my routes file:
PHP Code:
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route[LOGIN_PAGE] = 'users/login';
$route['landlords'] = 'listings/directory/1';
$route['complexes'] = 'listings/directory/2';
$route['managers'] = 'listings/directory/3';
$route['apartments/sublets'] = 'listings/index/13';
$route['apartments/roommates/19'] = 'listings/index/19';
$route['apartments/roommates/20'] = 'listings/index/20';
$route['apartments/roommates/21'] = 'listings/index/21';
$route['apartments/roommates/22'] = 'listings/index/22';
$route['apartments/roommates'] = 'listings/index/14';
$route['apartments/listings'] = 'listings/index/15';
$route['apartment-alerts'] = 'notification/add_notification';
$route['apartments/listings/([0-9]-(beds))'] = 'listings/index/$1';
Like I said, the site itself seems to be working fine, but I can't figure out what's causing these errors to show up in the logs. I've tried searching for answers, but they all seem to be dealing with 404 errors that are showing up on the site, and are actual resources that should be on the server. If it's just bots, is there anyway to stop these errors from clogging up my log files? Any help would be greatly appreciated!
↧
↧
Problems with creating subfolders in CodeIgniter 3 HMVC
I have a project that contains several subfolders, such as:
model+view+controller
signup(sub sub folder )
model+view+controller
These routes are not working, which shows CodeIgniter 404 error page. I have also attached an image of my file structure.
file_structure.jpg (Size: 36.11 KB / Downloads: 2)
file_structure.jpg (Size: 36.11 KB / Downloads: 2)
please help to solve this issue.
- client (folder name)
auth (sub folder )
model+view+controller
signup(sub sub folder )
model+view+controller
- admin(folder name)
- signin(sub folder)
model+view+controller
- signin(sub folder)
Code:
$route['default_controller'] = "admin/signin/signin";
$route['admin/signin'] = "admin/signin/signin/index";
$route['admin/(:any)'] = "admin/signin/signin/$1";
$route['client/auth'] = "auth/signin/signin";
$route['client/auth'] = "client/auth/signin/signin";
$route['client/auth/(.*)'] = "client/auth/signin/signin/$1";


↧
hashing password and decrypting(need hlp)
i have hashed my password but i can't decrypt it.what is the best way to solve the situation.can someone help me solve it.
this is my insert model
public function insert_client($codeDigits)
{
$hash = $this->hash($_POST['Password']);
$response = $this->taken_email($_POST['Email']);
if($response){
$returned = false;
}else{
$this->FirstName = $_POST['FirstName']; // please read the below note
$this->LastName = $_POST['LastName'];
$this->Email = $_POST['Email'];
$this->Role_Id = 2;
$this->Password = $hash;
$this->PhoneNo = $_POST['PhoneNo'];
$this->confirmCode = $codeDigits;
$this->db->insert('users', $this);
$returned = true;
}
return $returned;
}
this is my password harsh model
public function hash($password)
{
$hash = password_hash($password,PASSWORD_DEFAULT);
return $hash;
}
//verify password
public function verifyHash($password,$vpassword)
{
if(password_verify($password,$vpassword))
{
return TRUE;
}
else{
return FALSE;
}
}
this is my login model
public function login_model($email,$password)
{
$this->db->select('*');
$this->db->from('users');
$this->db->where(' Email',$email);
$this->db->where('Password',$password);
$this->db->where('Role_Id !=',1);
$query = $this->db->get();
if($query->num_rows() > 0)
{
$results = $query->row();
// storing the results in the variable $data
foreach($results as $data)
{
if($this->verifyHash($this->$password,$data->password == TRUE))
{
$dat = array(
'id_user' => $data->id_User,
'FirstName' => $data->FirstName,
'LastName' => $data->LastName,
'Phonenumber' => $data->PhoneNo,
'Email' => $data->Email,
'role' => $data->Role_Id,
'imageUrl' => $data->imageUrl,
'category_id' => $data->category_id,
'IdType' => $data->IdType,
'IdNumber' => $data->IdNumber,
'DOB' => $data->DOB,
'confirmCode' => $data->confirmCode,
'confirmed' => $data->confirmed,
'Points'=> $data->Points
);
}
$this->session->set_userdata($dat);
return true;
}
}
else{
return false;
}
}
please someone should help me to make the login work
this is my insert model
public function insert_client($codeDigits)
{
$hash = $this->hash($_POST['Password']);
$response = $this->taken_email($_POST['Email']);
if($response){
$returned = false;
}else{
$this->FirstName = $_POST['FirstName']; // please read the below note
$this->LastName = $_POST['LastName'];
$this->Email = $_POST['Email'];
$this->Role_Id = 2;
$this->Password = $hash;
$this->PhoneNo = $_POST['PhoneNo'];
$this->confirmCode = $codeDigits;
$this->db->insert('users', $this);
$returned = true;
}
return $returned;
}
this is my password harsh model
public function hash($password)
{
$hash = password_hash($password,PASSWORD_DEFAULT);
return $hash;
}
//verify password
public function verifyHash($password,$vpassword)
{
if(password_verify($password,$vpassword))
{
return TRUE;
}
else{
return FALSE;
}
}
this is my login model
public function login_model($email,$password)
{
$this->db->select('*');
$this->db->from('users');
$this->db->where(' Email',$email);
$this->db->where('Password',$password);
$this->db->where('Role_Id !=',1);
$query = $this->db->get();
if($query->num_rows() > 0)
{
$results = $query->row();
// storing the results in the variable $data
foreach($results as $data)
{
if($this->verifyHash($this->$password,$data->password == TRUE))
{
$dat = array(
'id_user' => $data->id_User,
'FirstName' => $data->FirstName,
'LastName' => $data->LastName,
'Phonenumber' => $data->PhoneNo,
'Email' => $data->Email,
'role' => $data->Role_Id,
'imageUrl' => $data->imageUrl,
'category_id' => $data->category_id,
'IdType' => $data->IdType,
'IdNumber' => $data->IdNumber,
'DOB' => $data->DOB,
'confirmCode' => $data->confirmCode,
'confirmed' => $data->confirmed,
'Points'=> $data->Points
);
}
$this->session->set_userdata($dat);
return true;
}
}
else{
return false;
}
}
please someone should help me to make the login work
↧
Escape string before inserting in a query
I know that when you are using CI query builder you don't need care about it, because CI automatically escapes strings for you.
But what if i need to use my own SQL query (which is not possible to build using query builder, or it's possible but only by taking really convoluted and strage ways)
for instance (it can be much more complicated, it is just an example)
I am using this query for Index optimization, because a built in mysql operator OR don't properly use indexes.
How do I protect myself from MySQL injection in this case?
What function do I need to use on $owner to escape all dangerous symbols.
But I don't want to distort string representation. I don't want to change HTML entities, only to escape string.
But what if i need to use my own SQL query (which is not possible to build using query builder, or it's possible but only by taking really convoluted and strage ways)
for instance (it can be much more complicated, it is just an example)
Code:
$query = $this->db->query("SELECT * FROM `PM_board` WHERE `lesser_id` ={$owner}
UNION
SELECT * FROM `PM_board` WHERE `greater_id` = {$owner}");
How do I protect myself from MySQL injection in this case?
What function do I need to use on $owner to escape all dangerous symbols.
But I don't want to distort string representation. I don't want to change HTML entities, only to escape string.
↧
↧
Image convert into base64 and store in database
I have try to convert image into base64 but its not showing image.when i fetch it from database( it works with smaller images like 400X300. but not with large dimension images ). which datatype should i use to store this data.
Code:
if ( ! $this->upload->do_upload('course_profile_image'))
{
error($this->upload->display_errors(),TRUE,400);
}else{
$data = array('upload_data' => $this->upload->data());
$filename=$data['upload_data']['file_name'];
$pathinfo = 'dist/img/courseimage/'.$filename;
$filetype = pathinfo($pathinfo, PATHINFO_EXTENSION);
$filecontent = file_get_contents($pathinfo);
try{
$base64=rtrim(base64_encode($filecontent));
}catch(Exception $e){
error($e,TRUE,855);
}
$image = 'data:image/' . $filetype . ';base64,' . $base64;
↧
Disable IP address, user-agent string in cookie
Hi,
I'm working with CI 3.0 and I have a problem with GDPR policies
I'd like to avoid CI store the IP address and User Agent of client in cookie.
I try to set config :
But cookie still store IP address and User Agent.
Also I found the code to set cookie with IP address and User Agent in function sess_create() in Session.php
Is there any config to affect above code ?
I need to keep the cookie without IP address and UA ,
Can anyone tell me how to avoid CI store the IP address and User Agent in Cookie.
Thanks in advance.
I'm working with CI 3.0 and I have a problem with GDPR policies
I'd like to avoid CI store the IP address and User Agent of client in cookie.
I try to set config :
Code:
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = FALSE;
But cookie still store IP address and User Agent.
Also I found the code to set cookie with IP address and User Agent in function sess_create() in Session.php
PHP Code:
function sess_create()
{
$sessid = '';
while (strlen($sessid) < 32)
{
$sessid .= mt_rand(0, mt_getrandmax());
}
// To make the session ID even more secure we'll combine it with the user's IP
$sessid .= $this->CI->input->ip_address();
$this->userdata = array(
'session_id' => md5(uniqid($sessid, TRUE)),
'ip_address' => $this->CI->input->ip_address(),
'user_agent' => substr($this->CI->input->user_agent(), 0, 120),
'last_activity' => $this->now,
'user_data' => ''
);
// Save the data to the DB if needed
if ($this->sess_use_database === TRUE)
{
$this->CI->db->query($this->CI->db->insert_string($this->sess_table_name, $this->userdata));
}
// Write the cookie
$this->_set_cookie();
}
Is there any config to affect above code ?
I need to keep the cookie without IP address and UA ,
Can anyone tell me how to avoid CI store the IP address and User Agent in Cookie.
Thanks in advance.
↧
Get data arguments
Hi, today I tried to follow the manual, in order to get data from the form, and did not quite understand how to correctly pass the parameter.
In my controller:
When I send 2 arguments in my model:
Get "Too few arguments to function ParamModel:
etParam(), 1 passed in Controllers/Param.php on line 457 and exactly 2 expected".
When I send 1 argument in my model, get "operand should contain 1 column(s)"...
Looking inside print_r($firstParam); getting Array ( [firstParam] => 67545647f [secondParam] => 654547547554d )
Tell me please what I missed. Thanks.
In my controller:
PHP Code:
$model->setParam([
'firstParam' => $this->request->getVar('firstParam'),
'secondParam' => $this->request->getVar('secondParam')
]);
When I send 2 arguments in my model:
PHP Code:
public function setParam($firstParam, $secondParam) {
return $this->table('test')->protect(false)->insert([
'title' => $firstParam,
'text' => $secondParam
]);
}

When I send 1 argument in my model, get "operand should contain 1 column(s)"...
PHP Code:
public function setParam($firstParam) {
return $this->table('test')->protect(false)->insert([
'title' => $firstParam,
'text' => '$secondParam'
]);
}
Looking inside print_r($firstParam); getting Array ( [firstParam] => 67545647f [secondParam] => 654547547554d )
Tell me please what I missed. Thanks.
↧
CodeIgniter HMVC error
1st time setup CodeIgniter HMVC. when i run code i face this error.
An uncaught Exception was encountered Type: Error
Message: Call to undefined method MY_Loader::_ci_object_to_array()
Filename: C:\xampp\htdocs\ciall\hmvc\application\third_party\MX\Loader.php
Line Number: 300
Backtrace:
File: C:\xampp\htdocs\ciall\hmvc\application\modules\foo\controllers\foo.php Line: 23 Function: view
File: C:\xampp\htdocs\ciall\hmvc\index.php Line: 315 Function: require_once
An uncaught Exception was encountered Type: Error
Message: Call to undefined method MY_Loader::_ci_object_to_array()
Filename: C:\xampp\htdocs\ciall\hmvc\application\third_party\MX\Loader.php
Line Number: 300
Backtrace:
File: C:\xampp\htdocs\ciall\hmvc\application\modules\foo\controllers\foo.php Line: 23 Function: view
File: C:\xampp\htdocs\ciall\hmvc\index.php Line: 315 Function: require_once
↧
↧
Message: file_get_contents(): https:// wrapper is disabled in the server configuratio
I am trying below code to get city detail from thirdparty website using one of my controller file
But I am getting below errors, I already tried allow_url_fopen = On & allow_url_include = On in php.ini file, it getting issue with php7.0 while I am using php 5.6 It works fine. So please let me guide its codeigniter issue or server? I am using same above code in external file than it works fine, but while I am using above code with controller it gives error with php7.0.
PHP Code:
$arrContextOptions=array( "ssl"=>array( "verify_peer"=>false, "verify_peer_name"=>false, ), );
$target_url = "https://ziptasticapi.com/{$zip}";
$cityInfo = file_get_contents($target_url, FILE_USE_INCLUDE_PATH);
But I am getting below errors, I already tried allow_url_fopen = On & allow_url_include = On in php.ini file, it getting issue with php7.0 while I am using php 5.6 It works fine. So please let me guide its codeigniter issue or server? I am using same above code in external file than it works fine, but while I am using above code with controller it gives error with php7.0.
Quote:Severity: Warning
Message: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0
Filename: controllers/Quotes.php
Line Number: 283
Backtrace:
File: /home/wprcf/public_html/admin/application/controllers/Quotes.php
Line: 283
Function: file_get_contents
File: /home/wprcf/public_html/admin/index.php
Line: 315
Function: require_once
A PHP Error was encountered
Severity: Warning
Message: file_get_contents(https://ziptasticapi.com/46220): failed to open stream: no suitable wrapper could be found
Filename: controllers/Quotes.php
Line Number: 283
Backtrace:
File: /home/wprcf/public_html/admin/application/controllers/Quotes.php
Line: 283
Function: file_get_contents
File: /home/wprcf/public_html/admin/index.php
Line: 315
Function: require_once
↧
changing session driver to database (modified)
I have a working application that uses the default session driver. Here is my config.php section:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = /localhost/
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
I am going to move this app from my localhost to a public hoster. Since only absolute paths to the session files are supported when using the files driver I NEED to change over to use the database session driver. I'd like to make this as painless as possible without any fancy modifications. Can someone tell me what is the minimum that I MUST do to make this work? Yes, I read the documentation. General pointers would be very helpful so I can zero in on what needs to be done.
Another possibility is to use the files driver but to point the sess_save_path to somewhere within my application directory. But what do I do about the "absolute path" requirement then?
thx
NOTE: this is the actual config.php:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'cisession';
$config['sess_expiration'] = 28800; // this is 8 hours, every 8 hours the session will be destroyed and when it does the user will be logged off
//$config['sess_expiration'] = 0; //default to 7200 In addition to this if a user doesn't have any activity in 30 minutes, they will log off via javascript_funcs.js
$config['sess_save_path'] = APPPATH.'cache';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = /localhost/
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
I am going to move this app from my localhost to a public hoster. Since only absolute paths to the session files are supported when using the files driver I NEED to change over to use the database session driver. I'd like to make this as painless as possible without any fancy modifications. Can someone tell me what is the minimum that I MUST do to make this work? Yes, I read the documentation. General pointers would be very helpful so I can zero in on what needs to be done.
Another possibility is to use the files driver but to point the sess_save_path to somewhere within my application directory. But what do I do about the "absolute path" requirement then?
thx
NOTE: this is the actual config.php:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'cisession';
$config['sess_expiration'] = 28800; // this is 8 hours, every 8 hours the session will be destroyed and when it does the user will be logged off
//$config['sess_expiration'] = 0; //default to 7200 In addition to this if a user doesn't have any activity in 30 minutes, they will log off via javascript_funcs.js
$config['sess_save_path'] = APPPATH.'cache';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
↧
Integration doctrine to codeigniter 4
I have installed doctrine with composer and added Doctrine.php to libraries using tutorial on next link
codeigniter and doctrine
and I try this:
Autoload
and I get error: Undefined variable: entityManager
This is only the test for me.
codeigniter and doctrine
and I try this:
PHP Code:
<?php namespace App\Controllers;
use CodeIgniter\Controller;
use App\Libraries\Doctrine;
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\Setup;
class Home extends Controller {
public function test {
$rsm = new ResultSetMapping();
$query = $entityManager->createNativeQuery('SELECT * FROM test', $rsm);
$users = $query->getResult();
print_r($users);
}
}
Autoload
PHP Code:
public $classmap = [
'Test' => APPPATH . 'libraries/Test.php',
'Twig' => APPPATH . 'libraries/Twig.php',
'Doctrine' => APPPATH . 'libraries/Doctrine.php',
];
and I get error: Undefined variable: entityManager
This is only the test for me.
↧
Sync contacts between android app and php
Hi guys
I'm programming chat application for android
In this app,i have to sync device's contacts with server
I send all contact phone number to server and check it with select sID from user where mobile = 09000000
Is is right way for sync contact or not?
I use mqtt protocol for chat
I am really confused about sync contacts
Thanks
I'm programming chat application for android
In this app,i have to sync device's contacts with server
I send all contact phone number to server and check it with select sID from user where mobile = 09000000
Is is right way for sync contact or not?
I use mqtt protocol for chat
I am really confused about sync contacts
Thanks
↧
↧
Placeholders in language lines
How to use placeholders in
$this->lang->line('misc_key', FALSE);
It is used in standard libraries (e.g. from validation), but how to use it in my own libs and models?
Is this the best way?
$this->lang->line('misc_key', FALSE);
It is used in standard libraries (e.g. from validation), but how to use it in my own libs and models?
Code:
echo sprintf($this->lang->line('somekey'),'XYZ');//load language library before use
↧
Re-entrancy and files based sessions
I am using file based (default) sessions. I am a little concerned about re-entrance. My program actually has two doors to get in. The first is a regular old CI app entrance where a user logs in via community auth (I am working on this login).
The second way in is via xhr. A user ( different user than the ones who logged in via community auth), sends a message to a different controller, which then fiddles with some of the same tables, logs some data, and goes away.
I am slightly worried about re-entrancy. Can I assume that each user (the logged in one,and the xhr one) will cause separate sessions. Also, do I need to close the session in the xhr manually? I am not manually cleaning up the sessions.
The second way in is via xhr. A user ( different user than the ones who logged in via community auth), sends a message to a different controller, which then fiddles with some of the same tables, logs some data, and goes away.
I am slightly worried about re-entrancy. Can I assume that each user (the logged in one,and the xhr one) will cause separate sessions. Also, do I need to close the session in the xhr manually? I am not manually cleaning up the sessions.
↧
Help
Need Help with my Pagination
Hello,
I have pagination working on my list page but I can't get it to work on a search result page. I'd appreciate any help!
Most stack overflows with similar questions all seem to be for a static page (not a problem for me).
Which also links to my github repository for it.
Things you'll need to know if you look at my github: My view: in heroes/find-giraffe.php (works as the list and serves as the search results My Controller for the search results: MainForms/searchGiraffe My Model: Main_Model
Hello,
I have pagination working on my list page but I can't get it to work on a search result page. I'd appreciate any help!
Most stack overflows with similar questions all seem to be for a static page (not a problem for me).
Which also links to my github repository for it.
Things you'll need to know if you look at my github: My view: in heroes/find-giraffe.php (works as the list and serves as the search results My Controller for the search results: MainForms/searchGiraffe My Model: Main_Model
↧
Upgrading a project
I purchased a project off Envato to use as a baseline to build on.
It is written using 3.0.0. Would it be recommended to update it to a later version?
It is written using 3.0.0. Would it be recommended to update it to a later version?
↧
↧
what kind of tire-architecture follows codeigniter?
is CodeIgniter follows 3 tier architecture or n-tier architecture?. What architecture basically used in Codeigniter for implement business logic.
↧
Load view from Controller issue
Hi there,
I am new to CodeIgniter framework and needs someone help, please.
I have an issue to redirect user back to Contact Us form after its submission.
My default controller is defined as below.
Now my view pages are in the sub-directory called pages, for example /views/pages/contact-us.php. So when I access this page like https://www.mysite.com/contact-us then it works fine and loads the contact us form as expected.
Look at my .htaccess file that removes index.php from the URL.
And also look at my routes.php file.
Now after user submits the contact us form it goes to controller called SendEmail.php and then I want user to come back to Contact Us form with message either successful or failed. I am getting an email to my gmail account but when it comes to loading VIEW it does not work.
Look at code of SendEmail.php
I am getting below error. As I said above I manage to get email to my gmail account but loading a view does not work.
An Error Was Encountered
Unable to load the requested file: contact-us.php
Can you please help me?
Thanks - Hitesh
I am new to CodeIgniter framework and needs someone help, please.
I have an issue to redirect user back to Contact Us form after its submission.
My default controller is defined as below.
PHP Code:
<?php
class Pages extends CI_Controller {
public function __construct() {
parent::__construct();
}
public function view($page = 'home') {
if (!file_exists(APPPATH . 'views/pages/' . $page . '.php')) {
show_404();
}
$data['title'] = ucfirst($page);
$this->load->view('templates/header');
$this->load->view('pages/' . $page, $data);
$this->load->view('templates/footer');
}
}
Now my view pages are in the sub-directory called pages, for example /views/pages/contact-us.php. So when I access this page like https://www.mysite.com/contact-us then it works fine and loads the contact us form as expected.
Look at my .htaccess file that removes index.php from the URL.
Code:
RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com
RewriteRule ^(.*)$ https://www.mysite.com/$1 [R,L]
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png|resources|robots\.txt)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
And also look at my routes.php file.
PHP Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$route['sendemail'] = 'sendemail/index';
$route['default_controller'] = 'pages/view';
$route['(:any)'] = 'pages/view/$1';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
Now after user submits the contact us form it goes to controller called SendEmail.php and then I want user to come back to Contact Us form with message either successful or failed. I am getting an email to my gmail account but when it comes to loading VIEW it does not work.
Look at code of SendEmail.php
PHP Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class SendEmail extends CI_Controller {
public function __construct() {
parent::__construct();
}
public function index() {
// Check form submit or not
//var_dump($this->input->post());
if ($this->input->post('submit') != NULL) {
// POST data
$postData = $this->input->post();
//SMTP related configuration is defined in /config/email.php
//it loads automatically by CodIgniter
$this->load->library('email');
$this->email->set_newline("\r\n");
$this->email->from($postData['email'], $postData['name']);
$this->email->to(ADMIN_CURRENT_EMAIL);
$this->email->subject(CONTACT_US_FORM_SUBJECT);
$this->email->message('Testing the email class.');
$data['is_error'] = false;
if ($this->email->send()) {
$data['message'] = 'The email has been sent successfully.';
} else {
$data['is_error'] = true;
$data['message'] = 'Sorry, the email was not sent successfully. Try again later or send a direct email to ' . ADMIN_CURRENT_EMAIL;
//echo $this->email->print_debugger();
}
$this->load->view('contact-us', $data);
} else {
echo "Invalid request.";
die();
}
}
}
?>
I am getting below error. As I said above I manage to get email to my gmail account but loading a view does not work.
An Error Was Encountered
Unable to load the requested file: contact-us.php
Can you please help me?
Thanks - Hitesh
↧
Problem using two different database
Hello, people of the forum.
All right?
I'm working with two databases, MySQL as primary and Progress as secondary bank via ODBC ...
The following is the code for the connections:
database.php
The default database is working normally, but when I try to access the database via ODBC with activerecord the following error:
md_test .php
Can anybody help me?
All right?
I'm working with two databases, MySQL as primary and Progress as secondary bank via ODBC ...
The following is the code for the connections:
database.php
PHP Code:
$active_group = 'default';
$query_builder = TRUE;
$active_record = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'Xxxx',
'username' => 'Xxxx',
'password' => 'Xxxx!',
'database' => 'Xxxx',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
$db['Zzzzzzzzz'] = array(
'dsn' => '',
'hostname' => 'Zzzz',
'username' => 'Zzzz',
'password' => 'Zzzz',
'database' => 'Zzzz',
'dbdriver' => 'odbc',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
The default database is working normally, but when I try to access the database via ODBC with activerecord the following error:
Code:
Fatal error: Call to undefined method CI_DB_odbc_driver::get() in C:\xampp\htdocs\novo\application\modules\test\models\Md_test.php on line 15
md_test .php
PHP Code:
class Md_test extends CI_Model {
function __construct(){
parent::__construct();
$this->test= $this->load->database('Zzzzzzzzz', TRUE);
}
function buscaPedidos($dt)
{
return $this->test->get('Zzzzz'); // line 15
}
}
Can anybody help me?
↧