usiyalla Posted September 8, 2010 Share Posted September 8, 2010 :'( 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] Quote Link to comment https://forums.phpfreaks.com/topic/212836-after-output_buffering-on-and-ob_start-still-not-redirecting/ Share on other sites More sharing options...
sasa Posted September 8, 2010 Share Posted September 8, 2010 remove 1st blank line in file session.php Quote Link to comment https://forums.phpfreaks.com/topic/212836-after-output_buffering-on-and-ob_start-still-not-redirecting/#findComment-1108584 Share on other sites More sharing options...
usiyalla Posted September 8, 2010 Author Share Posted September 8, 2010 sorry i try but this is not working.but can u tell y u suggest me to do this.because in first line there is no output.... thanx for suggestion Quote Link to comment https://forums.phpfreaks.com/topic/212836-after-output_buffering-on-and-ob_start-still-not-redirecting/#findComment-1108801 Share on other sites More sharing options...
AbraCadaver Posted September 8, 2010 Share Posted September 8, 2010 Also, this is a parse error: redirect_to(index.php); Try this at the top of your file: error_reporting(E_ALL); ini_set('display_errors', '1'); Quote Link to comment https://forums.phpfreaks.com/topic/212836-after-output_buffering-on-and-ob_start-still-not-redirecting/#findComment-1108806 Share on other sites More sharing options...
usiyalla Posted September 8, 2010 Author Share Posted September 8, 2010 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 .... Quote Link to comment https://forums.phpfreaks.com/topic/212836-after-output_buffering-on-and-ob_start-still-not-redirecting/#findComment-1108823 Share on other sites More sharing options...
usiyalla Posted September 8, 2010 Author Share Posted September 8, 2010 and another error that i using redirect_to(index.php); but its wrong i have to put quotation marks so right is redirect_to("index.php"); Quote Link to comment https://forums.phpfreaks.com/topic/212836-after-output_buffering-on-and-ob_start-still-not-redirecting/#findComment-1108826 Share on other sites More sharing options...
PFMaBiSmAd Posted September 8, 2010 Share Posted September 8, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/212836-after-output_buffering-on-and-ob_start-still-not-redirecting/#findComment-1108833 Share on other sites More sharing options...
usiyalla Posted September 8, 2010 Author Share Posted September 8, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/212836-after-output_buffering-on-and-ob_start-still-not-redirecting/#findComment-1108841 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.