Example #1
0
                        foreach (array_values($usernames) as $v) {
                            $usernames_fast[$v] = 1;
                        }
                        while (($line = fgets($handle)) !== false) {
                            if (strpos($line, "#") === 0) {
                                continue;
                            }
                            $data = explode(",", $line);
                            $done = false;
                            $username = CleanString($data[1]);
                            if (isset($usernames_fast[$username])) {
                                // update current client
                                Client::EditByUsername($username, $data[0], $data[2], $data[3], $data[4]);
                            } else {
                                // add new client
                                Client::Add($data[0], $username, $data[2], $data[3], $data[4]);
                            }
                        }
                        fclose($handle);
                        $database->commit();
                        ShowInfo("Done");
                        RedirectTimer("admin&clients", 3);
                    }
                }
            }
        }
    } elseif (isset($_GET["upload"])) {
        ?>
		<form role="form" method="post" enctype="multipart/form-data">
			<div class="form-group">
				<label for="file">Client Database File</label>