X7 Chat Support Board
Welcome, Guest. Please login or register.
July 31, 2010, 07:24:40 PM

Login with username, password and session length
Search:     Advanced search
X7 Chat Version 3.0.0 Alpha 2 is now available (http://x7chat.com/support_forum/index.php?topic=3198.msg11497#new).
13036 Posts in 3760 Topics by 66531 Members
Latest Member: yurapro1982
* Home Help Search Login Register
+  X7 Chat Support Board
|-+  X7 Chat Mods
| |-+  Developer Support
| | |-+  authmod help - custom CMS
« previous next »
Pages: [1] Reply Send this topic Print
Author Topic: authmod help - custom CMS  (Read 712 times)
meganT
Member
*
Offline Offline

Posts: 5


View Profile
« on: April 27, 2009, 05:57:25 AM »
Reply with quote

I've created an AuthMod for my custom CMS by looking at the other authMods and modifying to suit.  I reinstalled x7 chat to configure it to use the new authmod.  However, after logging in to the website successfully, I go into /chat and it still takes me to the "login" screen.  Obviously I need to fix something in the authMods, but I'm unsure of what!

I have tested the database calls to the CMS database via PHP MyAdmin, so I know these work.  And I have checked to make sure the cookies exist with the right names.  I have put echoes in the 3 custom functions in the authmod file to see if any of the functions are being called, and it does not appear that any are!

Here is my AuthMod.  I'd greatly appreciate it if someone could have a look and let me know where I might be going wrong.

<?PHP
   $auth_ucookie = "name";         // Name of username cookie
   $auth_pcookie = "pass";         // Name of password cookie
   $auth_register_link = "../join_now.php";   // Link to the registration Page
   $auth_disable_guest = true;         // Disable guest accounts
   
   // Any Cookie-Translations will have to go here
   session_start();
   require("../ci.php"); //file defining values of dbhost, dbuser, dbpass and dbdb
   $zestCms = new x7chat_db($dbhost,$dbuser,$dbpass,$dbdb);


   function auth_encrypt($data){
      echo "encrypt called!";
      // Encrypt $data
      return md5($data);
      //return $data;
   }
   
   function auth_getpass($auth_ucookie){
      // Get the password for user $_COOKIE[$auth_ucookie] (the user's username)
      echo "getpass called!";
      GLOBAL $db,$prefix,$zestCms,$g_default_settings,$txt,$x7c;

      $query = $zestCms->doQuery("SELECT password FROM users WHERE username = '".$username."' ");
      $password = $zestCms->Do_Fetch_Row($query);

if($password[0] != ""){   
         $query = $db->DoQuery("SELECT * FROM {$prefix}users WHERE username='$_COOKIE[$auth_ucookie]'");
         $row = $db->Do_Fetch_Row($query);
         if($row[0] == ""){
            // Create an X7 Chat account for them.
            $time = time();
            $ip = $_SERVER['REMOTE_ADDR'];
            $db->DoQuery("INSERT INTO {$prefix}users (id,username,password,status,user_group,time,settings,hideemail,ip) VALUES('0','$_COOKIE[$auth_ucookie]','$password[0]','$txt[150]','{$x7c->settings['usergroup_default']}','$time','{$g_default_settings}','0','$ip')");
         }
      }
      
      return $password[0];
   }
   
   function change_pass($user,$newpass){
      // Change $user's password to $newpass
      echo "change pass called!";
      GLOBAL $zestCms;
      $query = $zestCms->DoQuery("UPDATE users SET password = '$newpass' WHERE username='$user'");

   }
?>

Report to moderator   Logged
meganT
Member
*
Offline Offline

Posts: 5


View Profile
« Reply #1 on: April 29, 2009, 09:55:26 PM »
Reply with quote

I figured it out.  Apparently when I reinstalled and selected my custom authmod, it didn't take.  I had to manually change it in the config file.
Report to moderator   Logged
Pages: [1] Reply Send this topic Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.081 seconds with 15 queries.