<?php function war3_replays_submit() { if ( isset($replay_file) ) { $htmlHead = ""; pgHead('Shadow Legion :: Warcraft III Replays', $htmlHead); // Get Current DB Entrys $rDB = mysql_query("select * from war3_replays where 1"); // Select The Next Entry ID For Newly Uploaded Replay $db_count = sizeof($rDB); $db_nextid = $db_count + 1; // Define Date Dubmitted $rDate = date("m-d-y"); // Define HTTP_POST_FILES Variables $rTemp = $HTTP_POST_FILES['replay_file']['tmp_name']; $rName = $HTTP_POST_FILES['replay_file']['name']; $rSize = $HTTP_POST_FILES['replay_file']['size']; // Define Replay Upload DIR and FILE name $rFile = $db_nextid."_".$HTTP_POST_FILES['replay_file']['name']; $rLoc = "files/war3-replays/$rFile"; // DB Query For Inserting File Information into DB // DB Layout [ id | user | date | url | size | type | replaytitle | version | replayname | downloads ] $q1 = "INSERT INTO war3_replays VALUES ( $db_nextid, '$replay_submitter', '$rDate', '$rLoc', '$rSize', '$replay_type', '$replay_version', '$replay_mapname', 0 ) "; // Check If The File Was Moved And Renamed Properly if ( @ !move_uploaded_file($HTTP_POST_FILES['replay_file']['tmp_name'], "$rLoc") ) { print '<center>Sorry, file not correctly uploaded.'; pgMid(); nav('war3-replays-submit'); pgFoot(); exit(); // If File Was Moved And Renames Properly } else { // Check If The Database Information Was Inserted Properly if ( !mysql_query($q1) ) { print 'Failed to insert the Replay Information into the database.'; pgMid(); nav('war3-replays-submit'); pgFoot(); exit(); // If The DB Was Updated Properly... Make The User Happy !!! } else { print 'Thank you for submitting your replay '.$replay_submitter.'!<br> The view replay will be up within the next few days.<p>Thanks again!</p>'; } } } else { $htmlHead = '<script Language="Javascript" type="text/javascript" src="/files/upload.js"></script>'; pgHead('Shadow Legion :: Warcraft 3 Replays',$htmlHead); print '<p><br></p> <center>Upload Your Replay <form enctype="multipart/form-data" action="?q=war3-replays-submit" method="post"> <table border="1" cellpadding="0" cellspacing="0" width="400" borderColor="#000099"> <tr> <td valign="top"><center><font size="-1">Replay File< /font>:</center></td> <td valign="top"><input name="replay_file" type="file">< /td> </tr> <tr> <td valign="top"><center><font size="-1">Replay Title< /font></center></td> <td valign="top"><input type="text" maxlength="50" name="replay_title"></td> </tr> <tr> <td valign="top"><center><font size="-1">Category</font>:< /center></td> <td valign="top"><select name="replay_type"><option value="-">Type...</option><option value="solo">Solo</option><option value="ffa">Free For All</option><option value="team">Team</option><option value="ums">Use Map Settings</option></select></td> </tr> <tr> <td valign="top"><center><font size="-1">Map Name</font>:< /center></td> <td valign="top"><input type="text" maxlength="50" size="20" name="replay_mapname"></td> </tr> <tr> <td valign="top"><center><font size="-1">War3 Version<br> When Replay Recorded:</font></center></td> <td valign="top"><select name="replay_version" id="replay_version"><option value="-">Version...</option><option value="1.03"> v1.03</option><option value="1.02">v1.02</option><option value="1.01">v1.01< /option><option value="1.00">v1.00</option></select></td> </tr> <tr> <td valign="top"><center><font size="-1">Member</font>:< /center></td> <td valign="top"><input type="text" maxlength="20" name="replay_submitter" id="replay_submitter"></td> </tr> <tr> <td valign="top" colspan="2"><center><textarea name="replay_disc" cols="40" rows="7"></textarea></center></td> </tr> <tr> <td valign="top" colspan="2"><center><input type="button" onClick="javascript:uploadCheck();" value="Upload"> <input type="reset" value="Start Over"></center></td> </tr> </table> </form> </center> <p><br></p> <hr width="75%" size="1" color="#000099"> <p></p>'; pgMid(); nav('war3-replays-submit'); pgFoot(); } } ?>