~ubuntu-branches/ubuntu/maverick/ilohamail/maverick

« back to all changes in this revision

Viewing changes to CONTRIB/contacts_importer_CVS/addcontacts.php

  • Committer: Bazaar Package Importer
  • Author(s): Joerg Jaspert
  • Date: 2004-02-04 13:44:37 UTC
  • Revision ID: james.westby@ubuntu.com-20040204134437-kz8j3ui2qa7oq8z2
Tags: upstream-0.8.12
ImportĀ upstreamĀ versionĀ 0.8.12

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/********************************************************
 
4
 
 
5
        AUTHOR: Ben Weinberg <ben@bensbrain.com>
 
6
        FILE:  source/addcontacts.php
 
7
        PURPOSE:
 
8
                Add contacts from csv file...
 
9
        
 
10
********************************************************/
 
11
 
 
12
include("../include/super2global.inc");
 
13
//include("../include/contacts_commons.inc");
 
14
//include_once("../include/data_manager.inc");
 
15
if (isset($user)){
 
16
        include("../include/header_main.inc");
 
17
        include("../lang/".$my_prefs["lang"]."/contacts.inc");
 
18
        include("../lang/".$my_prefs["lang"]."/compose.inc");
 
19
 
 
20
        //authenticate
 
21
        include_once("../include/icl.inc");
 
22
        $conn=iil_Connect($host, $loginID, $password, $AUTH_MODE);
 
23
        if ($conn){
 
24
                iil_Close($conn);
 
25
        }else{
 
26
                echo "Authentication failed.";
 
27
                echo "</html>\n";
 
28
                exit;
 
29
        }
 
30
        }
 
31
?>
 
32
 
 
33
<br>
 
34
<table width="100%" cellpadding=2 cellspacing=0>
 
35
<tr bgcolor="#222244"><td>
 
36
<span class="bigTitle">Contact Importer: Page 1/3</span>
 
37
</td></tr>
 
38
<tr bgcolor="#f0f0f0"><td>
 
39
        <script language="JavaScript" type="text/javascript">
 
40
        function checkform() {
 
41
                form1 = document.forms['firstform'];
 
42
                strerror = "";
 
43
                if (form1.userfile.value=="") {strerror += "please find a file to upload first\n";}
 
44
                else{
 
45
                        if (form1.userfile.value.indexOf(".csv")>0)     form1.format[0].checked = true;
 
46
                        else if (form1.userfile.value.indexOf(".tsv")>0) form1.format[1].checked = true;
 
47
                        else {  if (form1.format[0].checked != true && form1.format[1].checked != true) strerror += "Please choose whether your file is a csv or tsv file.\n"; }
 
48
                }
 
49
                if (strerror == "") {return true;}
 
50
                else {alert(strerror);return false;}
 
51
        } 
 
52
        </script>
 
53
Instructions:<br>
 
54
<br>
 
55
<table width="500" cellpadding=0 cellspacing=0>
 
56
<tr><td>
 
57
Export your contacts from your current email program's address book to a text file.  <br>
 
58
<b>Note:</b> This file <b>must</b> be in CSV (comma separated variable) or TSV (tab separated variable) format with column headers in the first row. Any other format will cause the address import to fail.<br>
 
59
<br>
 
60
Once you have done this, use the form below to browse for the exported address book file on your computer and then hit the &quot;upload&quot; button to proceed to the next step.<br>
 
61
 
 
62
<form name="firstform" action="addcontacts2.php?user=<?php echo($user)?>" method="post" enctype="multipart/form-data" onSubmit="return checkform()">
 
63
<input type="hidden" name="max_file_size" value="1000000">
 
64
Find the exported address book file:<br>
 
65
<input type="file" name="userfile"><br>
 
66
<br>
 
67
If the file chosen above DOES NOT have a .csv or .tsv file extension, please choose the format of the file here (if you don't know, open it in a plain text editor).<br>
 
68
<br>
 
69
<input type="radio" name="format" value="csv"> CSV<br>
 
70
<input type="radio" name="format" value="tsv"> TSV<br>
 
71
<br>
 
72
<input type="submit" value="upload address file and begin import process">
 
73
</form>
 
74
</td></tr></table>
 
75
 
 
76
</td></tr></table>
 
77
</body>
 
78
</html>