whizzykid Posted May 7, 2009 Share Posted May 7, 2009 Hi have got this code. tried to link it up with each profile but it shows error is the code correct? if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; }else { $profile = mysql_fetch_array($LoginRS); $MM_redirectLoginSuccess = "profile_" .$profile[0] ."php"; } Link to comment https://forums.phpfreaks.com/topic/157174-solved-php-solution/ Share on other sites More sharing options...
jjacquay712 Posted May 7, 2009 Share Posted May 7, 2009 im not sure why you have an && false in there ??? Link to comment https://forums.phpfreaks.com/topic/157174-solved-php-solution/#findComment-828192 Share on other sites More sharing options...
whizzykid Posted May 7, 2009 Author Share Posted May 7, 2009 Hi thank you,with or without && false it still shows this. The requested URL /profile_234php was not found on this server. and i hv the profile_234php on my server just a bit confused if it has anything to do with the code? Link to comment https://forums.phpfreaks.com/topic/157174-solved-php-solution/#findComment-828203 Share on other sites More sharing options...
allworknoplay Posted May 7, 2009 Share Posted May 7, 2009 Hi have got this code. tried to link it up with each profile but it shows error is the code correct? if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; }else { $profile = mysql_fetch_array($LoginRS); $MM_redirectLoginSuccess = "profile_" .$profile[0] ."php"; } You're missing the DOT for .php... So use this... $MM_redirectLoginSuccess = "profile_" . $profile[0] . ".php"; Link to comment https://forums.phpfreaks.com/topic/157174-solved-php-solution/#findComment-828214 Share on other sites More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 But with the && false, the if statement will *NEVER* be true, so the else clause will *ALWAYS* execute. It's like never having an if statement to begin with. Link to comment https://forums.phpfreaks.com/topic/157174-solved-php-solution/#findComment-828265 Share on other sites More sharing options...
whizzykid Posted May 7, 2009 Author Share Posted May 7, 2009 Thank you,but anytime i try to excute it shows profile_.php not found on the server but when i rename the file on my folder to profile_.php it shows.Please help me correct my code this is my code if (isset($_POST['Login'])) { $loginUsername=$_POST['Login']; $password=$_POST['Password']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "profile_".$profile[0] .".php"; $MM_redirectLoginFailed = "Login Failed.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_inteecom_ellen, $inteecom_ellen); $LoginRS__query=sprintf("SELECT Login,Password FROM `Customer Login` WHERE Login=%s AND Password=%s", GetSQLValueString($loginUsername, "int"), GetSQLValueString($password, "int")); $LoginRS = mysql_query($LoginRS__query, $inteecom_ellen) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl'])) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; }}else { $profile = mysql_fetch_array($LoginRS); $MM_redirectLoginSuccess = "profile_".$profile[0] .".php"; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } Link to comment https://forums.phpfreaks.com/topic/157174-solved-php-solution/#findComment-828268 Share on other sites More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 Is the $profile array defined anywhere? Link to comment https://forums.phpfreaks.com/topic/157174-solved-php-solution/#findComment-828269 Share on other sites More sharing options...
whizzykid Posted May 7, 2009 Author Share Posted May 7, 2009 Yes $profile = mysql_fetch_array($LoginRS); Link to comment https://forums.phpfreaks.com/topic/157174-solved-php-solution/#findComment-828271 Share on other sites More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 But you declared that after you made a call to it, which defeats the purpose. Link to comment https://forums.phpfreaks.com/topic/157174-solved-php-solution/#findComment-828275 Share on other sites More sharing options...
whizzykid Posted May 7, 2009 Author Share Posted May 7, 2009 Tried to adjust it this way but it takes all of them to the same page.Gosh. if (isset($_POST['Login'])) { $loginUsername=$_POST['Login']; $password=$_POST['Password']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "my profile.php"; $MM_redirectLoginFailed = "Login Failed.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_inteecom_ellen, $inteecom_ellen); $LoginRS__query=sprintf("SELECT Login,Password FROM `Customer Login` WHERE Login=%s AND Password=%s", GetSQLValueString($loginUsername, "int"), GetSQLValueString($password, "int")); $LoginRS = mysql_query($LoginRS__query, $inteecom_ellen) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl'])) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; }}else { $profile = mysql_fetch_array($LoginRS); $MM_redirectLoginSuccess = "profile_".$profile[0] .".php"; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } Link to comment https://forums.phpfreaks.com/topic/157174-solved-php-solution/#findComment-828278 Share on other sites More sharing options...
whizzykid Posted May 7, 2009 Author Share Posted May 7, 2009 Never mind I have resolved it.Thank you all for ur rapid response,all the time. Link to comment https://forums.phpfreaks.com/topic/157174-solved-php-solution/#findComment-828290 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.