1
coulix
Mass Registering module, what about activation :/
  • 2005/2/5 6:29

  • coulix

  • Just popping in

  • Posts: 25

  • Since: 2005/1/18


hi, i m doing a small script to registers several users at the same time via a text area box.

i did this code

include("../../mainfile.php");

include(
XOOPS_ROOT_PATH."/header.php");

$xoopsOption['show_rblock'] = 1;



?>



Day 0 - Mass registering Form 


if  ($_POST['Submitted'] == "True") {


$lines explode("rn"$data);


//arrays containing the fiedls value for each row
$studentid;
$firstname;
$lastname;
$email;
$mobile;


foreach (
$lines as $i => $val)
{
    
$temparray explode(","$val);
    foreach (
$temparray as $j => $value)
    {
        switch (
$j) {
            case 
"0" $studentid[$i]=$value; break;
            case 
"1" $firstname[$i]=$value; break;
            case 
"2" $lastname[$i]=$value; break;
            case 
"3" $email[$i]=$value; break;
            case 
"4" $mobile[$i]=$value; break;    
        }
    }
}

//insert into XOOPS db

$host "localhost";
$user "headhunt_coulix";
$pass "pass";
$db "headhunt_xoop1";

$dbh=mysql_connect ($host$user$pass) or die ('I cannot connect to the database because: ' mysql_error());
mysql_select_db ($db);




foreach (
$studentid as $i => $vl) {
    
    
$pass md5($lastname[$i]);
    
$actkey substr(md5(uniqid(mt_rand(), 1)), 08);
    echo 
$pass;
    echo 
"";

    
$query="insert into xoops_users (uid,firstname,name,uname,email,url,user_avatar,user_regdate,user_icq,user_from,user_sig,
                      user_viewemail,actkey,user_aim,user_yim,user_msnm,pass,posts,attachsig,rank,level,theme,
                      timezone_offset,last_login,umode,uorder,notify_method,notify_mode,user_occ,bio,user_intrest,
                      user_mailok,mobile)

         values ('','"
.$firstname[$i]."','','".$studentid[$i]."','".$email[$i]."','','blank.gif',
                '"
.time()."','','','','0','".$actkey."','','','','".$pass."','0','0','0','0','','0','0','nest',
            '0','1','0','','','','0', '"
.$mobile[$i]."'   )" or die ( 'Query Error: ' mysql_error () );
        
    
        
$result mysql_query($query);
}
echo 
"New user inserted ! 

 "
;

@
mysql_close($dbh);

}

else {
 echo 

    Enter a list of fields as follow, each field separated by a coma
    It can be done from an excel csv sheet.

    careful do not add new lines after the last entry.


    student id,firstname,Lastname (used as password),email,mobile
 
    student id,firstname,Lastname (used as password),email,mobile
    
    

    eg : 4125698,john,carmark,john@wherever.org,04563542
    

    


        $PHP_SELF'>
        
         
 

    
    
"
;

}
//end non submitted




include(XOOPS_ROOT_PATH."/footer.php");
// $dbh=mysql_connect ("localhost", "headhunt_xoop1", "") or die ('I cannot connect to the database because: ' . mysql_error());
//mysql_select_db ("headhunt_xoop1");

// <<< EOF

?>


Its working fine but, the accounts are not activited i just touched xoops_user table where is the stuff which ll make them activated?

thank you

2
coulix
Re: Mass Registering module, what about activation :/
  • 2005/2/5 7:06

  • coulix

  • Just popping in

  • Posts: 25

  • Since: 2005/1/18


how is activation working btw ?
any help is more than welcome =))

3
Mithrandir
Re: Mass Registering module, what about activation :/

Bleh - I wanted to give you the code to do this with the XOOPS API... but it's just too much work.


Set the "level" field of the new user to 1

4
coulix
Re: Mass Registering module, what about activation :/
  • 2005/2/5 21:39

  • coulix

  • Just popping in

  • Posts: 25

  • Since: 2005/1/18


thanks a lot :)

Login

Who's Online

400 user(s) are online (66 user(s) are browsing Support Forums)


Members: 0


Guests: 400


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits