Neil- Posted June 22, 2006 Share Posted June 22, 2006 Hi All.i wouldnt be asking unless i was totally stummped. but my functionality produces the following error:Warning: Cannot modify header information - headers already sent by (output started at /home/staff/public_html/Cfg_Files/clsBilling.php:84) in /home/staff/public_html/Billing/index.php on line 23clsBilling.php[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<?phpclass Billing { var $db_link; var $db_prefix; var $db_host; var $db_user; var $db_pass; var $db_db; var $usr_Password; var $usr_Email; var $usr_AccessLevel; var $usr_AccessLevelID; var $usr_LoggedIn; var $query_rows; var $query_result; var $firstresult; function Billing(){ $this->db_host = "localhost"; $this->db_user = "staff_clients"; $this->db_pass = "xxxxxx"; $this->db_db = "staff_clients"; } //main function function Encrypt_string($string){ $enc_string = md5($string); return $enc_string; } //Encrypt Function function DBOpen(){ mysql_connect($this->db_host, $this->db_user, $this->db_pass) or die ("failed connection due to: " . mysql_error()); mysql_select_db($this->db_db); } //Database Connection Open function DBClose(){ mysql_close(); } //Database Connection Close function DBQuery($cmdText){ $this->DBOpen(); $result = mysql_query($cmdText); $numRows = mysql_num_rows($result); $firstResult = mysql_result($result, 0); $this->query_rows = $numRows; $this->firstresult = $firstResult; $this->DBClose(); } //Database Query Function function LogInUser($email, $password) { $enc_pass = $this->Encrypt_string($password); $cmdText = "SELECT AccessLevelID FROM tblClients WHERE Email = '$email' AND Password = '$enc_pass'"; $this->DBQuery($cmdText); if($this->query_rows !== '0'){ $this->AccessLevelID = $this->firstresult; $this->SetAccessLevel(); $this->usr_Password = $enc_pass; $this->usr_Email = $email; $this->usr_LoggedIn = '1'; } else { $this->usr_LoggedIn = '0'; } } //login function function SetAccessLevel(){ $accesslevelid = $this->AccessLevelID; $cmdText = "Select AccessLeveName From tblAccessLevels WHERE AccessLevelID = $accesslevelid"; $this->dbQuery($cmdText); $this->AccessLevel = $this->firstresult; } //Get AccessLevel Function }?> [/quote]index.php[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<?phpsession_start();require("../Cfg_Files/clsBilling.php");$mode = $_GET['mode'];if($mode == 'login'){ $billing = new billing; $email = $_POST['txtEmail']; $password = $_POST['txtPassword']; $billing->LogInUser($email, $password); if($billing->usr_LoggedIn == '1'){ $_SESSION['billing_obj'] = $billing; if($billing->usr_AccessLevel == "Administrator"){ header("location: admin/index.php"); } else { header("location: user/index.php"); } } else { $error = "Invalid Email Address And/Or Password!"; }}?>[/quote]if anyone could/would shed some light on this, theyd have a new best freind lol Quote Link to comment https://forums.phpfreaks.com/topic/12622-help-with-a-class-header-redirects/ Share on other sites More sharing options...
Orio Posted June 22, 2006 Share Posted June 22, 2006 Maybe you have the same problem I had once...In the included file, I accidently added a white space after the closing "?>". And a white space is somekind of outout, so I got the "headers already sent" error.So- Make sure you have no white spaces before/after the code, in both files.Orio. Quote Link to comment https://forums.phpfreaks.com/topic/12622-help-with-a-class-header-redirects/#findComment-48413 Share on other sites More sharing options...
Neil- Posted June 22, 2006 Author Share Posted June 22, 2006 you star, thats done the trick, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/12622-help-with-a-class-header-redirects/#findComment-48415 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.