1
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)), 0, 8);
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
";
}//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