Jump to content

daneth1712

Members
  • Posts

    77
  • Joined

  • Last visited

Everything posted by daneth1712

  1. Or is there another way I can do what I need? Just in case I didnt explain properly.... I have a page, the page has multiple forms. Each 'small' form requests a single image download. The 'large' form downloads all images as a zip file. The part of downloading the single or zip file works fine. What I need to get is the page to refresh after the download has appeared so that the images downloaded are removed from the list. If single image download just remove that 1 from list, and if downloaded as zip for all images that it removes everything from the list. I dont know a way of making this work in all browsers and I really need to come up with a solution to this ASAP. Thanks in advance to whoever can help me. Daniel
  2. Hi guys, I am having some problems that I hope someone can help me with. Basically I have a page that I need to initiate a download and then refresh the page afterwards. Right now everything seems to work fine in Firefox, but not in IE, Safari or Chrome. Firstly, there are 2 actions on the page; 1. Downloads 1 image file (info needs to be added to the database) and then page must refresh after so image downloaded is removed from the page. 2. Zip file is downloaded with all images on the page. Again info must be added to the database and the page refreshed. The code below should bring up the image to download and then fire off a refresh page (added google link for now). //set download file headers define('MP_BOUNDARY', '--'.sha1(microtime(true))); header('Content-Type: multipart/x-mixed-replace; boundary="'.MP_BOUNDARY.'"'); flush(); echo "Content-Type: ".$filetype."\r\n"; echo "Content-Disposition: attachment; filename=".$filename."\r\n"; echo "\r\n"; //force file download $handle = fopen($path, "rb"); if ($handle) { while (!feof($handle)) { echo(fread($handle, 8192)); } fclose($handle); } echo MP_BOUNDARY; flush(); //flush headers and send HTML headers and refresh page echo "Content-Type: text/html\r\n"; echo "\r\n"; echo '<html><script type="text/javascript">location.href="http://www.google.com";</script></html>'; echo MP_BOUNDARY.'--'; flush(); The zip file works in the same may except process happens beforehand to add all the files in to a zip. Any help would be really appreciated. Thanks
  3. ok great, so the foreach will repeat the hidden field for each array? So will the page I added as an example work for getting the info with your script? And one last thing, is there any limitation to the amount of times/files that can be used? Also... do you know if there are any server or browser limitations by doing it this way? As I kept running into problems before with http timeouts, header issues
  4. Many thanks Daniel0 for your help... so do you mean it will work like this? On page that will be on webserver (which I can add the list of files and paths to be downloaded) to look like this... <?php $updateitems=array('test1/test1.txt','test1/test2.txt','test1/test3.txt','test1/test4.txt','test1/test5.txt'); //etc etc for all 200+ files echo '<form method="post" action="http://localhost:80/updatefileonelocalserver.php">'; //where to send it echo '<input type="hidden" name="items" value="$updateitems">'; //array of files? Is there not a limit on the amount that can be posted here? ?> Then on the page on the local system to have them received like this? <?php $receiveditem1=$_POST['items'][0]; $receiveditem2=$_POST['items'][1]; $receiveditem3=$_POST['items'][2]; $receiveditem4=$_POST['items'][3]; $receiveditem5=$_POST['items'][4]; ?> Or have I done this wrong?
  5. apologies I meant to post this link http://www.phpfreaks.com/forums/index.php/topic,285559.0.html The script is an update/ftp download script. I have users with an apache/php setup on their local PC's where I plan on having a script added there that will basically talk to a script on a webserver that lists a load of files to download (this is perfectly legal btw) and connects via ftp and $_GET's the list of files and then places them where they should be on their local PC's. apologies again for missing the link on teh previous post
  6. Hi guys, If you see this thread, this is basically what I am trying to do. I have killed myself trying to fix that script and get it to work, that I know from trying that, that I can get it to work with 2 'reconnections'. So I am now looking to include as many 'files' ... or '$_GET's as possible in those 2 connections. Yes I could use $_POST for this, but it will just take me alot longer to set this up and test it. I more need an answer at this stage on a way this can/could work. Any pointers are very much welcomed.
  7. Hi guys, I just need some clarification regarding the limitations of $_GET. I understand that $_GET variables should be kept under 100 characters, but I am planning on using about 250 variables in a single url post and wanted to check before I started writing it that it is going to work. Each variable used will probably not exceed 50 charatcers at most, generally this will be around 15-20 characters each, but if I am planning on using over 200 $_GET variables in one url, is this going to cause any problems? I know its probably a better idea to use $_POST, but this is a much easier way for me to set this up using $_GET with the amount of variables that need to be used for this script. Thanks in advance for your help!
  8. Ok I have tried a few more things, firstly I removed all the 'echos' within the flush, - no changes. I have added ob_start(); before every header, and added ob_flush();ob_end_flush(); after every header - no changes. I have also added <?php ob_start(); ?> at the top of the script and <?php ob_flush(); ?> to the bottom of the script... no change. There is no html code in this page, and I have removed every 'white space' from the script. There were none before or after the <?php tags anyway, but I went through every line of code in the page (about 1800 line) and removed every 'blank line' from it... still no change. I have added 'output_buffering = 4096' to the php.ini file - still nothing.... I honestly dont know what else to try.... Plus, this is just to get more than one transfer complete, before this was failing after 5 transfers, I dont even know if this is going to fix the original problem. :'(
  9. Ok... thanks for that, but now I am getting a header error after the first transfer. Warning: Cannot modify header information - headers already sent in - which then refers to the local page (users system) refers to: header("location:http://www.example.com/fn.php?update=2"); I dont have much hair left, but am pulling what is left out... :'( I really appreciate your help!
  10. ok well i removed Eaccelerator, and that did nothing I tried to increased the 'ThreadsPerChild' in the apache httpd.conf file from 4 to 10, changed nothing.... I also removed the following from the httpd.conf file to see if this would make a difference, with no luck... BrowserMatch "Mozilla/2" keepalive BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0 BrowserMatch "RealPlayer 4\.0" force-response-1.0 BrowserMatch "Java/1\.0" force-response-1.0 BrowserMatch "JDK/1\.0" force-response-1.0 BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully BrowserMatch "^WebDrive" redirect-carefully BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully BrowserMatch "^gnome-vfs" redirect-carefully Lastly i tried your flush code, added it after every file transfer, however, it doesnt move past the first file. it now hangs for 60 seconds and i get the following result. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 0 1 2 3 4 5 6 Fatal error: Maximum execution time of 60 seconds exceeded in E:\xampp\htdocs\ftptest.php on line 66 Line 66 is the closing bracket in the second file for for($i=0;$i<50;$i++) { ob_start(); echo "$i<br>"; flush(); ob_end_flush(); sleep(1); }//this is line 66
  11. Ok after some investigation into the apache error logs, I have found that the local PC (where the files are being sent too) has something called 'EACCELERATOR' installed. I am afraid I dont know much about this, but if anyone can give some pointers on ways in which I can alter the settings, or better still, remove this feature, I would really appreciate any help and assistance
  12. Do you know what teh filename for this image is suppossed to be? Do you have a file called 2_a200c92db4cfa347f0316f1b09ed46bb.jpg in your 'files' folder? What should this be? Because that is what you are pulling from your database. Looks like an md5 hash to me
  13. can you just swap the above code you gave with the following and advise on the result. <?php if(isset($_GET['player'])) { $idpic = mysql_query("SELECT * FROM phpbb_attachments WHERE post_msg_id='$player'"); $countid = mysql_num_rows($idpic); if($countid==1) { while($countid = mysql_fetch_array($idpic)){ $filename=$countid['physical_filename']; $extension=$countid['extension']; } echo "$filename"; echo "<br>"; echo "$extension"; } else { echo 'No image yet'; } } ?>
  14. when the page is pulled after the query is run, I assume you have a page with a thumbnail with a red 'x' in it? if so, can you view the page source and print here how the image link is being pulled?
  15. after <img src= you need to open it with " and end it with the same <img src="http://blah.blah.host56.com/files/'.$idpic['physical_filename'].'.'.$idpic['extension'].'"> think about how it should look when it displays in html... <img src="http://www.example.com/somefilename.jpg"/>
  16. sorry to sound like a n00b, but where would i place this in my code? I just rewrote a script that used file_get_contents, fopen, fputs for all the files (eventually worked out how to transfer images without corrupting them) and it ended up doing exactly the same thing. Crashed out after 5 transfers, this time it just gives me a blank page, no errors at all. Doesnt appear to be a time execution problem as this new script completes also fairly quickly, just again after the 5th reconnect. Nearly jumped out the window as I spent a few hours rewriting that script to now have 2 scripts that work, but fail at the same place. So once I can either implement this buffering (and pray it works) to either script I will be a happy man. Otherwise need to work out what else could be causing this problem. If anyone else has any insight into this I would welcome any suggestiions, I will try anything at this stage. :'(
  17. ok using a flush just returns an header already used error. I also noticed I forgot to add exit; on the headers on one of the pages, but that made no difference either.... could this have anything to do with output_buffering ?? I am just clutching at straws here....
  18. I had nearly decided to scrap this method and work on a script that uses file_get_contents, fopen and fputs. Until I realised that I need to transfer images too, which wont transfer this way as they come out corrupted at the end. :'( Thanks teamatomic so you are suggesting I add str_repeat(" \n", 600); flush() after each ftp_get($conn_id, $local_file, $server_file, FTP_BINARY); from my original post?
  19. It probably is something like that... on the local system (users) the httpd.conf file has the following settings... PidFile logs/httpd.pid Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 15 <IfModule mpm_winnt.c> ThreadsPerChild 4 MaxRequestsPerChild 0 </IfModule> On the site server file for httpd.conf I cant find these settings.... Got to be honest, I dont know where the problem is, it could be the ftp server (which I doubt though) the local setup or the server setup... could be php or apache on either.
  20. Hi Guys, I really need some help with this.... I am going to try and keep this as simple as possible; otherwise I will probably just confuse myself… I have a user, that has apache/php installed on their local machine, and a web server running wamp on a win32 system. What I am attempting to do is send an update of files from the webserver to their local machine via an ftp transfer. The transfer works perfectly, up until the 6th attempt, which it just goes dead. Snippet of the code below; User would click on a link, with ?update=1 at the end, this gets sent to the webserver where the following code is waiting; $update=$_GET['update']; if($update=="1"){ $f1="test1/text1.txt"; $f2="test1/ text2.txt"; $f3="test1/ text3.txt"; $f4="test1/text4.txt"; $f5=""; $f6=""; $f7=""; $f8=""; $f9=""; $f10=""; $f11=""; $f12=""; $f13=""; $f14=""; $f15=""; header("location:http://localhost:80/ftptest.php?ftps=ipaddressofserver&un=username&pw=password&fn1=$f1&fn2=$f2&fn3=$f3&fn4=$f4&fn5=$f5&fn6=$f6&fn7=$f7&fn8=$f8&fn9=$f9&fn10=$f10&fn11=$f11&fn12=$f12&fn13=$f13&fn14=$f14&fn15=$f15&vsn=1"); exit; } Once it has found the name of the files I wish to send, it will connect to a page of their local machine, which is below; $server=$_GET['ftps']; $username=$_GET['un']; $password = $_GET['pw']; $number=$_GET['vsn']; $conn_id = ftp_connect($server); sleep(1); $login_result=@ftp_login($conn_id,$username,$password); sleep(1); //update 1 if($number=="1"){ if($login_result!="1"){ header("location:http://www.example.com/fn.php?update=1"); } elseif($login_result=="1"){ $f= $_GET['fn1']; $f2= $_GET['fn2']; $f3= $_GET['fn3']; $f4= $_GET['fn4']; $f5= $_GET['fn5']; $f6= $_GET['fn6']; $f7= $_GET['fn7']; $f8= $_GET['fn8']; $f9= $_GET['fn9']; $f10= $_GET['fn10']; $f11= $_GET['fn11']; $f12= $_GET['fn12']; $f13= $_GET['fn13']; $f14= $_GET['fn14']; $f15= $_GET['fn15']; if($f!=""){ $exp = explode("/",$f); $ex=$exp[0]; $dir = $_SERVER['DOCUMENT_ROOT']."/$ex"; if (!is_dir($dir)){ mkdir($dir,0777); } $local_file = $_SERVER['DOCUMENT_ROOT']."/$f"; $server_file = "$f"; ftp_get($conn_id, $local_file, $server_file, FTP_BINARY); } if($f2!=""){ $local_file2 = $_SERVER['DOCUMENT_ROOT']."/$f2"; $server_file2 = "$f2"; ftp_get($conn_id, $local_file2, $server_file2, FTP_BINARY); } if($f3!=""){ $local_file3 = $_SERVER['DOCUMENT_ROOT']."/$f3"; $server_file3 = "$f3"; ftp_get($conn_id, $local_file3, $server_file3, FTP_BINARY); } if($f4!=""){ $local_file4 = $_SERVER['DOCUMENT_ROOT']."/$f4"; $server_file4 = "$f4"; ftp_get($conn_id, $local_file4, $server_file4, FTP_BINARY); } if($f5!=""){ $local_file5 = $_SERVER['DOCUMENT_ROOT']."/$f5"; $server_file5 = "$f5"; ftp_get($conn_id, $local_file5, $server_file5, FTP_BINARY); } if($f6!=""){ $local_file6 = $_SERVER['DOCUMENT_ROOT']."/$f6"; $server_file6 = "$f6"; ftp_get($conn_id, $local_file6, $server_file6, FTP_BINARY); } if($f7!=""){ $local_file7 = $_SERVER['DOCUMENT_ROOT']."/$f7"; $server_file7 = "$f7"; ftp_get($conn_id, $local_file7, $server_file7, FTP_BINARY); } if($f8!=""){ $local_file8 = $_SERVER['DOCUMENT_ROOT']."/$f8"; $server_file8 = "$f8"; ftp_get($conn_id, $local_file8, $server_file8, FTP_BINARY); } if($f9!=""){ $local_file9 = $_SERVER['DOCUMENT_ROOT']."/$f9"; $server_file9 = "$f9"; ftp_get($conn_id, $local_file9, $server_file9, FTP_BINARY); } if($f10!=""){ $local_file10 = $_SERVER['DOCUMENT_ROOT']."/$f10"; $server_file10 = "$f10"; ftp_get($conn_id, $local_file10, $server_file10, FTP_BINARY); } if($f11!=""){ $local_file11 = $_SERVER['DOCUMENT_ROOT']."/$f11"; $server_file11 = "$f11"; ftp_get($conn_id, $local_file11, $server_file11, FTP_BINARY); } if($f12!=""){ $local_file12 = $_SERVER['DOCUMENT_ROOT']."/$f12"; $server_file12 = "$f12"; ftp_get($conn_id, $local_file12, $server_file12, FTP_BINARY); } if($f13!=""){ $local_file13 = $_SERVER['DOCUMENT_ROOT']."/$f13"; $server_file13 = "$f13"; ftp_get($conn_id, $local_file13, $server_file13, FTP_BINARY); } if($f14!=""){ $local_file14 = $_SERVER['DOCUMENT_ROOT']."/$f14"; $server_file14 = "$f14"; ftp_get($conn_id, $local_file14, $server_file14, FTP_BINARY); } if($f15!=""){ $local_file15 = $_SERVER['DOCUMENT_ROOT']."/$f15"; $server_file15 = "$f15"; ftp_get($conn_id, $local_file15, $server_file15, FTP_BINARY); } ftp_close($conn_id); if(!file_exists($local_file)){ header("location:http://www.example.com/fn.php?update=1"); } else{ header("location:http://www.example.com/fn.php?update=2"); } } } If this completes, it gets sent back to the page where it will look if there is another load of files to retrieve and will start the process again. This works perfectly up until the 6th attempt. The first 5 perform all the file transfers in about 20 seconds. I have increased the max_execution_time on the webserver, and on the users local machine to 600 seconds, I have increased the max_input_time on both to 180, and even tried to select ignore_user_abort = On. All with no change. At the end I just get a http error - 'This program cannot display the webpage.' I could very easily sit and try to edit every setting on both servers again and again until something changes, but I don’t have enough knowledge to just play with the settings and I know I will mess something else up in the process. Something is stopping this after the 5th attempt everytime, any help that can be offered will be extremely appreciated. I need it to perform about 20-25 transfers… if possible Thanks for taking the time to read this. If you need any additional info, please just say and will try my best to get it. Thanks in advance for any help!
  21. I personally like to use a mix. For example, every form I use, be it login form, or register forms I like to use both js and php validation. Mainly because if you use js validation (and the users have not turned js off) you dont have to rely on the server to check forms and can be done locally. However I would still use PHP to validate the forms incase the users turn js scripts off. This just saves a bit of server load, nothing too fancy but i think it makes sense to do it that way that just rely on PHP scripts and server-side all the time.
  22. I am confused, when I test your code and change your post to a value of 2 for each the adults and children, I get a result of 4 for both the echo and the insert in your form. Looks fine to me.
  23. I could be wrong, but from teh looks of it your not actually starting a session when you set it or call for it. you need to add session_start(); before you set the $_SESSION and call for it.
  24. @ joel24 - yes, the users wil be running an apache server locally. I have filezilla server running on my server with read only permissions set on one folder which contains all the files I am allowing them to download. My concerns are that someone will find a way of bypassing the server limits and gain access to other folders on the server. Especially as the connection files they will have full access too.
  25. Hi all, I am currently facing some serious problems with a script and really need some advise before I am actually sick :'( To give you a brief overview of the situation, I have a script which is going to end up on someones local PC (dont ask how or why, its an extremely long story). The script will basically end up having all the connection details for someone to connect to my server via FTP. The script allows someone to connect to a folder and download a file from within that. What i have noticed is the script can obviously be edited by anyone (as the file is on their PC, so they can change the script to include commands like ftp_chdir, or ftp_cdup, so I have set the permissions on the server to only allow a person access to a single directory. What I dont know is (as there are some pretty smart php coders out there) if there is a way someone can bypass this limit and still manage to download other files from my server. I am basically looking for some advise here on how I can secure this, even though I am fully aware that the process is not a very smart or secure one to start with. Sorry if I am being a bit vague. :-\
×
×
  • 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.