Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Default.php \\
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html>
- <head>
- <title>Upload Noteskin</title>
- <script type="text/javascript" language="JavaScript">
- function check() {
- var ext = document.f.uploaded.value;
- ext = ext.substring(ext.length-3,ext.length);
- ext = ext.toLowerCase();
- if(ext != 'png') {
- alert('You selected a .'+ext+
- ' file; please select a .png file instead!');
- return false; }
- else
- return true; }
- </script>
- </head>
- <body>
- <form method="post" name=f
- enctype="multipart/form-data"
- onsubmit="return check();"
- action="upload.php">
- <p>
- Select a PNG pic to upload as noteskin.<br />
- All noteskins will be based on this single skin.<br />
- And DO NOT UPLOAD ARROWS.<br />
- So please upload stuff like this.<br />
- <img src="http://jousway.webuda.com/kbonoteskins/no%20arrow.png"><br />
- I advice you to upload it in the color gray but its your choice.<br />
- Arrows function will be added later.
- <br />
- <input type="file" name="uploaded" size="40">
- <p>
- <input type="submit" value="Send">
- </form>
- </body>
- </html>
- // Upload.php \\
- <?php
- $randit = rand(100000, 999999);
- mkdir($randit."/",0777);
- $target = $randit."/";
- $target = $target . basename( $_FILES['uploaded']['name']) ;
- $ok=1;
- if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
- {
- echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, ";
- }
- else {
- echo "Sorry, there was a problem uploading your file.";
- }
- rename($randit.'/'.basename( $_FILES['uploaded']['name']), $randit.'/skin.png');
- $doc = new DOMDocument('1.0', 'utf-8');
- $doc->formatOutput = true;
- $data = $doc->createElementNS('http://www.keybeatonline.com/schema/customnoteskin', 'data');
- $doc->appendChild( $data );
- $name = $doc->createElement( 'name' );
- $name->appendChild(
- $doc->createTextNode( 'Noteskin' )
- );
- $data->appendChild( $name );
- $graphics = $doc->createElement( 'graphics' );
- $doc->appendChild( $graphics );
- $location = $doc->createElement( 'location' );
- $location->appendChild(
- $doc->createTextNode( 'http://jousway.webuda.com/kbonoteskins/'.$randit.'/' )
- );
- $graphics->appendChild( $location );
- $scale = $doc->createElement( 'scale' );
- $scale->appendChild(
- $doc->createTextNode( '1' )
- );
- $graphics->appendChild( $scale );
- $skins = $doc->createElement( 'skins' );
- $a = $doc->createElement( 'upleft' );
- $main = $doc->createElement( 'main' );
- $main->appendChild(
- $doc->createTextNode( 'skin.png' )
- );
- $a->appendChild( $main );
- $overlay = $doc->createElement( 'overlay' );
- $overlay->appendChild(
- $doc->createTextNode( ' ' )
- );
- $a->appendChild( $overlay );
- $skins->appendChild( $a );
- $graphics->appendChild( $skins );
- $receptors = $doc->createElement( 'receptors' );
- $b = $doc->createElement( 'upleft' );
- $main2 = $doc->createElement( 'main' );
- $main2->appendChild(
- $doc->createTextNode( 'skin.png' )
- );
- $b->appendChild( $main2 );
- $receptors->appendChild( $b );
- $graphics->appendChild( $receptors );
- $holds = $doc->createElement( 'holds' );
- $c = $doc->createElement( 'upleft' );
- $main3 = $doc->createElement( 'main' );
- $main3->appendChild(
- $doc->createTextNode( 'skin.png' )
- );
- $c->appendChild( $main3 );
- $holds->appendChild( $c );
- $graphics->appendChild( $holds );
- $explosions = $doc->createElement( 'explosions' );
- $transition = $doc->createElement('transition');
- $scalex = $doc->createAttribute('scalex');
- $scaley = $doc->createAttribute('scaley');
- $scalex->appendChild($doc->createTextNode('true'));
- $scaley->appendChild($doc->createTextNode('true'));
- $transition->appendChild($scalex);
- $transition->appendChild($scaley);;
- $begin = $doc->createElement( 'begin' );
- $alpha = $doc->createElement( 'alpha' );
- $alpha->appendChild(
- $doc->createTextNode( '1' )
- );
- $begin->appendChild( $alpha );
- $scale2 = $doc->createElement( 'scale' );
- $scale2->appendChild(
- $doc->createTextNode( '1' )
- );
- $begin->appendChild( $scale2 );
- $transition->appendChild( $begin );
- $transition->appendChild( $begin );
- $end = $doc->createElement( 'end' );
- $alpha2 = $doc->createElement( 'alpha' );
- $alpha2->appendChild(
- $doc->createTextNode( '0' )
- );
- $end->appendChild( $alpha2 );
- $scale3 = $doc->createElement( 'scale' );
- $scale3->appendChild(
- $doc->createTextNode( '2' )
- );
- $end->appendChild( $scale3 );
- $transition->appendChild( $end );
- $duration = $doc->createElement( 'duration' );
- $duration->appendChild(
- $doc->createTextNode( '0.2' )
- );
- $transition->appendChild( $duration );
- $explosions->appendChild( $transition );
- $d = $doc->createElement( 'upleft' );
- $main4 = $doc->createElement( 'main' );
- $main4->appendChild(
- $doc->createTextNode( 'skin.png' )
- );
- $d->appendChild( $main4 );
- $explosions->appendChild( $d );
- $graphics->appendChild( $explosions );
- $data->appendChild( $graphics );
- echo "to use your noteskin copy and past <font color='blue'>http://jousway.webuda.com/kbonoteskins/".$randit.".xml</font> in to the custom noteskin url in KBO";
- $doc->save($randit.'.xml');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement