MyBB - C# - Login & Check Usergroup

[php]

<?php
include_once("config.inc.php");
mysql_connect(PRIVAT, PRIVAT, PRIVAT);
mysql_select_db(PRIVAT);
 
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string(md5($_POST['password']));
 
$que = mysql_query("SELECT uid, password, salt FROM mybb_users WHERE username = '$username' LIMIT 1");
 
if(!mysql_num_rows($que))
  {    
  die("Username not found.");  
  }
 
  $row = mysql_fetch_assoc($que);  
  $uid = $row['uid'];  
  $salt = $row['salt'];  
  $hshed = $row['password'];  
  $input = md5(md5($salt).$password);
 
$objResult = mysql_query("SELECT uid FROM mybb_awaitingactivation WHERE uid = '$uid'");
 
$blnFound = (boolean) ($objResult) ? mysql_num_rows($objResult) : FALSE;
 
if($input != $hshed)
  {  
    die("bad");  
  }
  else
  {  
    if($blnFound == true)
    {
        echo "activation";
    }
    else
    {
        echo "good";
    }
  }  
?>

[/php]

I have the following problem. I have been crated a C# Login Program for my Forum.
This works relatively well so far.
However, all users can sign up there (except those that have their Acc not Activated)
I want that only the subscriber can log in.
I hope anybody can help me

You need to add a new field to your mybb_users and call it something like “activated”.

Then, when a new user registers, enter their data and “NO” in the filed “activated”.

In the code where you load the info from the database, with "WHERE username = ‘$username’,
you change it to "WHERE username = ‘$username’ AND activated = “YES”.

If the user has not activated his/her account, then the results returned would be 0.

When the user activates his/her account, update the field “activated” changing it to “YES”.

Is that what you needed?

No, I want that only some groups can login with the Launcher

Example :

The Groups – New Member and Waiting for Aktivation can’t login but the groups administrator, Moderator, and Subscriber can login in

should I send you the c# code?

Sponsor our Newsletter | Privacy Policy | Terms of Service