Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once "include/lr.php";
- $mysql_database="db";
- $mysql_username="root";
- $mysql_password="";
- $mysql_host="localhost";
- $mysql_connect = @mysql_connect($mysql_host, $mysql_username, $mysql_password);
- mysql_select_db($mysql_database);
- $doc = new DOMDocument;
- $fname = $doc->createElement('page');
- $fname->setAttribute('number', 1);
- $root = $doc->appendChild($fname);
- //$doc->formatOutput = true;
- $result = mysql_query("SELECT COUNT(*) FROM `db` ");
- $ar = mysql_fetch_row($result);
- $amount = $ar[0];
- $files_on_page = 1;
- if (isset($_GET['page'])) $page=($_GET['page']); else $page=0;
- $start=abs($page*$files_on_page);
- $sql = "SELECT * FROM `db` ORDER BY id LIMIT $start,$files_on_page";
- $result = mysql_query($sql);
- while ($row=mysql_fetch_array($result)){
- $file = $row['file_name'];
- $fname = $doc->createElement('file');
- $fname->setAttribute('name', $file);
- $fname->setAttribute('title', $row['name']);
- $root->appendChild($fname);
- }
- mysql_close($mysql_connect);
- $fname = $doc->createElement('pagination', LeftRight($amount,$page,"index.php?page=",$files_on_page));
- $root->appendChild($fname);
- // do xslt
- $xsl = new DOMDocument();
- $xsl->load('template.xsl');
- $proc = new XSLTProcessor();
- $proc->importStyleSheet($xsl);
- echo $proc->transformToXML($doc);
- //echo $doc->saveXML();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement