Possible Duplicate:
Headers already sent by PHP
I finally got my first Mac Book yesterday. I like it , but one problem is really screwing with me . For some reason my project I transferred from my windows laptop isnt working properly. XAMPP starts up , I go to localhost/CI_BUHZ and the login page works as expected , I type in my credentials and hit enter, but then for some reason the whole thing gets stuck on my validate_credentials function in my login controller. it doesnt give me any errors , only 2 warnings - included below
Id like to note that: *This project works perfect on my old windows laptop i transferred it from. *Mod Rewrite is on to the best of my knowledge- if my my other controllers method calls such as CI_PROJECT/Login and CI_PROJECT/Feeds/Home are working right? *Even if i delete the validate_credentials function and recreate it with only this:
function validate_credentials()
{
redirect('site/home');
}
it still will not go from login -> site/home on my mac.
Here is the original validate credentials function :
function validate_credentials()
{
$this->load->model('membership_model');
$query = $this->membership_model->validate();
if($query) // if the user's credentials validated...
{
$uid = $this->membership_model->grab_uid();
$data = array(
'username' => $this->input->post('username'),
'uid' => $uid,
'is_logged_in' => true
);
$this->session->set_userdata($data);
redirect('site/home');
}
else // incorrect username or password
{
$this->index();
}
}
here is the .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /CI_BUHZ/
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
Here's the img_model its complaining about ( even though the function being called doesn't require this model at all:
<?php
class Image_model extends CI_Model {
function get_images ($album_id, $uid){
$album_id =(int)$album_id;
$q = $this->db->query("SELECT image_id, album_id_fk, timestamp, ext, uid_fk FROM images WHERE album_id_fk = $album_id AND uid_fk = $uid");
if($q->num_rows() > 0) {
foreach($q->result() as $row) {
$data[] = $row;
}
return $data;
}
}
function image_check($image_id , $uid_fk){
$image_id = (int)$image_id;
$query = mysql_query("SELECT COUNT(image_id) FROM images WHERE image_id = $image_id AND $uid_fk");
return (mysql_result($query, 0)==1) ? true : false;
}
function delete_image($uid_fk, $image_id){
$image_id =(int)$image_id;
$image_query = mysql_query("SELECT album_id_fk , ext , uid_fk FROM images WHERE image_id = $image_id AND uid_fk = $uid_fk");
$image_result = mysql_fetch_assoc($image_query);
$album_id = $image_result['album_id_fk'];
$ext = $image_result['ext'];
$uid = $image_result['uid_fk'];
unlink('uploads/'.$uid.'_'.$album_id.'_'.$image_id.'.'.$ext);
unlink('uploads/thumbs/'.$uid.'_'.$album_id.'_'.$image_id.'.'.$ext);
mysql_query("DELETE FROM images WHERE image_id = $image_id AND uid_fk = $uid_fk");
}
}
?>
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/CI_BUHZ/application/models/image_model.php:2)
Filename: libraries/Session.php
Line Number: 672
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/CI_BUHZ/application/models/image_model.php:2)
Filename: helpers/url_helper.php
Line Number: 546