/var/www/onesolution.com.hk/support/customerindex.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<?php require("checkuser.php"); ?>
<?
if ($logged_in == 1) {
} else {
    
header('Location: logon.php');
}
?>

<html>
<head>
<title>One Solution Limited - Support</title>
<link rel="stylesheet" href="main.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<script language="JavaScript" type="text/javascript" src="richtext.js"></script>
<script type="text/javascript" src="calendarDateInput.js"></script>
<script type="text/javascript">
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}
</script>
</head>
<body>
<!--********************************************************-->
<script language="JavaScript">
<!--
var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
function formCheck(formobj){
    
    // Enter name of mandatory fields
    var fieldRequired = Array("email", "custid", "custname");
    // Enter field description to appear in the dialog box
    var fieldDescription = Array("Email","Customer no", "Customer name");
    
    // dialog message
    var alertMsg = "Please complete the following fields:\n";
    var l_Msg = alertMsg.length;



    var custid = formobj.custid.value
    if (IsNumeric(custid) == false)
    {
        alertMsg += " - Customer no only allow numeric.\n";
    }

    for (var i = 0; i < fieldRequired.length; i++){
        var obj = formobj.elements[fieldRequired[i]];
        if (obj){
            switch(obj.type){
            case "select-one":
                if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
                    alertMsg += " - " + fieldDescription[i] + "\n";
                }
                break;
            case "select-multiple":
                if (obj.selectedIndex == -1){
                    alertMsg += " - " + fieldDescription[i] + "\n";
                }
                break;
            case "text":
            case "textarea":
                if (obj.value == "" || obj.value == null){
                    alertMsg += " - " + fieldDescription[i] + "\n";
                }
                break;
            default:
            }
            if (obj.type == undefined){
                var blnchecked = false;
                for (var j = 0; j < obj.length; j++){
                    if (obj[j].checked){
                        blnchecked = true;
                    }
                }
                if (!blnchecked){
                    alertMsg += " - " + fieldDescription[i] + "\n";
                }
            }
        }
    }

    // check email start
    var returnval=emailfilter.test(formobj.email.value)
    if (returnval==false)
    {
        //alert("Please enter a valid email address.")
        alertMsg += " - Please enter a valid email address.\n";
    }

    if (alertMsg.length == l_Msg){
        return submitForm();
    }else{
        alert(alertMsg);
        return false;
    }
}
function IsNumeric(sText)
{
    var ValidChars = "0123456789.";
    var IsNumber=true;
    var Char;


    for (i = 0; i < sText.length && IsNumber == true; i++) 
    { 
        Char = sText.charAt(i); 
        if (ValidChars.indexOf(Char) == -1) 
        {
            IsNumber = false;
        }
    }
    return IsNumber;

}
function y2k(number) { return (number < 1000) ? number + 1900 : number; }

function daysElapsed(date1,date2) {
    var difference =
        Date.UTC(y2k(date1.getYear()),date1.getMonth(),date1.getDate(),0,0,0)
      - Date.UTC(y2k(date2.getYear()),date2.getMonth(),date2.getDate(),0,0,0);
    return difference/1000/60/60/24;
}
function submitForm() {
    return true;
}
// -->

</script>
<script type="text/javascript">

var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i

function checkmail(e){
var returnval=emailfilter.test(e.value)
if (returnval==false){
alert("Please enter a valid email address.")
e.select()
}
return returnval
}
</script>
<!--********************************************************-->


<table border="0" cellpadding="1" cellspacing="1" width="100%">
<tr><td class='pageheader' align="left" valign="middle" height="100"><img src="images/iconUser.png">&nbsp;<b>Customer Management</b></td>
    <td class='content' align="center" width="150"></td>
</tr>
</table>
<form action="customeradd.php" name="addform" method="post" onsubmit="return formCheck(this);">
<table border="0" cellpadding="1" cellspacing="1" width="600">
<tr><td class="content" width="150">Customer no: *</td>
    <td class="content"><input type="text" name="custid" size="10" maxlength="10" class="content">
    </td></tr>
<tr><td class="content" width="150">Customer name: *</td>
    <td class="content"><input type="text" name="custname" size="30" maxlength="100" class="content">
    </td></tr>
<tr><td class="content" width="150">Address:</td>
    <td class="content"><input type="text" name="address" size="50" maxlength="500" class="content">
    </td></tr>
<tr><td class="content" width="150">Contact person:</td>
    <td class="content"><input type="text" name="contactperson" size="30" maxlength="50" class="content">
    </td></tr>
<tr><td class="content" width="150">Tel no.:</td>
    <td class="content"><input type="text" name="telno" size="20" maxlength="20" class="content">
    </td></tr>
<tr><td class="content" width="150">Email: *</td>
    <td class="content"><input type="text" name="email" value="<?=$email?>" size="20" maxlength="100" class="content">
    </td></tr>
<tr><td class="content" width="150" valign="top">Status:</td>
    <td class="content">
    <input type="radio" name="status" value="1" checked>Enable
    <input type="radio" name="status" value="0">Disabled
    </td></tr>

<tr><td class="content" width="150" valign="top"></td>
    <td class="content"><input type="submit" value="Submit" class="content"><input type="reset" value="Reset" class="content">
    </td></tr>

</form>
<?
//echo date("F j, Y, g:i a");
//echo date("Ymdgi");
?>
</body>
</html>

<?
function getSelect($field1$field2)
{
    if (
$field1 == $field2)
    {
        return 
"selected";
    }
    else
    {
        return 
"";
    }
}
?>
<?
function getCheck($field1$field2)
{
    if (
$field1 == $field2)
    {
        return 
"checked";
    }
    else
    {
        return 
"";
    }
}
?>