<?php
/*

  VS SCORM 1.2 RTE - rte.php
  Rev 2009-11-30-01
  Copyright (C) 2009, Addison Robson LLC

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor,
  Boston, MA	02110-1301, USA.

 */

require "subs.php";

// input data
$SCOInstanceID = $_REQUEST['SCOInstanceID'] * 1;

//  read database login information and connect
require "../config.php";
dbConnect();

//$id1 = $_GET['id1'];
$id2 = $_GET['id2'];
$id3 = $_GET['id3'];
$id4 = $_GET['id4'];
$id5 = $_GET['SCOInstanceID'];

// delete all data
mysqli_query($link, "delete from scormvars");

$result = mysqli_query($link, "select scorm_id,content_path from content_details where contentdtl_id='" . $id5 . "'");
if ($row = mysqli_fetch_array($result)) {
    $scorm_id = $row['scorm_id'];
    $new = str_replace(' ', '%20', $row['content_path']);
    list($filename, $ext) = explode('.', $new);
}
$result1 = mysqli_query($link, "select * from scorm where scorm_id='" . $scorm_id . "'");
if ($row1 = mysqli_fetch_array($result1)) {
    $launch_page = $row1['launch_page'];
}
?>
<html>
    <head>
        <title>K-nest LMS - Scorm</title>
    </head>
    <frameset frameborder="0" framespacing="0" border="0" rows="0%,*" cols="*" onbeforeunload="API.LMSFinish('');" onunload="API.LMSFinish('');">
        <frame  src="api.php?SCOInstanceID=<?php print $SCOInstanceID; ?>" name="API" noresize/>
        <frame src="<?php echo ADMIN_PATH ?><?php echo $content_folder ?>/<?php echo $id2 ?>/<?php echo $id3 ?>/<?php echo $id4 ?>/<?php echo $filename ?>/<?php echo $launch_page ?>" name="course"/>
    </frameset>
</html>