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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 11,115
» Latest member: duccanh
» Forum threads: 67,637
» Forum posts: 422,833

Full Statistics

Latest Threads
cli cron job fails to see...
Forum: General Help
1 hour ago
» Replies: 2   » Views: 32
problem appending to tabl...
Forum: General Help
3 hours ago
» Replies: 4   » Views: 48
What is the best IDE for ...
Forum: Installation & Setup
3 hours ago
» Replies: 36   » Views: 18,805
Lost session
Forum: CodeIgniter 4 Support
4 hours ago
» Replies: 28   » Views: 614
Migration not working
Forum: CodeIgniter 4 Support
7 hours ago
» Replies: 0   » Views: 25
CodeIgniter 3.1.7 unbuffe...
Forum: Issues
7 hours ago
» Replies: 7   » Views: 379
Database ERROR Today on A...
Forum: Issues
8 hours ago
» Replies: 1   » Views: 36
just a memory usage quest...
Forum: CodeIgniter 4 Support
9 hours ago
» Replies: 0   » Views: 24
Insert Multiple in dropdo...
Forum: General Help
9 hours ago
» Replies: 1   » Views: 51
Routing on sub level menu...
Forum: General Help
10 hours ago
» Replies: 1   » Views: 43

 
  chinese question: it is about code for saving message to database.GBK
Posted by: El Forum - 10-16-2007, 03:03 AM - Forum: Archived Development & Programming - Replies (4)

[eluser]fanxiaotao[/eluser]
My english is very bad, i am a chinese.
Not everyone like me.

I user php at the first.

My database is mysql.
When i was save message to database ,that like Video Demo.
The message had saved to database, But the code was error.

egg: I wanted to save "阿四大幅" ,but it was "闃垮洓澶у箙" in the database.

If you can konw what i say.

I hope somebody could gave me a good answer.

May be i just need modify a file, that my thinking.


  Excellent CI+Xajax Resource/Examples!!
Posted by: El Forum - 10-16-2007, 02:28 AM - Forum: Archived Development & Programming - Replies (3)

[eluser]jz[/eluser]
Hello All,

Thank Goodness for Alex! This guy has put together some great examples of using CI and Xajax together.

Check them out:
Site 1
Site 2

Hope this helps somebody else!

-moo


  very easy, but i am fool
Posted by: El Forum - 10-16-2007, 01:43 AM - Forum: Archived Development & Programming - Replies (37)

[eluser]nirbhab[/eluser]
hello frndz, i am new to MVC and CodeIgniter, i am pretty impressed with its working but i am facing lil problem i think u MVC gurus can easily help me out.

So, lets begin:

Controller:
<?php
class Blog extends Controller
{
function __construct()
{
parent::Controller();
}
function index()
{
$this->load->model('tut/blogmodel','name');
$this->name->hello();
}
}
?>

Model:
<?php
class Blogmodel extends Model
{
function __construct()
{
parent::Model();
}
function hello()
{
echo 'hello';
}
}
?>
ERROR:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Blog::$name

Filename: tut/blog.php

Please help me out from this simple problem who has made me idiot.


  Force HTTPS for certain controllers
Posted by: El Forum - 10-16-2007, 12:00 AM - Forum: Archived Development & Programming - Replies (6)

[eluser]Michael Roper[/eluser]
I am trying to be able to force certain functions in my controller to only be accessed over SSL... so if they are accessed by a HTTP url, they will be redirected to the HTTPS url (with any POST data still intact)... but I only want those to be redirected, and everything else can stay on non-SSL.

here is my current .htaccess rules...

Code:
RewriteEngine On
RewriteBase /

## these were my original rules
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php/$1 [L]

#### SECURE CERTAIN PAGES

## if they are already on the http site
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} secure/(register|activation|login|profile)
RewriteRule ^(.*)$ https://%{HTTP_HOST}/index.php/$1 [L]

## if they are already on the https site
RewriteCond %{SERVER_PORT} !80
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} secure/(register|activation|login|profile)
RewriteRule ^(.*)$ https://%{HTTP_HOST}/index.php/$1 [L]


#### UNSECURE THE REST

## if they are already on the http site
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !secure/(register|activation|login|profile)
RewriteRule ^(.*)$ http://%{HTTP_HOST}/index.php/$1 [L]

## if they are on the https site
RewriteCond %{SERVER_PORT} !80
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !secure/(register|activation|login|profile)
RewriteRule ^(.*)$ http://%{HTTP_HOST}/index.php/$1 [L]

it looks convoluted, but it seems to work... with the exception of the fact that the 'index.php' shows up in the url when switching between the ssl and non-ssl site.. which i dont really like..

can anyone suggest a better way to do this, or at least a way to tidy up the rules above? i'm not familiar enough with the rewrite rules to figure it out without breaking other things... also, is this something i could be doing with routes?


  using anchor around an image tag
Posted by: El Forum - 10-15-2007, 11:38 PM - Forum: Archived Development & Programming - Replies (3)

[eluser]Eric Cope[/eluser]
Hello, I am trying to create the following code:

Code:
<a href="some/url"><img src="some/img.jpg"></a>

I am trying to use:
Code:
anchor("some/url","<img src='http://url/to/photo'>");

It produces odd undesired results. It is actually printing the text from a previous anchor call. Here is what it produces:

Code:
<a href="correct/url" <img src='current/img/src/path'>>link text from previous anchor use</a>

notice the redundant ">"?

It looks like it is redisplaying the old title. This does not sound correct. Any ideas or tips/tricks?


  Image Multi-Thumb
Posted by: El Forum - 10-15-2007, 09:23 PM - Forum: Archived Development & Programming - Replies (5)

[eluser]MMCCQQ[/eluser]
hi!


i got a question. how can i upload a Image , to get Resize to 640x400 , a Thumb 125x125 AND Thumb 25x25??? how???


  Database config file
Posted by: El Forum - 10-15-2007, 08:34 PM - Forum: Archived General Discussion - Replies (1)

[eluser]cinewbie81[/eluser]
Hi all,

Sorry i post it on another forum previously, think that this is the right forum for me to post.. so here's it again ::


[quote author="cinewbie81" date="1192469868"]Hi all,

The following is my setup.php controller clas:

Code:
class Setup extends Controller {

function Setup()
{
  parent::Controller();
  $this->load->helper(array('url','form','setting'));
  $this->load->model('dbmodel', 'sql', TRUE);
  $this->load->database();

}
    
function index()
{
  $this->load->dbutil();
  if ($this->dbutil->create_database('payroll'))   {
      echo 'Database created!';
  }
}

}


And the following is my database.php config:

Code:
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "password";
$db['default']['database'] = "payroll";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";

When function index() loaded, the following error message prompted out:
"Unable to select the specified database: payroll"

This error is because I bind the value 'payroll' to $db['default']['database'] in my config file. It can be easily fixed if i manually query 'Create Database payroll' in prior, but i don't want it to be this way cause i don't want all my client have to manually create the database first before they can use the system. Any solution ??[/quote]


  Blank page on server
Posted by: El Forum - 10-15-2007, 08:10 PM - Forum: Archived Development & Programming - No Replies

[eluser]Majd Taby[/eluser]
Hi, my website has two applications (frontend,backend), and it works fine on my local computer. Yet when I move to the shared server, the frontend application works fine, but the backend one doesn't.

It stops after Controller::Controller or any loading of anything...It doesn't make sense.

EDIT: Also, for some reason, it tries to access my file names when they're minimized, it doesn't like capitalization...but the frontend application requires the filenames of the controllers to be like the name of the contoller(with the capitalization)

EDIT 2: Also, I can't find any syntax errors...there shouldn't be any, it works fine on my local machine. When i upload it "as-is", i get errors that the controller files could not be found. Seems like it wants the names minimized, when i replace all the capital letters with small letters, i get a blank page...


EDIT 3: Sorry about all this, turns out error reporting isn't on...contacting host to see if there's a way to turn it on..I don't ever remember it being off...


  How can I control the acces to a page using routing and uri with a special behavior?
Posted by: El Forum - 10-15-2007, 08:02 PM - Forum: Archived General Discussion - No Replies

[eluser]Optimus Prime[/eluser]
Hi!

I post this topic because I want to know your opinion about my problem and to know another alternatives for it before to write a large code. I tested some alternatives but I want to know if there another way to acommplish my goal.

I explain my problem:

- Suppose that I have many controllers, all of them have the "show" function and it uses a parameter "name".
- Suppose that doesn't exist the same name between the sections (or controllers, in this case).

An example is:

site.com/people/show/name
site.com/places/show/name
site.com/{others_controller}/show/name

So, the problem is that I want to create easy access for the visitors (shorts url). I mean that redirect to the full address . Ideally, I want two types for accesing (or to redirect to) a page. I show it as an example:

Redirection Type 1:

site.com/name --&gt; redirects to --&gt; site.com/people/show/name

and

Redirection Type 2:

site.com/people/name --&gt; redirects to --&gt; site.com/people/show/name

The redirection type 2 can be discarded, but at less I need the type 1.

An alternative that I tried is to make a function (named redirection) that search for the name and redirect to the right controller (or URI adress) and config the routes (config/routes.php) in this way (based in the previos example):


$route['people(.*)'] = "people$1";
$route['places(.*)'] = "place$1";
$route['{other_controller}(.*)'] = "{other_controller}$1";
...etc...

$route['(.*)'] = "/redirects/to/$1";

It work for Redirection Type 1, but no for Redirection Type 2. I guess that I need to write the functions in $route like:

$route['people/list(.*)'] = "people/list(.*)";

So this mean that I need to config the config.php many times and write all the functions names too?(when I need to add o delete sections) a route map. Am i right? Ideally, I want to avoid it.

Another alternative but I want to avoid it, is to write a code like this:

Code:
function controller_function($action, $params...) {
  if ($action=="action1") {
  }
  elseif ($action=="action2") {
  }
  ...

}

Unless there is no way to accomplish my goal I will code with this style. But I want to find a better solution because the site that I'm working will suffer many modifications (sections will be added or deleted with the time).

The best alternative that I wish to find is to configure CI to process the uri segments: if the controller segment does not exist (in the code), before to show the error page, check if this uri segment is a name parameter and if is a name that exist in a database, then redirect to the rigth controller and function. Is this posible?

Or there is another suggestion?. I'll pleased to read your answers! :lol:


  --Is there a controller hierarchy ?
Posted by: El Forum - 10-15-2007, 07:26 PM - Forum: Archived Development & Programming - Replies (4)

[eluser]Unknown[/eluser]
Hi I am a newbie to CI. I created a controller which extends the Controller:

class BaseSessionController extends Controller {
// some logic here
}

Then I tried to create another controller class which extends the BaseSessionController:

class SubController extends BaseSessionController {
// some logic here
}

These two controllers are in two different php files -- both in the controllers folder. It seems that BaseSessionController could not be recognized by SubController . I am wondering if I have to manually include the BaseSessionController script file in my SubController script, using require() or require_once().



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