jamesxg1 Posted August 16, 2009 Share Posted August 16, 2009 Hiya peeps, Can anyone see a problem with this function because it is suppose to re-direct me but it isnt, function Login($lusername, $lpassword) { $this->lusername = mysql_real_escape_string(addslashes($lusername)); $this->lpassword = mysql_real_escape_string(addslashes(md5($lpassword))); $this->LoginQ = "SELECT * FROM `members` WHERE username = '$this->lusername' AND password = '$this->lpassword'"; $this->LoginR = mysql_query($this->LoginQ) or die (mysql_error()); if(mysql_num_rows($this->LoginR) == '1') { while($fetch = mysql_fetch_array($this->LoginR)) { if($fetch['sus'] == '0') { session_start(); $_SESSION['username'] = $this->lusername; $_SESSION['id'] = $fetch['id']; $_SESSION['firstname'] = $fetch['firstname']; echo '<META HTTP-EQUIV="Refresh" CONTENT="5"; URL="html-redirect.html">'; } else { echo "Sorry but the account you are trying to access is suspended, Please try again."; } } } else { echo "Sorry but the account you are trying to access is non existant, Please try again."; } } Quote Link to comment Share on other sites More sharing options...
Andy-H Posted August 16, 2009 Share Posted August 16, 2009 Is it a function or the method of a class. If its the former you shouldn't be using $this-> Quote Link to comment Share on other sites More sharing options...
jamesxg1 Posted August 16, 2009 Author Share Posted August 16, 2009 It is part of a class i will upload as it is too large too paste. James. [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
Andy-H Posted August 16, 2009 Share Posted August 16, 2009 error_reporting(E_ALL); ini_set('display_errors', 1); Add that at the top of the script. Why are you calling session start in every method? If you need to make a call of more than one method per page then you are calling session_start() multiple times... Also, you dont need to addslashes to an md5 encryption. Data is encrypted into alpha-numeric chars anyway with md5. Quote Link to comment Share on other sites More sharing options...
jamesxg1 Posted August 16, 2009 Author Share Posted August 16, 2009 Ok, changed. Here i will upload again still not working with no errors. [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
Andy-H Posted August 16, 2009 Share Posted August 16, 2009 echo '<meta http-equiv="refresh" content="5; url=html-redirect.html">'; EDIT Sorry just noticed your meta refresh tag was incorrect, try that. Quote Link to comment Share on other sites More sharing options...
jamesxg1 Posted August 16, 2009 Author Share Posted August 16, 2009 Ok, It echo'ed and it re-directed me but it re-directed me straight back to login.php. James. Quote Link to comment Share on other sites More sharing options...
jamesxg1 Posted August 16, 2009 Author Share Posted August 16, 2009 meta-data mod worked!!, Thanks dude. Many many thanks, James. Quote Link to comment Share on other sites More sharing options...
Andy-H Posted August 16, 2009 Share Posted August 16, 2009 NP Quote Link to comment 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.