Welcome Guest, Not a member yet? Register   Sign In
  Gallery problem - generating diferent size pictures from one?
Posted by: El Forum - 07-05-2007, 09:21 PM - No Replies

I am making gallery for my tuning portal and I need some help.

Idea is that every register user can build and maintain there own gallery. Gallery is based on three levels and four album container. It's look something like this [mark -> model -> album > album content] or [BMW -> E30 - 318i ->photos].

So problem is that I need to generate from one uploaded photo 3 deferent size [thumb, medium and full size]. My idea is to build some function($photo_id) that will temporarily generate photo from original. Basically idea is to have just one original photo on server, and from that one just generating others.

can anybody help me whit some idea how to start that function? or some example will be nice too.

  Needed: Summary of Security and Sessions versus standard PHP
Posted by: El Forum - 07-05-2007, 08:55 PM - No Replies

Hello all,

In apps I am working with the username and password are compared against the db and if a match is found a $_SESSION variable is set (say for example $_SESSION['logged_on']). Then in each module/page that variable is checked and if false the user is redirected to the home page. How would this be done in CI? CI does not use the native PHP sessions.

I imagine it is a rather simple thing to run the query to look for a hit, but how then do you insure that the user can see no pages other than the home page unless logged on? I am trying to get my head around all of this so I can port the app to CI.



Posted by: El Forum - 07-05-2007, 05:12 PM - No Replies


I know that Scaffolding is only for developers but isn't there a way to protect it?
I've got the trigger on "admin".

Now, this is how I try to protect it:

function User( )
        parent::Controller( );
        if( $this->userlib->logged_in( ) && $this->userlib->getData( $this->session->userdata( 'username' ), 'status' ) == 3 )
            $this->load->scaffolding( 'users' );
That's my userlib login and status check for admin.

But now it never opens scaffolding. Is there a way to make it only viewable for status 3 members? Or anything else?


  Scaffolding > SQL error
Posted by: El Forum - 07-05-2007, 04:41 PM - No Replies


I'm using CI 1.5.3, PHP 5.2.3 and MySQL 5.0.37. I have a table with the following structure:

CREATE TABLE `client` (
  `id` int(10) NOT NULL auto_increment,
  `first_name` varchar(50) NOT NULL,
  `last_name` varchar(50) NOT NULL,
  `address_1` varchar(75) NOT NULL,
  `address_2` varchar(75) NOT NULL,
  `city` varchar(50) NOT NULL,
  `state` char(2) NOT NULL,
  `zip` int(9) default NULL,
  `phone` int(10) default NULL,
  `cell` int(10) default NULL,
  `email` varchar(255) NOT NULL,
  `company` varchar(75) NOT NULL,
  PRIMARY KEY  (`id`)

When I use scaffolding and try to insert a record (leaving an INT field "empty"), I get a Database error:

An Error Was Encountered

Error Number: 1366

Incorrect integer value: '' for column 'zip' at row 1

INSERT INTO client (first_name, last_name, address_1, address_2, city, state, zip, phone, cell, email, company) VALUES ('xxx', 'xxx', '', '', 'xxx', 'CA', '', '', '', '[email protected]', '')

I did some research and it appears that I can just edit the MySQL my.ini file and remove "STRICT_TRANS_TABLES" from sql-mode...but I wanted to know if there were any other options. I don't know that everyone normally can edit the MySQL my.ini file and it appears that the issue is cause by the scaffolding sending a '' instead of a null.

Any thoughts?

  Scaffolding with enable_query_strings to true!
Posted by: El Forum - 07-05-2007, 02:52 PM - No Replies

This is really weird and perhaps there's a solution. I've enabled query strings for my development needs. And the scaffolding doesn't work if I access my page like this: index.php?c=classname&m=secretword. It works just fine if I use, index.php/classname/secretword.

So how can I use the scaffolding feature while keeping the enable_query_strings set to true?

Thanks in advance!

  Numerically Indexed Result Arrays?!?
Posted by: El Forum - 07-05-2007, 10:37 AM - No Replies

I'm still fairly new to CI, but I'm really lovin' it so far.

My problem is -- PHP has a way to retrieve records from tables with a numeric index but, apparently, CI does not. (At least not in the documentation I've read so far.)

Does anyone know how to get a numerically indexed (0 to whatever) array from a query result such as:
$res = $this->db->getwhere('contacts',array('id'=>$id));

When I use: $row = $res->row_array();

I get an array that does not allow me to place field contents using:

... value="<?=$row[0]?>" ...

Am I just converting to the row incorrectly or what?

  Issues with $this->db->insert
Posted by: El Forum - 07-05-2007, 09:13 AM - No Replies


function comments_insert() {
    $this->db->insert('awNewsComments', $_POST);

Taken from the sample blog tutorial.

Does db->insert not kick off a NOW() function on DATETIME fieldtypes? Seems to always leave the value NULL.

Is there a way to get it to fire off NOW(), or do I need to format a string to pass with it?

  Calling CI validation from within a callback
Posted by: El Forum - 07-05-2007, 09:00 AM - No Replies

[eluser]Pete Smith[/eluser]
Hey folks,

So I needed to do some conditional validation. Basically I give users the option to be invoiced or pay by credit card. So if they pick the Invoice radio button, they're golden, but if they want to pay by credit card, they need to enter Name on Card, Card Number, etc.

So I figured I could do callback functions for card name, card number etc and check the status of the radio button. If it's set to Invoice, return TRUE. If it's set to credit card, then I need to validate.

So I'm wondering if there's any way to call CI's Validation routines from inside a callback, so I get CI's robust validation tools, rather than having to write my own.

Any ideas how I might go about this?

  Using PHP's "virtual" function messes up CodeIgniter includes?
Posted by: El Forum - 07-05-2007, 08:56 AM - No Replies

I have a strange problem that I'm seeing on a site. When one of my includes uses PHP's "virtual" function to load some content, some of my other includes don't appear to be included.

Here's a test I created. I have a controller, and in it I put the following action:

function test_include()
        $data['title'] = "Title";
        $this->load->view('workshops/test_include', $data);
The test_include view looks like this:
<?php $this->load->view('includes/header'); ?>
    <?php $this->load->view('includes/test'); ?>

<?php $this->load->view('includes/footer'); ?>
The problem occurs because of this line in the "header" include:
<?php virtual("/cgi-bin/breadcrumb.cgi"); ?>

The contents of "includes/footer" do appear on the page, but not the contents of "includes/test". If I remove the call to "virtual" from "includes/header", then everything works as expected.

Any idea why this would happen or how to work around it?

  help with mod rewrite and CI
Posted by: El Forum - 07-05-2007, 08:12 AM - No Replies

i finished my first site based on CI FW and i really love how easy it made my life to finish such project.

The only problem im facing is with the virtual sub domains for the members in the site.

in order to have this i use mod_Rewrite to enable that.
my domain name is something like my-site.com and i made my Mod_rewrite to be like this

RewriteEngine on
##hide Index.php
RewriteCond $1 !^(index\.php|public|tmp|images|css|javascript|upload|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

##Subdomains redirect
RewriteCond %{HTTP_HOST} ^((.+)\.)?((my-site)\.(com))$ [NC]
RewriteCond $1 !^(index\.php|public|tmp|images|css|www|javascript|upload|robots\.txt)
RewriteRule ^(.*)$ http://%{HTTP_HOST}/index.php/groups/%1 [QSA,L]

basicly each subdomain represents a group and it should point it to http://www.my-site.com/index.php/groups/groupname ..

so if the groupname is Markgroup it should point to http://www.my-site.com/index.php/groups/markgroup

the rewrite code i wrote doesn't work
it will only point to the main page and nothing else ..

Anyone can tell me what i'm doing wrong ..?


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



Latest Threads
using define in a SQL sta...
by kenjis
3 hours ago
How do you View Cells?
by michalsn
8 hours ago
can temporary tables be u...
by richb201
Today, 09:29 AM
url encode
by donpwinston
Yesterday, 08:58 AM
PHP 7.4.32. This is a sec...
by InsiteFX
Yesterday, 03:57 AM
by MikiStoni
Yesterday, 02:48 AM
Introducing serverless Co...
by captain-sensible
Yesterday, 01:16 AM
builder question when usi...
by InsiteFX
Yesterday, 12:33 AM
Chrome returns "This page...
by InsiteFX
Yesterday, 12:31 AM
under maintenance
by superior
09-30-2022, 04:15 AM

Forum Statistics
» Members: 42,979
» Latest member: splicingmachine
» Forum threads: 75,504
» Forum posts: 367,675

Full Statistics

Search Forums

(Advanced Search)

Theme © iAndrew 2016 - Forum software by © MyBB