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."; } } Link to comment https://forums.phpfreaks.com/topic/170552-solved-can-anyone-see-anything-wrong-with-this-function/ 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-> Link to comment https://forums.phpfreaks.com/topic/170552-solved-can-anyone-see-anything-wrong-with-this-function/#findComment-899621 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] Link to comment https://forums.phpfreaks.com/topic/170552-solved-can-anyone-see-anything-wrong-with-this-function/#findComment-899622 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. Link to comment https://forums.phpfreaks.com/topic/170552-solved-can-anyone-see-anything-wrong-with-this-function/#findComment-899625 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] Link to comment https://forums.phpfreaks.com/topic/170552-solved-can-anyone-see-anything-wrong-with-this-function/#findComment-899627 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. Link to comment https://forums.phpfreaks.com/topic/170552-solved-can-anyone-see-anything-wrong-with-this-function/#findComment-899628 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. Link to comment https://forums.phpfreaks.com/topic/170552-solved-can-anyone-see-anything-wrong-with-this-function/#findComment-899630 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. Link to comment https://forums.phpfreaks.com/topic/170552-solved-can-anyone-see-anything-wrong-with-this-function/#findComment-899631 Share on other sites More sharing options...
Andy-H Posted August 16, 2009 Share Posted August 16, 2009 NP Link to comment https://forums.phpfreaks.com/topic/170552-solved-can-anyone-see-anything-wrong-with-this-function/#findComment-899634 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.