-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.php
More file actions
32 lines (28 loc) · 841 Bytes
/
main.php
File metadata and controls
32 lines (28 loc) · 841 Bytes
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
<?php
include_once("Element.php");
include_once("ElementFactory.php");
include_once("XMLAdapter.php");
include_once("XMLDsn.php");
include_once("XMLFactory.php");
include_once("XMLPassword.php");
include_once("XMLUser.php");
include_once("YamlAdapter.php");
include_once("YamlDsn.php");
include_once("YamlFactory.php");
include_once("YamlPassword.php");
include_once("YamlUser.php");
$factoryArg = $argv[1];
$dbhost = $argv[2];
$dbuser = $argv[3];
$dbpass = $argv[4];
$dbname = $argv[5];
switch($factoryArg) {
case "xml": $factory = new XMLFactory(); break;
case "yaml": $factory = new YamlFactory(); break;
}
$db = new mysqli($dbhost,$dbuser,$dbpass,$dbname);
$sql = "SELECT * FROM factory";
$res = $db->query($sql);
while($row = $res->fetch_assoc()) {
echo $factory->getElement($row["type"],$row["val"])->toString()."\n";
}