<?php
/*
###################################################################################
  Bigware Shop 2.3
  Release Datum: 23.08.2015
  
  Bigware Shop
  http://www.bigware.de

  Copyright (c) 2015 Bigware LTD
  (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
  (c) 2015	Bigware LTD

  Copyrightvermerke duerfen nicht entfernt werden.
  ------------------------------------------------------------------------
  Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
  der GNU General Public License, wie von der Free Software Foundation
  veroeffentlicht, weitergeben und/oder modifizieren, entweder gemaess Version 2 
  der Lizenz oder (nach Ihrer Option) jeder spaeteren Version.
  Die Veroeffentlichung dieses Programms erfolgt in der Hoffnung, dass es Ihnen
  von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die
  implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT FUER EINEN
  BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
  
  Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
  Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

  Infos:
  ------------------------------------------------------------------------
  Der Bigware Shop wurde vor vielen Jahren bereits aus dem bekannten Shopsystem osCommerce
  weiter- und neuentwickelt.
  Der Bigware Shop legt im hohen Masse Wert auf Bedienerfreundlichkeit, beinhaltet eine leichte
  Installation, viele neue professionelle Werkzeuge und zeichnet sich aus durch eine grosse 
  Community, die bei Problemen weiterhelfen kann.
  
  Der Bigware Shop ist auf jedem System lauffaehig, welches eine PHP Umgebung
  (ab PHP 4.1.3) und mySQL zur Verfuegung stellt und auf Linux basiert.
 
  Hilfe erhalten Sie im Forum auf www.bigware.de 
  
  -----------------------------------------------------------------------
  
 ##################################################################################




*/
?>
<?php 
  require('load_this/load_bigware_11.php'); 
  require(FOLDER_RELATIV_LANGUAGES . $language . '/' . NAME_OF_FILE_CHANGE_INVOICE); 
  
 
 $REQUEST_METHOD = $_SERVER['REQUEST_METHOD']; 
  if ($REQUEST_METHOD=="POST") 
  {   
	
	$uploaddir = "../picture/";
	$name_der_csv = $uploaddir. $_FILES['userfile']['name'];
	
	if (move_uploaded_file($_FILES['userfile']['tmp_name'], $name_der_csv)) {
	chmod ($uploaddir. $_FILES['userfile']['name'], 0777);   
	} else {
	print "Possible file upload attack! Here's some debugging info:\n";
	print_r($_FILES);
	}
  
  
  
  
 $handle = fopen ("$name_der_csv","r"); 
	while ($data = fgetcsv ($handle, 1000, ";")) {  
	    $num = count ($data);   
	if ($row == "1"){
		
	} 
	$row++; 
	    for ($c=0; $c < $num; $c++) {   
	
	
			$email_address= $data[0];		
			$firstname= $data[1];
			$lastname= $data[2];
			$street_address= $data[3];
			$postcode= $data[4];
			$city= $data[5];
			$telephone= $data[6];
			$land= $data[7];
			$company= $data[8];
			$password= $data[9];
				
	}
			$email_address= str_replace("'", "", $email_address);		
			$password= str_replace("'", "", $password);
			$company= str_replace("'", "", $company);
			$firstname= str_replace("'", "", $firstname);
			$lastname= str_replace("'", "", $lastname);
			$street_address= str_replace("'", "", $street_address);
			$land= str_replace("'", "", $land);
			$postcode= str_replace("'", "", $postcode);
			$city= str_replace("'", "", $city);
			$telephone= str_replace("'", "", $telephone);
			
			$email_address= str_replace("\"", "", $email_address);		
			$password= str_replace("\"", "", $password);
			$company= str_replace("\"", "", $company);
			$firstname= str_replace("\"", "", $firstname);
			$lastname= str_replace("\"", "", $lastname);
			$street_address= str_replace("\"", "", $street_address);
			$land= str_replace("\"", "", $land);
			$postcode= str_replace("\"", "", $postcode);
			$city= str_replace("\"", "", $city);
			$telephone= str_replace("\"", "", $telephone);			
      $check_query = go_db_query("select count(*) as total from " . DB_TBL_ATTENDEES . " where attendees_email_address = '" . $email_address . "'");
      $check = go_db_fetch_array($check_query);
      if ($check['total'] == 0){
      if ($password == ""){ 
	mt_srand((double)microtime()*1000000);	
	$menge = mt_rand(3,6); 
	$pass = array($menge); 
	
	for ($i = 0; $i <= ($menge - 1); $i++) { 
	   $grossKlein = mt_rand(1,2); 
	   if ($grossKlein == 1) 
	       { 
	        $nmr = mt_rand(97,121); 
	        } 
	        else 
	        { 
	        $nmr = mt_rand(65,90); 
	        } 
	         
	mt_srand((double)microtime()*1000000);
	$pass[$i] = chr($nmr) . mt_rand(1,9); 
	} 
		
	$password = implode("",$pass); 
      }
      if ($land != ""){
      		$lands_check_query = go_db_query("select count(*) as total, lands_iso_code_2, lands_id  from " . DB_TBL_LANDS . " where lands_iso_code_2 = '" . $land . "'");
      		$werte = go_db_fetch_array($lands_check_query);
      		
	      		if ($werte['total'] != 0){
				$lands_id = $werte['lands_id'];
			}      	
	      		else{
	      			$lands_check_query = go_db_query("select lands_id  from " . DB_TBL_LANDS . " where lands_iso_code_2 = 'DE'");
	      			$werte = go_db_fetch_array($lands_check_query);
	      			$lands_id = $werte['lands_id'];		      		
	      		}
      	}
	else{
	      	$lands_check_query = go_db_query("select lands_id  from " . DB_TBL_LANDS . " where lands_iso_code_2 = 'DE'");
	      	$werte = go_db_fetch_array($lands_check_query);
	      	$lands_id = $werte['lands_id'];	
	}			
	      $sql_data_array = array('attendees_firstname' => $firstname,
	                              'attendees_lastname' => $lastname,
	                              'attendees_email_address' => $email_address,
	                              'attendees_telephone' => $telephone,
	                              'attendees_fax' => $fax,
	                              'attendees_newsletter' => $newsletter,
	                              'attendees_password' => go_encrypt_password($password),	
	                              'attendees_password_uncript' => $password,
	                              'attendees_newsletter' => '1');
	                              
	      $sql_data_array['attendees_gender'] = $gender;
	      $sql_data_array['attendees_dob'] = go_date_raw($dob);                              
	      
	      go_db_carry(DB_TBL_ATTENDEES, $sql_data_array);	
	      $attendees_id = go_db_insert_id(); 
	
	      $sql_data_array = array('attendees_id' => $attendees_id,
	                              'entry_firstname' => $firstname,
	                              'entry_lastname' => $lastname,
	                              'entry_street_address' => $street_address,
	                              'entry_postcode' => $postcode,
	                              'entry_city' => $city,
	                              'entry_land_id' => $lands_id);
	
	      $sql_data_array['entry_gender'] = $gender;
	      $sql_data_array['entry_company'] = $company;
	      $sql_data_array['entry_suburb'] = $suburb;
		
	      
	      go_db_carry(DB_TBL_DIRECTORY_TO_ADDRESS, $sql_data_array);	
	      $directory_to_address_id = go_db_insert_id();   
		go_db_query("UPDATE " . DB_TBL_ATTENDEES . " SET attendees_default_address_id='$directory_to_address_id' WHERE attendees_id='$attendees_id'");	      
		
	
	}
	
	
   } 
			
		
	fclose($handle); 
  
}
  
  
  
  
  
?> 
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html '<?php echo HTML_PARAMS; ?>'> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 
<title><?php echo TITLE; ?></title> 
<link rel="stylesheet" type="text/css" href="load_this/style.css"> 
<script language="javascript" src="load_this/menu.js"></script>
</head> 
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> 
<!-- header //--> 
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_9.php'); ?>
<!-- header_eof //--> 
<!-- body //--> 
<table border="0" width="100%" cellspacing="2" cellpadding="2"> 
<tr> 
<!-- body_text //--> 
  <td class="pageGeneralsign" valign="top"><?php echo ABOVE_TITLE; ?><br><br>
   <table width="98%" align="center" border="0" cellpadding="0" cellspacing="0"> 
    <tr class="tbCountData"> 
     <td class="TbInsideData"><?php echo EXPLAIN; ?>
	<br><br></td> 
    </tr> 
<form method="POST" action="main_bigware_72.php" enctype="multipart/form-data" name="einlesen">
    <tr> 
     <td align="left" class="TbInsideData">
     
     
  <?php echo INPUTFIELD; ?> <input name="userfile" type="file" class="button" size="30">   
     
     
 <br><br><?php echo go_picture_submit('button_update.gif', PICTURE_UPDATE); ?>    
     
     
     
     </td> 
    </tr> 
   </form> 
   </table> 
  </td> 
<!-- body_text_eof //--> 
  </tr> 
</table> 
<!-- body_eof //--> 
<!-- footer //--> 
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_7.php'); ?> 
<!-- footer_eof //--> 
<br> 
</body> 
</html> 
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_6.php'); ?>