CodeIgniter Forums

Full Version: Where to put this code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm just beginning to use CodeIgniter to build this site for an educational conference. I had for many years used a program called Rapidweaver on my Mac in conjunction with a web app called Sitelok. Now I'm switching entirely to CodeIgniter. I have a number of static pages and I'm able to to connect to the database to show last year's presentations. Now I need to build the login and registration system but I want to piggy back off of the Sitelok login system designed for Rapidweaver. Below are three parts of the code that Sitelok requires for Rapidweaver, however, I'm not sure where to put this code in my CodeIgniter project. The Sitelok folder is still in my project, so the code will be able to access any config files there. The Sitelok user table is also part of the database that is loading so there's no issues there.

Here are the instructions for each of the three pieces of code followed by the code itself.

Part 1: Copy and paste the code below and add to the very top of your page (before any DOCTYPE or <HTML>)"

PHP Code:

Part 2: Copy and paste this code below to the <HEAD> section of your page

PHP Code:
<?php if (function_exists('sl_loginformhead')) sl_loginformhead(15,false); ?>

Part 3: Copy and paste this code below to the <BODY> section of your page where you want the form to appear

PHP Code:
<?php if (function_exists('sl_loginformbody')) sl_loginformbody(15,false,$msg); ?>

Any ideas on where this code would go to transfer this to CodeIgniter?
It's hard to tell without knowing what this code do. But assuming that the require_once only load functions and doesn't output anything to the browser, you should put part 1 in your login controller, and part 2 and 3 in your login view.
You don't need to build a login and registration system. There are several authentication libraries, especially for CI.
E.g. Ion_Auth en Community_Auth.

Why would you re-invent the wheel?