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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.