hi, i m doing a small script to registers several users at the same time via a text area box.
<?php include("../../mainfile.php"); include(XOOPS_ROOT_PATH."/header.php"); $xoopsOption['show_rblock'] = 1; ?> <h1 id="title">Day 0 - Mass registering Form </h1> <? 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 "<br />"; $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 "<p id='para'>New user inserted ! </p> "; @mysql_close($dbh); } else { echo " <p id='para'> Enter a list of fields as follow, each field separated by a coma<br /> It can be done from an excel csv sheet.<br/> <b>careful</b> do not add new lines after the last entry.<br/><br/> <b>student id</b>,firstname,Lastname (used as password),email,mobile<br/> <b>student id</b>,firstname,Lastname (used as password),email,mobile<br/> <br/> eg : 4125698,john,carmark,john@wherever.org,04563542 <br/> </p> <form method='POST' action='$PHP_SELF'> <TEXTAREA name='data' rows='20' cols='50'></TEXTAREA> <input type='hidden' name='Submitted'value='True'> <br/> <br/> <input type='submit' value='Process'> </form> "; }//end non submitted include(XOOPS_ROOT_PATH."/footer.php"); // $dbh=mysql_connect ("localhost", "headhunt_xoop1", "<PASSWORD HERE>") 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?