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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 8,106
» Latest member: uncrownedtechnology
» Forum threads: 65,581
» Forum posts: 412,336

Full Statistics

Latest Threads
Codeigniter Unable to joi...
Forum: General Help
1 hour ago
» Replies: 1   » Views: 51
loading template only onc...
Forum: General Help
4 hours ago
» Replies: 5   » Views: 115
Error 500
Forum: General Help
6 hours ago
» Replies: 0   » Views: 14
Login to client account p...
Forum: General Help
10 hours ago
» Replies: 0   » Views: 79
AJAX Load Content No Page...
Forum: General Help
11 hours ago
» Replies: 6   » Views: 239
Routing – error in tutori...
Forum: Issues
Yesterday, 02:57 PM
» Replies: 0   » Views: 44
CodeIgniter Spanish forum
Forum: Regional User Groups
Yesterday, 02:37 PM
» Replies: 38   » Views: 15,248
Migrate project Symfony t...
Forum: Best Practices
Yesterday, 12:51 PM
» Replies: 2   » Views: 96
image upload and crop
Forum: Addins
Yesterday, 08:55 AM
» Replies: 2   » Views: 151
Array to string conversio...
Forum: General Help
Yesterday, 06:39 AM
» Replies: 2   » Views: 101

 
  Error 500
Posted by: rantanplan - 6 hours ago - Forum: General Help - No Replies

We have an security tester, and he found a scenario where an 500 Error coming.

Any Idea how i can catch this?


With Burp Suite Repeater:
POST /appname/1' OR '1'='1/  HTTP/1.1
.
.
.

Get following Page from Server

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at
.... to inform them of the time this error occurred,
 and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
<p>Additionally, a 500 Internal Server Error
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>


  Codeigniter Unable to join the table properly
Posted by: apysan - 8 hours ago - Forum: General Help - Replies (1)

Hi I have 4 Tables.

1. t_category
  Id         category        parent_category     status
+------+----------------------+-----------------+-----------+
|   1    | Ayurvadic              |         0          |  Active    |
|   2    | Non Prescription     |         0          |  Active    |
|   3    | Pet Medicine          |         0          |  Deactive |
|   4    | Prescription Meds   |         0             Active     |
|   5    | Health Care Device |         0          |  Active     |
|   10  | Best Seller             |         0          |  Active     |
+------+----------------------+-----------------+-----------+
Mainly this is the top layer of the table, here the above 
categories are fixed.
One category may have any number of product(s).
Id is autogenerated which is unique for any category. 


2. t_product
  Id     product     generic_name   description  status
+------+-------------------------+-------------+----------+
|   1  | Alamia      | Alamia       |  desc1      | Active   |
|   2  | Bokachi     | Bokachi      |  desc2      | Active   |
|   3  | Bargol       | Bargol       |  desc3      | Deactive |
|   4  | Centrapin   | Centrapin   |  desc4      | Active   |
|   5  | Callis        | Callis         |  desc5      | Active   |
|   6  | Altroxin     | Altroxin      |  desc6      | Active   |
+------+-----------+-------------+-------------+----------+
We put the products in this table with the help of unique id
we can identify a particular product (Bargo-3) etc.
Id is autogenerated which is unique for any product. 

3. t_cp_link
  Id     category_id product_id    
+------+------------------------+
|   1  |     3     |     1      |
|   2  |     3     |     2      |
|   3  |     3     |     3      |
|   4  |     4     |     5      |
|   5  |     4     |     6      |
|   6  |     1     |     4      |
+------+-----------+------------+
category_id and product_id come from t_product_pack table at the time we enter a record in t_product_pack.



4. t_product_pack
  Id     product_id  Category_id  descr.    status     Dosage  unit_price Selling_price   Stock
+------+-------------------------+--------+----------+--------+----------+--------------+-------+
|   1    |   1          |     3         |  desc1 | Active     |  10     |  1250    |   125         | Active|
|   2    |   2          |     3         |  desc2 | Active     |   4      |  2550    |   400         | Active|
|   3    |   3          |     3         |  desc3 | Deactive |   5      |  1000    |   500         | Active|
|   4    |   5          |     4         |  desc4 | Active     |   6     |   5900    |  1250        | Active|
|   5    |   6          |     4         |  desc5 | Active     |   5     |   2200    |  580         | Active|
|   10  |   4          |      1         |  desc6 | Active    |   5      |  16.50   |  16.00       | Active|
+------+-----------+-------------+--------+----------+--------+----------+--------------+-------+

When we enter the detail of a particular in the product package we insert the category_id(id of t_category foreign key)
and product_id (from t_product id become a foregin key here).

When we save a record here we put the category_id and product_id in t_cp_link for linking the product table with category table.

Now the resullt i want like this.

Category_id   Category_name      Product_id  Product   Dosage  unit_price Selling_price   Stock
+-----------+------------------+-----------+--------+---------+----------+-------------+-----------+
|     3     | Pet Medicine        |     1      | Alamia   |   10    |  1250    |  125        |  Active     |
|     3     | Pet Medicine        |     2      | Bokachi |    4     |  2550    |  400        |  Active     |
|     3     | Pet Medicine        |     3      | Bargol   |    5     |  1000    |  500        |  Active     |
|     4     | Prescription Meds|     5      | Callis     |     6    |   5900    |  1250       |  Active    |
|     4     | Prescription Meds|     6      | Altroxi   |     5    |   2200    |  580        |  Active     |
|     2     | Ayurvadic            |     4       | Callis    |     5     |  16.50   |  16.00      |  Active     |
+-----------+------------------+-----------+--------+---------+----------+-------------+-----------+

by using the above 4 or less no of tables.

I write the following query:
but it does not display the category_id

    public function get_all_package() {

$this->db->select('t_product_pack.*,t_product.*');
        $this->db->FROM('t_product_pack');
$this->db->join('t_product', 't_product_pack.product_id = t_product.id','left'); 
        $this->db->order_by("product_id", "ASC");  
        $query_result = $this->db->get();
        $result = $query_result->result();
        echo "<pre>";
        print_r($result);
        exit();
        return $result;
    }

I want it to order by the id of t_product_pack table.

Please help.


Thank you very much.



Attached Files
.txt   question.txt (Size: 4.71 KB / Downloads: 5)
.txt   question1.txt (Size: 4.71 KB / Downloads: 3)

  Login to client account programatically
Posted by: JayAdra - 10 hours ago - Forum: General Help - No Replies

Hi,

I have an app which has a master account/database running on "example.com", with client accounts/databases using subdomains, e.g. "test.example.com".

I am trying to add a function in the master account to programatically login as the admin user of the client account. I can connect to the client DB, get the admin user, and set the session as I normally would for a normal login, but the problem I'm having is the session cookie is being set on example.com rather than test.example.com, causing the login to fail.

I can't set the cookie domain to be ".example.com" (site-wide) as each client account must have separate logins/sessions.

The simplest solution I could think of was would be to change the cookie domain before setting the session, so this one off time it would use my specified domain instead, i.e.:

PHP Code:
$this->config->set_item('cookie_domain''test.example.com'); 

This however doesn't seem to update the cached config item in the Session library.

My question is, is there any way to update this value dynamically in this way? If not, is there an alternate solution to my problem?

Any ideas are appreciated, and I can answer any additional questions about my app if you need.

Thanks,
Jay.


  Routing – error in tutorial?
Posted by: gerald - Yesterday, 02:57 PM - Forum: Issues - No Replies

https://www.codeigniter.com/user_guide/g...uting.html
On this page you can read:

Quote:Important
The reserved routes must come before any wildcard or regular expression routes.

https://www.codeigniter.com/user_guide/t...ction.html
On this page you have this example:
Code:
$route['news/(:any)'] = 'news/view/$1';
$route['news'] = 'news';
$route['(:any)'] = 'pages/view/$1';
$route['default_controller'] = 'pages/view';


$route['default_controller'] is a reserved route if I understand the documentation correctly.

Regards
Gerald


  loading template only once ?
Posted by: Coool6 - Yesterday, 08:22 AM - Forum: General Help - Replies (5)

Hello to the nice community !

I'm a beginner in CI (but not in PHP), i saw the CI logic is to load the template files in the controller in each method. 
At the end you load the same files all the time, and it makes heavy controller files for nothing. 

Code:
$this->load->view('templates/header', $data);
$this->load->view('news/create');
$this->load->view('templates/footer');

There is an easier solution to just load it once in your controller or even in your project (for example if you use the same template for the whole project ? 
Or maybe just to have one template.php file and loading the content inside ? 

If you can help me, you will be lovely ! 
Thanks a lot Smile


  Migrate project Symfony to Codeigniter
Posted by: Sciecha - Yesterday, 04:04 AM - Forum: Best Practices - Replies (2)

Hello, i'm new in CI

and how the topic is, I need to migrate existing project in Symfony to CI. What I need to look for? How to start and migrate step by step? Project is not so large.

Greetings


  Array to string conversion Error
Posted by: nollyvenon - 02-21-2017, 05:27 PM - Forum: General Help - Replies (2)

I get the following error
A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: database/DB_query_builder.php
Line Number: 676
Backtrace:
File: C:\wamp\www\stockfeb2017\app\models\Products_model.php
Line: 66
Function: where
File: C:\wamp\www\stockfeb2017\app\controllers\Products.php
Line: 635
Function: getProductOptionsWithWH


How can I sort this?

Many Thanks


  Creating a new session instead of updating
Posted by: bjacobs - 02-21-2017, 04:42 PM - Forum: General Help - No Replies

Using version 2.0.2 and storing sessions in a database. Issue persists with both 
$config['cookie_domain'] = '';
and 
$config['cookie_domain'] = '.' . $_SERVER['SERVER_NAME'];

I have a cart. I redirect to payment site, then redirect back to my site. When I redirect to my site, it creates a new blank session instead of updating the old one.

However, if I delete all my session records and delete my cookies, when I try a payment and redirect back to my site, the session correctly updates instead of creating a new blank one. It will continue to work properly for a while and then eventually the problem comes back.

Any ideas as to why a new session is being created instead of updating the old one? And any idea why deleting my sessions and cookies fixes that problem for a while?


  [split] Stored Procedure not returning all records
Posted by: macruzgi - 02-21-2017, 03:53 PM - Forum: General Help - Replies (1)

Regards, I have a problem calling a stored procedure, Codeigniter processes it well but it only returns me 2 records and in my database there are 3, it always removes the first record and it does not show it.

Does anyone know why this is given ?, I would appreciate your help, I have googleado but I have not had results.
Beforehand thank you very much!


  Same cookie name, different domain
Posted by: bjacobs - 02-21-2017, 02:38 PM - Forum: General Help - Replies (2)

I have:

Code:
$config['cookie_domain'] = '.' . $_SERVER['SERVER_NAME'];

So why do I have one cookie named ci_session with the domain:
Code:
.mysite.com

And another cookie named ci_session with the domain:
Code:
.www.mysite.com

And also, is this a problem. If not, I don't care why it's doing it! Ha!

This is version 2.0.2 btw



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