Login   Register  
PHP Classes
elePHPant
Icontem

File: example_phpbb.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Felix Manea  >  PHPBB 3 Integration class  >  example_phpbb.php  >  Download  
File: example_phpbb.php
Role: Example script
Content type: text/plain
Description: example on how to use this class
Class: PHPBB 3 Integration class
Manipulate accounts of PHPBB 3 users
Author: By
Last change: fixed user_add case example, added user_password instead of password key of the array
Date: 2010-03-19 00:18
Size: 2,257 bytes
 

Contents

Class file image Download
<?php
/*
PHPBB Forum manipulation Class
By Felix Manea (felix.manea@gmail.com)
www.ever.ro
Licensed under LGPL
NOTE: You are required to leave this header intact.
*/
//bag clasa
require_once("phpbb.class.php");

$phpbb_action = @$_REQUEST["op"];
//***************************************************************
//parameters used at class construction
//first parameter = absoulute physical path of the phpbb 3 forum ($phpbb_root_path variable)
//second parameter = php scripts extensions ($phpEx variable)
$phpbb = new phpbb("path/to/forum""php");

switch(
$phpbb_action){
    case 
"login":
        
//TESTING DATA
        
$phpbb_vars = array("username" => "test""password" => "123123");
        
//END TESTING DATA
        
$phpbb_result $phpbb->user_login($phpbb_vars);
    break;
    case 
"logout":
        
$phpbb_result $phpbb->user_logout();
    break;
    case 
"loggedin":
        
$phpbb_result $phpbb->user_loggedin();
    break;
    case 
"user_add":
        
//TESTING DATA
        
$phpbb_vars = array("username" => "test""user_password" => "123""user_email" => "test@test.com""group_id" => "2");
        
//END TESTING DATA
        
$phpbb_result $phpbb->user_add($phpbb_vars);
    break;
    case 
"user_delete":
        
//TESTING DATA
        
$phpbb_vars = array(/*"user_id" => "53", */"username" => "test");
        
//END TESTING DATA
        
$phpbb_result $phpbb->user_delete($phpbb_vars);
    break;
    case 
"user_update":
        
//TESTING DATA
        
$phpbb_vars = array(/*"user_id" => "53", */"username" => "test""user_email" => "1@2.com""user_yim" => "my_yim""user_website" => "http://www.ever.ro");
        
//END TESTING DATA
        
$phpbb_result $phpbb->user_update($phpbb_vars);
    break;
    case 
"change_password":
        
//TESTING DATA
        
$phpbb_vars = array(/*"user_id" => "53", */"username" => "test""password" => "123123");
        
//END TESTING DATA
        
$phpbb_result $phpbb->user_change_password($phpbb_vars);
    break;
}


if(isset(
$phpbb_result)) echo $phpbb_result."<br /><br />";
?>
<a href="?op=loggedin">loggedin</a><br />
<a href="?op=login">login</a><br />
<a href="?op=logout">logout</a><br />
<a href="?op=user_add">user_add</a><br />
<a href="?op=user_delete">user_delete</a><br />
<a href="?op=user_update">user_update</a><br />
<a href="?op=change_password">change_password</a><br />