Jump to content

maxwel

Members
  • Posts

    47
  • Joined

  • Last visited

Everything posted by maxwel

  1. what about the how to use finfo_file() function?
  2. would be great if mentioned about how to use finfo_file() function. i am sure i am doing the wrong way. Thanks
  3. @ requinix you didnt get me, the problem i dont want them to be just copying the name of the mix after the ?q= (this part) and bypassing the adfly link which i made it to help in making few money to support the project. even just hiding it is fair enough for me and i dont care if there someone tried it will work but just want it to work while being hidden by the script but there is no way to hide the query? about the refrening to another script is already done but still query is shown so yea seems i have no choice except the string replace method and ecrypting the letter to symbols and in other script i turn it vice versa. this will make users to hardly use mixes name shown in results of thier search in query as the query will be just symbols that will be decrypted later in another script. .WHat do you think about that idea will it work? @ psycho love your suggestion about better way to check file content instead of extension by finfo_file() function, its my first time to use it by the way but i got a problem which is it detect it as temp file not mp3 or wav here is my code $finfo = finfo_open(FILEINFO_MIME_TYPE); $tmpname = $_FILES["fileToUpload"]["tmp_name"]; if ( ((finfo_file( $finfo , $tmpname ) == "audio/mp3") || (finfo_file( $finfo , $tmpname ) == "audio/wav") || (finfo_file( $finfo , $tmpname ) == "audio/mpeg")) && ($_FILES["fileToUpload"]["size"] >= 26214400) && ($_FILES["fileToUpload"]["size"] <= 70000000) ) { rReally thank you all for your heavy support, Maxwel
  4. how to determine file type by content not extension Using server side solutions? i am using now $_FILES["file"]["type"] but i heard that it can be changed/malformed/spoofed any examples in simple way or referring me to an article that can clarify that to me, will be so great and helpful. Also got another question, i have and adfly account and i use there api while people is redirecting to page for downloading mixes and this link got a query which is the name of the mix in the url and i dont want to show that cuz like this later on ppl can just grab name of themix that appear in search and bypass part of adfly simply by pasting the name and adding the extension at the end like (.mp3, .wav etc..) So, i was asking if there is a solution that any think about to hide query and still it can be got by the script i tried .htaccess way and other php ways but they was only removing the query which is needed for the script to be work. i also thought about adding uniqid() but didnt work for lots of reasons like searching if same file exist. npw tjhinking of using something like $Input_data = "i want a apple";//Place the text here $Encrypter_variables= array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t","u", "v", "w", "x", "y", "z"); $Variables_replace = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "%", "!", "@", "#", "$", "^", "&", "*","~", "+", ":","-", "=", "?", "'", ".", "<"); $New_data = str_replace($Encrypter_variables, $Variables_replace, $Input_data); to encrypt name then de-crypt it in other page. what do you think guys? thanks alot
  5. ok read post more well and got what u said exactly it worked woot woot but now i have a question about something else, can i ask it here in that topic aswell? its like need a suggestion from you Thanks alot maxwell
  6. still dont work and it pass it as if its higher than 25 mb :S, sigh i used that $mp3 = ($_FILES["fileToUpload"]["type"] == "audio/mp3"); $wav = ($_FILES["fileToUpload"]["type"] == "audio/wav"); $mpeg = ($_FILES["fileToUpload"]["type"] == "audio/mpeg") && ($_FILES["fileToUpload"]["size"] >= 26214400) && ($_FILES["fileToUpload"]["size"] <= 70000000); if ($mp3 || $wav || $mpeg) { instead of that part if (($_FILES["fileToUpload"]["type"] == "audio/mp3") || ($_FILES["fileToUpload"]["type"] == "audio/wav") || ($_FILES["fileToUpload"]["type"] == "audio/mpeg") && ($_FILES["fileToUpload"]["size"] >= 26214400) && ($_FILES["fileToUpload"]["size"]<= 70000000) ) {
  7. <?php ini_set('upload_max_filesize', '70M'); ini_set('post_max_size', '70M'); ini_set('max_input_time', 6000); ini_set('max_execution_time', 300000); $f = 'path'; $obj = new COM ( 'scripting.filesystemobject' ); if ( is_object ( $obj ) ) { $ref = $obj->getfolder ( $f ); //echo 'Directory: ' . $f . ' => Size: ' . $ref->size; $obj = null; } else { //echo 'can not create object'; } if ( $ref->size < 32212254720){ if (($_FILES["fileToUpload"]["type"] == "audio/mp3") || ($_FILES["fileToUpload"]["type"] == "audio/wav") || ($_FILES["fileToUpload"]["type"] == "audio/mpeg") && ($_FILES["fileToUpload"]["size"] >= 26214400) && ($_FILES["fileToUpload"]["size"]<= 70000000) ) { things done else { echo error } echo error space if full }
  8. ($_FILES["fileToUpload"]["size"] >= 26214400) dont work, i can upload files less than 25 mb still?! is that normal? i upload file that is 800bytes and it works any idea how to make it work? or if there is another solution? Thanks in advance, Maxwel
  9. thanks alot, worked well so much appreciated Maxwel
  10. i found that when i do it like this <?php $dir = 'dir'; $exclude = array('.','..','.htaccess'); $q = (isset($_GET['q']))? strtolower($_GET['q']) : ''; $res = opendir($dir); if (strlen($q) < 3) { echo "Search must be longer than 3 characters.<br><br>"; } else { if (!( ($q == "mp3") || ($q == "wav") || ($q == ""))){ while(false!== ($file = readdir($res))) { if(strpos(strtolower($file),$q)!== false &&!in_array($file,$exclude)) { $nicefile = str_replace(".mp3", "", "$file"); $info = pathinfo($file); if (($info["extension"] == "mp3") || ($info["extension"] == "wav")) { echo "<a href='http://domainname/filename.php?name=$file'>$nicefile</a>"; echo "<br>"; }elseif(!isset($errorMsg)){ $errorMsg = "ERROR: File not found.<br><br>"; }else{} }elseif(!isset($errorMsge)){ $errorMsge = "ERROR: File not found.<br><br>"; }else{} } if (isset($errorMsge)){echo $errorMsge;} else{} if (isset($errorMsg)){echo $errorMsg;} else{} }else{echo"ERROR: File not found.<br><br>";} } closedir($res); ?> it shows the error msg whether there is results or not. seriously, i dont know why it shows if in if condition got no error msgs that i added
  11. its not uploading its like searching directory and coming up with results that contain such query. <?php $dir = 'dir'; $exclude = array('.','..','.htaccess'); $q = (isset($_GET['q']))? strtolower($_GET['q']) : ''; $res = opendir($dir); if (strlen($q) < 3) { echo "Search must be longer than 3 characters.<br><br>"; } else { if (!( ($q == "mp3") || ($q == "wav") || ($q == ""))){ while(false!== ($file = readdir($res))) { if(strpos(strtolower($file),$q)!== false &&!in_array($file,$exclude)) { $nicefile = str_replace(".mp3", "", "$file"); $info = pathinfo($file); if (($info["extension"] == "mp3") || ($info["extension"] == "wav")) { if(count($file) != 0) { echo "<a href='http://domainname/filename.php?name=$file'>$nicefile</a>"; echo "<br>"; }elseif(!isset($errorMsge)){ $errorMsge = "ERROR: File not found.<br><br>"; }else{} }elseif(!isset($errorMsg)){ $errorMsg = "ERROR: File not found.<br><br>"; }else{} } } if (isset($errorMsge)){echo $errorMsge;} else{} if (isset($errorMsg)){echo $errorMsg;} else{} }else{echo"ERROR: File not found.<br><br>";} } closedir($res); ?> this is the full code and the problem is that iwhen i try to search something that does not exist in directory it dont give error msg but it gives nothing in return :S
  12. <?php $dir = 'direction'; $q = (isset($_GET['q']))? strtolower($_GET['q']) : ''; $res = opendir($dir); f (strlen($q) < 3) { echo "Search must be longer than 3 characters.<br><br><a href='http://mbrservices.no-ip.org/search.html'>Back To Search Box</a>"; } else { if (!( ($q == "mp3") || ($q == "wav") || ($q == ""))){ while(false!== ($file = readdir($res))) { if(strpos(strtolower($file),$q)!== false &&!in_array($file,$exclude)) { $nicefile = str_replace(".mp3", "", "$file"); $info = pathinfo($file); if (($info["extension"] == "mp3") || ($info["extension"] == "wav")) { show links of the files that contain query of the string) the problem is that i want to create an if statment which check if there is files of query that user searhed show it else if the search result is ended up with nothing it return an error msg. i tried alot of things like: if ($files != ""){show the files} elseif(!isset($errorMsg)){errormsg} if (!empty($files)){show the files} elseif(!isset($errorMsg)){errormsg} if ($files != 0){show the files} elseif(!isset($errorMsg)){errormsg} and more but nothing ended up right they always gave blank with no error msg or nothing, any idea? Thanks alot, Maxwel
  13. hello jazzman1 XD yours work but, unfortunatly when i used the same with session_start() and $_SESSION. it didnt work but for 1234 variable it worked :S with login, anyways i did it in another way thanks alot for your help
  14. <?php session_start(); $dj_name_session = $_SESSION[rp_djname]; echo $dj_name_session; $sam = '1234'; echo $sam; ?> i found that echo of sam do appear when i use file_get_conetent but $name_session dont :S although it show when i acess the file through browser duh
  15. nope, i don't know how to use it :S honestly
  16. there is no way to grab the echo value of the variable from a php page to the remote server?
  17. i want to get value of a variable that on another server to simply log the username of the user who access a page on the server that got the variable (variable = $_SESSION[username]) so i wanna use php script to grab value of this variable (on other server) to log it in a txt file. i got everything working except being able to grab value of variable which is username
  18. guys been since morning trying to get a way to grab value of a variable from a remote server, tried require, include, fopen, file_get_contents and still cant make it any idea?
  19. @davidannis & Muddy_funster , Thanks alot that was helpful guys been since morning trying to get a way to grab value of a variable from a remote server, tried require, include, fopen, file_get_contents and still cant make it any idea?
  20. no i want to keep the loop but not to loop the error msg as its inside the loop, is that possible?
  21. i want to simply echo an error msg without this error msg being looped another question please: is it possible to get value of certain value from one server to another by php?
  22. while(false!== ($file = readdir($res))) { if(strpos(strtolower($file),$q)!== false &&!in_array($file,$exclude)) { if (($info["extension"] == "mp3") || ($info["extension"] == "wav")) { }else{} } } the problem is that when i put an error msg in the else of the red code part it loops as much as files that are not mp3 or wave type. so how i can stop that from happening? and if i did put it outside it wont read $file variable. or even is it possible to know how to make another variable that can bring results of my search outside the while loop cuz i tried alot of things but didnt work :S Thanks in advance, Maxwel
×
×
  • 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.