Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $commDocsAdminUsers
- $commDocsAdminExecutiveUsers
- Warning: in_array() expects parameter 2 to be array, null given in - on line 25
- <?php
- //ARRAYS OF USERS TO CHECK AGAINST
- $commDocsAdminUsers = array("kaisersolze", "bennyblanco", "carlitobrigante", "ashylarry", "claytonbigsby");
- $commDocsAdminExecutiveUsers = array("waltjr", "skylerwhite", "tuco", "skinnypete", "walterwhite");
- class userLogin {
- // ALLOWS US TO SET THE NAME OF USER
- function set_name($new_name) {
- $this->name = $new_name;
- }
- // ALLOWS US TO GET THE NAME OF USER
- function get_name() {
- return $this->name;
- }
- // ALLOWS US TO CHECK THE ACCESS LEVEL OF THE USER... FIND WHICH ARRAY USER IS IN
- function check_access() {
- if (in_array("kaisersolze", $commDocsAdminUsers)){
- return "Match found in comDocsUsers Array";
- }
- else if (in_array($this->name, $commDocsAdminExecutiveUsers)){
- return "Match found in comDocsUsers Array";
- }
- else {
- return "No Access Allowed"; // USER NOT FOUND IN EITHER ARRAY
- }
- }
- }
- // NOW LETS DO SOME STUFF WITH OUR NEW CLASS
- $currentUser = new userLogin(); // INVOKE THE NEW USER CLASS
- $currentUser->set_name("kaisersolze"); // SET NAME OF CURRENT USER
- print_r($currentUser); // SHOW THE FULL OBJECT $CURRENTUSER
- echo '<BR>-------------------------------------------------------------<BR>';
- echo $currentUser->get_name(); // ECHO OUT THE NAME FOR THE $CURRENTUSER
- echo '<BR>--------------------------------------------------------------<BR>';
- echo $currentUser->check_access(); // CHECK TO SEE WHICH ARRAY THE USER IS IN
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement