$rowlink['dogid_2'] .= makeoption($row['id'], $row['name'], $rowlink['dogid2']);
 }
 $result = $db->query("SELECT * FROM rhs_customer_groups WHERE mandant=" . $adminsession->session_mandant_data['mandant_id'] . " ORDER BY name");
 while ($row = $db->fetch_array($result)) {
     $rowlink['groups'] .= makeoption($row['id'], $row['name'], $rowlink['groupsid']);
 }
 $rowlink['show_user'] = create_options_yes_no($rowlink['show_user']);
 $rowlink['show_dog'] = create_options_yes_no($rowlink['show_dog']);
 $rowlink['show_dog2'] = create_options_yes_no($rowlink['show_dog2']);
 $rowlink['show_address'] = create_options_yes_no($rowlink['show_address']);
 $rowlink['show_email'] = create_options_yes_no($rowlink['show_email']);
 $rowlink['show_email2'] = create_options_yes_no($rowlink['show_email2']);
 $rowlink['show_phone'] = create_options_yes_no($rowlink['show_phone']);
 $rowlink['show_phone_business'] = create_options_yes_no($rowlink['show_phone_business']);
 $rowlink['show_fax'] = create_options_yes_no($rowlink['show_fax']);
 $rowlink['show_mobile'] = create_options_yes_no($rowlink['show_mobile']);
 if (is_file($shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . ".jpg")) {
     $smarty->assign("img_for_this_user", $shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . ".jpg");
 } elseif (is_file($shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . ".jpeg")) {
     $smarty->assign("img_for_this_user", $shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . ".png");
 } elseif (is_file($shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . ".png")) {
     $smarty->assign("img_for_this_user", $shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . ".png");
 } elseif (is_file($shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . ".gif")) {
     $smarty->assign("img_for_this_user", $shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . ".gif");
 } else {
     $smarty->assign("img_for_this_user", $shopconfig['shopconfig_adminimgpath'] . "nopic.png");
 }
 $smarty->assign("page_redirect", "customer.php?sid=" . $adminsession->session_data['hash']);
 $smarty->assign($rowlink);
 $smarty->display("a_customer_edit.tpl.php");
 exit;
    exit;
}
/**
*
*  Links erzeugen
*
**/
if ($action == "new") {
    $smarty->assign("action", $action);
    if ($_POST['send']) {
        $result = $db->query("INSERT INTO rhs_mandant SET mandant_name='{$_POST['mandant_name']}', mandant_email='{$_POST['mandant_email']}',\n\t\tmandant_nachname='{$_POST['mandant_nachname']}', mandant_vorname='{$_POST['mandant_vorname']}', mandant_show_index_start='{$_POST['mandant_show_index_start']}',\n\t\tmandant_show_kontakt='{$_POST['mandant_show_kontakt']}', mandant_show_index_portal='{$_POST['mandant_show_index_portal']}',\n\t\tmandant_show_index_projects='{$_POST['mandant_show_index_projects']}', mandant_show_index_sponsors='{$_POST['mandant_show_index_sponsors']}',\n\t\tmandant_show_konto='{$_POST['mandant_show_konto']}', mandant_konto_nr='{$_POST['mandant_konto_nr']}',\n\t\tmandant_konto_blz='{$_POST['mandant_konto_blz']}', mandant_konto_bank='{$_POST['mandant_konto_bank']}',\n\t\tmandant_staffeltext='{$_POST['message']}'\n\t\t create_userid=" . $adminsession->session_user_data['customer_id'] . ", create_date=" . time());
        @mkdir("../bilder/kontakt/" . $db->insert_id());
        if ($result) {
            $rowlink = $db->query_first("SELECT\n\t\t\t\tmandant_id as mandant_id2, mandant_name as mandant_name2, mandant_email as mandant_email2, mandant_nachname as mandant_nachname2,\n\t\t\t\tmandant_vorname as mandant_vorname2 , mandant_show_kontakt as mandant_show_kontakt2, mandant_show_index_start as mandant_show_index_start2,\n\t\t\t\tmandant_show_index_portal as mandant_show_index_portal2, mandant_show_index_projects as mandant_show_index_projects2,\n\t\t\t\tmandant_show_index_sponsors as mandant_show_index_sponsors2, mandant_show_konto as mandant_show_konto2, mandant_konto_nr as mandant_konto_nr2,\n\t\t\t\tmandant_konto_blz as mandant_konto_blz2, mandant_konto_bank as mandant_konto_bank2, mandant_staffeltext as mandant_staffeltext2\n\t\t\t\tFROM rhs_mandant WHERE mandant_id=" . $db->insert_id());
            $smarty->assign("fehler", 1);
            $smarty->assign("page_redirect", "mandant.php?sid=" . $adminsession->session_data['hash']);
        } else {
            $smarty->assign("fehler", 2);
        }
    }
    $rowlink['mandant_show_index_start2'] = create_options_yes_no($rowlink['mandant_show_index_start2']);
    $rowlink['mandant_show_kontakt2'] = create_options_yes_no($rowlink['mandant_show_kontakt2']);
    $rowlink['mandant_show_index_portal2'] = create_options_yes_no($rowlink['mandant_show_index_portal2']);
    $rowlink['mandant_show_index_projects2'] = create_options_yes_no($rowlink['mandant_show_index_projects2']);
    $rowlink['mandant_show_index_sponsors2'] = create_options_yes_no($rowlink['mandant_show_index_sponsors2']);
    $rowlink['mandant_show_konto2'] = create_options_yes_no($rowlink['mandant_show_konto2']);
    $rowlink['mandant_staffeltext2'] = htmlconverter(stripcrap(trim($rowlink['mandant_staffeltext2'])));
    $smarty->assign($rowlink);
    $smarty->display("a_mandant_edit.tpl.php");
    exit;
}
                         unlink($shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . '_hund.' . $attachment_file_extension);
                     }
                 } else {
                     // No Upload possible
                 }
             } else {
                 // file extension not allowed
             }
         }
     } else {
         $smarty->assign("fehler", 2);
     }
 }
 $rowlink['gender'] = create_options_gender($rowlink['gender']);
 $rowlink['exam'] = create_options_yes_no($rowlink['exam']);
 $rowlink['exam_tr'] = create_options_yes_no($rowlink['exam_tr']);
 if ($rowlink['dob'] == 0) {
     $rowlink['dob'] = date("d.m.Y", time());
 } else {
     $rowlink['dob'] = date("d.m.Y", $rowlink['dob']);
 }
 if (is_file($shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . "_hund.jpg")) {
     $smarty->assign("img_for_this_user", $shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . "_hund.jpg");
 } elseif (is_file($shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . "_hund.jpeg")) {
     $smarty->assign("img_for_this_user", $shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . "_hund.png");
 } elseif (is_file($shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . "_hund.png")) {
     $smarty->assign("img_for_this_user", $shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . "_hund.png");
 } elseif (is_file($shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . "_hund.gif")) {
     $smarty->assign("img_for_this_user", $shopconfig['shopconfig_adminimgpath'] . $adminsession->session_mandant_data['mandant_id'] . "/" . $thisdbinsertid . "_hund.gif");
 } else {
     $smarty->assign("img_for_this_user", $shopconfig['shopconfig_adminimgpath'] . "nopic_hund.png");