Welcome Guest, Not a member yet? Register   Sign In
  Database connection (Fear of overload with session, TRUE or FALSE)
Posted by: El Forum - 08-22-2007, 08:39 PM - No Replies

[eluser]sikkle[/eluser]
Hi there,

i opened this topic to received some opinion from people about how they deal with this.

A lot of people cry everyday about number of connection to database.

I'm wondering this, Code igniter got some libs to help you start, thanks to them indeed.

But the point is, if you use example db_session, indeed each page load you have a connection opened up with the database.

Sometime you have some writing there to keep the session up to date. You add userdata there, sometime last page visited to get the user at the right place.

Is it what we call overload ? does someone operate a barely huge website with something like Session in database ?

Does people cry for nothing there, or it's just EVIL to think it's not sooo awful.


Sorry for the lenght of this post again Smile

thanks.


  Which .htaccess is it?
Posted by: El Forum - 08-22-2007, 06:27 PM - No Replies

[eluser]piper-coda[/eluser]
Hi, I am putting up a site that was developed, I think there may be a problem with either the .htaccess file, or, the index.php file. I have no idea which one it is. Needless to say, the application works on my local system, no problems there.

The URL is is http://www.microkan.com.php4-2.websitetestlink.com

This is the current one:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

This one was the previous one:
Code:
RewriteEngine on
RewriteBase /
Options +FollowSymLinks
RewriteCond $1 !^(index\.php|images|js|media|info\.php|css|userfiles|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

And this was htacess.txt on the server (Not sure how it ended up there):
Code:
RewriteEngine on
#RewriteBase /
RewriteRule ^$ index.php [L]
RewriteCond $1 !^(index\.php|img|media|css|js|user_guide|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ index.php/$1 [L]

This is the index.php file:
Code:
<?php

error_reporting(E_ALL);

/*
|------------------------------------------------
| SYSTEM FOLDER NAME
|------------------------------------------------
|
| This variable must contain the name of your "system"
| folder. Include the path if the folder is not in the same
| directory as this file.  No trailing slash
*/

    $system_folder = "system";

/*
|------------------------------------------------
| APPLICATION FOLDER NAME
|------------------------------------------------
|
| If you want this front controller to use a specific
| "application" folder you can set its name here.
| By doing so you can have multiple applications share
| a common set of Code Igniter system files.
| Note: It is assumed that your application folder will
| be located within the main system/application folder.
| For example, lets say you have two applications,
| "foo" and "bar":
|
|  system/application/foo/
|  system/application/foo/config/
|  system/application/foo/controllers/
|  system/application/foo/errors/
|  system/application/foo/scripts/
|  system/application/foo/views/
|  system/application/bar/
|  system/application/bar/config/
|  system/application/bar/controllers/
|  system/application/bar/errors/
|  system/application/bar/scripts/
|  system/application/bar/views/
|
| If you would like to use the "foo" application you'll
| set the variable like this:
|
|    $application_folder = "foo";
|
*/

    $application_folder = "";

/*
|================================================
| END OF USER CONFIGURABLE SETTINGS
|================================================
*/

if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE)
{
    $system_folder = str_replace("\\", "/", realpath(dirname(__FILE__))).'/'.$system_folder;
}

if ($application_folder != '')
{
    $application_folder .= '/';
}

// Older versions of PHP don't support this so we'll explicitly define it
if ( ! defined('E_STRICT'))
{
    define('E_STRICT', 2048);
}

define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('BASEPATH', $system_folder.'/');
define('APPPATH', BASEPATH.'application/'.$application_folder);


require_once BASEPATH.'codeigniter/CodeIgniter'.EXT;
?>


If anyone could please shed some light on what's going on with this, I would appreciate it, I realize it's a bit much, but help would be appreciated.


  re-populating form after invalid submission
Posted by: El Forum - 08-22-2007, 05:19 PM - No Replies

[eluser]stevefink[/eluser]
I'm trying to re-populate a form after one or more invalid data fields have been submitted. As per the validation user guide, I have the following in my controller:

Code:
$fields['stock']    = 'Stock';
$fields['vin']        = 'VIN';

$this->validation->set_fields($fields);

And the following in my view:

Code:
<label>Stock# <span class="required"> * </span></label>
    &lt;input type="text" name="stock" value="&lt;?=$this-&gt;validation->stock;?&gt;" /> <br>
    
    <label>VIN    <span class="required"> * </span></label>
    &lt;input type="text" name="vin" value="&lt;?=$this-&gt;validation->vin;?&gt;" /> <br>

If any part of the form is not properly submitted, shouldn't those two essentially get repopulated? Instead I get this within my view:

Severity: Notice

Message: Undefined property: CI_Validation::$stock

Filename: console/car_info_view.php

Line Number: 43

and

A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Validation::$vin

Filename: console/car_info_view.php

Line Number: 46

Thank you.


  using fonts
Posted by: El Forum - 08-22-2007, 04:27 PM - No Replies

[eluser]megabyte[/eluser]
I notices that there is a fonts directory in CI.

Does anyone know how to use it?

Thank you.


  Iterating through a form's $_POST
Posted by: El Forum - 08-22-2007, 04:02 PM - No Replies

[eluser]stevefink[/eluser]
Hi all,

So I have a fairly large form. About 8 text fields, 3 different select boxes, one radio group with two choices, some textareas etc.

Some of these fields are required, some are not. I have my validation working perfectly.

My question is, what technique would you folks use to insert the data that is submitted via $this->input->post to take the validated data and insert it into my respective database table? I'm not sure if I should check for every single potential post value, that could take a lot of code.

If anyone can throw an example here, that'd be awesome.

Thanks!


  User Accounts
Posted by: El Forum - 08-22-2007, 03:14 PM - No Replies

[eluser]pbreit[/eluser]
Has anyone tackled user accounts in CodeIgniter? I've seen various authentication packages but I'm looking more for individual user accounts. Is the source for these forums available?


  Problem with Controller
Posted by: El Forum - 08-22-2007, 02:38 PM - No Replies

[eluser]phrozen3[/eluser]
When I use the default index function when using a controller, the website comes up perfectly. But if I call a different function in the controller, the stylesheet doesn't come up.

Example Code
------------------------------------------------------------------------

&lt;?php

class Edit extends Controller {

function index() {
$data['PageHeader'] = "Delete User";
$this->load->view("deluser",$data);
}

function adduser() {
$data['PageHeader'] = "Add User";
$this->load->view("adduser",$data);
}
}
?&gt;
------------------------------------------------------------------------

If I call the index page http://www.website.com/edit, it works but if I use http://www.website.com/edit/adduser, the page comes up but it doesn't recognize the stylesheet. I've also tried the _remap function and encountered the same problem.

What could be the problem?

Thanks in advance...


  Routing improvement/recommendation on my current schema
Posted by: El Forum - 08-22-2007, 02:12 PM - No Replies

[eluser]stevefink[/eluser]
Greetings!

I'm looking to improve my current routing/controller/method schema. I'm going to use real names of my current schema here in hopes of someone suggesting something more clever.

Essentially, my site is broken down into a front-end website for public surfers and a console end of the site for backend inventory management, etc.

Currently the user would login to http://site/console (console being a controller and having it's index() {} verify a user with a login form. )

If the user successfully validates, I want the URL schema to remain under console. So what I did was redirect the user to http://site/console/addvehicle/carinfo (my routing engine has this:

$route['console/addvehicle/carinfo'] = 'addvehicle/carinfo';

What kind of sucks, is for my addvehicle photos section (which is a form which you get passed onto if carinfo() {} validates) is another controller, photoupload.php which I have the following routes for:

Code:
$route['console/addvehicle/photos'] = 'photoupload';
$route['console/addvehicle/photos/upload']    = 'photoupload/upload';
$route['console/addvehicle/photos/get_photos'] = 'photoupload/get_photos';

It would be cool if I can do something more along the lines of:

http://site/console/vehicle/add/carinfo
http://site/console/vehicle/add/photos
http://site/console/vehicle/add/carfax

I'm just not sure how I'd properly revamp that into controller/methods and routing due to lack of experience.

If anyone would be kind enough to help me out, that'd be great!

Thanks all.

- sf


  a small mistake in documentation...
Posted by: El Forum - 08-22-2007, 01:26 PM - No Replies

[eluser]eljunior[/eluser]
in the Calendaring Class page ,
on the section Showing Next/Previous Month Links
the $prefs array is being passed as an argument to $this->calendar->generate() method instead
of to $this->load->library().

this confused me when trying to reproduce the results described, until i figured out what was going on.

(by the way, am i posting this in the right place?)


  Authentification & traffic management guru
Posted by: El Forum - 08-22-2007, 11:44 AM - No Replies

[eluser]sikkle[/eluser]
I'm wondering if someone got some way maybe i didn't know already include in example with Ci, FreackAuth or Db_session.

Some people got some way to start managing BANNED ip user from your website ?

Some people got some way to start managing not more then 20 actions in one minute from a user ?

Some people got some way to handle maximum try to login way ?


This is general but i'm windering if i miss something BIG and just receive a link to go read or if it's more and need to have a though about it.

thanks.


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

Username
  

Password
  





Latest Threads
Changing Session cookie -...
by codeus
55 minutes ago
hot-reload side effects s...
by PaulC
11 hours ago
using app/Config/App.php ...
by sam547
Yesterday, 03:04 PM
Setting baseURL in Regist...
by grimpirate
05-15-2025, 02:20 PM
CRUD Code Generator
by DeanE10
05-15-2025, 05:31 AM
CodeIgniter.com - Report ...
by Harry Lyre
05-14-2025, 04:26 AM
Missing closing bracket w...
by abf
05-13-2025, 07:27 PM
Update from 4.6.0 to 4.6....
by FlavioSuar
05-13-2025, 04:17 AM
Sessions old files are de...
by InsiteFX
05-12-2025, 10:30 PM
Ajax post failing with Ty...
by PaulC
05-12-2025, 12:23 AM

Forum Statistics
» Members: 146,562
» Latest member: oefwoef
» Forum threads: 78,392
» Forum posts: 379,465

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB