Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. Set $fname ie $fname = "myimage.jpg";
  2. This is hardly a PHP question!
  3. depends on your inputs but try checkdate()
  4. Your welcome Can you click the solved button (bottom left) please
  5. fopen wrappers have been disabled.. that sucks! if its your server just update allow_url_include in the php.ini if not then get a better server i guess your stuck with curl (not a bad thing) but i would update to this <?php $url = $_GET['url']; $name = $_GET['name']; header("Content-Type: application/octet-stream;"); header('Content-Disposition: attachment; filename="'.$name.'"'); $curl_handler = curl_init(); curl_setopt($curl_handler, CURLOPT_URL, $url); curl_setopt($curl_handler, CURLOPT_HEADER, false); //added curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, 0); //pointless having this on! curl_setopt($curl_handler, CURLOPT_BINARYTRANSFER, 1); curl_exec($curl_handler); curl_close($curl_handler); exit; ?> EDIT: turned off header
  6. well if its a different filename your swapping as your need to update its link.. thats not truly replacing it.. So yeah just delete the old one!
  7. if your using the same name then it will replace! as stated in the manual!
  8. Check the following in php.ini post_max_size max_input_time max_execution_time <?php phpinfo(); ?> if you don't have access to the php.ini look into ini_set();
  9. Why the bump ? lass than an hour had passed and their was a unread reply?
  10. Your memory usage is going over 32Mb, update the php.ini file to increase the memory why not just do this <?php $url = 'http://www.dynamixlabs.com/images/largeimage.bmp'; header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($url)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); ob_clean(); flush(); readfile($url); exit; ?>
  11. The number of files are limited by File System thats used for example on Windows NTFS the max diskspace would be 256 terabytes that can only handle 4,294,967,295 files per disk, So yeah theirs limits, i would guess that facebook has resource servers that host the images and the DNS is mapped to those servers for example the static images are NOT on the same server the as the apache server that hosts the PHP etc etc
  12. So are you on a Mac ? if so i think theirs an encoding option (sorry my home Mac Keyboard got coffee soaked) try "Windows Comma Separated & MS-DOS Comma" or something like that! EDIT: also try the 3 types of delimtors \r \n \r\n
  13. You say you open them in "TextEdit" is that the Mac OS X editor ? if so, your line delimitor would be CR (/r) Mac = CR (/r) *nix = LF (/n) Win = CRLF (/r/n)
  14. PHP was Running but had the exection complete! have you tried the script from the CLI or tried my script alone?
  15. If you have a large variable that is no longer needed and your about to to set another large variable then yes its worth it for the memory.. it really does depend on the script but unsetting really to related to memory the cost of the CPU cycle to unset is normally worth the return in memory but if you have a single boolean variable it may not really be worth unsetting but if you have a image or large array then it is worth it.. Personally i only really unset the large variables, (of course their are exceptions)
  16. if(isset($_GET['id'])) //add this line switch(strtolower($_GET['id']))
  17. PHP is handing the data to apache, but you still have to deal with apache buffer, apache will only accept a set amount from php when thats full php must wait for it to be cleared, remember echo is not a php function its a php method! Okay heres a very simple script that may help me explain. Basically this either output to apache or doesn't all depending on ob_start() So with ob_start("callback"); being used PHP doesn't ever get told to send to the browser (well infact doesn't get told to send to apache!) without it.. well it's like normal.. So your expect the times to be the same.. considering its the same code and all! Well No..Echo doesn't get to apache and thus theirs no delays.. i run this on my PC and the times are as below //Time:6.8108780384064 //Via Apache //Time:0.067671060562134 //Via PHP ONLY <?php function callback($buffer) { global $echobuffer; $echobuffer .= $buffer; return ""; } function test($WithApache = false,$file) { global $echobuffer; $echobuffer =""; if(!$WithApache)ob_start("callback"); //Don't pass to apache $c=0; $begin = microtime(true); while($c<10000) { $c++; echo rand(1111111111,9999999999)."<br>"; ob_flush(); flush(); } ob_end_flush(); $end = microtime(true); $time = "Time:".($end-$begin)."<br>\n"; file_put_contents($file,"$time $echobuffer"); echo $time; } test(false,"c:/test1.txt"); test(true,"c:/test2.txt"); ?> i increased the loop to 100000 and the times are as follows //timesout (after 30 seconds) //Via Apache //Time:0.67965197563171 //Via PHP ONLY Now if i change the code to do just 1 echo.. ie function test2($WithApache = false,$file) { global $echobuffer; $echobuffer =""; if(!$WithApache)ob_start("callback"); //Don't pass to apache $c=0; $begin = microtime(true); $str = ""; while($c<100000) { $c++; $str .= rand(1111111111,9999999999)."<br>"; ob_flush(); flush(); } echo $str; ob_end_flush(); $end = microtime(true); $time = "Time:".($end-$begin)."<br>\n"; file_put_contents($file,"$time $echobuffer"); echo $time; } heres the times Time:0.80782103538513 //Via Apache Time:0.75758194923401 //Via PHP ONLY BUT! the page took 44 Seconds to load So the reason their was no timeout was because PHP had infact finished (BUT apache still had work todo).. Okay well i have to go eat.. i hope that helps explain a little better.. But to do believe this is more of a apache issule! --MadTechie
  18. WAMP is not case sensitive. Also is it indexfailed.php or loginfailed.php if it's loginfailed.php when is that file ?
  19. do you try the code i posted ?
  20. okay well short tags are not a good thing.. try <?php again (<? php could also cause the problem)
  21. What editor are you using ? try notepad++ (its free) open the files and check them and then re-save them the fact is says phppageheader(); would suggest that theirs no whitespace and short tags are enabled! (maybe try changing <?php to <? )
  22. try something like this while($str = fgets($handle,515)) { if(substr($str,3,1) == " ") { break; } }
  23. I can't see any problems, unless you have the script like this <?phpinclude("../common/header.php"); try commenting out both the includes (your still get errors but if you no longer get the same error remove the comment from one on the include and test again) repeat with the other include then open the included file and see if you can see the error
  24. I you wanted to write a pure php Yahoo IM connection script your need to look into sockets and analyse the data packets from Yahoo IM to thei server, once you have worked out how the yahoo TCP packets connect to their server. your then look at the packets for the messages.. So yes you can do it but it will take awhile
  25. On step One is tells you to goto here the reason i added the bot info is because a bot does things automatically (normally based on a request or a timer) now if theirs some code that allows a bot to do IM's then the same basica code can be used for sending IM's via a form! It may not be useful but i havn't read the whole thing!
×
×
  • 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.