Welcome Guest, Not a member yet? Register   Sign In
Help revive codeigniter 2.x project
#13

(02-26-2018, 10:09 PM)Paradinight Wrote:
(02-26-2018, 04:16 PM)Ricke Wrote: Yes, one step further, but yet another problem richer.

Yepp, I'm from Sweden, thought you might be Swedish to because of the jrEklund name Smile

Well, I'm being cheated 2 times, first of $2,5K which was handwritten code that would be more expensive to get sorted than build it from scratch, so I fell in the trap again and let another one do it from scratch, so about $20k + $3K design later I'm left with this unfinished project and has no funds to be able to pay that amount again, that's why I'm trying to sort it out myself as far as I'm able to.
Even thinking about go an development education, but you have to start somewhere Smile

I always had notepad++ on my PC, and got a trial PHPStorm just to get started with this project again after it been in an folder on my desktop about a year.

Although, I changed back to the CI 2.x project again, the updated CI 3.1.7 project just throws db duplicated errors, so have to take a look at that one later on, if I get this one to work I can just make a copy of the entire project, update it to 3.1.7 and go from there with an working backup.


I noticed that she has copied models since the bottom lines aren't changed to the right "xxxx_model" it's in.

PHP Code:
/* End of file event_model.php */
/* Location: ./application/models/event_model.php */ 


Here's the admin_model code:


PHP Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class 
Administrator_model extends CI_Model {

 
   public function __construct()
 {
 
// Call the Model constructor
 
parent::__construct();
 }
 
 function 
login($username$password)
 {
 
$this->db->where('username'$username);
 
$this->db->from('accounts');
 
$this->db->limit(1);
 
$query $this->db->get();
 
$admin $query->row();
 
 if (
is_object($admin) && $admin->password == sha1($this->config->item('member_salt') . $password)) {
 return 
$admin;
 } else {
 return 
false;
 }
 }
 
 function 
get_countries($country FALSE)
 {
 
$this->db->from('countries');
 
$query $this->db->get();
 return 
$query;
 }
 
 function 
get_states()
 {
 
$this->db->from('states');
 
$this->db->join('countries''countries.country_id=states.country_id''left');
 
$this->db->order_by('countries.country_name','asc');
 
$this->db->order_by('states.state_name''asc');
 
$query $this->db->get();
 return 
$query;
 }
 
 function 
get_provinces()
 {
 
$this->db->from('provinces');
 
$this->db->join('states''states.state_id=provinces.state_id''left');
 
$this->db->join('countries''countries.country_id=states.country_id''left');
 
$this->db->order_by('countries.country_name','asc');
 
$this->db->order_by('states.state_name''asc');
 
$this->db->order_by('provinces.province_name''asc');
 
$query $this->db->get();
 return 
$query;
 }
 
 function 
get_members($letter){
 
$this->db->like('username',$letter'after');
 
$this->db->from('members');
 
$this->db->join('provinces''provinces.province_id=members.location_id''left');
 
$this->db->join('states''states.state_id=provinces.state_id''left');
 
$this->db->join('countries''countries.country_id=states.country_id''left');
 
$this->db->join('memberships''memberships.membership_id=members.membership_id''left');
 
$query $this->db->get();
 return 
$query;
 
 }
 
 
// add a country to the DB
 
function add_country($country)
 {
 
// add the $country object/array to the DB
 
$this->db->insert('countries'$country);
 
 
// fetch the inserted id (auto incremented value of country_id) and return it
 
return $this->db->insert_id();
 }
 function 
add_state($state)
 { 
 
// add the $country object/array to the DB
 
$this->db->insert('states'$state);
 
 
// fetch the inserted id (auto incremented value of country_id) and return it
 
return $this->db->insert_id();
 }
 function 
update_state($state$state_id)
 { 
 
// add the $country object/array to the DB
 
$this->db->where('state_id'$state_id);
 
$this->db->update('states'$state);
 }
 function 
add_province($province)
 { 
 
// add the $country object/array to the DB
 
$this->db->insert('provinces'$province);
 
 
// fetch the inserted id (auto incremented value of country_id) and return it
 
return $this->db->insert_id();
 }
 function 
update_province($province$province_id)
 { 
 
// add the $country object/array to the DB
 
$this->db->where('province_id'$province_id);
 
$this->db->update('provinces'$province);
 }
 
 function 
get_reports(){
 
$this->db->from('reports');
 
$this->db->join('members''members.member_id = reports.reported_member_id''left');
 
 
$query $this->db->get();
 return 
$query
 }
 function 
read_report($read)
 { 
 
// add the $country object/array to the DB
 
$this->db->where('read'0);
 
$this->db->update('reports'$read);
 
 
// fetch the inserted id (auto incremented value of country_id) and return it
 
return $this->db->insert_id();
 }
 
 function 
get_text($id)
 {
 
$this->db->where('id'$id);
 
$this->db->from('texts');
 
$query $this->db->get();
 return 
$query->row();
 }
 
 function 
edit_text($id$text)
 { 
 
$this->db->where('id'$id);
 
$this->db->update('texts'$text);
 }

 
}
/* End of file event_model.php */
/* Location: ./application/models/event_model.php */ 

The Passwordcode is bad design Sad.

Has it ever worked? If not, start with 3.1.7. How many controllers/models and views?

I have no idea actually.
The developer said it had work to login into the admin page,, if it has,, no clue, never seen it.
I just saw the page through my browser from her server during the so called developement :/

15 controllers
16 models
39 views

Bare in mind some of the are called:
xxxxx.php,
xxxxx_controller.php
old_xxxxx.php
old_xxxxx_controller.php


So instead of debugging or fix one of each there are sometimes old_xxxxx.php and older_xxxxx.php files in the folders.
Reply


Messages In This Thread
Help revive codeigniter 2.x project - by Ricke - 02-25-2018, 06:45 AM
RE: Help revive codeigniter 2.x project - by Ricke - 02-27-2018, 07:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB