function import()
 {
     $this->time_start = time();
     $lines = 1;
     $lines_ok = 0;
     // sonstige variablen
     $newsletter = 0;
     $set_suburb = ACCOUNT_SUBURB == TRUE_STRING_S;
     $set_state = ACCOUNT_STATE == TRUE_STRING_S;
     $email_adresses = array();
     $error = EMPTY_STRING;
     define('INSERT_INTO_CUSTOMERS_INFO_SQL', INSERT_INTO . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('");
     define('SELECT_COUNTRY_SQL', SELECT_ALL . "`countries` WHERE `countries_iso_code_2` = '");
     $check_email_sql = SELECT_COUNT . "as total from " . TABLE_CUSTOMERS . " where customers_email_address = '";
     $update_table_customers = SQL_UPDATE . TABLE_CUSTOMERS . " set customers_default_address_id = '";
     $fh = fopen($this->filename, "r");
     if ($fh) {
         $zeile = fgets($fh);
         while (!feof($fh)) {
             // zeile einlesen & werte zuweisen
             $zeile = trim(fgets($fh));
             if ($zeile) {
                 $dataArray = explode(SEMI_COLON, $zeile);
                 for ($j = 0, $m = sizeof($this->dataArray); $j < $m; $j++) {
                     $data = $this->dataArray[$j];
                     if (substr($data, -1) == CSV_TEXTSIGN) {
                         $dataArray[$j] = substr($data, 1, strlen($data) - 2);
                     }
                 }
                 list($cid, $gruppe, $anrede, $email_address, $company, $lkz, $lastname, $city, $postcode, $password, $street_address, $fax, $telephone, $firstname, $d_company, $d_lkz, $d_lastname, $d_city, $d_postcode, $d_street_address, $d_fax, $d_telephone, $d_firstname) = $dataArray;
                 $lines++;
                 if (!$password) {
                     // neues zufallspasswort erstelllen.
                     $password = getpass(10);
                 }
                 // vorhandene Daten aufbereiten.
                 $gruppe = trim($gruppe);
                 switch ($gruppe) {
                     case "Registriert":
                         $customers_status = DEFAULT_CUSTOMERS_STATUS_ID_CUSTOMER;
                         break;
                     case "Merchant":
                         $customers_status = DEFAULT_CUSTOMERS_STATUS_ID_DEALER;
                         break;
                     default:
                         $customers_status = DEFAULT_CUSTOMERS_STATUS_ID_GUEST;
                 }
                 $anrede = trim($anrede);
                 switch ($anrede) {
                     case "Herr":
                         $gender = "m";
                         break;
                     case "Frau":
                         $gender = "f";
                         break;
                     default:
                         $gender = "m";
                 }
                 $country = set_country_info($lkz);
                 $geburtsdatum = trim($geburtsdatum);
                 if ($geburtsdatum != EMPTY_STRING && $geburtsdatum != ".000000000") {
                     list($jahr, $monat, $tag) = sscanf($geburtsdatum, "%4d%2d%2d.%d");
                     $dob = sprintf("%02d.%02d.%4d", $tag, $monat, $jahr);
                 } else {
                     $dob = EMPTY_STRING;
                 }
                 // daten in db eintragen
                 $vatID = new vat_validation($vat, EMPTY_STRING, EMPTY_STRING, $country);
                 $customers_status = $vatID->vat_info['status'];
                 $customers_vat_id_status = $vatID->vat_info['vat_id_status'];
                 if ($vatID->vat_info['error']) {
                     $error .= ENTRY_VAT_ERROR;
                 }
                 $email_address = trim($email_address);
                 $check_email_query = olc_db_query($check_email_sql . olc_db_input($email_address) . "' and account_type = '0'");
                 $check_email = olc_db_fetch_array($check_email_query);
                 $s = QUOTE . $email_address . QUOTE . ' -- ';
                 if ($check_email['total'] > 0) {
                     $error .= $s . ENTRY_EMAIL_ADDRESS_ERROR_EXISTS . LPAREN . EMAIL_ALREADY_USED . $email_adresses[$email_address] . RPAREN;
                 } elseif (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
                     $error .= $s . ENTRY_EMAIL_ADDRESS_ERROR;
                 } elseif (olc_validate_email($email_address) == false) {
                     $error .= $s . ENTRY_EMAIL_ADDRESS_CHECK_ERROR;
                     /*
                     $fp3 = fopen("kunden_import_mail-check-fail.csv", "a");
                     fputs($fp3, $zeile);
                     fclose ($fp3);
                     */
                 }
                 if ($email_adresses[$email_address]) {
                     $email_adresses[$email_address] .= COMMA_BLANK;
                 }
                 $email_adresses[$email_address] .= $lines;
                 if ($dob != EMPTY_STRING) {
                     $date_raw = olc_date_raw($dob);
                     if (checkdate(substr($date_raw, 4, 2), substr($date_raw, 6, 2), substr($date_raw, 0, 4)) == false) {
                         $error .= QUOTE . $dob . QUOTE . ' -- ' . ENTRY_DATE_OF_BIRTH_ERROR;
                     }
                 }
                 if ($error) {
                     $this->errorLog[] = sprintf(TEXT_ERROR, $error, $lines);
                     $error = EMPTY_STRING;
                 } else {
                     $lines_ok++;
                     $cid = trim($cid);
                     $firstname = trim($firstname);
                     $lastname = trim($lastname);
                     $telephone = trim($telephone);
                     $fax = trim($fax);
                     $street_address = trim($street_address);
                     $company = trim($company);
                     $postcode = trim($postcode);
                     $city = trim($city);
                     $sql_data_array = array('customers_cid' => $cid, 'customers_vat_id' => $vat, 'customers_vat_id_status' => $customers_vat_id_status, 'customers_status' => $customers_status, 'customers_firstname' => $firstname, 'customers_lastname' => $lastname, 'customers_email_address' => $email_address, 'customers_telephone' => $telephone, 'customers_fax' => $fax, 'customers_newsletter' => $newsletter, 'customers_password' => olc_encrypt_password($password), 'customers_gender' => $gender, 'customers_dob' => $date_raw, 'customers_date_added' => 'now()', 'customers_last_modified' => 'now()');
                     olc_db_perform(TABLE_CUSTOMERS, $sql_data_array);
                     $user_id = olc_db_insert_id();
                     $sql_data_array = array('customers_id' => $user_id, 'entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_country_id' => $country, 'entry_gender' => $gender, 'entry_company' => $company, 'address_date_added' => 'now()', 'address_last_modified' => 'now()');
                     olc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
                     $address_id = olc_db_insert_id();
                     olc_db_query($update_table_customers . $address_id . "' where customers_id = '" . (int) $user_id . APOS);
                     olc_db_query(INSERT_INTO_CUSTOMERS_INFO_SQL . (int) $user_id . "', '0', now())");
                     if ($d_lkz) {
                         //Separate delivery-adress.
                         $country = set_country_info($d_lkz);
                         $firstname = trim($d_firstname);
                         $lastname = trim($d_lastname);
                         $telephone = trim($d_telephone);
                         $fax = trim($d_fax);
                         $street_address = trim($d_street_address);
                         $company = trim($d_company);
                         $postcode = trim($d_postcode);
                         $city = trim($d_city);
                         $sql_data_array = array('customers_id' => $user_id, 'entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_country_id' => $country, 'entry_gender' => $gender, 'entry_company' => $company, 'address_date_added' => 'now()', 'address_last_modified' => 'now()');
                         olc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
                     }
                     // create smarty elements
                     if ($send_mail) {
                         $this->smarty->assign('GENDER', $gender);
                         $this->smarty->assign('FIRSTNAME', $firstname);
                         $this->smarty->assign('LASTNAME', $lastname);
                         $this->smarty->assign('EMAIL', $email_address);
                         $this->smarty->assign('PASSWORT', $password);
                         $this->smarty->caching = false;
                         $txt_mail_customer = $this->smarty->fetch($this->email_template);
                         // mail versenden
                         olc_php_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, $email_address, $firstname . BLANK . $lastname, EMPTY_STRING, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, EMPTY_STRING, EMPTY_STRING, TEXT_MAIL_SUBJECT, EMPTY_STRING, $txt_mail_customer);
                     }
                 }
                 flush();
             }
         }
         fclose($fh);
     } else {
         $file_error = TEXT_FILE_ERROR_OPEN;
     }
     if ($file_error) {
         $this->errorLog[] = sprintf(TEXT_ERROR_FILE, $file_error);
     }
     $this->result = array(array('prod_new' => $lines_ok . " von " . ($lines - 1)), $this->errorLog, $this->calcElapsedTime($this->time_start));
     return $this->result;
 }
Example #2
0
    return $pwd;
}
//Begin
if ($_POST["sent"] == 1 && $_POST["einverstanden"] == 'on') {
    $accname = $_POST["name"];
    $accemail = $_POST["email"];
    changeit($accname);
    changeit($accemail);
    echo '!!ACCMAIL: ', $accemail;
    $existName = 0;
    $abfrage = mysql_query("SELECT * FROM account WHERE login='******' OR email='{$accemail}'");
    while ($account = mysql_fetch_array($abfrage)) {
        $existName = 1;
    }
    if ($existName == 0) {
        $accpasswort = getpass();
        echo 'Erfolgreich registriert, Passwort wird zugesendet';
        $message = "Du wurdest erfolgreich registriert!\n\n Dein Name lautet: {$accname} \n Dein Passwort lautet: {$accpasswort} .\n\n Link zum einloggen: http://www.galaxy-adventures.net/ \n\n sollte es Probleme geben wende dich an: den Administrator \n Das GA - Team";
        mail($accemail, "Willkommen beim Browser Game - Galaxy Adventures!", $message, "From: GA-Registrierung <*****@*****.**>");
        echo '<a href="login.php">zum login</a>';
        $pass = $accpasswort;
        $accpasswort = md5($accpasswort);
        mysql_query("INSERT INTO `account` (login,email,passwort) VALUES ('{$accname}' , '{$accemail}' , '{$accpasswort}')") or die(mysql_error());
    }
}
include "nav2.php";
?>
<table width="750" border="0" valign="top" align="middle">
    <tr><td align="middle"><b>Registrieren</b></td></tr>
    <tr><td bgcolor="#300000">&nbsp;</td></tr>
    <tr><td align="middle">
    for ($i = 1; $i <= $laenge; $i++) {
        $newpass .= substr($string, mt_rand(0, strlen($string) - 1), 1);
    }
    return $newpass;
}
$lines = 0;
$lines_ok = 0;
$importfile = "kunden_import.csv";
$fh = fopen($importfile, "r") or die("Kann Datei nicht lesen.");
while (!feof($fh)) {
    // zeile einlesen & werte zuweisen
    $zeile = fgets($fh);
    list($anrede, $firstname, $lastname, $company, $geburtsdatum, $street_address, $lkz, $postcode, $city, $suburb, $telephone, $fax, $email_address, $password) = split(";", $zeile);
    $lines += 1;
    // neues zufallspasswort erstelllen.
    $password = getpass(10);
    // vorhandene Daten aufbereiten.
    switch ($anrede) {
        case "01":
            $gender = "m";
            break;
        case "02":
            $gender = "f";
            break;
        default:
            $gender = "m";
    }
    // http://www.didihome.de/html/tab-lkz.htm
    // Problemkinder: BAL, EI
    switch (strtoupper($lkz)) {
        case "D":
Example #4
0
      * and all compile folders (also for the extensions).
      */
 /**
  * Check access rights to autoconf.php, the logfile, the temporary folder
  * and all compile folders (also for the extensions).
  */
 case "checkRights":
     if (!($fp = @fopen("../includes/autoconf.php", "w"))) {
         $errors++;
         $javascript .= "\$('span.ch_autoconf').addClass('fail');";
     }
     if (!($fp = @fopen("../temporary/logfile.txt", "w"))) {
         $errors++;
         $javascript .= "\$('span.ch_logfile').addClass('fail');";
     }
     $filename = "%%" . getpass();
     if (!($fp = @fopen("../compile/" . $filename . "_testfile.txt", "w"))) {
         $errors++;
         $javascript .= "\$('span.ch_compile').addClass('fail');";
     }
     if (!($fp = @fopen("../extensions/ki_timesheets/compile/" . $filename . "_testfile.txt", "w"))) {
         $errors++;
         $javascript .= "\$('span.ch_compile_tsext').addClass('fail');";
     }
     if (!($fp = @fopen("../extensions/ki_adminpanel/compile/" . $filename . "_testfile.txt", "w"))) {
         $errors++;
         $javascript .= "\$('span.ch_compile_apext').addClass('fail');";
     }
     if (!($fp = @fopen("../extensions/ki_expenses/compile/" . $filename . "_testfile.txt", "w"))) {
         $errors++;
         $javascript .= "\$('span.ch_compile_epext').addClass('fail');";