Jump to content

Extra Login Code


conker87

Recommended Posts

Here is the function I use to check if one is logged in:

 

<?php   function loveLogged() // Function to determine if the sessioned variables are correct, and therefore logged in.
    {
     $check = mysql_num_rows(mysql_query("SELECT * FROM ". MEMBER_TBL ." WHERE `username` = '".$_SESSION['username']."' AND `password` ='".$_SESSION['password']."'"));
     if ($check == 0) { return false; }
     else if ($check == 1) { return true; }
     else if ($check > 1) { return false; }
    } ?>

Works great. But I'm wanting to add a little to it.

 

For instance, my members area consists of groups: Admin, Villain, Writer, Fan, User all numbered (1-5 respectively). Only Admins, Villains and Writers are allowed to open the pages to add content to the site. I'm wanting to add to this function the ability to check for group < Writers, < Villains and Admins only. Maybe by using true and false values in the brackets? I'm fairly new to functions.

 

And help appreciated.

Link to comment
https://forums.phpfreaks.com/topic/57570-extra-login-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.