Jump to content

After output_buffering on and ob_start() still not redirecting :-(


Recommended Posts

:'(

i enabled my output_buffering

i used ob_start() and ob_end_flush functions

i did'nt put any html tag before my php

i used rapid php 2010 so dont know it making utf8 or not and i dont know how to check it

i read many forums threads but cant find answer please answer

but still i'm not redirecting to index.php from login.php

 

 

 

here is my login.php

 

 

<?php

require_once("../../includes/database.php");

require_once("../../includes/functions.php");

require_once("../../includes/user.php");

require_once("../../includes/session.php");

if($session->is_logged_in())

{ redirect_to(index.php); }

//redirect_to("index.php");

 

if(isset($_POST['submit'])) //... if submit button is clicked

{

  $username = trim($_POST['username']);

  $password = trim($_POST['password']);

 

// check in database to see if username/password exist

$found_user = User::authenticate($username,$password);

// if we get some record in var $found_user

if($found_user)

  {

  $session->login($found_user);

  // echo $found_user->username;  // here is problem not redirecting

  redirect_to("index.php");        // this method is user define in function.php

  } else {                          //where i put header()

  $message =  "Password/Username combination is not correct.";

  }

}  else  {

      $username ="";

      $password ="";

}

?>

<html>

  <head>.......

 

 

here is my function.php

 

<?php

function redirect_to( $location = NULL ) {

if ($location != NULL) {

header("Location: {$location}");

exit;

}

}

 

function output_message($message="") {

if (!empty($message)) {

return "<p class=\"message\">{$message}</p>";

} else {

return "";

}

}

?>

 

 

i'm attaching files too

 

[attachment deleted by admin]

my error reporting is on already in php.ini

thanx you all but i doing one other thing wrong that i dont use $this-> with my variables so my all variables had local scope and because of local scope session cant registered and because of that i again redirect to login.php

so by removing line in session.php and puttiing $this-> all is fine now thank you all and really sorry that i made stupid mistake here ....

my error reporting is on already in php.ini

 

If it was, several of the errors would have been reported.

 

What does a phpinfo(); statement show for the error_reporting and display_errors settings?

i check it again so display_error is on and error_reporting is 22519  wat i'm thinking is that there was no error . In index.php i have this line in start

if(!$session->is_logged_in()){ redirect_to("login.php"); }

and because (not use of $this->) in session.php session was not registering and thats way the above line of index.php send mee back to login.php and i was thinking that it not redirecting me from login to index

although in true..

" it redirect me from login to index and because of no session it again redirect me from

index to login ..............."

and why there is no error in session.php because my session.php code is ok syntax.

by not using $this-> php thinks that i'm calling locally variables 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.