Jump to content

niki

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

niki's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. yes thank you that was the problem.... but in column i cant get USERID
  2. uploadify.php <?php if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/'; $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name']; if (move_uploaded_file($tempFile,$targetFile)) { dbconnect($dbhost, $dbusername, $dbpassword, $dbname); dbquery("INSERT INTO `test` (`test`) VALUES ('test')"); } } ?> and test.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Uploadify Example Script</title> <link href="/example/css/default.css" rel="stylesheet" type="text/css" /> <link href="/example/css/uploadify.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="/example/scripts/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="/example/scripts/swfobject.js"></script> <script type="text/javascript" src="/example/scripts/jquery.uploadify.v2.1.0.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#uploadify").uploadify({ 'uploader' : 'scripts/uploadify.swf', 'script' : 'scripts/uploadify.php', 'cancelImg' : 'cancel.png', 'folder' : 'publicdemos/map/', 'queueID' : 'fileQueue', 'auto' : true, 'multi' : true }); }); </script> </head> <body> <div id="fileQueue"></div> <input type="file" name="uploadify" id="uploadify" /> <p><a href="javascript:jQuery('#uploadify').uploadifyClearQueue()">Cancel All Uploads</a></p> </body> </html> Dont know whats the problem,because file is uploaded successfully.... Only the data is not entered in the mysql table...
  3. First of all sorry that I cant to resolve this so I have to ask for help. Here are codes : <?php require_once("class2.php"); require_once(HEADERF); if (!ADMIN) { //$ns->tablerender("Submit Demos", "<div align=\"center\">Trenutacno smo onesposobili ubacivanje dema.</div>"); //die(); } if (!USER) { $ns->tablerender("Submit Demos", "<div align=\"center\">Sign up if you want to submit demos</div>"); die(); } // configuration $dir = "./publicdemos/map/"; $dirlj = "./publicdemos/longjumps/"; $dirrejected = "./publicdemos/rejected/"; $flag = "http://kz-serbia.com/e107_images/flags"; //$dir = "/xampp/htdocs/asd/"; $max = "20"; $demos = "0"; $ljdemos = 0; $rdemos = 0; $str = ""; $admin = true; if (isset($_GET["delete"])) unlink($dir.$_GET["delete"]); if (isset($_GET["reject"])) rename($dir.$_GET["reject"], $dirrejected.$_GET["reject"]); if (isset($_GET["deletelj"])) unlink($dirlj.$_GET["deletelj"]); if (isset($_GET["rejectlj"])) rename($dirlj.$_GET["rejectlj"], $dirrejected.$_GET["rejectlj"]); //counting files $files = myscan($dir); $fileslj = myscan($dirlj); $filesrj = myscan($dirrejected); sort($files);sort($fileslj );sort($filesrj ); for ($x=0; $x<sizeof($files); $x++) { if (($files[$x] != ".") and ($files[$x] != "..") and ($files[$x] != "logs") and ($files[$x] != ".ftpquota")) { $vip .= $files[$x]." "; $demos++; } } $vip_user = $vip; for ($x=0; $x<sizeof($filesrj); $x++) { if (($filesrj[$x] != ".") and ($filesrj[$x] != "..") and ($filesrj[$x] != "logs") and ($filesrj[$x] != ".ftpquota")) { $vip_user .= $filesrj[$x]." "; $rdemos++; } } for ($x=0; $x<sizeof($fileslj); $x++) { if (($fileslj[$x] != ".") and ($fileslj[$x] != "..") and ($fileslj[$x] != "logs") and ($fileslj[$x] != ".ftpquota")) { $vip .= $fileslj[$x]." "; $vip_user .= $fileslj[$x]." "; $ljdemos++; } } // javascript $text .= ' <script type="text/javascript"> <!-- function checkValidName() { var name = document.uploadform.uploadedfile.value; if (name == "") return false; var i = 0, ext_begin = -1, vrijeme_begin = -1, jumper_begin = -1; var vrijeme = "", jumper = "", map = ""; if (name.lastIndexOf(".zip") != -1){ alert("Ne prihvacamo zip. Rename please: ime=\'" + name + "\'"); return false; } if (name.lastIndexOf(".rar.rar") != -1){ alert("Neispravno ime, dvaput .rar pise. Rename please: ime=\'" + name + "\'"); return false; } if (name.lastIndexOf(".dem.rar") != -1){ alert("Neispravno ime, pise .dem.rar, mora samo .rar. Rename please: ime=\'" + name + "\'"); return false; } if (name.lastIndexOf(".rar") == -1){ alert("Neispravno ime, mora biti .rar. Rename please: ime=\'" + name + "\'"); return false; } for (i = name.length - 1; i >= 0; i--) { if (name[i] == \'.\' && ext_begin == -1) ext_begin = i; else if (name[i] == \'.\') { alert("ekstra . u imenu, rename please: ime=\'" + name + "\'"); return false; } else if (name[i] == \'_\') { if (vrijeme == "") { vrijeme = name.substring(i + 1, ext_begin); vrijeme_begin = i; } else if (jumper == "") { jumper = name.substring(i + 1, vrijeme_begin); jumper_begin = i; } } } if (jumper_begin == -1) { alert("Ne mogu prepoznati ime, rename please: ime=\'" + name + "\'(" + vrijeme + ")"); return false; } map = name.substring(0, jumper_begin); if ((map != "" && vrijeme != "" && jumper != "" && vrijeme.length == 4) || map.length == 3) { //alert("ok je"); var el = document.createElement("div"); el.appendChild(document.createTextNode("Demo name OK (" + map + ", " + jumper + ", " + vrijeme + ")")); el.setAttribute("style", "color: green;"); document.uploadform.appendChild(el); return true; } else alert("Ne mogu prepoznati mapa_nick_vrijeme, mapa=\'" + map + "\', nick=\'" + jumper + "\', vrijeme=\'" + vrijeme + "\'"); return false; } --> </script> '; //upload form if ($demos < $max) { dbconnect($dbhost, $dbusername, $dbpassword, $dbname); $text .= ' <ul><li>If you are not from these countries (Serbia, Croatia, Montenegro, Bosnia, Macedonia, Slovenia, Greece, Albania) We do not allow you to upload demos. <li>Demo must be in rar format</li> <li>Record for map,must have a name,mapname_nick_time.rar</li> <li>In rar file,demo must be named like this,mapname_nick_time.dem (If your nick is LEET*,you must set onyl LEET without *</li> <li>You must choose the correct category .</li> <li>Do not use the other models (kzm_lj.mdl, spetnaz.mdl) except basic cs models.You can use Hltv XJ models.</li> <li>Do not upload too long longjump demos.</li> </ul><br/> <div id="content"> <form name="uploadform" enctype="multipart/form-data" action="upload.php" method="POST" onSubmit="return checkValidName()"> <p align="center">Choose a file to upload: <input name="uploadedfile" type="file" /><br /> What are you uploading? <select name=\"rec_type\"> <option>Map Record</option> <option>Longjump</option> </select><br/> <input type="submit" value="Upload File" /></p> </form> </div>'; } else { $text .= " The limit of the demos is reached.<br />Please wait until the next demo release.<br /><br />"; } if ($demos == 1){ $text .= "1/".$max." demo has been uploaded so far."; } else { $text .= $demos."/".$max." demos have been uploaded so far."; } $text .= "<br>Read the <a href=\"http://www.kz-serbia.com/page.php?27#Demo\">demo rules</a> before submitting.</br>"; if (ADMIN == true) { $demoz = explode(" ", $vip); $i = 0; $text .= "<br /><br /><b>ADMIN area:</b><br />"; $text .= " <table style=\"width: 100%;\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\" class=\"demorank\"> <tbody> <tr class=\"forumheader\"> <th class=\"fcaption\" style=\"width: 30%; text-align: left;\"><strong>File Name</strong></th> <th class=\"fcaption\" style=\"width: 30%; text-align: right;\"><strong>Actions</strong></th> <th class=\"fcaption\"><strong></strong></th> </tr>"; $text .= "<tr><td colspan=3 class=\"fcaption\"><strong>Records</strong></td></tr>"; while($i < ($demos + $ljdemos)) { if ($i == $demos) $text .= "<tr><td colspan=3 class=\"fcaption\"><strong>Longjump demos</strong></td></tr>"; $query = dbquery("SELECT * FROM `publicuploads` WHERE `file`='".$demoz[$i]."'"); $row = dbarray($query); if (dbrows($query) != 0){ $l_un_row = dbarray(dbquery("SELECT * FROM `e107_user` WHERE `user_id`='".$row["siteid"]."'")); $l_un = $l_un_row["user_name"]; } else $l_un= ""; if (($i%2) == 0) { $class = ""; } else { $class = " class=\"even\""; } if ($i >= $demos) $sufix = "lj"; else $sufix = ""; $text .= " <tr".$class."> <td style=\"text-align: left;\"><a href=\"".$dir.$demoz[$i]."\">".$demoz[$i]."</a></td> <td><a href=\"?delete".$sufix."=".$demoz[$i]."\">Delete</a></td> <td><a href=\"?reject".$sufix."=".$demoz[$i]."\">Reject</a></td> </tr> <tr".$class."> <td colspan=3 style=\"text-align: left; \"><table> <tr><td><strong>User:</strong></td><td><a href=\"http://kz-serbia.com/user.php?id.".$row["siteid"]."\">".$l_un."</a></td> <td><strong>IP:</strong></td><td>".$row["ip"]."</td> <td><strong>Date:</strong></td><td>".$row["date"]."</td> <td><strong>Size:</strong></td><td>".$row["size"]."</td> <td><strong>Type:</strong></td><td>".$row["type"]."</td></tr> </table></td> </tr> "; $i++; } $text .= "<tr><td colspan=3 class=\"fcaption\"><strong>Rejected demos</strong></td></tr>"; $files2 = myscan($dirrejected ); sort($files2); for ($x=0; $x<sizeof($files2 ); $x++) { if (($i%2) == 0) { $class = ""; } else { $class = " class=\"even\""; } if (($files2 [$x] != ".") and ($files2 [$x] != "..") and ($files2 [$x] != "logs") and ($files2 [$x] != ".ftpquota")) { $text .= "<tr".$class."><td style=\"text-align: left;\">".$files2[$x]."</td><td></td><td></td></tr>"; } } $text .= " </tbody> </table>"; } else if (USER == TRUE) { $demoz = explode(" ", $vip_user); $i = 0; $text .= " <table style=\"width: 100%;\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\" class=\"demorank\"> <tbody>"; $text .= "<tr><td colspan=3 class=\"fcaption\"><strong>Personal uploads</strong></td></tr>"; // i counts demos, j counts which row are we filling in table $j = 0; while($i < ($demos + $ljdemos)) { if ($i == ($demos + $rdemos)) $text .= "<tr><td colspan=3 class=\"fcaption\"><strong>Longjump demos</strong></td></tr>"; $query = dbquery("SELECT * FROM `publicuploads` WHERE `file`='".$demoz[$i]."'"); $row = dbarray($query); if ($row["siteid"] == USERID || strstr($demoz[$i], "_".USERNAME."_") != null || strstr($demoz[$i], "_".USERNAME.".") != null) { if ($row["siteid"] != USERID) { if ($row["siteid"] != 0) { $qq = dbarray(dbquery("SELECT * FROM `e107_user` WHERE `user_id`='".$row["siteid"]."'")); $qqq = $qq["user_name"]; $extra = " <span style=\"color:red\">Uploaded by ".$qqq."</span>"; } else { $extra = " <span style=\"color:red\">Admin upload</span>"; } } else $extra = ""; if (dbrows($query) != 0){ $l_un_row = dbarray(dbquery("SELECT * FROM `e107_user` WHERE `user_id`='".$row["siteid"]."'")); $l_un = $l_un_row["user_name"]; } else $l_un= ""; if (($j%2) == 0) { $class = ""; } else { $class = " class=\"even\""; } $text .= " <tr".$class."> <td style=\"text-align: left;\">".$demoz[$i].$extra."</td> <td style=\"text-align: center;\"><strong>Date:</strong> ".$row["date"]."</td> </tr>"; $j++; } $i++; } $text .= " </tbody> </table>"; } $ns->tablerender("Submit Demos", $text); require_once(FOOTERF); ?> As I see upload form works perfect.But upload.php will not.So here is the code. <?php require_once("class2.php"); require_once(HEADERF); if (!USER) { $ns->tablerender("Upload", "<div align=\"center\">Sign up if you want to submit demos</div>"); die(); } //Target path $target_path_rec = "./publicdemos/map/"; $target_path_rec = $target_path_rec.basename( $_FILES['uploadedfile']['name']); $target_path_lj = "./publicdemos/longjumps/"; $target_path_lj = $target_path_lj.basename( $_FILES['uploadedfile']['name']); $nameFile = basename( $_FILES['uploadedfile']['name']); $upload = $_POST['upload']; $ip=$_SERVER['REMOTE_ADDR']; /*echo "<b>IP Address= ".$ip."</b><br/>"; echo $userid."</b><br/>"; echo $_POST['\"rec_type\"']."---<br/>"; echo $_FILES["uploadedfile"]["name"]."---<br/>"; echo $_FILES['uploadedfile']['tmp_name']."---<br/>"; echo $_FILES["uploadedfile"]["size"]."---<br/>"; print_r($_FILES); print_r($_POST);*/ dbconnect($dbhost, $dbusername, $dbpassword, $dbname); if ($_POST['\"rec_type\"'] == "Map Record") { dbquery("INSERT INTO `publicuploads` (`file`, `size`, `siteid`, `ip`, `date`, `type`) VALUES ('".$_FILES['uploadedfile']['name']."', '".$_FILES['uploadedfile']['size']."', '".USERID."', '".$ip."', '".date("Y-m-d")."', 'Ma p Record')"); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path_rec)) { $text .= "<div>The file ".basename( $_FILES['uploadedfile']['name'])." has been uploaded</div>"; } else{ $text .= "<div>There was an error uploading the file (rec), please try again!</div>"; } } else if ($_POST['\"rec_type\"'] == "Longjump") { dbquery("INSERT INTO `publicuploads` (`file`, `size`, `siteid`, `ip`, `date`, `type`) VALUES ('".$_FILES['uploadedfile']['tmp_name']."', '".$_FILES['uploadedfile']['size']."', '".USERID."', '".$ip."', '".date("Y-m-d")."', 'Longjump')"); if(move_uploaded_file($_FILES['uploadedfile']['name'], $target_path_lj)) { $text .= "<div>The file ".basename( $_FILES['uploadedfile']['name'])." has been uploaded</div>"; } else{ $text .= "<div>There was an error uploading the file (lj), please try again!</div>"; } } else { $text .=" Something else "; } $ns->tablerender("Submit Demos", $text); require_once(FOOTERF); ?> I don't get one of this messages $text .= "<div>The file ".basename( $_FILES['uploadedfile']['name'])." has been uploaded</div>"; } else{ $text .= "<div>There was an error uploading the file (rec), please try again!</div>"; I get this. else { $text .=" Something else "; } Which means that the file doesn't upload and informations doesn't insert into mysql table..
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.