Subversion Repositories computer_asset_manager_v1

Rev

Rev 100 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 100 Rev 102
Line 19... Line 19...
19
         if ( isset( $_POST["submit"] ) ) {
19
         if ( isset( $_POST["submit"] ) ) {
20
            include_once( 'csvImporter.php' );
20
            include_once( 'csvImporter.php' );
21
            $filename = tempnam( '/tmp', 'blk' );
21
            $filename = tempnam( '/tmp', 'blk' );
22
            if ( move_uploaded_file( $_FILES["fileToUpload"]["tmp_name"], $filename ) ) {
22
            if ( move_uploaded_file( $_FILES["fileToUpload"]["tmp_name"], $filename ) ) {
23
               print "<p>Loading Data</p>\n";
23
               print "<p>Loading Data</p>\n";
24
               //$data = file( $filename,  FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES  );
24
               $data = file( $filename,  FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES  );
25
               $data = file_get_contents( $filename );
25
               //$data = file_get_contents( $filename );
26
               print"<pre>"; print_r( $_REQUEST ); print "</pre>";
26
               //print"<pre>"; print_r( $_REQUEST ); print "</pre>";
27
               $data = parseTabDelimFile (
27
               $data = parseTabDelimFile (
28
                              $data,
28
                              $data,
29
                              isset( $_REQUEST['createattribute'] ),
29
                              isset( $_REQUEST['createattribute'] ),
30
                              isset( $_REQUEST['createdevice'] ),
30
                              isset( $_REQUEST['createdevice'] ),
31
                              cleanInput( $_REQUEST['device_id'] ),
31
                              cleanInput( $_REQUEST['device_id'] ),
32
                              cleanInput( $_REQUEST['site_id'] ),
32
                              cleanInput( $_REQUEST['site_id'] ),
33
                              cleanInput( $_REQUEST['client_id'] )
33
                              cleanInput( $_REQUEST['client_id'] )
34
                           );
34
                           );
-
 
35
               if ( $data['errors'] ) {
-
 
36
                  print "<h4>Error: Could not import</h4><h5>The following errors were encountered</h5>";
-
 
37
                  print "<ul><li>" . implode( "</li><li>", $data['errors'] ) . "</li></ul>";
-
 
38
               } else {
-
 
39
                  $data = $data['sql'];
35
               print"<pre>"; print_r( $data ); print "</pre>";
40
                  //print"<pre>"; print_r( $data ); print "</pre>";
-
 
41
                  print '<p>' . updateDatabase( $data ) . '</p>';
-
 
42
               }
36
            } else {
43
            } else {
37
               print "<p>Error: move_uploaded_file failed to move to $filename</p>";
44
               print "<p>Error: move_uploaded_file failed to move to $filename</p>";
38
            }
45
            }
39
            //unlink( $filename );
46
            //unlink( $filename );
40
         } else {
47
         } else {