[TYPO3-english] Advise needed – import many FF users

Steffen Ritter info at rs-websystems.de
Wed Dec 31 15:28:37 CET 2008


I wrote a script to do the same, which a called through a BE-Module...
Create an empy be module with the kickstarter and copy following lines 
(and adapt) to your module function

$datei = file('.../cms/fileadmin/liste.csv');
					$fields = explode(';',trim($datei[0]));
					for ( $i = 1 ; $i < count($datei) ; $i++ ) {
						$datensatz = explode(";",addslashes(trim($datei[$i])));
						$insertArray = array();
						for($j = 0 ; $j < count($fields) ; $j++ ) {
							switch($fields[$j]) {
								case 'date_of_birth':
								case 'starttime':
								case 'endtime' :
									if(trim($datensatz[$j]) != '') {
										$date = explode(".",trim($datensatz[$j]));
										
										$insertArray[$fields[$j]] = 
mktime(1,0,0,$date[1],$date[0],($date[2] ? $date[2] : 2008));
									}
									break;
								case 'disable':
										if($datensatz[$j]) {
											$insertArray[$fields[$j]] = 0;
										}
										else {
											$insertArray[$fields[$j]] = 1;
										}
										break;
								default :
									if(trim($datensatz[$j]) != '') {
										$insertArray[$fields[$j]] = trim($datensatz[$j]);
									}
									break;
							}
							
						}
						$insertArray['name'] = $insertArray['first_name'] . ' ' . 
$insertArray['last_name'];
						$insertArray['username'] = strtolower($insertArray['first_name']) 
. '.' . substr(strtolower($insertArray['last_name']),0,1);
						$insertArray['password'] = md5('yourpw');
						$insertArray['pid'] = 31;
						$this->content .= '<pre>'. print_r($insertArray,1) . '</pre>';
						( $insertArray['starttime'] ? $this->content .= '<br />Eintritt: ' 
. date('d.m.Y',$insertArray['starttime']) : null);
						( $insertArray['endtime'] ? $this->content .= '<br />Austritt: ' . 
date('d.m.Y',$insertArray['endtime']) : null);
						( $insertArray['date_of_birth'] ? $this->content .= '<br 
/>Geburtsdatum: ' . date('d.m.Y',$insertArray['date_of_birth']) : null);
						$GLOBALS['TYPO3_DB']->exec_INSERTquery('fe_users',$insertArray);
						
						$this->content .= $GLOBALS['TYPO3_DB']->sql_error();
						
						$this->content .= '<hr />';


Have Fun


More information about the TYPO3-english mailing list