RopeADope Posted June 29, 2010 Share Posted June 29, 2010 The class: class Auth{ function validate_login($user,$pass){ if(ctype_alnum($user)){ return true; }else{ return false; } } } Q1: (new to OOPHP) As you can see, I just have it checking an input to make sure it contains only alphanumeric characters. My question is, how do I work with the returned result from the if() statement(if at all possible)? I basically want to have an automatic denial followed by a kickback to the login screen if the if() statement returns false. My assumption is I should have a class/function somewhere called "location" that I can call to redirect to different pages and such. Thougts? Quote Link to comment https://forums.phpfreaks.com/topic/206198-question-regarding-custom-auth-class/ Share on other sites More sharing options...
RopeADope Posted June 29, 2010 Author Share Posted June 29, 2010 Nobody? Really? Quote Link to comment https://forums.phpfreaks.com/topic/206198-question-regarding-custom-auth-class/#findComment-1078918 Share on other sites More sharing options...
MadTechie Posted June 29, 2010 Share Posted June 29, 2010 You question is quite ambiguous, so my answer is $user = ""; $pass = ""; if(Auth::validate_login($user,$pass)){ header("Location: Failed.html"); } Quote Link to comment https://forums.phpfreaks.com/topic/206198-question-regarding-custom-auth-class/#findComment-1078926 Share on other sites More sharing options...
RopeADope Posted June 29, 2010 Author Share Posted June 29, 2010 You question is quite ambiguous, so my answer is $user = ""; $pass = ""; if(Auth::validate_login($user,$pass)){ header("Location: Failed.html"); } What does the "::" do? Also, I plan to have a function under the Auth class that calls another class with a query method to check the $user and $pass against a database. Will I still be able to do that using your method? Quote Link to comment https://forums.phpfreaks.com/topic/206198-question-regarding-custom-auth-class/#findComment-1078948 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.